Le duodi 12 brumaire, an CCXXIV, Marton Balint a écrit : > Signed-off-by: Marton Balint <c...@passwd.hu> > --- > doc/demuxers.texi | 8 ++++++++ > libavformat/concatdec.c | 12 ++++++++++++ > 2 files changed, 20 insertions(+)
Looks ok, except for a tiny remark below, but please consider what I suggested in the first patch: only set the duration metadata if the duration is reliable. > > diff --git a/doc/demuxers.texi b/doc/demuxers.texi > index 34bfc9b..41d3722 100644 > --- a/doc/demuxers.texi > +++ b/doc/demuxers.texi > @@ -204,6 +204,14 @@ Currently, the only conversion is adding the > h264_mp4toannexb bitstream > filter to H.264 streams in MP4 format. This is necessary in particular if > there are resolution changes. > > +@item segment_time_metadata > +If set to 1, every packet will contain the @var{lavf.concat.start_time} and > the > +@var{lavf.concat.duration} packet metadata values which are the start_time > and > +the duration of the respective file segments in the concatenated output > +expressed in microseconds. The duration is only estimated in some files (e.g. > +MP3 without extra headers) > +The default is 0. > + > @end table > > @section flv > diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c > index 15094bf..603f1b7 100644 > --- a/libavformat/concatdec.c > +++ b/libavformat/concatdec.c > @@ -62,6 +62,7 @@ typedef struct { > int eof; > ConcatMatchMode stream_match_mode; > unsigned auto_convert; > + int segment_time_metadata; > } ConcatContext; > > static int concat_probe(AVProbeData *probe) > @@ -326,6 +327,15 @@ static int open_file(AVFormatContext *avf, unsigned > fileno) > cat->files[fileno - 1].duration; > file->file_start_time = (cat->avf->start_time == AV_NOPTS_VALUE) ? 0 : > cat->avf->start_time; > file->file_inpoint = (file->inpoint == AV_NOPTS_VALUE) ? > file->file_start_time : file->inpoint; > + > + if (cat->segment_time_metadata) { > + int64_t duration = file->duration; > + if (duration == AV_NOPTS_VALUE) > + duration = get_duration(file, cat->avf); > + av_dict_set_int(&file->metadata, "lavf.concatdec.start_time", > file->start_time, 0); > + av_dict_set_int(&file->metadata, "lavf.concatdec.duration", > duration, 0); > + } > + > if ((ret = match_streams(avf)) < 0) > return ret; > if (file->inpoint != AV_NOPTS_VALUE) { > @@ -709,6 +719,8 @@ static const AVOption options[] = { > OFFSET(safe), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, DEC }, > { "auto_convert", "automatically convert bitstream format", > OFFSET(auto_convert), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, DEC }, > + { "segment_time_metadata", "output file segment start time and duration > as packet metadata", > + OFFSET(segment_time_metadata), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC > }, AV_OPT_TYPE_BOOL (some other options should too, but AV_OPT_TYPE_BOOL is recent) > { NULL } > }; Regards, -- Nicolas George
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel