Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
e5ae2f91
Commit
e5ae2f91
authored
Aug 15, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/segment: add M3U8 list support
Address trac ticket #1642.
parent
4a12d1e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
muxers.texi
doc/muxers.texi
+4
-0
segment.c
libavformat/segment.c
+20
-0
version.h
libavformat/version.h
+1
-1
No files found.
doc/muxers.texi
View file @
e5ae2f91
...
...
@@ -502,6 +502,10 @@ muxer according to the provided pattern, and should not contain the
@var{segment_start_time} and @var{segment_end_time} specify
the segment start and end time expressed in seconds.
@item m3u8
Generate an extended M3U8 file, version 4, compliant with
@url{http://tools.ietf.org/id/draft-pantos-http-live-streaming-08.txt}.
@end table
Default value is "flat".
...
...
libavformat/segment.c
View file @
e5ae2f91
...
...
@@ -20,6 +20,8 @@
/**
* @file generic segmenter
* M3U8 specification can be find here:
* @url{http://tools.ietf.org/id/draft-pantos-http-live-streaming-08.txt}
*/
#include <float.h>
...
...
@@ -37,6 +39,7 @@
typedef
enum
{
LIST_TYPE_FLAT
=
0
,
LIST_TYPE_EXT
,
LIST_TYPE_M3U8
,
LIST_TYPE_NB
,
}
ListType
;
...
...
@@ -120,12 +123,25 @@ static int segment_list_open(AVFormatContext *s)
if
(
ret
<
0
)
return
ret
;
seg
->
list_max_segment_time
=
0
;
if
(
seg
->
list_type
==
LIST_TYPE_M3U8
)
{
avio_printf
(
seg
->
list_pb
,
"#EXTM3U
\n
"
);
avio_printf
(
seg
->
list_pb
,
"#EXT-X-VERSION:4
\n
"
);
}
return
ret
;
}
static
void
segment_list_close
(
AVFormatContext
*
s
)
{
SegmentContext
*
seg
=
s
->
priv_data
;
if
(
seg
->
list_type
==
LIST_TYPE_M3U8
)
{
avio_printf
(
seg
->
list_pb
,
"#EXT-X-TARGETDURATION:%d
\n
"
,
(
int
)(
seg
->
list_max_segment_time
+
0
.
5
));
avio_printf
(
seg
->
list_pb
,
"#EXT-X-ENDLIST
\n
"
);
}
avio_close
(
seg
->
list_pb
);
}
...
...
@@ -153,6 +169,9 @@ static int segment_end(AVFormatContext *s)
avio_printf
(
seg
->
list_pb
,
"%s
\n
"
,
oc
->
filename
);
}
else
if
(
seg
->
list_type
==
LIST_TYPE_EXT
)
{
avio_printf
(
seg
->
list_pb
,
"%s,%f,%f
\n
"
,
oc
->
filename
,
seg
->
start_time
,
seg
->
end_time
);
}
else
if
(
seg
->
list_type
==
LIST_TYPE_M3U8
)
{
avio_printf
(
seg
->
list_pb
,
"#EXTINF:%f,
\n
%s
\n
"
,
seg
->
end_time
-
seg
->
start_time
,
oc
->
filename
);
}
seg
->
list_max_segment_time
=
FFMAX
(
seg
->
end_time
-
seg
->
start_time
,
seg
->
list_max_segment_time
);
avio_flush
(
seg
->
list_pb
);
...
...
@@ -395,6 +414,7 @@ static const AVOption options[] = {
{
"segment_list_type"
,
"set the segment list type"
,
OFFSET
(
list_type
),
AV_OPT_TYPE_INT
,
{.
dbl
=
LIST_TYPE_FLAT
},
0
,
LIST_TYPE_NB
-
1
,
E
,
"list_type"
},
{
"flat"
,
"flat format"
,
0
,
AV_OPT_TYPE_CONST
,
{.
dbl
=
LIST_TYPE_FLAT
},
INT_MIN
,
INT_MAX
,
0
,
"list_type"
},
{
"ext"
,
"extended format"
,
0
,
AV_OPT_TYPE_CONST
,
{.
dbl
=
LIST_TYPE_EXT
},
INT_MIN
,
INT_MAX
,
0
,
"list_type"
},
{
"m3u8"
,
"M3U8 format"
,
0
,
AV_OPT_TYPE_CONST
,
{.
dbl
=
LIST_TYPE_M3U8
},
INT_MIN
,
INT_MAX
,
0
,
"list_type"
},
{
"segment_time"
,
"set segment duration"
,
OFFSET
(
time_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
E
},
{
"segment_time_delta"
,
"set approximation value used for the segment times"
,
OFFSET
(
time_delta_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"0"
},
0
,
0
,
E
},
{
"segment_times"
,
"set segment split time points"
,
OFFSET
(
times_str
),
AV_OPT_TYPE_STRING
,{.
str
=
NULL
},
0
,
0
,
E
},
...
...
libavformat/version.h
View file @
e5ae2f91
...
...
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 25
#define LIBAVFORMAT_VERSION_MICRO 10
1
#define LIBAVFORMAT_VERSION_MICRO 10
2
#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