From 4f0d56b9ae993ab39db45eeac978a9a5e632add3 Mon Sep 17 00:00:00 2001 From: voroshil Date: Sun, 29 Jul 2007 17:55:28 +0000 Subject: Teletext support. Part 2/5: options/slaves/configure/definitions/etc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23920 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/Makefile | 1 + stream/stream_tv.c | 3 ++ stream/tv.c | 6 ++++ stream/tv.h | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) (limited to 'stream') diff --git a/stream/Makefile b/stream/Makefile index a5d7edcf37..cb7baa6175 100644 --- a/stream/Makefile +++ b/stream/Makefile @@ -49,6 +49,7 @@ SRCS_COMMON-$(STREAM_CACHE) += cache2.c SRCS_COMMON-$(STREAMING_LIVE555) += stream_livedotcom.c SRCS_COMMON-$(TV) += stream_tv.c tv.c frequencies.c tvi_dummy.c SRCS_COMMON-$(TV_BSDBT848) += tvi_bsdbt848.c +SRCS_COMMON-$(TV_TELETEXT) += tvi_vbi.c SRCS_COMMON-$(TV_V4L1) += tvi_v4l.c audio_in.c SRCS_COMMON-$(TV_V4L2) += tvi_v4l2.c audio_in.c SRCS_COMMON-$(VCD) += stream_vcd.c diff --git a/stream/stream_tv.c b/stream/stream_tv.c index 126c35d8f2..8332b07477 100644 --- a/stream/stream_tv.c +++ b/stream/stream_tv.c @@ -72,6 +72,9 @@ tv_param_t stream_tv_defaults = { 0, //contrast 0, //hue 0, //saturation + NULL, //tdevice + 0, //tformat + 100 //tpage }; #define ST_OFF(f) M_ST_OFF(tv_param_t,f) diff --git a/stream/tv.c b/stream/tv.c index 884271d53b..12d23895b9 100644 --- a/stream/tv.c +++ b/stream/tv.c @@ -516,6 +516,9 @@ static demuxer_t* demux_open_tv(demuxer_t *demuxer) demuxer->priv=NULL; if(!(tvh=tv_begin(demuxer->stream->priv))) return NULL; if (!tvh->functions->init(tvh->priv)) return NULL; + + tvh->functions->control(tvh->priv,TVI_CONTROL_VBI_INIT,&(tvh->tv_param->tdevice)); + if (!open_tv(tvh)){ tv_uninit(tvh); return NULL; @@ -731,6 +734,7 @@ int tv_set_freq(tvi_handle_t *tvh, unsigned long freq) mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_CurrentFrequency, freq, (float)freq/16); } + tvh->functions->control(tvh->priv,TV_VBI_CONTROL_RESET,tvh->tv_param); return(1); } @@ -890,6 +894,7 @@ int tv_step_norm(tvi_handle_t *tvh) return 0; } } + tvh->functions->control(tvh->priv,TV_VBI_CONTROL_RESET,tvh->tv_param); return(1); } @@ -907,6 +912,7 @@ int tv_set_norm(tvi_handle_t *tvh, char* norm) mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm); return 0; } + tvh->functions->control(tvh->priv,TV_VBI_CONTROL_RESET,tvh->tv_param); return(1); } diff --git a/stream/tv.h b/stream/tv.h index ad40780414..292238b51b 100644 --- a/stream/tv.h +++ b/stream/tv.h @@ -47,6 +47,9 @@ typedef struct tv_param_s { int contrast; int hue; int saturation; + char *tdevice; ///< teletext device + int tformat; ///< teletext display format + int tpage; ///< start teletext page } tv_param_t; extern tv_param_t stream_tv_defaults; @@ -157,6 +160,39 @@ extern char *tv_channel_last_real; #define TVI_CONTROL_SPC_SET_INPUT 0x402 /* set input channel (tv,s-video,composite..) */ #define TVI_CONTROL_SPC_GET_NORMID 0x403 /* get normid from norm name */ +//tvi_* ioctl (not tvi_vbi.c !!!) +#define TVI_CONTROL_VBI_INIT 0x501 ///< vbi init + +/* + TELETEXT controls (through tv_teletext_control() ) + NOTE: + _SET_ should be _GET_ +1 + _STEP_ should be _GET_ +2 +*/ +#define TV_VBI_CONTROL_GET_MODE 0x510 ///< get current mode teletext +#define TV_VBI_CONTROL_SET_MODE 0x511 ///< on/off grab teletext + +#define TV_VBI_CONTROL_GET_PAGE 0x513 ///< get grabbed teletext page +#define TV_VBI_CONTROL_SET_PAGE 0x514 ///< set grab teletext page number +#define TV_VBI_CONTROL_STEP_PAGE 0x515 ///< step grab teletext page number + +#define TV_VBI_CONTROL_GET_SUBPAGE 0x516 ///< get grabbed teletext page +#define TV_VBI_CONTROL_SET_SUBPAGE 0x517 ///< set grab teletext page number + +#define TV_VBI_CONTROL_GET_FORMAT 0x519 ///< get eletext format +#define TV_VBI_CONTROL_SET_FORMAT 0x51a ///< set teletext format + +#define TV_VBI_CONTROL_GET_HALF_PAGE 0x51c ///< get current half page +#define TV_VBI_CONTROL_SET_HALF_PAGE 0x51d ///< switch half page + +#define TV_VBI_CONTROL_ADD_DEC 0x550 ///< add page number with dec +#define TV_VBI_CONTROL_GO_LINK 0x551 ///< go link (1..6) NYI +#define TV_VBI_CONTROL_GET_VBIPAGE 0x552 ///< get vbi_image for grabbed teletext page +#define TV_VBI_CONTROL_RESET 0x553 ///< vbi reset +#define TV_VBI_CONTROL_START 0x554 ///< vbi start +#define TV_VBI_CONTROL_STOP 0x555 ///< vbi stop +#define TV_VBI_CONTROL_DECODE_PAGE 0x556 ///< decode vbi page + int tv_set_color_options(tvi_handle_t *tvh, int opt, int val); int tv_get_color_options(tvi_handle_t *tvh, int opt, int* val); #define TV_COLOR_BRIGHTNESS 1 @@ -191,4 +227,60 @@ int tv_set_norm(tvi_handle_t *tvh, char* norm); #define TV_NORM_PALN 6 #define TV_NORM_NTSCJP 7 +#define VBI_TFORMAT_TEXT 0 ///< text mode +#define VBI_TFORMAT_BW 1 ///< back&white mode +#define VBI_TFORMAT_GRAY 2 ///< grayscale mode +#define VBI_TFORMAT_COLOR 3 ///< color mode (require color_spu patch!) + +#define VBI_MAX_PAGES 0x800 ///< max sub pages number +#define VBI_MAX_SUBPAGES 64 ///< max sub pages number + +#define VBI_ROWS 24 ///< teletext page width in chars +#define VBI_COLUMNS 40 ///< teletext page height in chars +#define VBI_TIME_LINEPOS 26 ///< time line pos in page header + +typedef +enum{ + TT_FORMAT_OPAQUE=0, ///< opaque + TT_FORMAT_TRANSPARENT, ///< translarent + TT_FORMAT_OPAQUE_INV, ///< opaque with inverted colors + TT_FORMAT_TRANSPARENT_INV ///< translarent with inverted colors +} teletext_format; + +typedef +enum{ + TT_ZOOM_NORMAL=0, + TT_ZOOM_TOP_HALF, + TT_ZOOM_BOTTOM_HALF +} teletext_zoom; + +typedef struct tt_char_s{ + unsigned int unicode; ///< unicode (utf8) character + unsigned char fg; ///< foreground color + unsigned char bg; ///< background color + unsigned char gfx; ///< 0-no gfx, 1-solid gfx, 2-separated gfx + unsigned char ctl; ///< control character + unsigned char lng; ///< lang: 0-lating,1-national + unsigned char raw; ///< raw character (as received from device) +} tt_char; + +typedef struct tt_page_s{ + int pagenum; ///< page number + int subpagenum; ///< subpage number + unsigned char lang; ///< language code + unsigned char active; ///< page is complete and ready for rendering + unsigned char flags; ///< page flags, not used + unsigned char raw[VBI_ROWS*VBI_COLUMNS]; ///< page data + struct tt_page_s* next_subpage; +} tt_page; + +typedef struct tt_stream_props_s{ + int sampling_rate; + int samples_per_line; + int offset; + int count[2]; ///< number of lines in first and second fields + int interlaced; ///< vbi data are interlaced + int bufsize; ///< required buffer size +} tt_stream_props; + #endif /* TV_H */ -- cgit v1.2.3