[FFmpeg-devel] [PATCH 4/4] lavc: deprecate aac_adtstoasc BSF; remove warnings referencing it
Rodger Combs
rodger.combs at gmail.com
Tue Sep 22 03:49:44 CEST 2015
---
doc/bitstream_filters.texi | 11 -------
libavcodec/aac_adtstoasc_bsf.c | 74 ++----------------------------------------
libavformat/flvenc.c | 6 ----
libavformat/movenc.c | 6 ----
4 files changed, 2 insertions(+), 95 deletions(-)
diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index 563049e..db0eec8 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -24,17 +24,6 @@ ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1/opt2=str2][,filter2] OUTPUT
Below is a description of the currently available bitstream filters,
with their parameters, if any.
- at section aac_adtstoasc
-
-Convert MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration
-bitstream filter.
-
-This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4
-ADTS header and removes the ADTS header.
-
-This is required for example when copying an AAC stream from a raw
-ADTS AAC container to a FLV or a MOV/MP4 file.
-
@section chomp
Remove zero padding at the end of a packet.
diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c
index 9c117c6..17cf2fb 100644
--- a/libavcodec/aac_adtstoasc_bsf.c
+++ b/libavcodec/aac_adtstoasc_bsf.c
@@ -30,89 +30,19 @@ typedef struct AACBSFContext {
int first_frame_done;
} AACBSFContext;
-/**
- * This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4
- * ADTS header and removes the ADTS header.
- */
static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc,
AVCodecContext *avctx, const char *args,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size,
int keyframe)
{
- GetBitContext gb;
- PutBitContext pb;
- AACADTSHeaderInfo hdr;
-
- AACBSFContext *ctx = bsfc->priv_data;
-
- init_get_bits(&gb, buf, AAC_ADTS_HEADER_SIZE*8);
-
- *poutbuf = (uint8_t*) buf;
- *poutbuf_size = buf_size;
-
- if (avctx->extradata)
- if (show_bits(&gb, 12) != 0xfff)
- return 0;
-
- if (avpriv_aac_parse_header(&gb, &hdr) < 0) {
- av_log(avctx, AV_LOG_ERROR, "Error parsing ADTS frame header!\n");
- return AVERROR_INVALIDDATA;
- }
-
- if (!hdr.crc_absent && hdr.num_aac_frames > 1) {
- avpriv_report_missing_feature(avctx,
- "Multiple RDBs per frame with CRC");
- return AVERROR_PATCHWELCOME;
- }
-
- buf += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent;
- buf_size -= AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent;
-
if (!ctx->first_frame_done) {
- int pce_size = 0;
- uint8_t pce_data[MAX_PCE_SIZE];
- if (!hdr.chan_config) {
- init_get_bits(&gb, buf, buf_size * 8);
- if (get_bits(&gb, 3) != 5) {
- avpriv_report_missing_feature(avctx,
- "PCE-based channel configuration "
- "without PCE as first syntax "
- "element");
- return AVERROR_PATCHWELCOME;
- }
- init_put_bits(&pb, pce_data, MAX_PCE_SIZE);
- pce_size = avpriv_copy_pce_data(&pb, &gb)/8;
- flush_put_bits(&pb);
- buf_size -= get_bits_count(&gb)/8;
- buf += get_bits_count(&gb)/8;
- }
- av_free(avctx->extradata);
- avctx->extradata_size = 2 + pce_size;
- avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
- if (!avctx->extradata) {
- avctx->extradata_size = 0;
- return AVERROR(ENOMEM);
- }
-
- init_put_bits(&pb, avctx->extradata, avctx->extradata_size);
- put_bits(&pb, 5, hdr.object_type);
- put_bits(&pb, 4, hdr.sampling_index);
- put_bits(&pb, 4, hdr.chan_config);
- put_bits(&pb, 1, 0); //frame length - 1024 samples
- put_bits(&pb, 1, 0); //does not depend on core coder
- put_bits(&pb, 1, 0); //is not extension
- flush_put_bits(&pb);
- if (pce_size) {
- memcpy(avctx->extradata + 2, pce_data, pce_size);
- }
+ av_log(avctx, AV_LOG_WARNING, "The aac_adtstoasc bitstream filter is\n"
+ "no longer required.\n");
ctx->first_frame_done = 1;
}
- *poutbuf = (uint8_t*) buf;
- *poutbuf_size = buf_size;
-
return 0;
}
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index e217ba8..da8f5b9 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -568,12 +568,6 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
return ret;
} else if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
(AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
- if (!s->streams[pkt->stream_index]->nb_frames) {
- av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: "
- "use the audio bitstream filter 'aac_adtstoasc' to fix it "
- "('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
- return AVERROR_INVALIDDATA;
- }
av_log(s, AV_LOG_WARNING, "aac bitstream error\n");
}
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index af03d1e..1af4031 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4382,12 +4382,6 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
(AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
- if (!s->streams[pkt->stream_index]->nb_frames) {
- av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: "
- "use the audio bitstream filter 'aac_adtstoasc' to fix it "
- "('-bsf:a aac_adtstoasc' option with ffmpeg)\n");
- return -1;
- }
av_log(s, AV_LOG_WARNING, "aac bitstream error\n");
}
if (enc->codec_id == AV_CODEC_ID_H264 && trk->vos_len > 0 && *(uint8_t *)trk->vos_data != 1 && !TAG_IS_AVCI(trk->tag)) {
--
2.5.1
More information about the ffmpeg-devel
mailing list