1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-12 10:25:32 +02:00

Merge commit '13c90bc9a359e969cc2b7f7e8199b02a0e4c6ec9'

* commit '13c90bc9a359e969cc2b7f7e8199b02a0e4c6ec9':
  adts: Return more meaningful error codes

Conflicts:
	libavformat/adtsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-08-21 21:56:33 +02:00
commit fca76dc61e

View File

@ -63,23 +63,23 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t
if (adts->objecttype > 3U) {
av_log(s, AV_LOG_ERROR, "MPEG-4 AOT %d is not allowed in ADTS\n", adts->objecttype+1);
return -1;
return AVERROR_INVALIDDATA;
}
if (adts->sample_rate_index == 15) {
av_log(s, AV_LOG_ERROR, "Escape sample rate index illegal in ADTS\n");
return -1;
return AVERROR_INVALIDDATA;
}
if (get_bits(&gb, 1)) {
av_log(s, AV_LOG_ERROR, "960/120 MDCT window is not allowed in ADTS\n");
return -1;
return AVERROR_INVALIDDATA;
}
if (get_bits(&gb, 1)) {
av_log(s, AV_LOG_ERROR, "Scalable configurations are not allowed in ADTS\n");
return -1;
return AVERROR_INVALIDDATA;
}
if (get_bits(&gb, 1)) {
av_log(s, AV_LOG_ERROR, "Extension flag is not allowed in ADTS\n");
return -1;
return AVERROR_INVALIDDATA;
}
if (!adts->channel_conf) {
init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE);
@ -101,9 +101,9 @@ static int adts_write_header(AVFormatContext *s)
if (adts->id3v2tag)
ff_id3v2_write_simple(s, 4, ID3v2_DEFAULT_MAGIC);
if (avc->extradata_size > 0 &&
adts_decode_extradata(s, adts, avc->extradata, avc->extradata_size) < 0)
return -1;
if (avc->extradata_size > 0)
return adts_decode_extradata(s, adts, avc->extradata,
avc->extradata_size);
return 0;
}