多余空格删除

Signed-off-by: liushuai <cqliushuai@outlook.com>
This commit is contained in:
liushuai 2024-11-06 22:55:38 +08:00
parent d80043ab7b
commit a2bfd80a73
4 changed files with 14 additions and 15 deletions

View File

@ -42,7 +42,6 @@ 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;
@ -165,7 +164,7 @@ static int ff_read_av3a_header_parse(GetBitContext *gb, AATFHeaderInfo *hdf)
} }
hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution; hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution;
hdf->sample_format = ff_av3a_sample_format_map_table[hdf->resolution_index].sample_format; hdf->sample_format = ff_av3a_sample_format_map_table[hdf->resolution_index].sample_format;
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)) {

View File

@ -50,7 +50,7 @@ static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf)
hdf->nb_channels = 0; hdf->nb_channels = 0;
hdf->nb_objects = 0; hdf->nb_objects = 0;
init_get_bits8(&gb, buf, AV3A_MAX_NBYTES_HEADER); init_get_bits8(&gb, buf, AV3A_MAX_NBYTES_HEADER);
sync_word = get_bits(&gb, 12); sync_word = get_bits(&gb, 12);
@ -78,7 +78,7 @@ static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf)
/* coding profile */ /* coding profile */
hdf->coding_profile = get_bits(&gb, 3); hdf->coding_profile = get_bits(&gb, 3);
/* sampling rate */ /* sampling rate */
hdf->sampling_frequency_index = get_bits(&gb, 4); hdf->sampling_frequency_index = get_bits(&gb, 4);
if ((hdf->sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (hdf->sampling_frequency_index < 0)) { if ((hdf->sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (hdf->sampling_frequency_index < 0)) {
@ -107,7 +107,7 @@ static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
hdf->bitrate_index_per_channel = get_bits(&gb, 4); hdf->bitrate_index_per_channel = get_bits(&gb, 4);
if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)){ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) {
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
hdf->nb_objects = hdf->object_channel_number + 1; hdf->nb_objects = hdf->object_channel_number + 1;
@ -126,7 +126,7 @@ static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf)
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->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;
@ -174,7 +174,7 @@ static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf)
} }
hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution; hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution;
hdf->sample_format = ff_av3a_sample_format_map_table[hdf->resolution_index].sample_format; hdf->sample_format = ff_av3a_sample_format_map_table[hdf->resolution_index].sample_format;
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)){
@ -202,7 +202,7 @@ static int av3a_get_packet_size(AVFormatContext *s)
int16_t bitrate_index, bitrate_index_per_channel; int16_t bitrate_index, bitrate_index_per_channel;
int16_t objects, hoa_order; int16_t objects, hoa_order;
int64_t total_bitrate; int64_t total_bitrate;
if (!s) { if (!s) {
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
@ -215,6 +215,7 @@ static int av3a_get_packet_size(AVFormatContext *s)
if (read_bytes != AV3A_MAX_NBYTES_HEADER) { if (read_bytes != AV3A_MAX_NBYTES_HEADER) {
return (read_bytes < 0) ? read_bytes : AVERROR_EOF; return (read_bytes < 0) ? read_bytes : AVERROR_EOF;
} }
init_get_bits8(&gb, header, AV3A_MAX_NBYTES_HEADER); init_get_bits8(&gb, header, AV3A_MAX_NBYTES_HEADER);
sync_word = get_bits(&gb, 12); sync_word = get_bits(&gb, 12);
@ -277,7 +278,7 @@ static int av3a_get_packet_size(AVFormatContext *s)
} }
objects += 1; objects += 1;
bitrate_index_per_channel = get_bits(&gb, 4); bitrate_index_per_channel = get_bits(&gb, 4);
if ((bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index_per_channel < 0)){ if ((bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index_per_channel < 0)) {
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@ -372,7 +373,7 @@ static int av3a_read_header(AVFormatContext *s)
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) {
return (ret < 0) ? ret : AVERROR_EOF; return (ret < 0) ? ret : AVERROR_EOF;
} }
ret = av3a_read_aatf_frame_header(&hdf, header); ret = av3a_read_aatf_frame_header(&hdf, header);
if (ret) { if (ret) {
return ret; return ret;
@ -425,7 +426,7 @@ static int av3a_read_packet(AVFormatContext *s, AVPacket *pkt) {
return AVERROR_EOF; return AVERROR_EOF;
} }
pos = avio_tell(s->pb); pos = avio_tell(s->pb);
if (!(packet_size = av3a_get_packet_size(s))) { if (!(packet_size = av3a_get_packet_size(s))) {
return AVERROR_EOF; return AVERROR_EOF;
} }
@ -437,7 +438,7 @@ static int av3a_read_packet(AVFormatContext *s, AVPacket *pkt) {
if ((ret = av_new_packet(pkt, packet_size)) < 0) { if ((ret = av_new_packet(pkt, packet_size)) < 0) {
return ret; return ret;
} }
if (!s->streams[0]) { if (!s->streams[0]) {
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }

View File

@ -7959,7 +7959,6 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
} }
st->codecpar->frame_size = AV3A_AUDIO_FRAME_SIZE; st->codecpar->frame_size = AV3A_AUDIO_FRAME_SIZE;
sampling_frequency_index = get_bits(&gb, 4); sampling_frequency_index = get_bits(&gb, 4);
if ((sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (sampling_frequency_index < 0)) { if ((sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (sampling_frequency_index < 0)) {
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
@ -8041,7 +8040,7 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
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];
} }
} }
for (i = nb_channels; i < st->codecpar->ch_layout.nb_channels; i++) { for (i = nb_channels; i < st->codecpar->ch_layout.nb_channels; i++) {
st->codecpar->ch_layout.u.map[i].id = AV3A_CH_AUDIO_OBJECT; st->codecpar->ch_layout.u.map[i].id = AV3A_CH_AUDIO_OBJECT;
} }

View File

@ -446,7 +446,7 @@ static int get_dvb_stream_type(AVFormatContext *s, AVStream *st)
stream_type = STREAM_TYPE_PRIVATE_DATA; stream_type = STREAM_TYPE_PRIVATE_DATA;
break; break;
} }
return stream_type; return stream_type;
} }