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
9bec3ca2
Commit
9bec3ca2
authored
Oct 17, 2014
by
Uwe L. Korn
Committed by
Martin Storsjö
Oct 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtmpproto: Add pause support
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
f4cd8b80
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
rtmpproto.c
libavformat/rtmpproto.c
+42
-0
version.h
libavformat/version.h
+1
-1
No files found.
libavformat/rtmpproto.c
View file @
9bec3ca2
...
...
@@ -776,6 +776,33 @@ static int gen_seek(URLContext *s, RTMPContext *rt, int64_t timestamp)
return
rtmp_send_packet
(
rt
,
&
pkt
,
1
);
}
/**
* Generate a pause packet that either pauses or unpauses the current stream.
*/
static
int
gen_pause
(
URLContext
*
s
,
RTMPContext
*
rt
,
int
pause
,
uint32_t
timestamp
)
{
RTMPPacket
pkt
;
uint8_t
*
p
;
int
ret
;
av_log
(
s
,
AV_LOG_DEBUG
,
"Sending pause command for timestamp %d
\n
"
,
timestamp
);
if
((
ret
=
ff_rtmp_packet_create
(
&
pkt
,
3
,
RTMP_PT_INVOKE
,
0
,
29
))
<
0
)
return
ret
;
pkt
.
extra
=
rt
->
stream_id
;
p
=
pkt
.
data
;
ff_amf_write_string
(
&
p
,
"pause"
);
ff_amf_write_number
(
&
p
,
0
);
//no tracking back responses
ff_amf_write_null
(
&
p
);
//as usual, the first null param
ff_amf_write_bool
(
&
p
,
pause
);
// pause or unpause
ff_amf_write_number
(
&
p
,
timestamp
);
//where we pause the stream
return
rtmp_send_packet
(
rt
,
&
pkt
,
1
);
}
/**
* Generate 'publish' call and send it to the server.
*/
...
...
@@ -2889,6 +2916,20 @@ static int64_t rtmp_seek(URLContext *s, int stream_index, int64_t timestamp,
return
timestamp
;
}
static
int
rtmp_pause
(
URLContext
*
s
,
int
pause
)
{
RTMPContext
*
rt
=
s
->
priv_data
;
int
ret
;
av_log
(
s
,
AV_LOG_DEBUG
,
"Pause at timestamp %d
\n
"
,
rt
->
last_timestamp
);
if
((
ret
=
gen_pause
(
s
,
rt
,
pause
,
rt
->
last_timestamp
))
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to send pause command at timestamp %d
\n
"
,
rt
->
last_timestamp
);
return
ret
;
}
return
0
;
}
static
int
rtmp_write
(
URLContext
*
s
,
const
uint8_t
*
buf
,
int
size
)
{
RTMPContext
*
rt
=
s
->
priv_data
;
...
...
@@ -3051,6 +3092,7 @@ URLProtocol ff_##flavor##_protocol = { \
.url_open = rtmp_open, \
.url_read = rtmp_read, \
.url_read_seek = rtmp_seek, \
.url_read_pause = rtmp_pause, \
.url_write = rtmp_write, \
.url_close = rtmp_close, \
.priv_data_size = sizeof(RTMPContext), \
...
...
libavformat/version.h
View file @
9bec3ca2
...
...
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR 6
#define LIBAVFORMAT_VERSION_MICRO
0
#define LIBAVFORMAT_VERSION_MICRO
1
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
...
...
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