Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
77e355ff
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
77e355ff
编写于
12月 17, 2015
作者:
A
Adam Kent
提交者:
Michael Niedermayer
3月 12, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avformat/hlsenc: Add support for HLS PLAYLIST types EVENT and VOD
Signed-off-by:
N
Michael Niedermayer
<
michael@niedermayer.cc
>
上级
4aea2c7d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
0 deletion
+28
-0
doc/muxers.texi
doc/muxers.texi
+8
-0
libavformat/hlsenc.c
libavformat/hlsenc.c
+20
-0
未找到文件。
doc/muxers.texi
浏览文件 @
77e355ff
...
@@ -408,6 +408,14 @@ Will produce the playlist, @file{out.m3u8}, and a single segment file,
...
@@ -408,6 +408,14 @@ Will produce the playlist, @file{out.m3u8}, and a single segment file,
@item hls_flags delete_segments
@item hls_flags delete_segments
Segment files removed from the playlist are deleted after a period of time
Segment files removed from the playlist are deleted after a period of time
equal to the duration of the segment plus the duration of the playlist.
equal to the duration of the segment plus the duration of the playlist.
@item hls_playlist_type event
Emit @code{#EXT-X-PLAYLIST-TYPE:EVENT} in the m3u8 header. Forces
@option{hls_list_size} to 0; the playlist can only be appended to.
@item hls_playlist_type vod
Emit @code{#EXT-X-PLAYLIST-TYPE:VOD} in the m3u8 header. Forces
@option{hls_list_size} to 0; the playlist must not change.
@end table
@end table
@anchor{ico}
@anchor{ico}
...
...
libavformat/hlsenc.c
浏览文件 @
77e355ff
...
@@ -64,6 +64,13 @@ typedef enum HLSFlags {
...
@@ -64,6 +64,13 @@ typedef enum HLSFlags {
HLS_OMIT_ENDLIST
=
(
1
<<
4
),
HLS_OMIT_ENDLIST
=
(
1
<<
4
),
}
HLSFlags
;
}
HLSFlags
;
typedef
enum
{
PLAYLIST_TYPE_NONE
,
PLAYLIST_TYPE_EVENT
,
PLAYLIST_TYPE_VOD
,
PLAYLIST_TYPE_NB
,
}
PlaylistType
;
typedef
struct
HLSContext
{
typedef
struct
HLSContext
{
const
AVClass
*
class
;
// Class for private options.
const
AVClass
*
class
;
// Class for private options.
unsigned
number
;
unsigned
number
;
...
@@ -79,6 +86,7 @@ typedef struct HLSContext {
...
@@ -79,6 +86,7 @@ typedef struct HLSContext {
int
max_nb_segments
;
// Set by a private option.
int
max_nb_segments
;
// Set by a private option.
int
wrap
;
// Set by a private option.
int
wrap
;
// Set by a private option.
uint32_t
flags
;
// enum HLSFlags
uint32_t
flags
;
// enum HLSFlags
uint32_t
pl_type
;
// enum PlaylistType
char
*
segment_filename
;
char
*
segment_filename
;
int
use_localtime
;
///< flag to expand filename with localtime
int
use_localtime
;
///< flag to expand filename with localtime
...
@@ -357,6 +365,10 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double
...
@@ -357,6 +365,10 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double
hls
->
last_segment
=
en
;
hls
->
last_segment
=
en
;
// EVENT or VOD playlists imply sliding window cannot be used
if
(
hls
->
pl_type
!=
PLAYLIST_TYPE_NONE
)
hls
->
max_nb_segments
=
0
;
if
(
hls
->
max_nb_segments
&&
hls
->
nb_entries
>=
hls
->
max_nb_segments
)
{
if
(
hls
->
max_nb_segments
&&
hls
->
nb_entries
>=
hls
->
max_nb_segments
)
{
en
=
hls
->
segments
;
en
=
hls
->
segments
;
hls
->
segments
=
en
->
next
;
hls
->
segments
=
en
->
next
;
...
@@ -432,6 +444,11 @@ static int hls_window(AVFormatContext *s, int last)
...
@@ -432,6 +444,11 @@ static int hls_window(AVFormatContext *s, int last)
}
}
avio_printf
(
out
,
"#EXT-X-TARGETDURATION:%d
\n
"
,
target_duration
);
avio_printf
(
out
,
"#EXT-X-TARGETDURATION:%d
\n
"
,
target_duration
);
avio_printf
(
out
,
"#EXT-X-MEDIA-SEQUENCE:%"
PRId64
"
\n
"
,
sequence
);
avio_printf
(
out
,
"#EXT-X-MEDIA-SEQUENCE:%"
PRId64
"
\n
"
,
sequence
);
if
(
hls
->
pl_type
==
PLAYLIST_TYPE_EVENT
)
{
avio_printf
(
out
,
"#EXT-X-PLAYLIST-TYPE:EVENT
\n
"
);
}
else
if
(
hls
->
pl_type
==
PLAYLIST_TYPE_VOD
)
{
avio_printf
(
out
,
"#EXT-X-PLAYLIST-TYPE:VOD
\n
"
);
}
av_log
(
s
,
AV_LOG_VERBOSE
,
"EXT-X-MEDIA-SEQUENCE:%"
PRId64
"
\n
"
,
av_log
(
s
,
AV_LOG_VERBOSE
,
"EXT-X-MEDIA-SEQUENCE:%"
PRId64
"
\n
"
,
sequence
);
sequence
);
...
@@ -908,6 +925,9 @@ static const AVOption options[] = {
...
@@ -908,6 +925,9 @@ static const AVOption options[] = {
{
"omit_endlist"
,
"Do not append an endlist when ending stream"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HLS_OMIT_ENDLIST
},
0
,
UINT_MAX
,
E
,
"flags"
},
{
"omit_endlist"
,
"Do not append an endlist when ending stream"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HLS_OMIT_ENDLIST
},
0
,
UINT_MAX
,
E
,
"flags"
},
{
"use_localtime"
,
"set filename expansion with strftime at segment creation"
,
OFFSET
(
use_localtime
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
E
},
{
"use_localtime"
,
"set filename expansion with strftime at segment creation"
,
OFFSET
(
use_localtime
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
E
},
{
"use_localtime_mkdir"
,
"create last directory component in strftime-generated filename"
,
OFFSET
(
use_localtime_mkdir
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
E
},
{
"use_localtime_mkdir"
,
"create last directory component in strftime-generated filename"
,
OFFSET
(
use_localtime_mkdir
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
E
},
{
"hls_playlist_type"
,
"set the HLS playlist type"
,
OFFSET
(
pl_type
),
AV_OPT_TYPE_INT
,
{.
i64
=
PLAYLIST_TYPE_NONE
},
0
,
PLAYLIST_TYPE_NB
-
1
,
E
,
"pl_type"
},
{
"event"
,
"EVENT playlist"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PLAYLIST_TYPE_EVENT
},
INT_MIN
,
INT_MAX
,
E
,
"pl_type"
},
{
"vod"
,
"VOD playlist"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PLAYLIST_TYPE_VOD
},
INT_MIN
,
INT_MAX
,
E
,
"pl_type"
},
{
"method"
,
"set the HTTP method"
,
OFFSET
(
method
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
E
},
{
"method"
,
"set the HTTP method"
,
OFFSET
(
method
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
E
},
{
NULL
},
{
NULL
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录