From dfdb3ca34175482887dc0480a445b880d331c6c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 15 Dec 2011 18:30:03 +0200 Subject: [PATCH] libavcodec: Define a side data type for parameter changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also define a codec capability for codecs that can handle parameters changed externally between decoded packets. Signed-off-by: Martin Storsjö (cherry picked from commit fe75dc8583b65612f3a94144ee090e741dc926d5) Conflicts: libavcodec/avcodec.h libavcodec/version.h Signed-off-by: Michael Niedermayer --- libavcodec/avcodec.h | 26 ++++++++++++++++++++++++++ libavcodec/version.h | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 795149ce36..c40a23ec2f 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -790,6 +790,10 @@ typedef struct RcOverride{ * Codec supports slice-based (or partition-based) multithreading. */ #define CODEC_CAP_SLICE_THREADS 0x2000 +/** + * Codec supports changed parameters at any point. + */ +#define CODEC_CAP_PARAM_CHANGE 0x4000 /** * Codec is lossless. */ @@ -877,6 +881,7 @@ typedef struct AVPanScan{ enum AVPacketSideDataType { AV_PKT_DATA_PALETTE, AV_PKT_DATA_NEW_EXTRADATA, + AV_PKT_DATA_PARAM_CHANGE, }; typedef struct AVPacket { @@ -945,6 +950,27 @@ typedef struct AVPacket { #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted +/** + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: + * u32le param_flags + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) + * s32le channel_count + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) + * u64le channel_layout + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) + * s32le sample_rate + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) + * s32le width + * s32le height + */ + +enum AVSideDataParamChangeFlags { + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, +}; + /** * Audio Video Frame. * New fields can be added to the end of AVFRAME with minor version diff --git a/libavcodec/version.h b/libavcodec/version.h index 069d844e43..b088456e6f 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -22,7 +22,7 @@ #define LIBAVCODEC_VERSION_MAJOR 53 #define LIBAVCODEC_VERSION_MINOR 42 -#define LIBAVCODEC_VERSION_MICRO 1 +#define LIBAVCODEC_VERSION_MICRO 2 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \