X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Filbc.c;h=efa5339089e6860a2d220efa2ace48aa6929171a;hb=bc70684e74a185d7b80c8b80bdedda659cb581b8;hp=50e3c3cc769d56b5bbb82e06da47087f9fb12b80;hpb=5c1aafff2d844b177b0b20db4a38d8460992558b;p=ffmpeg diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c index 50e3c3cc769..efa5339089e 100644 --- a/libavformat/ilbc.c +++ b/libavformat/ilbc.c @@ -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