[FFmpeg-devel] Patch for chained OGG files
David Conrad
lessen42
Tue Apr 13 00:05:08 CEST 2010
On Apr 3, 2010, at 12:37 PM, M?ns Rullg?rd wrote:
> Cyril Zorin <cyril.zorin at gmail.com> writes:
>
>> Hi!
>>
>> 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, so only really working for this case seems OK to me.
More information about the ffmpeg-devel
mailing list