[FFmpeg-cvslog] lavc: add codec_descriptor field to AVCodecContext.

Michael Niedermayer git at videolan.org
Sun Aug 12 14:55:48 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Aug 11 16:07:28 2012 +0200| [da74e883f14469a1aad7c07c9aa7629a554bbceb] | committer: Michael Niedermayer

lavc: add codec_descriptor field to AVCodecContext.

This can be used to avoid a time consuming lookup of the
descriptor

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=da74e883f14469a1aad7c07c9aa7629a554bbceb
---

 libavcodec/avcodec.h |   12 ++++++++++++
 libavcodec/utils.c   |    2 ++
 libavcodec/version.h |    2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 351e372..f739acd 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3036,6 +3036,15 @@ typedef struct AVCodecContext {
     AVRational pkt_timebase;
 
     /**
+     * AVCodecDescriptor
+     * Code outside libavcodec should access this field using:
+     * avcodec_get_codec_descriptior(avctx)
+     * - encoding: unused.
+     * - decoding: set by libavcodec.
+     */
+    AVCodecDescriptor *codec_descriptor;
+
+    /**
      * Current statistics for PTS correction.
      * - decoding: maintained and used by libavcodec, not intended to be used by user apps
      * - encoding: unused
@@ -3049,6 +3058,9 @@ typedef struct AVCodecContext {
 AVRational av_codec_get_pkt_timebase         (const AVCodecContext *avctx);
 void       av_codec_set_pkt_timebase         (AVCodecContext *avctx, AVRational val);
 
+AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
+void               av_codec_set_codec_descriptor(AVCodecContext *avctx, AVCodecDescriptor *desc);
+
 /**
  * AVProfile.
  */
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d9ad10f..90df647 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -712,6 +712,7 @@ MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata)
 MAKE_ACCESSORS(AVFrame, frame, int,     decode_error_flags)
 
 MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase)
+MAKE_ACCESSORS(AVCodecContext, codec, AVCodecDescriptor*, codec_descriptor)
 
 static void avcodec_get_subtitle_defaults(AVSubtitle *sub)
 {
@@ -860,6 +861,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
         goto free_and_end;
     }
     avctx->frame_number = 0;
+    avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);
 
     if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&
         (!avctx->time_base.num || !avctx->time_base.den)) {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 8f07291..c877fe9 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -27,7 +27,7 @@
  */
 
 #define LIBAVCODEC_VERSION_MAJOR 54
-#define LIBAVCODEC_VERSION_MINOR 51
+#define LIBAVCODEC_VERSION_MINOR 52
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list