[FFmpeg-devel] [PATCH] avcodec: add HDMV Text Subtitle decoder

Paul B Mahol onemda at gmail.com
Wed Feb 1 14:20:20 EET 2017


On 2/1/17, wm4 <nfxjfg at googlemail.com> wrote:
> On Wed,  1 Feb 2017 12:12:51 +0100
> Paul B Mahol <onemda at gmail.com> wrote:
>
>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> ---
>>  libavcodec/Makefile    |   1 +
>>  libavcodec/allcodecs.c |   1 +
>>  libavcodec/textstdec.c | 409
>> +++++++++++++++++++++++++++++++++++++++++++++++++
>>  3 files changed, 411 insertions(+)
>>  create mode 100644 libavcodec/textstdec.c
>>

[...]

>> +
>> +static void decode_presentation_segment(AVCodecContext *avctx,
>> GetByteContext *gb, AVSubtitle *sub)
>> +{
>> +    TextSTContext *s = avctx->priv_data;
>> +    unsigned ii, palette_update_flag, region_count;
>> +    int64_t start_pts, end_pts;
>> +
>> +    start_pts = decode_pts(gb);
>> +    end_pts   = decode_pts(gb);
>> +
>> +    sub->pts = start_pts * 100 / 9;
>
> I don't think this will work. You should use packet timestamps, not get
> them from the packet contents. Otherwise we'd be back to the situation
> with other text subtitles, which used to embed timestamps in the packet
> data.
>

pts are stored in packet, they are not available from packet timestamp.

And this succesfully converts TextST to ass format.


More information about the ffmpeg-devel mailing list