codecpar: Add video delay field
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>
Wed, 30 Mar 2016 16:15:04 +0000 (17:15 +0100)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Thu, 31 Mar 2016 20:20:39 +0000 (21:20 +0100)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
libavcodec/avcodec.h
libavcodec/utils.c

index 10a2083..bbf742f 100644 (file)
@@ -3869,6 +3869,11 @@ typedef struct AVCodecParameters {
     enum AVChromaLocation              chroma_location;
 
     /**
+     * Video only. Number of delayed frames.
+     */
+    int video_delay;
+
+    /**
      * Audio only. The channel layout bitmask. May be 0 if the channel layout is
      * unknown or unspecified, otherwise the number of bits set must be equal to
      * the channels field.
index 0341686..5288d4d 100644 (file)
@@ -3776,6 +3776,7 @@ int avcodec_parameters_from_context(AVCodecParameters *par,
         par->color_space         = codec->colorspace;
         par->chroma_location     = codec->chroma_sample_location;
         par->sample_aspect_ratio = codec->sample_aspect_ratio;
+        par->video_delay         = codec->has_b_frames;
         break;
     case AVMEDIA_TYPE_AUDIO:
         par->format          = codec->sample_fmt;
@@ -3824,6 +3825,7 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
         codec->colorspace             = par->color_space;
         codec->chroma_sample_location = par->chroma_location;
         codec->sample_aspect_ratio    = par->sample_aspect_ratio;
+        codec->has_b_frames           = par->video_delay;
         break;
     case AVMEDIA_TYPE_AUDIO:
         codec->sample_fmt      = par->format;