[FFmpeg-devel] [PATCH 1/4] srtdec: Add timing-less "subrip" decoder.
Clément Bœsch
ubitux at gmail.com
Mon Aug 13 07:43:30 CEST 2012
On Sun, Aug 12, 2012 at 02:26:26PM -0700, Philip Langdale wrote:
> After various discussions, we concluded that, amongst other things,
> it made sense to have a separate subrip decoder that did not use
> in-band timing information, and rather relied on the ffmpeg level
> timing.
>
> As this is 90% the same as the existing srt decoder, it's implemented
> in the same file.
>
> Signed-off-by: Philip Langdale <philipl at overt.org>
> ---
> libavcodec/Makefile | 1 +
> libavcodec/allcodecs.c | 1 +
> libavcodec/avcodec.h | 1 +
> libavcodec/srtdec.c | 31 +++++++++++++++++++++++++++----
> libavcodec/version.h | 2 +-
> 5 files changed, 31 insertions(+), 5 deletions(-)
>
[...]
>
> while (ptr < end && *ptr) {
> - ptr = read_ts(ptr, &ts_start, &ts_end, &x1, &y1, &x2, &y2);
> - if (!ptr)
> - break;
> + if (avctx->codec->id == CODEC_ID_SRT) {
> + ptr = read_ts(ptr, &ts_start, &ts_end, &x1, &y1, &x2, &y2);
> + if (!ptr)
> + break;
> + } else {
> + // Do final divide-by-10 outside rescale to force rounding down.
If the subtitles time_base happens to be different than 1/1000 this
comment is not true.
> + ts_start = av_rescale_q(avpkt->pts,
> + avctx->time_base,
> + (AVRational){1,100});
> + ts_end = av_rescale_q(avpkt->pts + avpkt->duration,
> + avctx->time_base,
> + (AVRational){1,100});
> + }
[...]
The patch still LGTM.
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120813/4168e844/attachment.asc>
More information about the ffmpeg-devel
mailing list