编程规范修订

Signed-off-by: liushuai <cqliushuai@outlook.com>
This commit is contained in:
liushuai 2024-11-06 21:49:31 +08:00
parent a8372d8c94
commit 5413bfa369
5 changed files with 35 additions and 20 deletions

View File

@ -207,6 +207,10 @@ static int av3a_get_packet_size(AVFormatContext *s)
return AVERROR(ENOMEM);
}
if (!s->pb) {
return AVERROR(ENOMEM);
}
read_bytes = avio_read(s->pb, header, AV3A_MAX_NBYTES_HEADER);
if (read_bytes != AV3A_MAX_NBYTES_HEADER) {
return (read_bytes < 0) ? read_bytes : AVERROR_EOF;
@ -413,7 +417,7 @@ static int av3a_read_packet(AVFormatContext *s, AVPacket *pkt) {
int read_bytes = 0;
int ret = 0;
if (!s->streams[0]->codecpar) {
if (!s) {
return AVERROR(ENOMEM);
}
@ -434,6 +438,14 @@ static int av3a_read_packet(AVFormatContext *s, AVPacket *pkt) {
return ret;
}
if (!s->streams[0]) {
return AVERROR(ENOMEM);
}
if (!s->streams[0]->codecpar) {
return AVERROR(ENOMEM);
}
pkt->stream_index = 0;
pkt->pos = pos;
pkt->duration = s->streams[0]->codecpar->frame_size;

View File

@ -7988,6 +7988,9 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
number_objects = get_bits(&gb, 7);
reserved = get_bits(&gb, 1);
nb_objects = number_objects;
if (nb_objects < 1) {
return AVERROR_INVALIDDATA;
}
} else if (content_type == AV3A_CHANNEL_OBJECT_TYPE) {
channel_number_index = get_bits(&gb, 7);
reserved = get_bits(&gb, 1);
@ -8001,6 +8004,9 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
reserved = get_bits(&gb, 1);
nb_channels = ff_av3a_channels_map_table[channel_number_index].channels;
nb_objects = number_objects;
if (nb_objects < 1) {
return AVERROR_INVALIDDATA;
}
} else if (content_type == AV3A_AMBISONIC_TYPE) {
hoa_order = get_bits(&gb , 4);
if ((hoa_order < AV3A_AMBISONIC_FIRST_ORDER) || (hoa_order > AV3A_AMBISONIC_THIRD_ORDER)) {
@ -8025,8 +8031,7 @@ static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (content_type != AV3A_AMBISONIC_TYPE) {
st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_CUSTOM;
st->codecpar->ch_layout.nb_channels = (nb_channels + nb_objects);
st->codecpar->ch_layout.u.map = av_calloc(st->codecpar->ch_layout.nb_channels,
sizeof(*st->codecpar->ch_layout.u.map));
st->codecpar->ch_layout.u.map = av_calloc(st->codecpar->ch_layout.nb_channels, sizeof(AVChannelCustom));
if (!st->codecpar->ch_layout.u.map) {
return AVERROR(ENOMEM);
}

View File

@ -934,7 +934,6 @@ static int mov_write_dca3_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
}
put_bits(&pb_dca3, 4, audio_codec_id);
put_bits(&pb_dca3, 4, sampling_frequency_index);
put_bits(&pb_dca3, 3, nn_type);
put_bits(&pb_dca3, 1, 0); /* reserved */
put_bits(&pb_dca3, 4, content_type);
@ -8360,7 +8359,7 @@ static const AVCodecTag codec_mp4_tags[] = {
#ifdef OHOS_TIMED_META_TRACK
{ AV_CODEC_ID_FFMETADATA, MKTAG('c', 'd', 's', 'c') },
#endif
#ifdef OHOS_AV3A_DEMUXER
#ifdef
{ AV_CODEC_ID_AVS3DA, MKTAG('a', 'v', '3', 'a') },
#endif
{ AV_CODEC_ID_NONE, 0 },

View File

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