[FFmpeg-devel] [PATCH] lavf: JSON captions demuxer.
Stefano Sabatini
stefasab at gmail.com
Sat Jun 23 00:07:42 CEST 2012
On date Thursday 2012-06-21 19:19:55 +0200, Nicolas George encoded:
[...]
> +static const AVOption json_captions_options[] = {
> + { "start_time", "set the start time (offset) of the subtitles, in ms",
> + offsetof(struct json_captions_demuxer, start_time), FF_OPT_TYPE_INT64,
> + { .dbl = 15000 }, INT64_MIN, INT64_MAX,
> + AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM },
> + { NULL },
> +};
Would you mind adding a short section in demuxers.texi? (also a link
to specs would be nice, at least in the file doxy if not in the
documentation).
> +
> +static const AVClass json_captions_demuxer_class = {
> + .class_name = "json_captions_demuxer",
> + .item_name = av_default_item_name,
> + .option = json_captions_options,
> + .version = LIBAVUTIL_VERSION_INT,
> +};
> +
> +#define HEX_DIGIT_TEST(c) ( (unsigned)(c) - '0' <= 9 || \
> + ((unsigned)(c) | 32) - 'a' <= 5)
> +#define HEX_DIGIT_VAL(c) ((c) <= '9' ? (c) - '0' : ((c) | 32) - 'a' + 10)
> +#define ERR_CODE(c) (c < 0 ? c : AVERROR_INVALIDDATA)
> +
> +static void av_bprint_utf8(AVBPrint *bp, unsigned c)
> +{
> + int bytes, i;
> +
> + if (c <= 0x7F) {
> + av_bprint_chars(bp, c, 1);
> + return;
> + }
> + bytes = (av_log2(c) - 2) / 5;
> + av_bprint_chars(bp, (c >> (bytes * 6)) | ((0xFF80 >> bytes) & 0xFF), 1);
> + for (i = bytes - 1; i >= 0; i--)
> + av_bprint_chars(bp, ((c >> (i * 6)) & 0x3F) | 0x80, 1);
> +}
> +
> +static void next_byte(AVIOContext *pb, int *cur_byte)
Nit++: read_next_byte() or get_next_byte() could be more
explicative/less confusing at first reading.
--
FFmpeg = Faithless and Freak Mortal Picky Elitist God
More information about the ffmpeg-devel
mailing list