On Tue, Sep 02, 2014 at 08:56:09PM +0200, wm4 wrote:
> Use the UTF-16 BOM to detect UTF-16 encoding. Convert the file contents
> to UTF-8 on the fly using FFTextReader, which acts as converting wrapper
> around AVIOContext. It also can work on a static buffer, needed for
> format probing. The FFTextReader wrapper now also takes care of skipping
> the UTF-8 BOM.
> ---
> libavformat/assdec.c | 19 +++++++++------
> libavformat/subtitles.c | 63
> +++++++++++++++++++++++++++++++++++++++++++++++++
> libavformat/subtitles.h | 51 +++++++++++++++++++++++++++++++++++++++
> 3 files changed, 126 insertions(+), 7 deletions(-)
>
[...]
> +void ff_text_init_avio(FFTextReader *r, AVIOContext *pb)
> +{
> + int i;
> + r->pb = pb;
> + r->buf_pos = r->buf_len = 0;
> + r->type = 0;
> + for (i = 0; i < 2; i++)
> + r->buf[r->buf_len++] = avio_r8(r->pb);
> + if (strncmp("\xFF\xFE", r->buf, 2) == 0) {> + r->type = 1; // UTF16LE Would you mind using an enum for type? You won't need these comments anymore, and the rest of the code will be easier to read. [...] Apart from that, patch looks really good to me. I'll review the rest of the patchset in a moment. -- Clément B.
pgpMsxPlCkd3f.pgp
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
