[FFmpeg-devel] [PATCH]Implement Bluray subtitle forcing

Paul B Mahol onemda at gmail.com
Sun Jan 29 19:31:34 CET 2012


On 1/29/12, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> On Sunday 29 January 2012 05:46:13 pm Reimar Doeffinger wrote:
>> On Sun, Jan 29, 2012 at 04:42:04PM +0000, Carl Eugen Hoyos wrote:
>> > Reimar Doeffinger <Reimar.Doeffinger <at> gmx.de> writes:
>> > > > +        if (!ctx->forced_subs_only ||
>> > > > ctx->presentation.objects[rect].composition & 0x40)
>> > > >          memcpy(sub->rects[rect]->pict.data[1], ctx->clut,
>> > > > sub->rects[rect]->nb_colors * sizeof(uint32_t));
>> > >
>> > > Well, I'd be in favour of having some flags in sub->rects, but
>> > > I think that would mean an API/ABI change...
>> >
>> > So may I commit?
>>
>> I don't know if the patch is correct otherwise, I don't use
>> the option code usually.
>> I don't really see why you need the AVCodecContext in the struct
>> for example.
>
> I thought it is needed, but it seems I was wrong.
>
> New patch attached.
>
> Please comment, Carl Eugen
>
> diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
> index 2785d25..e9c1b0e 100644
> --- a/libavcodec/pgssubdec.c
> +++ b/libavcodec/pgssubdec.c
> @@ -503,6 +505,20 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
>      return buf_size;
>  }
>
> +#define OFFSET(x) offsetof(PGSSubContext, x)
> +#define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
> +static const AVOption options[] = {
> +    {"forced_subs_only", "Only show forced subtitles", OFFSET(forced_subs_only), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, SD},
> +    { NULL },
> +};
> +
> +static const AVClass pgsdec_class = {
> +    .class_name = "PGS subtitle decdoder",

nit: typo.
> +    .item_name  = av_default_item_name,
> +    .option     = options,
> +    .version    = LIBAVUTIL_VERSION_INT,
> +};
> +
>  AVCodec ff_pgssub_decoder = {
>      .name           = "pgssub",
>      .type           = AVMEDIA_TYPE_SUBTITLE,


More information about the ffmpeg-devel mailing list