0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

Add support for DVB teletext.

Patch by Francesco Lavra [francescolavra interfree it] with modifications by me.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29875 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2009-11-10 11:31:47 +00:00
parent 1135e23dfc
commit 9a8a73e547
4 changed files with 52 additions and 2 deletions

View File

@ -431,7 +431,8 @@ Confirm choice.
.RS
.
(The following keys are only valid if teletext support is enabled during
compilation: They are used for controlling TV teletext.)
compilation: They are used for controlling TV teletext, whose data may come
from either an analog TV source or an MPEG Transport Stream.)
.RE
.PP
.PD 0

View File

@ -1537,6 +1537,29 @@ static void vbi_decode(priv_vbi_t* priv,unsigned char*buf){
}
/**
* \brief decodes a vbi line from a DVB teletext stream
* \param priv private data structure
* \param buf buffer with DVB teletext data
*
* No locking is done since this is only called from a single-threaded context
*/
static void vbi_decode_dvb(priv_vbi_t *priv, const uint8_t buf[44]){
int i;
uint8_t data[42];
mp_msg(MSGT_TELETEXT,MSGL_DBG3, "vbi: vbi_decode_dvb\n");
/* Reverse bit order, skipping the first two bytes (field parity, line
offset and framing code). */
for (i = 0; i < sizeof(data); i++)
data[i] = av_reverse[buf[2 + i]];
vbi_decode_line(priv, data);
if (priv->cache_reset)
priv->cache_reset--;
}
/*
---------------------------------------------------------------------------------
Public routines
@ -1846,6 +1869,9 @@ int teletext_control(void* p, int cmd, void *arg)
case TV_VBI_CONTROL_DECODE_PAGE:
vbi_decode(priv,*(unsigned char**)arg);
return VBI_CONTROL_TRUE;
case TV_VBI_CONTROL_DECODE_DVB:
vbi_decode_dvb(priv, arg);
return VBI_CONTROL_TRUE;
case TV_VBI_CONTROL_GET_VBIPAGE:
if(!priv->on)
return VBI_CONTROL_FALSE;

View File

@ -69,6 +69,7 @@ int teletext_control(void* p, int cmd, void *arg);
#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 TV_VBI_CONTROL_DECODE_DVB 0x558 ///< decode DVB teletext
#define VBI_TFORMAT_TEXT 0 ///< text mode
#define VBI_TFORMAT_BW 1 ///< black&white mode

View File

@ -141,9 +141,15 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
if (spudec_changed(vo_spudec))
vo_osd_changed(OSDTYPE_SPU);
} else if (dvdsub_id >= 0 && (type == 't' || type == 'm' || type == 'a')) {
} else if (dvdsub_id >= 0 && (type == 't' || type == 'm' || type == 'a' || type == 'd')) {
double curpts = refpts + sub_delay;
double endpts;
if (type == 'd' && !d_dvdsub->demuxer->teletext) {
tt_stream_props tsp = {0};
void *ptr = &tsp;
if (teletext_control(NULL, TV_VBI_CONTROL_START, &ptr) == VBI_CONTROL_TRUE)
d_dvdsub->demuxer->teletext = ptr;
}
if (d_dvdsub->non_interleaved)
ds_get_next_pts(d_dvdsub);
while (d_dvdsub->first) {
@ -157,6 +163,22 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
len = FFMIN(len - 2, AV_RB16(packet));
packet += 2;
}
if (type == 'd') {
if (d_dvdsub->demuxer->teletext) {
uint8_t *p = packet;
p++;
len--;
while (len >= 46) {
int sublen = p[1];
if (p[0] == 2 || p[0] == 3)
teletext_control(d_dvdsub->demuxer->teletext,
TV_VBI_CONTROL_DECODE_DVB, p + 2);
p += sublen + 2;
len -= sublen + 2;
}
}
continue;
}
#ifdef CONFIG_ASS
if (ass_enabled) {
sh_sub_t* sh = d_dvdsub->sh;