You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
Merge commit '45ee556d51ef04d79d52bf6b0b7f28a4d231cb0c'
* commit '45ee556d51ef04d79d52bf6b0b7f28a4d231cb0c': qdm2: Whitespace cosmetics flac: use meaningful return values Conflicts: libavcodec/flacdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -55,7 +55,7 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
|
|||||||
/* frame sync code */
|
/* frame sync code */
|
||||||
if ((get_bits(gb, 15) & 0x7FFF) != 0x7FFC) {
|
if ((get_bits(gb, 15) & 0x7FFF) != 0x7FFC) {
|
||||||
av_log(avctx, AV_LOG_ERROR + log_level_offset, "invalid sync code\n");
|
av_log(avctx, AV_LOG_ERROR + log_level_offset, "invalid sync code\n");
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* variable block size stream code */
|
/* variable block size stream code */
|
||||||
@@ -76,7 +76,7 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
|
|||||||
} else {
|
} else {
|
||||||
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
||||||
"invalid channel mode: %d\n", fi->ch_mode);
|
"invalid channel mode: %d\n", fi->ch_mode);
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bits per sample */
|
/* bits per sample */
|
||||||
@@ -85,7 +85,7 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
|
|||||||
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
||||||
"invalid sample size code (%d)\n",
|
"invalid sample size code (%d)\n",
|
||||||
bps_code);
|
bps_code);
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
fi->bps = sample_size_table[bps_code];
|
fi->bps = sample_size_table[bps_code];
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
|
|||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
||||||
"broken stream, invalid padding\n");
|
"broken stream, invalid padding\n");
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sample or frame count */
|
/* sample or frame count */
|
||||||
@@ -101,14 +101,14 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
|
|||||||
if (fi->frame_or_sample_num < 0) {
|
if (fi->frame_or_sample_num < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
||||||
"sample/frame number invalid; utf8 fscked\n");
|
"sample/frame number invalid; utf8 fscked\n");
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* blocksize */
|
/* blocksize */
|
||||||
if (bs_code == 0) {
|
if (bs_code == 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
||||||
"reserved blocksize code: 0\n");
|
"reserved blocksize code: 0\n");
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
} else if (bs_code == 6) {
|
} else if (bs_code == 6) {
|
||||||
fi->blocksize = get_bits(gb, 8) + 1;
|
fi->blocksize = get_bits(gb, 8) + 1;
|
||||||
} else if (bs_code == 7) {
|
} else if (bs_code == 7) {
|
||||||
@@ -130,7 +130,7 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
|
|||||||
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
||||||
"illegal sample rate code %d\n",
|
"illegal sample rate code %d\n",
|
||||||
sr_code);
|
sr_code);
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* header CRC-8 check */
|
/* header CRC-8 check */
|
||||||
@@ -139,7 +139,7 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
|
|||||||
get_bits_count(gb)/8)) {
|
get_bits_count(gb)/8)) {
|
||||||
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
av_log(avctx, AV_LOG_ERROR + log_level_offset,
|
||||||
"header crc mismatch\n");
|
"header crc mismatch\n");
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -409,9 +409,9 @@ static int decode_frame(FLACContext *s)
|
|||||||
GetBitContext *gb = &s->gb;
|
GetBitContext *gb = &s->gb;
|
||||||
FLACFrameInfo fi;
|
FLACFrameInfo fi;
|
||||||
|
|
||||||
if (ff_flac_decode_frame_header(s->avctx, gb, &fi, 0)) {
|
if ((ret = ff_flac_decode_frame_header(s->avctx, gb, &fi, 0)) < 0) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "invalid frame header\n");
|
av_log(s->avctx, AV_LOG_ERROR, "invalid frame header\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->channels && fi.channels != s->channels && s->got_streaminfo) {
|
if (s->channels && fi.channels != s->channels && s->got_streaminfo) {
|
||||||
@@ -435,7 +435,7 @@ static int decode_frame(FLACContext *s)
|
|||||||
} else if (s->bps && fi.bps != s->bps) {
|
} else if (s->bps && fi.bps != s->bps) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "switching bps mid-stream is not "
|
av_log(s->avctx, AV_LOG_ERROR, "switching bps mid-stream is not "
|
||||||
"supported\n");
|
"supported\n");
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->bps) {
|
if (!s->bps) {
|
||||||
@@ -523,9 +523,9 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
|
|
||||||
/* check for inline header */
|
/* check for inline header */
|
||||||
if (AV_RB32(buf) == MKBETAG('f','L','a','C')) {
|
if (AV_RB32(buf) == MKBETAG('f','L','a','C')) {
|
||||||
if (!s->got_streaminfo && parse_streaminfo(s, buf, buf_size)) {
|
if (!s->got_streaminfo && (ret = parse_streaminfo(s, buf, buf_size))) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "invalid header\n");
|
av_log(s->avctx, AV_LOG_ERROR, "invalid header\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return ret;
|
||||||
}
|
}
|
||||||
return get_metadata_size(buf, buf_size);
|
return get_metadata_size(buf, buf_size);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user