[FFmpeg-devel] [PATCH] lavc: add detection of forced subtitles

Hendrik Leppkes h.leppkes at gmail.com
Mon Sep 19 23:58:12 EEST 2022


On Mon, Sep 19, 2022 at 10:53 PM Andreas Rheinhardt
<andreas.rheinhardt at outlook.com> wrote:
>
> Scott Theisen:
> > This is from the following MythTV commits:
> > libavcodec: add support for detecting forced subtitle segments. https://github.com/MythTV/mythtv/commit/5099f1a5777966fba482b623e581c1eef5c8fc09
> > This adds forced subtitle segment detection to the PGS subtitle decoder and
> > copies the result to AVSubtitle.
> >
> > Subtitles: Flag forced DVD subtitles. https://github.com/MythTV/mythtv/commit/78f71eecdbd53ba92af2ad639b32564c01f24563
> > ---
> >  libavcodec/avcodec.h   | 1 +
> >  libavcodec/dvdsubdec.c | 4 +++-
> >  libavcodec/pgssubdec.c | 4 ++++
> >  3 files changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 7db5d1b1c5..b9aa9efb2f 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -2331,6 +2331,7 @@ typedef struct AVSubtitle {
> >      unsigned num_rects;
> >      AVSubtitleRect **rects;
> >      int64_t pts;    ///< Same as packet pts, in AV_TIME_BASE
> > +    int forced;
>
> sizeof(AVSubtitle) is part of the public ABI, no additions to it are
> possible. I wanted to suggest using AVSubtitleRect.flags, but apparently
> AV_SUBTITLE_FLAG_FORCED already exists. And it seems that both the
> dvdsub as well as the pgssub decoders already set this.
>

Which is also more correct, since in PGS for example you can have both
active rects that are forced, and those that are not, at the same
time.

- Hendrik


More information about the ffmpeg-devel mailing list