]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/adtsenc.c
fate/mp3: use the f32le format as output
[ffmpeg] / libavformat / adtsenc.c
index e08eef5e5c8cdd64fa2c3bc0ef3935e27c25098c..55d7510557fca7bb08ffc29c210e3c2325db38a2 100644 (file)
@@ -28,7 +28,7 @@
 
 #define ADTS_HEADER_SIZE 7
 
-typedef struct {
+typedef struct ADTSContext {
     int write_adts;
     int objecttype;
     int sample_rate_index;
@@ -57,23 +57,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);
@@ -93,9 +93,9 @@ static int adts_write_header(AVFormatContext *s)
     ADTSContext *adts = s->priv_data;
     AVCodecContext *avc = s->streams[0]->codec;
 
-    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;
 }
@@ -158,7 +158,6 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
         }
     }
     avio_write(pb, pkt->data, pkt->size);
-    avio_flush(pb);
 
     return 0;
 }
@@ -169,8 +168,9 @@ AVOutputFormat ff_adts_muxer = {
     .mime_type         = "audio/aac",
     .extensions        = "aac,adts",
     .priv_data_size    = sizeof(ADTSContext),
-    .audio_codec       = CODEC_ID_AAC,
-    .video_codec       = CODEC_ID_NONE,
+    .audio_codec       = AV_CODEC_ID_AAC,
+    .video_codec       = AV_CODEC_ID_NONE,
     .write_header      = adts_write_header,
     .write_packet      = adts_write_packet,
+    .flags             = AVFMT_NOTIMESTAMPS,
 };