[FFmpeg-devel] [PATCH] lavf/matroska: Export codecdelay and seekpreroll as metadata tags
Vignesh Venkatasubramanian
vigneshv at google.com
Tue Sep 17 23:41:05 CEST 2013
This patch exports the values of Codec Delay and Seek Preroll
container elements as metadata tags.
Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
---
libavformat/matroskadec.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 76c610b..62b95f1 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -163,6 +163,8 @@ typedef struct {
uint64_t default_duration;
uint64_t flag_default;
uint64_t flag_forced;
+ uint64_t codec_delay;
+ uint64_t seek_preroll;
MatroskaTrackVideo video;
MatroskaTrackAudio audio;
MatroskaTrackOperation operation;
@@ -410,6 +412,8 @@ static EbmlSyntax matroska_track[] = {
{ MATROSKA_ID_TRACKOPERATION, EBML_NEST, 0, offsetof(MatroskaTrack,operation), {.n=matroska_track_operation} },
{ MATROSKA_ID_TRACKCONTENTENCODINGS,EBML_NEST, 0, 0, {.n=matroska_track_encodings} },
{ MATROSKA_ID_TRACKMAXBLKADDID, EBML_UINT, 0, offsetof(MatroskaTrack,max_block_additional_id) },
+ { MATROSKA_ID_CODECDELAY, EBML_UINT, 0, offsetof(MatroskaTrack,codec_delay) },
+ { MATROSKA_ID_SEEKPREROLL, EBML_UINT, 0, offsetof(MatroskaTrack,seek_preroll) },
{ MATROSKA_ID_TRACKFLAGENABLED, EBML_NONE },
{ MATROSKA_ID_TRACKFLAGLACING, EBML_NONE },
{ MATROSKA_ID_CODECNAME, EBML_NONE },
@@ -1821,6 +1825,21 @@ static int matroska_read_header(AVFormatContext *s)
}
}
+ /* export codec delay and seek preroll as metadata tags */
+ if (track->codec_delay > 0) {
+ char codec_delay[25];
+ snprintf(codec_delay, sizeof(codec_delay), "%"PRIu64,
+ track->codec_delay);
+ av_dict_set(&st->metadata, "codec_delay", codec_delay, 0);
+ }
+
+ if (track->seek_preroll > 0) {
+ char seek_preroll[25];
+ snprintf(seek_preroll, sizeof(seek_preroll), "%"PRIu64,
+ track->seek_preroll);
+ av_dict_set(&st->metadata, "seek_preroll", seek_preroll, 0);
+ }
+
if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
MatroskaTrackPlane *planes = track->operation.combine_planes.elem;
--
1.8.4
More information about the ffmpeg-devel
mailing list