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
45f5c557
Unverified
Commit
45f5c557
authored
Apr 08, 2016
by
Rodger Combs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/segment: fix writing separate header with auto BSF
parent
c7cd6ad8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
segment.c
libavformat/segment.c
+28
-1
No files found.
libavformat/segment.c
View file @
45f5c557
...
@@ -89,6 +89,7 @@ typedef struct SegmentContext {
...
@@ -89,6 +89,7 @@ typedef struct SegmentContext {
int64_t
last_val
;
///< remember last time for wrap around detection
int64_t
last_val
;
///< remember last time for wrap around detection
int64_t
last_cut
;
///< remember last cut
int64_t
last_cut
;
///< remember last cut
int
cut_pending
;
int
cut_pending
;
int
header_written
;
///< whether we've already called avformat_write_header
char
*
entry_prefix
;
///< prefix to add to list entry filenames
char
*
entry_prefix
;
///< prefix to add to list entry filenames
int
list_type
;
///< set the list type
int
list_type
;
///< set the list type
...
@@ -260,6 +261,7 @@ static int segment_start(AVFormatContext *s, int write_header)
...
@@ -260,6 +261,7 @@ static int segment_start(AVFormatContext *s, int write_header)
if
(
write_header
)
{
if
(
write_header
)
{
AVDictionary
*
options
=
NULL
;
AVDictionary
*
options
=
NULL
;
av_dict_copy
(
&
options
,
seg
->
format_options
,
0
);
av_dict_copy
(
&
options
,
seg
->
format_options
,
0
);
av_dict_set
(
&
options
,
"fflags"
,
"-autobsf"
,
0
);
err
=
avformat_write_header
(
oc
,
&
options
);
err
=
avformat_write_header
(
oc
,
&
options
);
av_dict_free
(
&
options
);
av_dict_free
(
&
options
);
if
(
err
<
0
)
if
(
err
<
0
)
...
@@ -756,7 +758,8 @@ static int seg_init(AVFormatContext *s)
...
@@ -756,7 +758,8 @@ static int seg_init(AVFormatContext *s)
}
}
av_dict_copy
(
&
options
,
seg
->
format_options
,
0
);
av_dict_copy
(
&
options
,
seg
->
format_options
,
0
);
ret
=
avformat_write_header
(
oc
,
&
options
);
av_dict_set
(
&
options
,
"fflags"
,
"-autobsf"
,
0
);
ret
=
avformat_init_output
(
oc
,
&
options
);
if
(
av_dict_count
(
options
))
{
if
(
av_dict_count
(
options
))
{
av_log
(
s
,
AV_LOG_ERROR
,
av_log
(
s
,
AV_LOG_ERROR
,
"Some of the provided format options in '%s' are not recognized
\n
"
,
seg
->
format_options_str
);
"Some of the provided format options in '%s' are not recognized
\n
"
,
seg
->
format_options_str
);
...
@@ -772,6 +775,13 @@ static int seg_init(AVFormatContext *s)
...
@@ -772,6 +775,13 @@ static int seg_init(AVFormatContext *s)
seg
->
segment_frame_count
=
0
;
seg
->
segment_frame_count
=
0
;
av_assert0
(
s
->
nb_streams
==
oc
->
nb_streams
);
av_assert0
(
s
->
nb_streams
==
oc
->
nb_streams
);
if
(
ret
==
AVSTREAM_INIT_IN_WRITE_HEADER
)
{
ret
=
avformat_write_header
(
oc
,
NULL
);
if
(
ret
<
0
)
return
ret
;
seg
->
header_written
=
1
;
}
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
AVStream
*
inner_st
=
oc
->
streams
[
i
];
AVStream
*
inner_st
=
oc
->
streams
[
i
];
AVStream
*
outer_st
=
s
->
streams
[
i
];
AVStream
*
outer_st
=
s
->
streams
[
i
];
...
@@ -781,6 +791,21 @@ static int seg_init(AVFormatContext *s)
...
@@ -781,6 +791,21 @@ static int seg_init(AVFormatContext *s)
if
(
oc
->
avoid_negative_ts
>
0
&&
s
->
avoid_negative_ts
<
0
)
if
(
oc
->
avoid_negative_ts
>
0
&&
s
->
avoid_negative_ts
<
0
)
s
->
avoid_negative_ts
=
1
;
s
->
avoid_negative_ts
=
1
;
return
ret
;
}
static
int
seg_write_header
(
AVFormatContext
*
s
)
{
SegmentContext
*
seg
=
s
->
priv_data
;
AVFormatContext
*
oc
=
seg
->
avf
;
int
ret
;
if
(
!
seg
->
header_written
)
{
ret
=
avformat_write_header
(
oc
,
NULL
);
if
(
ret
<
0
)
return
ret
;
}
if
(
!
seg
->
write_header_trailer
||
seg
->
header_filename
)
{
if
(
!
seg
->
write_header_trailer
||
seg
->
header_filename
)
{
if
(
seg
->
header_filename
)
{
if
(
seg
->
header_filename
)
{
av_write_frame
(
oc
,
NULL
);
av_write_frame
(
oc
,
NULL
);
...
@@ -1012,6 +1037,7 @@ AVOutputFormat ff_segment_muxer = {
...
@@ -1012,6 +1037,7 @@ AVOutputFormat ff_segment_muxer = {
.
priv_data_size
=
sizeof
(
SegmentContext
),
.
priv_data_size
=
sizeof
(
SegmentContext
),
.
flags
=
AVFMT_NOFILE
|
AVFMT_GLOBALHEADER
,
.
flags
=
AVFMT_NOFILE
|
AVFMT_GLOBALHEADER
,
.
init
=
seg_init
,
.
init
=
seg_init
,
.
write_header
=
seg_write_header
,
.
write_packet
=
seg_write_packet
,
.
write_packet
=
seg_write_packet
,
.
write_trailer
=
seg_write_trailer
,
.
write_trailer
=
seg_write_trailer
,
.
deinit
=
seg_free
,
.
deinit
=
seg_free
,
...
@@ -1031,6 +1057,7 @@ AVOutputFormat ff_stream_segment_muxer = {
...
@@ -1031,6 +1057,7 @@ AVOutputFormat ff_stream_segment_muxer = {
.
priv_data_size
=
sizeof
(
SegmentContext
),
.
priv_data_size
=
sizeof
(
SegmentContext
),
.
flags
=
AVFMT_NOFILE
,
.
flags
=
AVFMT_NOFILE
,
.
init
=
seg_init
,
.
init
=
seg_init
,
.
write_header
=
seg_write_header
,
.
write_packet
=
seg_write_packet
,
.
write_packet
=
seg_write_packet
,
.
write_trailer
=
seg_write_trailer
,
.
write_trailer
=
seg_write_trailer
,
.
deinit
=
seg_free
,
.
deinit
=
seg_free
,
...
...
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