summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-10-29 22:13:04 +0000
committercehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-10-29 22:13:04 +0000
commita9474b0b39b999ef17163bec9337a96a72ddb458 (patch)
tree77b8d831565425d359d87c17bd5a42ed77651327
parentf86cab4ecc5ca22bcfd2fc723e2fbb7b020b0b25 (diff)
downloadmpv-a9474b0b39b999ef17163bec9337a96a72ddb458.tar.bz2
mpv-a9474b0b39b999ef17163bec9337a96a72ddb458.tar.xz
Move teletext specific code from stream into libmpcodecs.
Patch by Francesco Lavra, francescolavra interfree it git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29801 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--Makefile2
-rw-r--r--command.c1
-rw-r--r--libmpcodecs/dec_teletext.c (renamed from stream/tvi_vbi.c)3
-rw-r--r--libmpcodecs/dec_teletext.h136
-rw-r--r--libvo/sub.c2
-rw-r--r--mpcommon.c1
-rw-r--r--stream/tv.c1
-rw-r--r--stream/tv.h108
-rw-r--r--stream/tvi_def.h2
-rw-r--r--stream/tvi_dshow.c1
-rw-r--r--stream/tvi_v4l.c1
-rw-r--r--stream/tvi_v4l2.c1
12 files changed, 146 insertions, 113 deletions
diff --git a/Makefile b/Makefile
index b38fdc4542..e613d51cfe 100644
--- a/Makefile
+++ b/Makefile
@@ -272,7 +272,7 @@ SRCS_COMMON-$(TV) += stream/stream_tv.c stream/tv.c \
stream/frequencies.c stream/tvi_dummy.c
SRCS_COMMON-$(TV_BSDBT848) += stream/tvi_bsdbt848.c
SRCS_COMMON-$(TV_DSHOW) += stream/tvi_dshow.c
-SRCS_COMMON-$(TV_TELETEXT) += stream/tvi_vbi.c
+SRCS_COMMON-$(TV_TELETEXT) += libmpcodecs/dec_teletext.c
SRCS_COMMON-$(TV_V4L1) += stream/tvi_v4l.c stream/audio_in.c
SRCS_COMMON-$(TV_V4L2) += stream/tvi_v4l2.c stream/audio_in.c
SRCS_COMMON-$(UNRAR_EXEC) += unrar_exec.c
diff --git a/command.c b/command.c
index 3269db5949..37a0780cbd 100644
--- a/command.c
+++ b/command.c
@@ -25,6 +25,7 @@
#include "mpcommon.h"
#include "mixer.h"
#include "libmpcodecs/dec_video.h"
+#include "libmpcodecs/dec_teletext.h"
#include "vobsub.h"
#include "spudec.h"
#include "get_path.h"
diff --git a/stream/tvi_vbi.c b/libmpcodecs/dec_teletext.c
index a2aa530f7a..5e1192b355 100644
--- a/stream/tvi_vbi.c
+++ b/libmpcodecs/dec_teletext.c
@@ -91,7 +91,8 @@
#include <pthread.h>
-#include "tv.h"
+#include "stream/tv.h"
+#include "dec_teletext.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "libmpcodecs/img_format.h"
diff --git a/libmpcodecs/dec_teletext.h b/libmpcodecs/dec_teletext.h
new file mode 100644
index 0000000000..5b4ad6bb8d
--- /dev/null
+++ b/libmpcodecs/dec_teletext.h
@@ -0,0 +1,136 @@
+/*
+ * Teletext support
+ *
+ * Copyright (C) 2007 Vladimir Voroshilov <voroshil@gmail.com>
+ *
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPLAYER_DEC_TELETEXT_H
+#define MPLAYER_DEC_TELETEXT_H
+
+int teletext_control(void* p, int cmd, void *arg);
+
+/*
+ TELETEXT controls (through 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 teletext 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_IS_CHANGED 0x540 ///< teletext page is changed
+#define TV_VBI_CONTROL_MARK_UNCHANGED 0x541 ///< teletext page is changed
+
+#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
+#define TV_VBI_CONTROL_GET_NETWORKNAME 0x557 ///< get current network name
+
+#define VBI_TFORMAT_TEXT 0 ///< text mode
+#define VBI_TFORMAT_BW 1 ///< black&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 25 ///< teletext page height in rows
+#define VBI_COLUMNS 40 ///< teletext page width in chars
+#define VBI_TIME_LINEPOS 26 ///< time line pos in page header
+
+typedef
+enum{
+ TT_FORMAT_OPAQUE=0, ///< opaque
+ TT_FORMAT_TRANSPARENT, ///< transparent
+ TT_FORMAT_OPAQUE_INV, ///< opaque with inverted colors
+ TT_FORMAT_TRANSPARENT_INV ///< transparent 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 flh; ///< 0-no flash, 1-flash
+ unsigned char hidden; ///< char is hidden (for subtitle pages)
+ unsigned char ctl; ///< control character
+ unsigned char lng; ///< lang: 0-secondary language,1-primary language
+ unsigned char raw; ///< raw character (as received from device)
+} tt_char;
+
+typedef struct tt_link_s{
+ int pagenum; ///< page number
+ int subpagenum; ///< subpage number
+} tt_link_t;
+
+typedef struct tt_page_s{
+ int pagenum; ///< page number
+ int subpagenum; ///< subpage number
+ unsigned char primary_lang; ///< primary language code
+ unsigned char secondary_lang; ///< secondary language code
+ unsigned char active; ///< page is complete and ready for rendering
+ unsigned char flags; ///< page flags
+ unsigned char raw[VBI_ROWS*VBI_COLUMNS]; ///< page data
+ struct tt_page_s* next_subpage;
+ struct tt_link_s links[6];
+} tt_page;
+
+#define TT_PGFL_SUPPRESS_HEADER 0x01
+#define TT_PGFL_UPDATE_INDICATOR 0x02
+#define TT_PGFL_INTERRUPTED_SEQ 0x04
+#define TT_PGFL_INHIBIT_DISPLAY 0x08
+#define TT_PGFL_NEWFLASH 0x10
+#define TT_PGFL_SUBTITLE 0x20
+#define TT_PGFL_ERASE_PAGE 0x40
+#define TT_PGFL_MAGAZINE_SERIAL 0x80
+
+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 /* MPLAYER_DEC_TELETEXT_H */
diff --git a/libvo/sub.c b/libvo/sub.c
index da3f97db0d..114739bf13 100644
--- a/libvo/sub.c
+++ b/libvo/sub.c
@@ -29,7 +29,7 @@
#include "stream/stream_dvdnav.h"
#define OSD_NAV_BOX_ALPHA 0x7f
-#include "stream/tv.h"
+#include "libmpcodecs/dec_teletext.h"
#include "osdep/timer.h"
#include "mplayer.h"
diff --git a/mpcommon.c b/mpcommon.c
index 162dbbf26e..6df406922f 100644
--- a/mpcommon.c
+++ b/mpcommon.c
@@ -12,6 +12,7 @@
#include "version.h"
#include "vobsub.h"
#include "stream/tv.h"
+#include "libmpcodecs/dec_teletext.h"
#include "libavutil/intreadwrite.h"
#include "m_option.h"
#include "mpcommon.h"
diff --git a/stream/tv.c b/stream/tv.c
index 34e184a37f..7e7ba263fa 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -29,6 +29,7 @@
#include "libaf/af_format.h"
#include "libmpcodecs/img_format.h"
+#include "libmpcodecs/dec_teletext.h"
#include "libavutil/avstring.h"
#include "osdep/timer.h"
diff --git a/stream/tv.h b/stream/tv.h
index d177628e85..1ec112fee2 100644
--- a/stream/tv.h
+++ b/stream/tv.h
@@ -221,40 +221,6 @@ typedef struct {
//tvi_* ioctl (not tvi_vbi.c !!!)
#define TVI_CONTROL_VBI_INIT 0x501 ///< vbi init
-/*
- TELETEXT controls (through 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 teletext 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_IS_CHANGED 0x540 ///< teletext page is changed
-#define TV_VBI_CONTROL_MARK_UNCHANGED 0x541 ///< teletext page is changed
-
-#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
-#define TV_VBI_CONTROL_GET_NETWORKNAME 0x557 ///< get current network name
-
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
@@ -292,78 +258,4 @@ void tv_start_scan(tvi_handle_t *tvh, int start);
#define TV_NORM_PALN 6
#define TV_NORM_NTSCJP 7
-#define VBI_TFORMAT_TEXT 0 ///< text mode
-#define VBI_TFORMAT_BW 1 ///< black&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 25 ///< teletext page height in rows
-#define VBI_COLUMNS 40 ///< teletext page width in chars
-#define VBI_TIME_LINEPOS 26 ///< time line pos in page header
-
-typedef
-enum{
- TT_FORMAT_OPAQUE=0, ///< opaque
- TT_FORMAT_TRANSPARENT, ///< transparent
- TT_FORMAT_OPAQUE_INV, ///< opaque with inverted colors
- TT_FORMAT_TRANSPARENT_INV ///< transparent 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 flh; ///< 0-no flash, 1-flash
- unsigned char hidden; ///< char is hidden (for subtitle pages)
- unsigned char ctl; ///< control character
- unsigned char lng; ///< lang: 0-secondary language,1-primary language
- unsigned char raw; ///< raw character (as received from device)
-} tt_char;
-
-typedef struct tt_link_s{
- int pagenum; ///< page number
- int subpagenum; ///< subpage number
-} tt_link_t;
-
-typedef struct tt_page_s{
- int pagenum; ///< page number
- int subpagenum; ///< subpage number
- unsigned char primary_lang; ///< primary language code
- unsigned char secondary_lang; ///< secondary language code
- unsigned char active; ///< page is complete and ready for rendering
- unsigned char flags; ///< page flags
- unsigned char raw[VBI_ROWS*VBI_COLUMNS]; ///< page data
- struct tt_page_s* next_subpage;
- struct tt_link_s links[6];
-} tt_page;
-
-#define TT_PGFL_SUPPRESS_HEADER 0x01
-#define TT_PGFL_UPDATE_INDICATOR 0x02
-#define TT_PGFL_INTERRUPTED_SEQ 0x04
-#define TT_PGFL_INHIBIT_DISPLAY 0x08
-#define TT_PGFL_NEWFLASH 0x10
-#define TT_PGFL_SUBTITLE 0x20
-#define TT_PGFL_ERASE_PAGE 0x40
-#define TT_PGFL_MAGAZINE_SERIAL 0x80
-
-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 /* MPLAYER_TV_H */
diff --git a/stream/tvi_def.h b/stream/tvi_def.h
index 3c0ef8edb0..f15fcce481 100644
--- a/stream/tvi_def.h
+++ b/stream/tvi_def.h
@@ -15,8 +15,6 @@ static int get_video_framesize(priv_t *priv);
static double grab_audio_frame(priv_t *priv, char *buffer, int len);
static int get_audio_framesize(priv_t *priv);
-int teletext_control(void* p, int cmd, void *arg);
-
static const tvi_functions_t functions =
{
init,
diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c
index 37816f82cb..99c719f409 100644
--- a/stream/tvi_dshow.c
+++ b/stream/tvi_dshow.c
@@ -76,6 +76,7 @@
#include <stdio.h>
#include "libmpcodecs/img_format.h"
+#include "libmpcodecs/dec_teletext.h"
#include "libaf/af_format.h"
#include "help_mp.h"
#include "osdep/timer.h"
diff --git a/stream/tvi_v4l.c b/stream/tvi_v4l.c
index ea7064762c..07cbc540bb 100644
--- a/stream/tvi_v4l.c
+++ b/stream/tvi_v4l.c
@@ -40,6 +40,7 @@
#include "mp_msg.h"
#include "libaf/af_format.h"
#include "libmpcodecs/img_format.h"
+#include "libmpcodecs/dec_teletext.h"
#include "libvo/fastmemcpy.h"
#include "libvo/videodev_mjpeg.h"
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 786d42529e..0de15d245f 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -53,6 +53,7 @@ known issues:
#include <linux/videodev2.h>
#include "mp_msg.h"
#include "libmpcodecs/img_format.h"
+#include "libmpcodecs/dec_teletext.h"
#include "libaf/af_format.h"
#include "tv.h"
#include "audio_in.h"