[FFmpeg-devel] [PATCH] Decoding of raw UTF-8 text from Ogg streams

ogg.k.ogg.k at googlemail.com ogg.k.ogg.k
Mon Jul 13 10:42:57 CEST 2009


>> @@ -450,7 +457,7 @@ ogg_get_length (AVFormatContext * s)
>>      size = url_fsize(s->pb);
>>      if(size < 0)
>>          return 0;
>> -    end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0;
>> +    end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: size;
>>
>>      ogg_save (s);
>>      url_fseek (s->pb, end, SEEK_SET);
>
> This breaks finding the duration of ogg files smaller than
> MAX_PAGE_SIZE, why is it needed?

Don't recall this. Looking at the git log, it looks like it's a rebase losing
commit 4eb3f7b3680dd9cb39a695b6903c1674d3675875. I did not notice
this, sorry.

>>      ogg = s->priv_data;
>>      os = ogg->streams + idx;
>>
>> +    if (psize == 0)
>> +        return 0;
>> +
>
> Kate can have size 0 packets?

It cannot, all packets have at least a type byte.
However, some packets may have no text payload (eg, only
graphical contents). These are thus skipped. If skipping zero
sized content is a problem, I can rework this ?

> If Kate allows for formatting above raw UTF-8, I think that the idea
> of ffmpeg's subtitle system is to pass the raw data, and have a
> decoder convert it to plain utf-8 or ass, with the renderer being a
> third separate thing. But I'm not sure since I don't think that's
> really implemented.

I understand that. The reasons I did not do this are:
- I needed to extract the raw text first to help someone do conversion
of raw text
  as a quick fix - more complex data isn't needed there (yet ?).
- The 'raw' data is binary, and in a quite specific encoding, which
would not be of
   use without a decoder.
- I thought this patch might not be accepted, in which case doing all
that decoder
  work upfront would have been wasted, so first things first.
- A decoder would need this patch written first pretty much as is, so
it's not wasted
  if I get to write a decoder next.
- The easiest way to add a decoder and renderer is to use external
libs, and ffmpeg
  seems to prefer not to use external libs where possible.

Cheers



More information about the ffmpeg-devel mailing list