From patchwork Sun Feb 11 18:09:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marth64 X-Patchwork-Id: 46187 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9002:b0:19e:cdac:8cce with SMTP id d2csp294315pzc; Sun, 11 Feb 2024 10:09:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU0rHvEtfhMh1WXqtUNKOGDViCqzVstvf24HoQTndO+bSCHEPABqsIJUlkptase9lW/WeFxCZJ4V9MSKYbrEKw/+xrqeP3LlbkH1g== X-Google-Smtp-Source: AGHT+IE6tSuPkrZWpbdKq4Qf23kOKvLU9TA3sE6KMTVErmt5JsGsno8+/Pq+0y2U8cP/xdcOhVga X-Received: by 2002:a05:651c:210a:b0:2d0:f3a4:472 with SMTP id a10-20020a05651c210a00b002d0f3a40472mr1531676ljq.48.1707674996324; Sun, 11 Feb 2024 10:09:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707674996; cv=none; d=google.com; s=arc-20160816; b=RJQVY+r+vHfcmivbh+A5UbECnjtPF88qewfQg/ozcQHgXr/TNvJaiwU1sWSpdBkpIH ftx2GORdxDLwl9so0JdBVqT/77XK8eLs3NCKS+vXnG+XVC55gqFvT+Y6sFc9OUFrpf2G OOvTC5SoMF4Ob8BW/1Gv3nii/l27epqWyF/73YUxkBhTS9tcyTgXlH9X3w0SrAt7P305 GffxgSD1nBSttdhpdnEeWcFp1ojw3soslLKroL+d/TPRGaKH8KCSRE7uA4REDKg/2zsI cVLoAkC0NKRWlcwFFTMnolxmzPN6BmJaf11BgjAoW9S1ku1DMoM/dG9A/caaj3XwfEVf Zazg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=YR4IcwCRION0SaBvChR7Rx1w2g44AgNFKhtlliRRpXY=; fh=R+gS/Wi9n7AEeptXQZ3htr1Su+w/gZQB0mrJIUk1uvY=; b=KMYdJkVzDxCrOJfIPft/At7sHioxH6SpDZhPWMWpoHVNOZgH93Fce2/3BTl5bXHOgZ jKXApC874z/1B3JLNun/WxrIhU6rhQbVBlAjriqy1QqNU9JadJ9Bw+PweWEHIYrKT7Zj MShtCPbj2+Wae4QG6l3r4y2EA4zVb26GyyIj/qI+p1lHa9xNt8geMSBXm5XhBhPsNmju bmGQjok8JMXHra4lP1VWST9gp1y/oEHpg3HQH8E/rqZL6O/k9S6PrbC3oZ1t/ec3nYa/ iOYMdr7ErsvHT3PbujEGIfbPTggx8RZ4LBMTjcoxXpzQUE/Y3qBE95FZibKGau6dx4b3 /OvQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b=b1NaDXph; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org X-Forwarded-Encrypted: i=1; AJvYcCV9Ba8gptqRmxscwgK/jpU0A+kTRgiYmvtfJg7X1FF+o6L8beGya7woOkNxs8Bhrvb5C1vYXzsiGlRU3w3YdbOPuIu8pcoflblwPDRfciU1gpe4IQdxIGGzKmjSfrGX3eaLiw/0dFYTecM5sR1ZyYeZgXgS0yC9sa08lhzsrRKCLUhO7RjKFiKKO1446updWkHQa2+BdI0jjw1tgA8r5k2Y8my6mUj0DDorzcNFVrNGt+4sYBlzebSOvhcb/SQ+NAXyUVfM938q2ZZyvSkq87JLNv3T2NxlKm9YQQfIvlErmgYb/41z8eZq8QfQy/l4jSXJfhfuC150XOQfRqmwrufjZVtfltJTNxSuTHQ9KR76uotEJuR0GmDu5Psx0rJbvo1+1CM1FxaH+kEcMGtUBqTX2mHmaJ5TX92ncA1h+91mzTlm/G8OnGC6aD9ZkV//cTeqpBhdlI7PAx7P61mN3u9aW+tn8QWi+zkDCUeU/2mQ2kNaSY0Hgcod2PI/+vVQjs8Np1rcTKStdx1j1icWt+H3r9Uh5vJ1uzDyKANYVegacHTI7QmElNuqUoWR46E+SRxwwAlmwDAXZZFXhTLfNQJN2i8955il4ojmCOfdqViQ+WYlRedPqUfx7dtptxlAx3jT/5iK3cTZCBYvioo8r56RrChNRVs7Y/vZGudSt17zsFWoTrvDLYhGu+mCAKKroDvWC77CF+b/YhqBuceTPy5Lfs7CNXDdWnElBgV7+msH8VWuGUq07tiCd6GjAEwqOjb8KhI9t3KfL3Mp4VsbKDEAskL8xLVtZbepUy5itwHhkukH09topN2vsFqzi675R4BLjmHbk4KUGfmM9XS1T4JTMvi87Cf/7m5ucSyUy0SlctWZZZbvWyNX5qEIcvf2kAh57OSosuxMM0xNr9VQ3WAkvz0y+TtLAKB+sV9IFW7CeUcIIBMdspVKuk6KLS1dc1ElGy 1JRlH6Uk8XbsTjpN6vK5j+0Atk8p5BMIWcp5fxRx4wiA5hkRiky6/veYjh7LaiC5r1QJmdNMyjLrFphN+VOg14QzXPZCbzj54FlSp5rQ/wYrYJ/a1P7/1GDBuZjWgMXYKSFfRNR6wWfhRdAf3z+r5VADpkifeu5/O3/foUSMgtuDP5ifT/vpCFC2ykFE1xrfspIyMG4TqR8LWWOMsQtYlKakufbJLHIctCogEO8nEkHh1LZ7BruNysqYGuOih5+UV2gTr5vhhvwczVSV7WsFfUH5UpzxsQk9bKlFng3BCvL7k8Eqn53N3MmwPnQOsvuI8cIVP+1EJt33Jc2JT8lFRfupyxTO73Nty4mdHmxqqOGi17DoFny5tm3cVhi8Lo19yiyXZFr7yT+5IRRZyOhzEQkvPTBN2wIDDNyGz5ddxsOOaF5JESHoQih+6oe4+ppdzSUqOlT70xHHchxTERyCwwjEk/RYOzc36YWPcZ1mLTWwTCqdAqPl6S1ur4ilc269ifcIK9FvuPKHnLG0u5LMzPyv8AWtTkQz0sAZRxCFbsY9ToNCl934ywiMJS6ZdXzZe8sz3BxuAW3O89B9BlAJe0Fo2YtlWJEQoLcA== Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id da16-20020a056402177000b00560852e9e18si1991131edb.534.2024.02.11.10.09.55; Sun, 11 Feb 2024 10:09:56 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@proxyid.net header.s=google header.b=b1NaDXph; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 605DD68D0BA; Sun, 11 Feb 2024 20:09:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f225.google.com (mail-pg1-f225.google.com [209.85.215.225]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9A12468D08A for ; Sun, 11 Feb 2024 20:09:35 +0200 (EET) Received: by mail-pg1-f225.google.com with SMTP id 41be03b00d2f7-5d81b08d6f2so1993898a12.0 for ; Sun, 11 Feb 2024 10:09:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1707674974; x=1708279774; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D/KS5+LN4YIkeT2pugJ5hXQlpOJXoG0MOanAaxxCdFI=; b=b1NaDXphQBRWVoc0AWEjqRvHRROUdeJCKCV092H3Qhei3e2TkPnYrciHITJb5A0l5g FseltH0dhdfeLS0YJc+pQwxQLJ71fFR4+uEYa+qe9jVw0EYmGZLtCj9vSXbMZjeYkJEi y26Y02GcSsD4uKNGBPH5GQhP7GJBgUQtyuyOETC4yHAlapArdNs/L7vDpiR5mhDtV798 1fh6URH021BeDw/NTunyQbi0UptDp1TOGUx7Rj/hq8ydtt+VVpk8EZB6EkJawTv8MWbQ Opt9VQ+rNpyW8HCGcb+6dJxt3T0K9Gb1FUAb9kt02kjRTt7GxgvvzlNYlRFktzxJpCe1 gDqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707674974; x=1708279774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D/KS5+LN4YIkeT2pugJ5hXQlpOJXoG0MOanAaxxCdFI=; b=aOJp5XIXAeKq2OgL5X7y540kXktgOukO0DZ+0TmqlCcgAwzYxugAb1igiA7Q4zN+cm COm+LjZwmxkaxVsuuP/Ugk/qzcI0B1s6ylXtyOO9Yr81OTtxkmmFe5YcQQEAUkkpD4iH g+OexeGFnxs5qtw1rALwP1Ntk5L5ZDBnTL3pdE9rBJS4YiE/9DlHAI7dELrx+75JNBa4 o15WwiT4+0YK1DFeN7YXwUx0hevfiWpzIwevqFhZsxSbOlL+yztdigYf89VHxh/6Jjoz l/uHDSQQ8QHVi7Y2+TrM9GMRypta6CobzLro9LeizOnRaxaCskdasG4FIvgyTAzGCGyJ CViA== X-Gm-Message-State: AOJu0YwmNGjL1DpLXFP91xnl+W3YgLno2JQ3Qho/tW9ZAZkZF7OPuPgC OSmvOs7lnTmBCEa36H5nTnlnS9fzs9I0bgv0esCJJ7AsCUDANMd9F6EbauBDKWgBWHqqbU6IaKb HpQ5rNbwEmqWpJhhzvvIM6Sh4Wb0IzrO4cFX1OjfE X-Received: by 2002:a05:6a20:9f45:b0:19e:9d92:b6a6 with SMTP id ml5-20020a056a209f4500b0019e9d92b6a6mr7366874pzb.44.1707674973949; Sun, 11 Feb 2024 10:09:33 -0800 (PST) Received: from wsx-cc1-001.. (c-76-141-249-38.hsd1.il.comcast.net. [76.141.249.38]) by smtp-relay.gmail.com with ESMTPS id s3-20020a656903000000b005cfbe87fb56sm111144pgq.23.2024.02.11.10.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 10:09:33 -0800 (PST) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Sun, 11 Feb 2024 12:09:17 -0600 Message-Id: <20240211180917.1675603-2-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240211180917.1675603-1-marth64@proxyid.net> References: <20240211180917.1675603-1-marth64@proxyid.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v13 2/2] libavformat/dvdvideo: add CLUT utilities and enable subtitle palette support X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marth64 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gIztECE8iyob Signed-off-by: Marth64 --- doc/demuxers.texi | 5 +++ libavformat/Makefile | 2 +- libavformat/dvdclut.c | 76 +++++++++++++++++++++++++++++++++++++++ libavformat/dvdclut.h | 37 +++++++++++++++++++ libavformat/dvdvideodec.c | 14 ++++++++ 5 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 libavformat/dvdclut.c create mode 100644 libavformat/dvdclut.h diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 062ea2ea42..d3c7675631 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -391,6 +391,11 @@ often with junk data intended for controlling a real DVD player's buffering speed and with no other material data value. Default is 1, true. +@item clut_rgb @var{bool} +Output subtitle palettes (CLUTs) as RGB, required for Matroska. +Disable to output the palette in its original YUV colorspace. +Default is 1, true. + @end table @subsection Examples diff --git a/libavformat/Makefile b/libavformat/Makefile index df69734877..8f17e43e49 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -192,7 +192,7 @@ OBJS-$(CONFIG_DTS_MUXER) += rawenc.o OBJS-$(CONFIG_DV_MUXER) += dvenc.o OBJS-$(CONFIG_DVBSUB_DEMUXER) += dvbsub.o rawdec.o OBJS-$(CONFIG_DVBTXT_DEMUXER) += dvbtxt.o rawdec.o -OBJS-$(CONFIG_DVDVIDEO_DEMUXER) += dvdvideodec.o +OBJS-$(CONFIG_DVDVIDEO_DEMUXER) += dvdvideodec.o dvdclut.o OBJS-$(CONFIG_DXA_DEMUXER) += dxa.o OBJS-$(CONFIG_EA_CDATA_DEMUXER) += eacdata.o OBJS-$(CONFIG_EA_DEMUXER) += electronicarts.o diff --git a/libavformat/dvdclut.c b/libavformat/dvdclut.c new file mode 100644 index 0000000000..2125e91541 --- /dev/null +++ b/libavformat/dvdclut.c @@ -0,0 +1,76 @@ +/* + * DVD-Video subpicture CLUT (Color Lookup Table) utilities + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/bprint.h" +#include "libavutil/colorspace.h" +#include "libavutil/common.h" + +#include "dvdclut.h" +#include "internal.h" + +int ff_dvdclut_palette_extradata_cat(const uint32_t *clut, + const size_t clut_size, + AVCodecParameters *par) +{ + int ret = 0; + AVBPrint bp; + + if (clut_size != FF_DVDCLUT_CLUT_SIZE) + return AVERROR(EINVAL); + + av_bprint_init(&bp, 0, FF_DVDCLUT_EXTRADATA_SIZE); + + av_bprintf(&bp, "palette: "); + + for (int i = 0; i < FF_DVDCLUT_CLUT_LEN; i++) + av_bprintf(&bp, "%06"PRIx32"%s", clut[i], + i != (FF_DVDCLUT_CLUT_LEN - 1) ? ", " : ""); + + av_bprintf(&bp, "\n"); + + return ff_bprint_to_codecpar_extradata(par, &bp); +} + +int ff_dvdclut_yuv_to_rgb(uint32_t *clut, const size_t clut_size) +{ + int y, cb, cr; + uint8_t r, g, b; + int r_add, g_add, b_add; + + if (clut_size != FF_DVDCLUT_CLUT_SIZE) + return AVERROR(EINVAL); + + for (int i = 0; i < FF_DVDCLUT_CLUT_LEN; i++) { + y = (clut[i] >> 16) & 0xFF; + cr = (clut[i] >> 8) & 0xFF; + cb = clut[i] & 0xFF; + + YUV_TO_RGB1_CCIR(cb, cr); + + y = (y - 16) * FIX(255.0 / 219.0); + r = av_clip_uint8((y + r_add - 1024) >> SCALEBITS); + g = av_clip_uint8((y + g_add - 1024) >> SCALEBITS); + b = av_clip_uint8((y + b_add - 1024) >> SCALEBITS); + + clut[i] = (r << 16) | (g << 8) | b; + } + + return 0; +} diff --git a/libavformat/dvdclut.h b/libavformat/dvdclut.h new file mode 100644 index 0000000000..41cea7e2c9 --- /dev/null +++ b/libavformat/dvdclut.h @@ -0,0 +1,37 @@ +/* + * DVD-Video subpicture CLUT (Color Lookup Table) utilities + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_DVDCLUT_H +#define AVFORMAT_DVDCLUT_H + +#include "libavcodec/codec_par.h" + +/* ("palette: ") + ("rrggbb, "*15) + ("rrggbb") + \n + \0 */ +#define FF_DVDCLUT_EXTRADATA_SIZE (9 + (8 * 15) + 6 + 1 + 1) +#define FF_DVDCLUT_CLUT_LEN 16 +#define FF_DVDCLUT_CLUT_SIZE FF_DVDCLUT_CLUT_LEN * sizeof(uint32_t) + +int ff_dvdclut_palette_extradata_cat(const uint32_t *clut, + const size_t clut_size, + AVCodecParameters *par); + +int ff_dvdclut_yuv_to_rgb(uint32_t *clut, const size_t clut_size); + +#endif /* AVFORMAT_DVDCLUT_H */ diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c index 9fb6d8b3f2..de2d1583e0 100644 --- a/libavformat/dvdvideodec.c +++ b/libavformat/dvdvideodec.c @@ -50,6 +50,7 @@ #include "avio_internal.h" #include "avlanguage.h" #include "demux.h" +#include "dvdclut.h" #include "internal.h" #include "url.h" @@ -96,6 +97,7 @@ typedef struct DVDVideoPGCSubtitleStreamEntry { int startcode; enum DVDVideoSubpictureViewport viewport; int disposition; + uint32_t clut[FF_DVDCLUT_CLUT_LEN]; const char *lang_iso; } DVDVideoPGCSubtitleStreamEntry; @@ -129,6 +131,7 @@ typedef struct DVDVideoDemuxContext { int opt_angle; /* the user-provided angle number (1-indexed) */ int opt_chapter_end; /* the user-provided exit PTT (0 for last) */ int opt_chapter_start; /* the user-provided entry PTT (1-indexed) */ + int opt_clut_rgb; /* output subtitle palette (CLUT) as RGB */ int opt_pg; /* the user-provided PG number (1-indexed) */ int opt_pgc; /* the user-provided PGC number (1-indexed) */ int opt_preindex; /* pre-indexing mode (2-pass read) */ @@ -1039,6 +1042,8 @@ break_error: static int dvdvideo_subp_stream_analyze(AVFormatContext *s, uint32_t offset, subp_attr_t subp_attr, DVDVideoPGCSubtitleStreamEntry *entry) { + DVDVideoDemuxContext *c = s->priv_data; + char lang_dvd[3] = {0}; entry->startcode = 0x20 + (offset & 0x1F); @@ -1046,6 +1051,11 @@ static int dvdvideo_subp_stream_analyze(AVFormatContext *s, uint32_t offset, sub if (subp_attr.lang_extension == 9) entry->disposition |= AV_DISPOSITION_FORCED; + memcpy(&entry->clut, c->play_state.pgc->palette, FF_DVDCLUT_CLUT_SIZE); + + if (c->opt_clut_rgb) + ff_dvdclut_yuv_to_rgb(entry->clut, FF_DVDCLUT_CLUT_SIZE); + AV_WB16(lang_dvd, subp_attr.lang_code); entry->lang_iso = ff_convert_lang_to(lang_dvd, AV_LANG_ISO639_2_BIBL); @@ -1067,6 +1077,9 @@ static int dvdvideo_subp_stream_add(AVFormatContext *s, DVDVideoPGCSubtitleStrea st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codecpar->codec_id = AV_CODEC_ID_DVD_SUBTITLE; + if ((ret = ff_dvdclut_palette_extradata_cat(entry->clut, FF_DVDCLUT_CLUT_SIZE, st->codecpar)) < 0) + return ret; + if (entry->lang_iso) av_dict_set(&st->metadata, "language", entry->lang_iso, 0); @@ -1389,6 +1402,7 @@ static const AVOption dvdvideo_options[] = { {"angle", "playback angle number", OFFSET(opt_angle), AV_OPT_TYPE_INT, { .i64=1 }, 1, 9, AV_OPT_FLAG_DECODING_PARAM }, {"chapter_end", "exit chapter (PTT) number (0=end)", OFFSET(opt_chapter_end), AV_OPT_TYPE_INT, { .i64=0 }, 0, 99, AV_OPT_FLAG_DECODING_PARAM }, {"chapter_start", "entry chapter (PTT) number", OFFSET(opt_chapter_start), AV_OPT_TYPE_INT, { .i64=1 }, 1, 99, AV_OPT_FLAG_DECODING_PARAM }, + {"clut_rgb", "output subtitle palette (CLUT) as RGB", OFFSET(opt_clut_rgb), AV_OPT_TYPE_BOOL, { .i64=1 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, {"pg", "entry PG number (0=auto)", OFFSET(opt_pg), AV_OPT_TYPE_INT, { .i64=0 }, 0, 255, AV_OPT_FLAG_DECODING_PARAM }, {"pgc", "entry PGC number (0=auto)", OFFSET(opt_pgc), AV_OPT_TYPE_INT, { .i64=0 }, 0, 999, AV_OPT_FLAG_DECODING_PARAM }, {"preindex", "enable for accurate chapter markers, slow (2-pass read)", OFFSET(opt_preindex), AV_OPT_TYPE_BOOL, { .i64=0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM },