]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/ilbc.c
avfilter/vf_identity: fix typo
[ffmpeg] / libavformat / ilbc.c
index 50e3c3cc769d56b5bbb82e06da47087f9fb12b80..efa5339089e6860a2d220efa2ace48aa6929171a 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "avformat.h"
 #include "internal.h"
+#include "rawenc.h"
 
 static const char mode20_header[] = "#!iLBC20\n";
 static const char mode30_header[] = "#!iLBC30\n";
@@ -49,17 +50,10 @@ static int ilbc_write_header(AVFormatContext *s)
         av_log(s, AV_LOG_ERROR, "Unsupported mode\n");
         return AVERROR(EINVAL);
     }
-    avio_flush(pb);
     return 0;
 }
 
-static int ilbc_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    avio_write(s->pb, pkt->data, pkt->size);
-    return 0;
-}
-
-static int ilbc_probe(AVProbeData *p)
+static int ilbc_probe(const AVProbeData *p)
 {
     // Only check for "#!iLBC" which matches both formats
     if (!memcmp(p->buf, mode20_header, 6))
@@ -112,14 +106,13 @@ static int ilbc_read_packet(AVFormatContext *s,
     pkt->pos = avio_tell(s->pb);
     pkt->duration = par->block_align == 38 ? 160 : 240;
     if ((ret = avio_read(s->pb, pkt->data, par->block_align)) != par->block_align) {
-        av_packet_unref(pkt);
         return ret < 0 ? ret : AVERROR(EIO);
     }
 
     return 0;
 }
 
-AVInputFormat ff_ilbc_demuxer = {
+const AVInputFormat ff_ilbc_demuxer = {
     .name         = "ilbc",
     .long_name    = NULL_IF_CONFIG_SMALL("iLBC storage"),
     .read_probe   = ilbc_probe,
@@ -128,13 +121,15 @@ AVInputFormat ff_ilbc_demuxer = {
     .flags        = AVFMT_GENERIC_INDEX,
 };
 
-AVOutputFormat ff_ilbc_muxer = {
+#if CONFIG_ILBC_MUXER
+const AVOutputFormat ff_ilbc_muxer = {
     .name         = "ilbc",
     .long_name    = NULL_IF_CONFIG_SMALL("iLBC storage"),
     .mime_type    = "audio/iLBC",
     .extensions   = "lbc",
     .audio_codec  = AV_CODEC_ID_ILBC,
     .write_header = ilbc_write_header,
-    .write_packet = ilbc_write_packet,
+    .write_packet = ff_raw_write_packet,
     .flags        = AVFMT_NOTIMESTAMPS,
 };
+#endif