On date Sunday 2016-03-06 20:49:24 -0600, Rodger Combs encoded: > --- > doc/muxers.texi | 5 +++++ > libavformat/segment.c | 8 +++++++- > 2 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/doc/muxers.texi b/doc/muxers.texi > index f2ad7fe..700ec88 100644 > --- a/doc/muxers.texi > +++ b/doc/muxers.texi > @@ -1224,6 +1224,11 @@ muxers/codecs. It is set to @code{0} by default. > @item initial_offset @var{offset} > Specify timestamp offset to apply to the output packet timestamps. The > argument must be a time duration specification, and defaults to 0. > + > +@item write_empty_segments @var{1|0} > +If enabled, write an empty segment if there are no packets during the period > a > +segment would usually span. Otherwise, the segment will be filled with the > next > +packet written. Defaults to @code{0}. > @end table
Can you describe an use case for this (and possibly add a short description in the log)? > > @subsection Examples > diff --git a/libavformat/segment.c b/libavformat/segment.c > index 6ad991f..df1514f 100644 > --- a/libavformat/segment.c > +++ b/libavformat/segment.c > @@ -116,6 +116,7 @@ typedef struct SegmentContext { > char *reference_stream_specifier; ///< reference stream specifier > int reference_stream_index; > int break_non_keyframes; > + int write_empty; > > int use_rename; > char temp_list_filename[1024]; > @@ -774,6 +775,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket > *pkt) > if (!seg->avf) > return AVERROR(EINVAL); > > +calc_times: > if (seg->times) { > end_pts = seg->segment_count < seg->nb_times ? > seg->times[seg->segment_count] : INT64_MAX; > @@ -805,7 +807,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket > *pkt) > > if (pkt->stream_index == seg->reference_stream_index && > (pkt->flags & AV_PKT_FLAG_KEY || seg->break_non_keyframes) && > - seg->segment_frame_count > 0 && > + (seg->segment_frame_count > 0 || seg->write_empty) && > (seg->cut_pending || seg->frame_count >= start_frame || > (pkt->pts != AV_NOPTS_VALUE && > av_compare_ts(pkt->pts, st->time_base, > @@ -825,6 +827,9 @@ static int seg_write_packet(AVFormatContext *s, AVPacket > *pkt) > seg->cur_entry.start_time = (double)pkt->pts * av_q2d(st->time_base); > seg->cur_entry.start_pts = av_rescale_q(pkt->pts, st->time_base, > AV_TIME_BASE_Q); > seg->cur_entry.end_time = seg->cur_entry.start_time; > + > + if (seg->times || (!seg->frames && !seg->use_clocktime) && > seg->write_empty) > + goto calc_times; what's the point of this goto? [...] -- FFmpeg = Funny and Frenzy Muttering Picky Emblematic Generator _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel