Skip to content
Snippets Groups Projects
Commit da74e883 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

lavc: add codec_descriptor field to AVCodecContext.


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

Signed-off-by: default avatarMichael Niedermayer <michaelni@gmx.at>
parent d0bf3bf1
No related branches found
No related tags found
No related merge requests found
...@@ -3035,6 +3035,15 @@ typedef struct AVCodecContext { ...@@ -3035,6 +3035,15 @@ typedef struct AVCodecContext {
*/ */
AVRational pkt_timebase; 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. * Current statistics for PTS correction.
* - decoding: maintained and used by libavcodec, not intended to be used by user apps * - decoding: maintained and used by libavcodec, not intended to be used by user apps
...@@ -3049,6 +3058,9 @@ typedef struct AVCodecContext { ...@@ -3049,6 +3058,9 @@ typedef struct AVCodecContext {
AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); 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. * AVProfile.
*/ */
......
...@@ -712,6 +712,7 @@ MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata) ...@@ -712,6 +712,7 @@ MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata)
MAKE_ACCESSORS(AVFrame, frame, int, decode_error_flags) MAKE_ACCESSORS(AVFrame, frame, int, decode_error_flags)
MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase) MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase)
MAKE_ACCESSORS(AVCodecContext, codec, AVCodecDescriptor*, codec_descriptor)
static void avcodec_get_subtitle_defaults(AVSubtitle *sub) static void avcodec_get_subtitle_defaults(AVSubtitle *sub)
{ {
...@@ -860,6 +861,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD ...@@ -860,6 +861,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
goto free_and_end; goto free_and_end;
} }
avctx->frame_number = 0; avctx->frame_number = 0;
avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&
(!avctx->time_base.num || !avctx->time_base.den)) { (!avctx->time_base.num || !avctx->time_base.den)) {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
#define LIBAVCODEC_VERSION_MAJOR 54 #define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 51 #define LIBAVCODEC_VERSION_MINOR 52
#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment