X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Filbc.c;h=188c0f091a73ffcd5836a5768eecbc1943e31a81;hb=ea2d9b7a2e02861ea680f91404414955f55a294c;hp=50e3c3cc769d56b5bbb82e06da47087f9fb12b80;hpb=a12063b118ad05409ff775ba30fab00265ad3031;p=ffmpeg diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c index 50e3c3cc769..188c0f091a7 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,7 +106,6 @@ 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); } @@ -128,6 +121,7 @@ AVInputFormat ff_ilbc_demuxer = { .flags = AVFMT_GENERIC_INDEX, }; +#if CONFIG_ILBC_MUXER AVOutputFormat ff_ilbc_muxer = { .name = "ilbc", .long_name = NULL_IF_CONFIG_SMALL("iLBC storage"), @@ -135,6 +129,7 @@ AVOutputFormat ff_ilbc_muxer = { .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