Commit 7e0b6fad authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Jean-Paul Saman

Add positioning/alignment of SPU Teletext subpictures to the list.

parent 845b1179
......@@ -5,6 +5,7 @@
* $Id$
*
* Authors: Derk-Jan Hartman <djhartman at m2x dot nl> for M2X
* Jean-Paul Saman <jpsaman at m2x dot nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -71,6 +72,17 @@ static subpicture_t *Decode( decoder_t *, block_t ** );
#define OPAQUE_LONGTEXT N_("Setting vbi-opaque to false " \
"makes the boxed text transparent." )
#define POS_TEXT N_("Teletext alignment")
#define POS_LONGTEXT N_( \
"You can enforce the teletext position on the video " \
"(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \
"also use combinations of these values, eg. 6 = top-right).")
static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
static char *ppsz_pos_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
vlc_module_begin();
set_description( _("VBI and Teletext decoder") );
set_shortname( "VBI & Teletext" );
......@@ -83,6 +95,9 @@ vlc_module_begin();
PAGE_TEXT, PAGE_LONGTEXT, VLC_FALSE );
add_bool( "vbi-opaque", VLC_TRUE, NULL,
OPAQUE_TEXT, OPAQUE_LONGTEXT, VLC_FALSE );
add_integer( "vbi-align", 4, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE );
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
vlc_module_end();
/****************************************************************************
......@@ -97,6 +112,9 @@ struct decoder_sys_t
unsigned int i_last_page;
vlc_bool_t b_update;
vlc_bool_t b_opaque;
/* Positioning of Teletext images */
int i_align;
};
static void event_handler(vbi_event *ev, void *user_data);
......@@ -105,6 +123,8 @@ static int RequestPage( vlc_object_t *p_this, char const *psz_cmd,
static int Opaque( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
static int Align( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
/*****************************************************************************
* Open: probe the decoder and return score
......@@ -152,6 +172,9 @@ static int Open( vlc_object_t *p_this )
p_sys->b_opaque = var_CreateGetBool( p_dec, "vbi-opaque" );
var_AddCallback( p_dec, "vbi-opaque", Opaque, p_sys );
p_sys->i_align = var_CreateGetInteger( p_dec, "vbi-align" );
var_AddCallback( p_dec, "vbi-align", Align, p_sys );
return VLC_SUCCESS;
}
......@@ -212,7 +235,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
}
/* Try to see if the page we want is in the cache yet */
memset( &p_page, 0, sizeof( vbi_page ) );
//memset( &p_page, 0, sizeof( vbi_page ) );
b_cached = vbi_fetch_vt_page( p_sys->p_vbi_dec, &p_page,
vbi_dec2bcd( p_sys->i_wanted_page ),
VBI_ANY_SUBNO, VBI_WST_LEVEL_3p5,
......@@ -260,7 +283,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
p_spu->p_region->i_align = SUBPICTURE_ALIGN_TOP;
/* Normal text subs, easy markup */
p_spu->i_flags = SUBPICTURE_ALIGN_BOTTOM;
p_spu->i_flags = p_sys->i_align;
p_spu->i_start = p_block->i_pts;
p_spu->i_stop = 0;
......@@ -389,3 +412,13 @@ static int Opaque( vlc_object_t *p_this, char const *psz_cmd,
p_sys->b_opaque = newval.b_bool;
return VLC_SUCCESS;
}
static int Align( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
decoder_sys_t *p_sys = p_data;
if( p_sys )
p_sys->i_align = newval.i_int;
return VLC_SUCCESS;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment