mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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>
This commit is contained in:
parent
f423497b45
commit
09b5d3fb44
@ -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;
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user