On Sat, Nov 15, 2014 at 02:25:48AM +0900, TOYAMA Shin-ichi wrote: > Thanks for many comments. > Attached is the forth try. > Please review it. > > -- > TOYAMA Shin-ichi mailto:sh...@wmail.plala.or.jp
> doc/decoders.texi | 3 ++ > libavcodec/dvdsubdec.c | 58 > +++++++++++++++++++++++++++++++++++++++++++++++++ > libavcodec/version.h | 2 - > 3 files changed, 62 insertions(+), 1 deletion(-) > 6d350bb26b48ed7c79071cd920e6358d44928961 > 0001-New-option-for-obtaining-global-palette-from-.IFO-fi.patch > From ed95a453997bee9557f6af852c9b81f9f8c426f8 Mon Sep 17 00:00:00 2001 > From: Shin-ichi Toyama <sh...@wmail.plala.or.jp> > Date: Sat, 15 Nov 2014 02:15:57 +0900 > Subject: [PATCH] New option for obtaining global palette from .IFO file > > --- > doc/decoders.texi | 3 +++ > libavcodec/dvdsubdec.c | 58 > ++++++++++++++++++++++++++++++++++++++++++++++++++ > libavcodec/version.h | 2 +- > 3 files changed, 62 insertions(+), 1 deletion(-) > > diff --git a/doc/decoders.texi b/doc/decoders.texi > index ae20cea..d01c4d1 100644 > --- a/doc/decoders.texi > +++ b/doc/decoders.texi > @@ -191,6 +191,9 @@ numbers (without 0x prefix) separated by comas, for > example @code{0d00ee, > ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1, > 7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b}. > > +@item ifo_palette > +Specify the the IFO file from which the global palette is obtained. > + > @item forced_subs_only > Only decode subtitle entries marked as forced. Some titles have forced > and non-forced subtitles in the same track. Setting this flag to @code{1} > diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c > index bb28d9e..b96a5e0 100644 > --- a/libavcodec/dvdsubdec.c > +++ b/libavcodec/dvdsubdec.c > @@ -28,12 +28,15 @@ > #include "libavutil/opt.h" > #include "libavutil/imgutils.h" > #include "libavutil/avstring.h" > +#include "libavutil/bswap.h" > +#include "libavformat/avio.h" > > typedef struct DVDSubContext > { > AVClass *class; > uint32_t palette[16]; > char *palette_str; > + char *ifo_str; > int has_palette; > uint8_t colormap[4]; > uint8_t alpha[256]; > @@ -583,6 +586,58 @@ static void parse_palette(DVDSubContext *ctx, char *p) > } > } > > +static int parse_ifo_palette(DVDSubContext *ctx, char *p) > +{ > + AVIOContext *ifo = NULL; > + char ifostr[12]; > + uint32_t sp_pgci, pgci, off_pgc, pgc; > + uint8_t r, g, b, yuv[65], *buf; > + int i, y, cb, cr, r_add, g_add, b_add; > + int ret = 0; > + const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; > + > + ctx->has_palette = 0; > + ret = avio_open2(&ifo, p, AVIO_FLAG_READ, NULL, NULL); libavcodec does not depend on libavformat, thus libavcodec cannot use avio_* directly. I should have realized/mentioned this when suggesting avio libavformat OTOH could read the IFO file with avio_open2/avio_read into extradata or some newly added ifo specific side data and dvdsubdec.c could then parse the palette out of that. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No snowflake in an avalanche ever feels responsible. -- Voltaire
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel