[4/8] libavcodec: Define a side data type for parameter changes

Message ID 1324044883-78833-1-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö Dec. 16, 2011, 2:14 p.m.
Also define a codec capability for codecs that can handle
parameters changed externally between decoded packets.
---
 libavcodec/avcodec.h |   26 ++++++++++++++++++++++++++
 libavcodec/version.h |    2 +-
 2 files changed, 27 insertions(+), 1 deletions(-)

Comments

Justin Ruggles Dec. 19, 2011, 5:44 p.m. | #1
On 12/16/2011 09:14 AM, Martin Storsjö wrote:

> Also define a codec capability for codecs that can handle
> parameters changed externally between decoded packets.
> ---
>  libavcodec/avcodec.h |   26 ++++++++++++++++++++++++++
>  libavcodec/version.h |    2 +-
>  2 files changed, 27 insertions(+), 1 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 2cdaef6..f649c94 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -773,6 +773,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
>  
>  //The following defines may change, don't expect compatibility if you use them.
>  #define MB_TYPE_INTRA4x4   0x0001
> @@ -856,6 +860,7 @@ typedef struct AVPanScan{
>  enum AVPacketSideDataType {
>      AV_PKT_DATA_PALETTE,
>      AV_PKT_DATA_NEW_EXTRADATA,
> +    AV_PKT_DATA_PARAM_CHANGE,
>  };
>  
>  typedef struct AVPacket {
> @@ -925,6 +930,27 @@ typedef struct AVPacket {
>  #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)
> + *     u32le 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)
> + *     u32le sample_rate
> + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
> + *     u32le width
> + *     u32le 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
>   * bumps. Removal, reordering and changes to existing fields require
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index b6c12a8..0284263 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -21,7 +21,7 @@
>  #define AVCODEC_VERSION_H
>  
>  #define LIBAVCODEC_VERSION_MAJOR 53
> -#define LIBAVCODEC_VERSION_MINOR 29
> +#define LIBAVCODEC_VERSION_MINOR 30
>  #define LIBAVCODEC_VERSION_MICRO  0
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \


lgtm.

-Justin

Patch

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 2cdaef6..f649c94 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -773,6 +773,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
 
 //The following defines may change, don't expect compatibility if you use them.
 #define MB_TYPE_INTRA4x4   0x0001
@@ -856,6 +860,7 @@  typedef struct AVPanScan{
 enum AVPacketSideDataType {
     AV_PKT_DATA_PALETTE,
     AV_PKT_DATA_NEW_EXTRADATA,
+    AV_PKT_DATA_PARAM_CHANGE,
 };
 
 typedef struct AVPacket {
@@ -925,6 +930,27 @@  typedef struct AVPacket {
 #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)
+ *     u32le 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)
+ *     u32le sample_rate
+ * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
+ *     u32le width
+ *     u32le 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
  * bumps. Removal, reordering and changes to existing fields require
diff --git a/libavcodec/version.h b/libavcodec/version.h
index b6c12a8..0284263 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -21,7 +21,7 @@ 
 #define AVCODEC_VERSION_H
 
 #define LIBAVCODEC_VERSION_MAJOR 53
-#define LIBAVCODEC_VERSION_MINOR 29
+#define LIBAVCODEC_VERSION_MINOR 30
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \