diff options
author | Clément Bœsch <ubitux@gmail.com> | 2012-12-28 05:15:00 +0100 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2012-12-30 23:55:28 +0100 |
commit | 7b43402724b21cca805c8afac6ec33a211d52b85 (patch) | |
tree | ab285806766de979f79df1f47bc716cd4cc98d94 /libavcodec | |
parent | 580ee973d16cb5afb3d5974133576d6c570d2dda (diff) | |
download | ffmpeg-7b43402724b21cca805c8afac6ec33a211d52b85.tar.gz |
Add PJS subtitles demuxer and decoder.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/Makefile | 1 | ||||
-rw-r--r-- | libavcodec/allcodecs.c | 1 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 1 | ||||
-rw-r--r-- | libavcodec/codec_desc.c | 6 | ||||
-rw-r--r-- | libavcodec/textdec.c | 30 |
5 files changed, 34 insertions, 5 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 949c66b706..f8dd081097 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -333,6 +333,7 @@ OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o pnm.o OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o OBJS-$(CONFIG_PICTOR_DECODER) += pictordec.o cga_data.o +OBJS-$(CONFIG_PJS_DECODER) += textdec.o ass.o OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o pngdsp.o OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 314ef37764..d519a3e977 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -450,6 +450,7 @@ void avcodec_register_all(void) REGISTER_ENCDEC (MOVTEXT, movtext); REGISTER_DECODER(MPL2, mpl2); REGISTER_DECODER(PGSSUB, pgssub); + REGISTER_DECODER(PJS, pjs); REGISTER_DECODER(REALTEXT, realtext); REGISTER_DECODER(SAMI, sami); REGISTER_ENCDEC (SRT, srt); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 8730ccbbba..782b46b6ce 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -468,6 +468,7 @@ enum AVCodecID { AV_CODEC_ID_WEBVTT = MKBETAG('W','V','T','T'), AV_CODEC_ID_MPL2 = MKBETAG('M','P','L','2'), AV_CODEC_ID_VPLAYER = MKBETAG('V','P','l','r'), + AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'), /* other specific kind of codecs (generally used for attachments) */ AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 2ea5e99629..13ebcecef6 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -2423,6 +2423,12 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("JACOsub subtitle"), }, { + .id = AV_CODEC_ID_PJS, + .type = AVMEDIA_TYPE_SUBTITLE, + .name = "pjs", + .long_name = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitle"), + }, + { .id = AV_CODEC_ID_SAMI, .type = AVMEDIA_TYPE_SUBTITLE, .name = "sami", diff --git a/libavcodec/textdec.c b/libavcodec/textdec.c index 9e19b37dd9..32af644150 100644 --- a/libavcodec/textdec.c +++ b/libavcodec/textdec.c @@ -128,17 +128,19 @@ AVCodec ff_text_decoder = { }; #endif -#if CONFIG_VPLAYER_DECODER -#define vplayer_options options -DECLARE_CLASS(vplayer); +#if CONFIG_VPLAYER_DECODER || CONFIG_PJS_DECODER -static int vplayer_init(AVCodecContext *avctx) +static int linebreak_init(AVCodecContext *avctx) { TextContext *text = avctx->priv_data; text->linebreaks = "|"; return ff_ass_subtitle_header_default(avctx); } +#if CONFIG_VPLAYER_DECODER +#define vplayer_options options +DECLARE_CLASS(vplayer); + AVCodec ff_vplayer_decoder = { .name = "vplayer", .priv_data_size = sizeof(TextContext), @@ -146,7 +148,25 @@ AVCodec ff_vplayer_decoder = { .type = AVMEDIA_TYPE_SUBTITLE, .id = AV_CODEC_ID_VPLAYER, .decode = text_decode_frame, - .init = vplayer_init, + .init = linebreak_init, .priv_class = &vplayer_decoder_class, }; #endif + +#if CONFIG_PJS_DECODER +#define pjs_options options +DECLARE_CLASS(pjs); + +AVCodec ff_pjs_decoder = { + .name = "pjs", + .priv_data_size = sizeof(TextContext), + .long_name = NULL_IF_CONFIG_SMALL("PJS subtitle"), + .type = AVMEDIA_TYPE_SUBTITLE, + .id = AV_CODEC_ID_PJS, + .decode = text_decode_frame, + .init = linebreak_init, + .priv_class = &pjs_decoder_class, +}; +#endif + +#endif /* text subtitles with '|' line break */ |