]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/ilbc.c
thp: set duration for audio stream too
[ffmpeg] / libavformat / ilbc.c
index b6be5abfbb8b6bea95103650d4d6e79a6d25d831..5ed8899a9e0590f88e07131f55305d3ab6138cde 100644 (file)
@@ -36,7 +36,7 @@ static int ilbc_write_header(AVFormatContext *s)
     }
     enc = s->streams[0]->codec;
 
-    if (enc->codec_id != CODEC_ID_ILBC) {
+    if (enc->codec_id != AV_CODEC_ID_ILBC) {
         av_log(s, AV_LOG_ERROR, "Unsupported codec\n");
         return AVERROR(EINVAL);
     }
@@ -56,7 +56,6 @@ static int ilbc_write_header(AVFormatContext *s)
 static int ilbc_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     avio_write(s->pb, pkt->data, pkt->size);
-    avio_flush(s->pb);
     return 0;
 }
 
@@ -80,7 +79,7 @@ static int ilbc_read_header(AVFormatContext *s)
     st = avformat_new_stream(s, NULL);
     if (!st)
         return AVERROR(ENOMEM);
-    st->codec->codec_id = CODEC_ID_ILBC;
+    st->codec->codec_id = AV_CODEC_ID_ILBC;
     st->codec->sample_rate = 8000;
     st->codec->channels = 1;
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -113,7 +112,7 @@ static int ilbc_read_packet(AVFormatContext *s,
     pkt->pos = avio_tell(s->pb);
     pkt->duration = enc->block_align == 38 ? 160 : 240;
     if ((ret = avio_read(s->pb, pkt->data, enc->block_align)) != enc->block_align) {
-        av_free_packet(pkt);
+        av_packet_unref(pkt);
         return ret < 0 ? ret : AVERROR(EIO);
     }
 
@@ -134,7 +133,7 @@ AVOutputFormat ff_ilbc_muxer = {
     .long_name    = NULL_IF_CONFIG_SMALL("iLBC storage"),
     .mime_type    = "audio/iLBC",
     .extensions   = "lbc",
-    .audio_codec  = CODEC_ID_ILBC,
+    .audio_codec  = AV_CODEC_ID_ILBC,
     .write_header = ilbc_write_header,
     .write_packet = ilbc_write_packet,
     .flags        = AVFMT_NOTIMESTAMPS,