[FFmpeg-devel] Patch for chained OGG files
Tue Apr 13 00:14:50 CEST 2010
David Conrad <lessen42 at gmail.com> writes:
> On Apr 3, 2010, at 12:37 PM, M?ns Rullg?rd wrote:
>> Cyril Zorin <cyril.zorin at gmail.com> writes:
>>> Attached is a patch that lets ffmpeg handle chained OGG files, often used in
>>> internet radio streams. Let me know if there's anything to change.
>>> +static int
>>> +ogg_read_packet (AVFormatContext * s, AVPacket * pkt)
>>> + const int result = ogg_read_packet_internal(s, pkt);
>>> + if (result >= 0)
>>> + return result;
>>> + ogg_read_close(s);
>>> + memset(s->priv_data, 0, sizeof(struct ogg));
>>> + if (ogg_read_header(s, 0) < 0)
>>> + return AVERROR(EIO);
>>> + return ogg_read_packet_internal(s, pkt);
>> This won't work if the parameters of the new set of streams don't
>> exactly match the old. Libavformat simply doesn't support randomly
>> changing streams halfway through a file.
> I'd imagine that the most common (only?) usage of chained ogg is to
> update metadata mid-stream for streaming radio,
That's probably true, but the spec allows _anything_.
> so only really working for this case seems OK to me.
We should at least make sure it fails gracefully in other cases.
mans at mansr.com
More information about the ffmpeg-devel