Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
71036a3a
Commit
71036a3a
authored
Aug 09, 2012
by
Samuel Pitoiset
Committed by
Luca Barbato
Aug 09, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtmp: Factorize the code by adding handle_invoke_status
Signed-off-by:
Luca Barbato
<
lu_zero@gentoo.org
>
parent
5e6001db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
24 deletions
+34
-24
rtmpproto.c
libavformat/rtmpproto.c
+34
-24
No files found.
libavformat/rtmpproto.c
View file @
71036a3a
...
@@ -1098,10 +1098,41 @@ fail:
...
@@ -1098,10 +1098,41 @@ fail:
return
ret
;
return
ret
;
}
}
static
int
handle_invoke
(
URLContext
*
s
,
RTMPPacket
*
pkt
)
static
int
handle_invoke
_status
(
URLContext
*
s
,
RTMPPacket
*
pkt
)
{
{
RTMPContext
*
rt
=
s
->
priv_data
;
RTMPContext
*
rt
=
s
->
priv_data
;
const
uint8_t
*
data_end
=
pkt
->
data
+
pkt
->
data_size
;
const
uint8_t
*
ptr
=
pkt
->
data
+
11
;
uint8_t
tmpstr
[
256
];
int
i
,
t
;
int
i
,
t
;
for
(
i
=
0
;
i
<
2
;
i
++
)
{
t
=
ff_amf_tag_size
(
ptr
,
data_end
);
if
(
t
<
0
)
return
1
;
ptr
+=
t
;
}
t
=
ff_amf_get_field_value
(
ptr
,
data_end
,
"level"
,
tmpstr
,
sizeof
(
tmpstr
));
if
(
!
t
&&
!
strcmp
(
tmpstr
,
"error"
))
{
if
(
!
ff_amf_get_field_value
(
ptr
,
data_end
,
"description"
,
tmpstr
,
sizeof
(
tmpstr
)))
av_log
(
s
,
AV_LOG_ERROR
,
"Server error: %s
\n
"
,
tmpstr
);
return
-
1
;
}
t
=
ff_amf_get_field_value
(
ptr
,
data_end
,
"code"
,
tmpstr
,
sizeof
(
tmpstr
));
if
(
!
t
&&
!
strcmp
(
tmpstr
,
"NetStream.Play.Start"
))
rt
->
state
=
STATE_PLAYING
;
if
(
!
t
&&
!
strcmp
(
tmpstr
,
"NetStream.Play.Stop"
))
rt
->
state
=
STATE_STOPPED
;
if
(
!
t
&&
!
strcmp
(
tmpstr
,
"NetStream.Play.UnpublishNotify"
))
rt
->
state
=
STATE_STOPPED
;
if
(
!
t
&&
!
strcmp
(
tmpstr
,
"NetStream.Publish.Start"
))
rt
->
state
=
STATE_PUBLISHING
;
return
0
;
}
static
int
handle_invoke
(
URLContext
*
s
,
RTMPPacket
*
pkt
)
{
RTMPContext
*
rt
=
s
->
priv_data
;
const
uint8_t
*
data_end
=
pkt
->
data
+
pkt
->
data_size
;
const
uint8_t
*
data_end
=
pkt
->
data
+
pkt
->
data_size
;
int
ret
=
0
;
int
ret
=
0
;
...
@@ -1117,29 +1148,8 @@ static int handle_invoke(URLContext *s, RTMPPacket *pkt)
...
@@ -1117,29 +1148,8 @@ static int handle_invoke(URLContext *s, RTMPPacket *pkt)
if
((
ret
=
handle_invoke_result
(
s
,
pkt
))
<
0
)
if
((
ret
=
handle_invoke_result
(
s
,
pkt
))
<
0
)
return
ret
;
return
ret
;
}
else
if
(
!
memcmp
(
pkt
->
data
,
"
\002\000\010
onStatus"
,
11
))
{
}
else
if
(
!
memcmp
(
pkt
->
data
,
"
\002\000\010
onStatus"
,
11
))
{
const
uint8_t
*
ptr
=
pkt
->
data
+
11
;
if
((
ret
=
handle_invoke_status
(
s
,
pkt
))
<
0
)
uint8_t
tmpstr
[
256
];
return
ret
;
for
(
i
=
0
;
i
<
2
;
i
++
)
{
t
=
ff_amf_tag_size
(
ptr
,
data_end
);
if
(
t
<
0
)
return
1
;
ptr
+=
t
;
}
t
=
ff_amf_get_field_value
(
ptr
,
data_end
,
"level"
,
tmpstr
,
sizeof
(
tmpstr
));
if
(
!
t
&&
!
strcmp
(
tmpstr
,
"error"
))
{
if
(
!
ff_amf_get_field_value
(
ptr
,
data_end
,
"description"
,
tmpstr
,
sizeof
(
tmpstr
)))
av_log
(
s
,
AV_LOG_ERROR
,
"Server error: %s
\n
"
,
tmpstr
);
return
-
1
;
}
t
=
ff_amf_get_field_value
(
ptr
,
data_end
,
"code"
,
tmpstr
,
sizeof
(
tmpstr
));
if
(
!
t
&&
!
strcmp
(
tmpstr
,
"NetStream.Play.Start"
))
rt
->
state
=
STATE_PLAYING
;
if
(
!
t
&&
!
strcmp
(
tmpstr
,
"NetStream.Play.Stop"
))
rt
->
state
=
STATE_STOPPED
;
if
(
!
t
&&
!
strcmp
(
tmpstr
,
"NetStream.Play.UnpublishNotify"
))
rt
->
state
=
STATE_STOPPED
;
if
(
!
t
&&
!
strcmp
(
tmpstr
,
"NetStream.Publish.Start"
))
rt
->
state
=
STATE_PUBLISHING
;
}
else
if
(
!
memcmp
(
pkt
->
data
,
"
\002\000\010
onBWDone"
,
11
))
{
}
else
if
(
!
memcmp
(
pkt
->
data
,
"
\002\000\010
onBWDone"
,
11
))
{
if
((
ret
=
gen_check_bw
(
s
,
rt
))
<
0
)
if
((
ret
=
gen_check_bw
(
s
,
rt
))
<
0
)
return
ret
;
return
ret
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment