diff options
author | Kirill Savkov <k.savkov@inventos.ru> | 2020-02-19 09:44:00 +0300 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-02-24 00:14:21 +0100 |
commit | 4627a56d46a07dd2384c92310147cabac98b4539 (patch) | |
tree | 68650177b821c731b36ad38ba55dd9f4de75b682 | |
parent | 45085d8d3cd977a0b2c2677dab9643be9adbb56e (diff) | |
download | ffmpeg-4627a56d46a07dd2384c92310147cabac98b4539.tar.gz |
avcodec/libzvbi-teletextdec: add option to set default G0 character set
Signed-off-by: Kirill Savkov <k.savkov@inventos.ru>
Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r-- | doc/decoders.texi | 5 | ||||
-rw-r--r-- | libavcodec/libzvbi-teletextdec.c | 6 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/doc/decoders.texi b/doc/decoders.texi index 9094c55e24..0c5a39bc9c 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -316,6 +316,11 @@ List of teletext page numbers to decode. Pages that do not match the specified list are dropped. You may use the special @code{*} string to match all pages, or @code{subtitle} to match all subtitle pages. Default value is *. +@item txt_default_region +Set default G0 character set used for decoding, a value between 0 and 80 (see +ETS 300 706, Section 15, Table 32). Default value is -1, which does not +override the libzvbi default. This option is needed for some legacy level 1.0 +transmissions which cannot signal the proper charset. @item txt_chop_top Discards the top teletext line. Default value is 1. @item txt_format diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c index 3515f33924..fe6504ff8a 100644 --- a/libavcodec/libzvbi-teletextdec.c +++ b/libavcodec/libzvbi-teletextdec.c @@ -55,6 +55,7 @@ typedef struct TeletextContext { AVClass *class; char *pgno; + int default_region; int x_offset; int y_offset; int format_id; /* 0 = bitmap, 1 = text/ass, 2 = ass */ @@ -645,6 +646,10 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_si if (!ctx->vbi) { if (!(ctx->vbi = vbi_decoder_new())) return AVERROR(ENOMEM); + if (ctx->default_region != -1) { + av_log(avctx, AV_LOG_INFO, "Setting default zvbi region to %i\n", ctx->default_region); + vbi_teletext_set_default_region(ctx->vbi, ctx->default_region); + } if (!vbi_event_handler_register(ctx->vbi, VBI_EVENT_TTX_PAGE, handler, ctx)) { vbi_decoder_delete(ctx->vbi); ctx->vbi = NULL; @@ -792,6 +797,7 @@ static void teletext_flush(AVCodecContext *avctx) #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { {"txt_page", "page numbers to decode, subtitle for subtitles, * for all", OFFSET(pgno), AV_OPT_TYPE_STRING, {.str = "*"}, 0, 0, SD}, + {"txt_default_region", "default G0 character set used for decoding", OFFSET(default_region), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 80, SD}, {"txt_chop_top", "discards the top teletext line", OFFSET(chop_top), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, SD}, {"txt_format", "format of the subtitles (bitmap or text or ass)", OFFSET(format_id), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 2, SD, "txt_format"}, {"bitmap", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 0, SD, "txt_format"}, diff --git a/libavcodec/version.h b/libavcodec/version.h index a356445596..36536c3725 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 73 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MICRO 102 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ |