aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-06-05 07:02:53 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:29 -0300
commit09b5d3fb44ae1036700f80c8c80b15e9074c58c3 (patch)
treea89932ad3a2b8050c6fc3f93715bfb3a31dab5c8
parentf423497b455da06c1337846902c770028760e094 (diff)
downloadffmpeg-09b5d3fb44ae1036700f80c8c80b15e9074c58c3.tar.gz
lavc: deprecate channel count/layout changing side data
They are incompatible with the new channel layout scheme and no decoder uses them. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavcodec/decode.c4
-rw-r--r--libavcodec/packet.h5
-rw-r--r--libavformat/dump.c9
-rw-r--r--libavformat/nutenc.c2
-rw-r--r--libavformat/utils.c9
5 files changed, 28 insertions, 1 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 7423a177c7..48a953da5c 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -91,6 +91,8 @@ static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
flags = bytestream_get_le32(&data);
size -= 4;
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
if (size < 4)
goto fail;
@@ -109,6 +111,8 @@ static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
avctx->channel_layout = bytestream_get_le64(&data);
size -= 8;
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
if (size < 4)
goto fail;
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index 4a349fe051..0c3729f32c 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -447,8 +447,13 @@ typedef struct AVPacketList {
#define AV_PKT_FLAG_DISPOSABLE 0x0010
enum AVSideDataParamChangeFlags {
+#if FF_API_OLD_CHANNEL_LAYOUT
+ /**
+ * @deprecated those are not used by any decoder
+ */
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
+#endif
AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
};
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 4824965ee9..69b838fbc7 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -164,8 +164,11 @@ static void dump_paramchange(void *ctx, const AVPacketSideData *sd)
{
int size = sd->size;
const uint8_t *data = sd->data;
- uint32_t flags, channels, sample_rate, width, height;
+ uint32_t flags, sample_rate, width, height;
+#if FF_API_OLD_CHANNEL_LAYOUT
+ uint32_t channels;
uint64_t layout;
+#endif
if (!data || sd->size < 4)
goto fail;
@@ -174,6 +177,8 @@ static void dump_paramchange(void *ctx, const AVPacketSideData *sd)
data += 4;
size -= 4;
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
if (size < 4)
goto fail;
@@ -191,6 +196,8 @@ static void dump_paramchange(void *ctx, const AVPacketSideData *sd)
av_log(ctx, AV_LOG_INFO,
"channel layout: %s, ", av_get_channel_name(layout));
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif /* FF_API_OLD_CHANNEL_LAYOUT */
if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
if (size < 4)
goto fail;
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 585ce953ca..9d5eb4ed99 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -894,6 +894,7 @@ static int write_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int
break;
case AV_PKT_DATA_PARAM_CHANGE:
flags = bytestream_get_le32(&data);
+#if FF_API_OLD_CHANNEL_LAYOUT
if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
put_str(dyn_bc, "Channels");
put_s(dyn_bc, bytestream_get_le32(&data));
@@ -907,6 +908,7 @@ static int write_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int
avio_write(dyn_bc, data, 8); data+=8;
sm_data_count++;
}
+#endif
if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
put_str(dyn_bc, "SampleRate");
put_s(dyn_bc, bytestream_get_le32(&data));
diff --git a/libavformat/utils.c b/libavformat/utils.c
index ca61a97759..3c775cf6c6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1329,6 +1329,9 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
uint8_t *data;
if (!pkt)
return AVERROR(EINVAL);
+
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
if (channels) {
size += 4;
flags |= AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT;
@@ -1337,6 +1340,8 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
size += 8;
flags |= AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT;
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (sample_rate) {
size += 4;
flags |= AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE;
@@ -1349,10 +1354,14 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
if (!data)
return AVERROR(ENOMEM);
bytestream_put_le32(&data, flags);
+#if FF_API_OLD_CHANNEL_LAYOUT
+FF_DISABLE_DEPRECATION_WARNINGS
if (channels)
bytestream_put_le32(&data, channels);
if (channel_layout)
bytestream_put_le64(&data, channel_layout);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (sample_rate)
bytestream_put_le32(&data, sample_rate);
if (width || height) {