mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 11:19:55 +00:00
!326 av3a code clean
Merge pull request !326 from liushuai/av3a_codeclean_20241111
This commit is contained in:
commit
912b4ac2f7
@ -2,7 +2,7 @@
|
|||||||
* AV3A Common Header File
|
* AV3A Common Header File
|
||||||
*
|
*
|
||||||
* Copyright (c) 2024 Shuai Liu <cqliushuai@outlook.com>
|
* Copyright (c) 2024 Shuai Liu <cqliushuai@outlook.com>
|
||||||
*
|
*
|
||||||
* This file is part of FFmpeg.
|
* This file is part of FFmpeg.
|
||||||
*
|
*
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
@ -56,17 +56,17 @@ typedef enum {
|
|||||||
|
|
||||||
/* Content Type */
|
/* Content Type */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AV3A_CHANNEL_BASED_TYPE = 0,
|
AV3A_CHANNEL_BASED_TYPE = 0,
|
||||||
AV3A_OBJECT_BASED_TYPE = 1,
|
AV3A_OBJECT_BASED_TYPE = 1,
|
||||||
AV3A_CHANNEL_OBJECT_TYPE = 2,
|
AV3A_CHANNEL_OBJECT_TYPE = 2,
|
||||||
AV3A_AMBISONIC_TYPE = 3
|
AV3A_AMBISONIC_TYPE = 3
|
||||||
} Av3aContentType;
|
} Av3aContentType;
|
||||||
|
|
||||||
/* Internal Coding Profile */
|
/* Internal Coding Profile */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AV3A_BASE_PROFILE = 0,
|
AV3A_BASE_PROFILE = 0,
|
||||||
AV3A_OBJECT_METADATA_PROFILE = 1,
|
AV3A_OBJECT_METADATA_PROFILE = 1,
|
||||||
AV3A_AMBISONIC_PROFILE = 2
|
AV3A_AMBISONIC_PROFILE = 2
|
||||||
} Av3aCodingProfile;
|
} Av3aCodingProfile;
|
||||||
|
|
||||||
/* NN Type */
|
/* NN Type */
|
||||||
@ -159,8 +159,7 @@ static const int64_t ff_av3a_mc4p0_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = {
|
|||||||
|
|
||||||
/* bitrate table for MC 5.1.2 */
|
/* bitrate table for MC 5.1.2 */
|
||||||
static const int64_t ff_av3a_mc5p1p2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = {
|
static const int64_t ff_av3a_mc5p1p2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = {
|
||||||
152000, 320000, 480000, 576000, 0, 0, 0, 0, 0, 0,
|
152000, 320000, 480000, 576000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
0, 0, 0, 0, 0, 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* bitrate table for MC 5.1.4 */
|
/* bitrate table for MC 5.1.4 */
|
||||||
@ -228,27 +227,27 @@ static const enum AVChannel ff_av3a_channel_layout_mc_4_0[4] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1[6] = {
|
static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1[6] = {
|
||||||
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
||||||
AV_CHAN_LOW_FREQUENCY,
|
AV_CHAN_LOW_FREQUENCY,
|
||||||
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT
|
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT
|
||||||
};
|
};
|
||||||
|
|
||||||
static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_2[8] = {
|
static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_2[8] = {
|
||||||
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
||||||
AV_CHAN_LOW_FREQUENCY,
|
AV_CHAN_LOW_FREQUENCY,
|
||||||
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT,
|
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT,
|
||||||
AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT
|
AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT
|
||||||
};
|
};
|
||||||
|
|
||||||
static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1[8] = {
|
static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1[8] = {
|
||||||
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
||||||
AV_CHAN_LOW_FREQUENCY,
|
AV_CHAN_LOW_FREQUENCY,
|
||||||
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT,
|
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT,
|
||||||
AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT
|
AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT
|
||||||
};
|
};
|
||||||
|
|
||||||
static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_4[10] = {
|
static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_4[10] = {
|
||||||
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
||||||
AV_CHAN_LOW_FREQUENCY,
|
AV_CHAN_LOW_FREQUENCY,
|
||||||
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT,
|
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT,
|
||||||
AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT,
|
AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT,
|
||||||
@ -256,7 +255,7 @@ static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_4[10] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_2[10] = {
|
static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_2[10] = {
|
||||||
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
||||||
AV_CHAN_LOW_FREQUENCY,
|
AV_CHAN_LOW_FREQUENCY,
|
||||||
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT,
|
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT,
|
||||||
AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT,
|
AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT,
|
||||||
@ -264,7 +263,7 @@ static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_2[10] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_4[12] = {
|
static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_4[12] = {
|
||||||
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER,
|
||||||
AV_CHAN_LOW_FREQUENCY,
|
AV_CHAN_LOW_FREQUENCY,
|
||||||
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT,
|
AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT,
|
||||||
AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT,
|
AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT,
|
||||||
@ -273,21 +272,21 @@ static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_4[12] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const Av3aChannelConfigMap ff_av3a_channels_map_table[AV3A_CHANNEL_LAYOUT_SIZE] = {
|
static const Av3aChannelConfigMap ff_av3a_channels_map_table[AV3A_CHANNEL_LAYOUT_SIZE] = {
|
||||||
{ CHANNEL_CONFIG_MONO, 1, ff_av3a_default_channel_layout_mono, AV3A_CH_LAYOUT_MONO },
|
{ CHANNEL_CONFIG_MONO, 1, ff_av3a_default_channel_layout_mono, AV3A_CH_LAYOUT_MONO },
|
||||||
{ CHANNEL_CONFIG_STEREO, 2, ff_av3a_default_channel_layout_stereo, AV3A_CH_LAYOUT_STEREO },
|
{ CHANNEL_CONFIG_STEREO, 2, ff_av3a_default_channel_layout_stereo, AV3A_CH_LAYOUT_STEREO },
|
||||||
{ CHANNEL_CONFIG_MC_5_1, 6, ff_av3a_default_channel_layout_mc_5_1, AV3A_CH_LAYOUT_5POINT1 },
|
{ CHANNEL_CONFIG_MC_5_1, 6, ff_av3a_default_channel_layout_mc_5_1, AV3A_CH_LAYOUT_5POINT1 },
|
||||||
{ CHANNEL_CONFIG_MC_7_1, 8, ff_av3a_default_channel_layout_mc_7_1, AV3A_CH_LAYOUT_7POINT1 },
|
{ CHANNEL_CONFIG_MC_7_1, 8, ff_av3a_default_channel_layout_mc_7_1, AV3A_CH_LAYOUT_7POINT1 },
|
||||||
{ CHANNEL_CONFIG_MC_10_2, 12, NULL, 0L }, /* reserved */
|
{ CHANNEL_CONFIG_MC_10_2, 12, NULL, 0L }, /* reserved */
|
||||||
{ CHANNEL_CONFIG_MC_22_2, 24, NULL, 0L }, /* reserved */
|
{ CHANNEL_CONFIG_MC_22_2, 24, NULL, 0L }, /* reserved */
|
||||||
{ CHANNEL_CONFIG_MC_4_0, 4, ff_av3a_channel_layout_mc_4_0, AV3A_CH_LAYOUT_4POINT0 },
|
{ CHANNEL_CONFIG_MC_4_0, 4, ff_av3a_channel_layout_mc_4_0, AV3A_CH_LAYOUT_4POINT0 },
|
||||||
{ CHANNEL_CONFIG_MC_5_1_2, 8, ff_av3a_default_channel_layout_mc_5_1_2, AV3A_CH_LAYOUT_5POINT1POINT2 },
|
{ CHANNEL_CONFIG_MC_5_1_2, 8, ff_av3a_default_channel_layout_mc_5_1_2, AV3A_CH_LAYOUT_5POINT1POINT2 },
|
||||||
{ CHANNEL_CONFIG_MC_5_1_4, 10, ff_av3a_default_channel_layout_mc_5_1_4, AV3A_CH_LAYOUT_5POINT1POINT4 },
|
{ CHANNEL_CONFIG_MC_5_1_4, 10, ff_av3a_default_channel_layout_mc_5_1_4, AV3A_CH_LAYOUT_5POINT1POINT4 },
|
||||||
{ CHANNEL_CONFIG_MC_7_1_2, 10, ff_av3a_default_channel_layout_mc_7_1_2, AV3A_CH_LAYOUT_7POINT1POINT2 },
|
{ CHANNEL_CONFIG_MC_7_1_2, 10, ff_av3a_default_channel_layout_mc_7_1_2, AV3A_CH_LAYOUT_7POINT1POINT2 },
|
||||||
{ CHANNEL_CONFIG_MC_7_1_4, 12, ff_av3a_default_channel_layout_mc_7_1_4, AV3A_CH_LAYOUT_7POINT1POINT4 },
|
{ CHANNEL_CONFIG_MC_7_1_4, 12, ff_av3a_default_channel_layout_mc_7_1_4, AV3A_CH_LAYOUT_7POINT1POINT4 },
|
||||||
{ CHANNEL_CONFIG_HOA_ORDER1, 4, NULL, 0L },
|
{ CHANNEL_CONFIG_HOA_ORDER1, 4, NULL, 0L },
|
||||||
{ CHANNEL_CONFIG_HOA_ORDER2, 9, NULL, 0L },
|
{ CHANNEL_CONFIG_HOA_ORDER2, 9, NULL, 0L },
|
||||||
{ CHANNEL_CONFIG_HOA_ORDER3, 16, NULL, 0L },
|
{ CHANNEL_CONFIG_HOA_ORDER3, 16, NULL, 0L },
|
||||||
{ CHANNEL_CONFIG_UNKNOWN, 0, NULL, 0L },
|
{ CHANNEL_CONFIG_UNKNOWN, 0, NULL, 0L },
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -296,20 +295,20 @@ typedef struct {
|
|||||||
} Av3aBitrateMap;
|
} Av3aBitrateMap;
|
||||||
|
|
||||||
static const Av3aBitrateMap ff_av3a_bitrate_map_table[15] = {
|
static const Av3aBitrateMap ff_av3a_bitrate_map_table[15] = {
|
||||||
{CHANNEL_CONFIG_MONO, ff_av3a_mono_bitrate_table },
|
{CHANNEL_CONFIG_MONO, ff_av3a_mono_bitrate_table },
|
||||||
{CHANNEL_CONFIG_STEREO, ff_av3a_stereo_bitrate_table },
|
{CHANNEL_CONFIG_STEREO, ff_av3a_stereo_bitrate_table },
|
||||||
{CHANNEL_CONFIG_MC_5_1, ff_av3a_mc5p1_bitrate_table },
|
{CHANNEL_CONFIG_MC_5_1, ff_av3a_mc5p1_bitrate_table },
|
||||||
{CHANNEL_CONFIG_MC_7_1, ff_av3a_mc7p1_bitrate_table },
|
{CHANNEL_CONFIG_MC_7_1, ff_av3a_mc7p1_bitrate_table },
|
||||||
{CHANNEL_CONFIG_MC_10_2, NULL }, /* reserved */
|
{CHANNEL_CONFIG_MC_10_2, NULL }, /* reserved */
|
||||||
{CHANNEL_CONFIG_MC_22_2, NULL }, /* reserved */
|
{CHANNEL_CONFIG_MC_22_2, NULL }, /* reserved */
|
||||||
{CHANNEL_CONFIG_MC_4_0, ff_av3a_mc4p0_bitrate_table },
|
{CHANNEL_CONFIG_MC_4_0, ff_av3a_mc4p0_bitrate_table },
|
||||||
{CHANNEL_CONFIG_MC_5_1_2, ff_av3a_mc5p1p2_bitrate_table },
|
{CHANNEL_CONFIG_MC_5_1_2, ff_av3a_mc5p1p2_bitrate_table },
|
||||||
{CHANNEL_CONFIG_MC_5_1_4, ff_av3a_mc5p1p4_bitrate_table },
|
{CHANNEL_CONFIG_MC_5_1_4, ff_av3a_mc5p1p4_bitrate_table },
|
||||||
{CHANNEL_CONFIG_MC_7_1_2, ff_av3a_mc7p1p2_bitrate_table },
|
{CHANNEL_CONFIG_MC_7_1_2, ff_av3a_mc7p1p2_bitrate_table },
|
||||||
{CHANNEL_CONFIG_MC_7_1_4, ff_av3a_mc7p1p4_bitrate_table },
|
{CHANNEL_CONFIG_MC_7_1_4, ff_av3a_mc7p1p4_bitrate_table },
|
||||||
{CHANNEL_CONFIG_HOA_ORDER1, ff_av3a_foa_bitrate_table },
|
{CHANNEL_CONFIG_HOA_ORDER1, ff_av3a_foa_bitrate_table },
|
||||||
{CHANNEL_CONFIG_HOA_ORDER2, ff_av3a_hoa2_bitrate_table },
|
{CHANNEL_CONFIG_HOA_ORDER2, ff_av3a_hoa2_bitrate_table },
|
||||||
{CHANNEL_CONFIG_HOA_ORDER3, ff_av3a_hoa3_bitrate_table },
|
{CHANNEL_CONFIG_HOA_ORDER3, ff_av3a_hoa3_bitrate_table },
|
||||||
{CHANNEL_CONFIG_UNKNOWN, NULL },
|
{CHANNEL_CONFIG_UNKNOWN, NULL },
|
||||||
};
|
};
|
||||||
#endif /* AVCODEC_AV3A_H */
|
#endif /* AVCODEC_AV3A_H */
|
||||||
|
@ -42,8 +42,8 @@ typedef struct {
|
|||||||
int16_t total_channels;
|
int16_t total_channels;
|
||||||
} Av3aParseContext;
|
} Av3aParseContext;
|
||||||
|
|
||||||
static int ff_read_av3a_header_parse(GetBitContext *gb, AATFHeaderInfo *hdf)
|
static int ff_read_av3a_header_parse(GetBitContext *gb, AATFHeaderInfo *hdf)
|
||||||
{
|
{
|
||||||
int64_t soundbed_bitrate = 0L;
|
int64_t soundbed_bitrate = 0L;
|
||||||
int64_t object_bitrate = 0L;
|
int64_t object_bitrate = 0L;
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ static int ff_read_av3a_header_parse(GetBitContext *gb, AATFHeaderInfo *hdf)
|
|||||||
hdf->total_channels = hdf->nb_channels + hdf->nb_objects;
|
hdf->total_channels = hdf->nb_channels + hdf->nb_objects;
|
||||||
|
|
||||||
hdf->resolution_index = get_bits(gb, 2);
|
hdf->resolution_index = get_bits(gb, 2);
|
||||||
if((hdf->resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (hdf->resolution_index < 0)) {
|
if ((hdf->resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (hdf->resolution_index < 0)) {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution;
|
hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* AV3A Demuxer
|
* AV3A Demuxer
|
||||||
*
|
*
|
||||||
* Copyright (c) 2024 Shuai Liu <cqliushuai@outlook.com>
|
* Copyright (c) 2024 Shuai Liu <cqliushuai@outlook.com>
|
||||||
*
|
*
|
||||||
* This file is part of FFmpeg.
|
* This file is part of FFmpeg.
|
||||||
*
|
*
|
||||||
* FFmpeg is free software; you can redistribute it and/or
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
@ -101,7 +101,7 @@ static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf)
|
|||||||
} else if (hdf->coding_profile == AV3A_OBJECT_METADATA_PROFILE) {
|
} else if (hdf->coding_profile == AV3A_OBJECT_METADATA_PROFILE) {
|
||||||
hdf->soundbed_type = get_bits(&gb, 2);
|
hdf->soundbed_type = get_bits(&gb, 2);
|
||||||
if (hdf->soundbed_type == 0) {
|
if (hdf->soundbed_type == 0) {
|
||||||
hdf->content_type = AV3A_OBJECT_BASED_TYPE;
|
hdf->content_type = AV3A_OBJECT_BASED_TYPE;
|
||||||
hdf->object_channel_number = get_bits(&gb, 7);
|
hdf->object_channel_number = get_bits(&gb, 7);
|
||||||
if (hdf->object_channel_number < 0) {
|
if (hdf->object_channel_number < 0) {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -137,7 +137,7 @@ static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf)
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index] +
|
hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index] +
|
||||||
ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel] * hdf->nb_objects;
|
ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel] * hdf->nb_objects;
|
||||||
} else {
|
} else {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -169,7 +169,7 @@ static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf)
|
|||||||
|
|
||||||
/* resolution */
|
/* resolution */
|
||||||
hdf->resolution_index = get_bits(&gb, 2);
|
hdf->resolution_index = get_bits(&gb, 2);
|
||||||
if((hdf->resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (hdf->resolution_index < 0)) {
|
if ((hdf->resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (hdf->resolution_index < 0)) {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution;
|
hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution;
|
||||||
@ -177,7 +177,7 @@ static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf)
|
|||||||
|
|
||||||
if (hdf->coding_profile != AV3A_OBJECT_METADATA_PROFILE) {
|
if (hdf->coding_profile != AV3A_OBJECT_METADATA_PROFILE) {
|
||||||
hdf->bitrate_index = get_bits(&gb, 4);
|
hdf->bitrate_index = get_bits(&gb, 4);
|
||||||
if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)){
|
if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index];
|
hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index];
|
||||||
@ -188,7 +188,7 @@ static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int av3a_get_packet_size(AVFormatContext *s)
|
static int av3a_get_packet_size(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int read_bytes = 0;
|
int read_bytes = 0;
|
||||||
@ -333,9 +333,8 @@ static int av3a_get_packet_size(AVFormatContext *s)
|
|||||||
return payload_bytes;
|
return payload_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int av3a_probe(const AVProbeData *p)
|
static int av3a_probe(const AVProbeData *p)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint16_t frame_sync_word;
|
uint16_t frame_sync_word;
|
||||||
uint16_t lval = ((uint16_t)(p->buf[0]));
|
uint16_t lval = ((uint16_t)(p->buf[0]));
|
||||||
uint16_t rval = ((uint16_t)(p->buf[1]));
|
uint16_t rval = ((uint16_t)(p->buf[1]));
|
||||||
@ -348,7 +347,7 @@ static int av3a_probe(const AVProbeData *p)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int av3a_read_header(AVFormatContext *s)
|
static int av3a_read_header(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint8_t header[AV3A_MAX_NBYTES_HEADER];
|
uint8_t header[AV3A_MAX_NBYTES_HEADER];
|
||||||
@ -367,7 +366,7 @@ static int av3a_read_header(AVFormatContext *s)
|
|||||||
stream->start_time = 0;
|
stream->start_time = 0;
|
||||||
ffstream(stream)->need_parsing = AVSTREAM_PARSE_FULL_RAW;
|
ffstream(stream)->need_parsing = AVSTREAM_PARSE_FULL_RAW;
|
||||||
stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
|
stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||||
stream->codecpar->codec_id = s->iformat->raw_codec_id;
|
stream->codecpar->codec_id = s->iformat->raw_codec_id;
|
||||||
stream->codecpar->codec_tag = MKTAG('a', 'v', '3', 'a');
|
stream->codecpar->codec_tag = MKTAG('a', 'v', '3', 'a');
|
||||||
|
|
||||||
if ((ret = avio_read(s->pb, header, AV3A_MAX_NBYTES_HEADER)) != AV3A_MAX_NBYTES_HEADER) {
|
if ((ret = avio_read(s->pb, header, AV3A_MAX_NBYTES_HEADER)) != AV3A_MAX_NBYTES_HEADER) {
|
||||||
@ -399,7 +398,7 @@ static int av3a_read_header(AVFormatContext *s)
|
|||||||
av3afmtctx.resolution_index = hdf.resolution_index;
|
av3afmtctx.resolution_index = hdf.resolution_index;
|
||||||
av3afmtctx.total_bitrate_kbps = (int) (hdf.total_bitrate / 1000);
|
av3afmtctx.total_bitrate_kbps = (int) (hdf.total_bitrate / 1000);
|
||||||
|
|
||||||
if((ret = ff_alloc_extradata(stream->codecpar, sizeof(Av3aFormatContext))) < 0) {
|
if ((ret = ff_alloc_extradata(stream->codecpar, sizeof(Av3aFormatContext))) < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
memcpy(stream->codecpar->extradata, &av3afmtctx, sizeof(Av3aFormatContext));
|
memcpy(stream->codecpar->extradata, &av3afmtctx, sizeof(Av3aFormatContext));
|
||||||
@ -411,8 +410,8 @@ static int av3a_read_header(AVFormatContext *s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int av3a_read_packet(AVFormatContext *s, AVPacket *pkt) {
|
static int av3a_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
|
{
|
||||||
int64_t pos;
|
int64_t pos;
|
||||||
int packet_size = 0;
|
int packet_size = 0;
|
||||||
int read_bytes = 0;
|
int read_bytes = 0;
|
||||||
@ -440,7 +439,7 @@ static int av3a_read_packet(AVFormatContext *s, AVPacket *pkt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!s->streams[0]) {
|
if (!s->streams[0]) {
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->streams[0]->codecpar) {
|
if (!s->streams[0]->codecpar) {
|
||||||
|
@ -7949,7 +7949,7 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
}
|
}
|
||||||
st = c->fc->streams[c->fc->nb_streams - 1];
|
st = c->fc->streams[c->fc->nb_streams - 1];
|
||||||
|
|
||||||
if ((ret = avio_read(pb, buffer, sizeof(buffer))) < 0){
|
if ((ret = avio_read(pb, buffer, sizeof(buffer))) < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7972,7 +7972,6 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
|
|
||||||
reserved = get_bits(&gb, 1);
|
reserved = get_bits(&gb, 1);
|
||||||
content_type = get_bits(&gb, 4);
|
content_type = get_bits(&gb, 4);
|
||||||
|
|
||||||
if (content_type == AV3A_CHANNEL_BASED_TYPE) {
|
if (content_type == AV3A_CHANNEL_BASED_TYPE) {
|
||||||
channel_number_index = get_bits(&gb, 7);
|
channel_number_index = get_bits(&gb, 7);
|
||||||
reserved = get_bits(&gb, 1);
|
reserved = get_bits(&gb, 1);
|
||||||
@ -8007,7 +8006,7 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
} else if (content_type == AV3A_AMBISONIC_TYPE) {
|
} else if (content_type == AV3A_AMBISONIC_TYPE) {
|
||||||
hoa_order = get_bits(&gb , 4);
|
hoa_order = get_bits(&gb, 4);
|
||||||
if ((hoa_order < AV3A_AMBISONIC_FIRST_ORDER) || (hoa_order > AV3A_AMBISONIC_THIRD_ORDER)) {
|
if ((hoa_order < AV3A_AMBISONIC_FIRST_ORDER) || (hoa_order > AV3A_AMBISONIC_THIRD_ORDER)) {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
@ -8036,7 +8035,7 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (content_type != AV3A_OBJECT_BASED_TYPE) {
|
if (content_type != AV3A_OBJECT_BASED_TYPE) {
|
||||||
for(i = 0; i < nb_channels; i ++) {
|
for (i = 0; i < nb_channels; i ++) {
|
||||||
st->codecpar->ch_layout.u.map[i].id = ff_av3a_channels_map_table[channel_number_index].channel_layout[i];
|
st->codecpar->ch_layout.u.map[i].id = ff_av3a_channels_map_table[channel_number_index].channel_layout[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -941,10 +941,10 @@ static int mov_write_dca3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
|
|||||||
if (content_type == AV3A_CHANNEL_BASED_TYPE) {
|
if (content_type == AV3A_CHANNEL_BASED_TYPE) {
|
||||||
put_bits(&pb_dca3, 7, channel_number_index);
|
put_bits(&pb_dca3, 7, channel_number_index);
|
||||||
put_bits(&pb_dca3, 1, 0); /* reserved */
|
put_bits(&pb_dca3, 1, 0); /* reserved */
|
||||||
} else if (content_type == AV3A_OBJECT_BASED_TYPE){
|
} else if (content_type == AV3A_OBJECT_BASED_TYPE) {
|
||||||
put_bits(&pb_dca3, 7, number_objects);
|
put_bits(&pb_dca3, 7, number_objects);
|
||||||
put_bits(&pb_dca3, 1, 0); /* reserved */
|
put_bits(&pb_dca3, 1, 0); /* reserved */
|
||||||
} else if (content_type == AV3A_CHANNEL_OBJECT_TYPE){
|
} else if (content_type == AV3A_CHANNEL_OBJECT_TYPE) {
|
||||||
put_bits(&pb_dca3, 7, channel_number_index);
|
put_bits(&pb_dca3, 7, channel_number_index);
|
||||||
put_bits(&pb_dca3, 1, 0); /* reserved */
|
put_bits(&pb_dca3, 1, 0); /* reserved */
|
||||||
put_bits(&pb_dca3, 7, number_objects);
|
put_bits(&pb_dca3, 7, number_objects);
|
||||||
|
Loading…
Reference in New Issue
Block a user