Commit 0ee22e97 authored by Thomas Guillem's avatar Thomas Guillem

libvlc: libvlc_video_set_teletext can send keys

parent a555034b
......@@ -148,6 +148,18 @@ typedef enum libvlc_position_t {
libvlc_position_bottom_right
} libvlc_position_t;
/**
* Enumeration of teletext keys than can be passed via
* libvlc_video_set_teletext()
*/
typedef enum libvlc_teletext_key_t {
libvlc_teletext_key_red = 'r' << 16,
libvlc_teletext_key_green = 'g' << 16,
libvlc_teletext_key_yellow = 'y' << 16,
libvlc_teletext_key_blue = 'b' << 16,
libvlc_teletext_key_index = 'i' << 16,
} libvlc_teletext_key_t;
/**
* Opaque equalizer handle.
*
......@@ -1350,10 +1362,12 @@ LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
/**
* Set new teletext page to retrieve.
*
* This function can also be used to send a teletext key.
*
* \param p_mi the media player
* \param i_page teletex page number requested. This value can be -1 to disable
* teletext or a number in the range [0;1000[ to show the requested page. 100
* is the default teletext page.
* teletext, a number in the range [0;1000[ to show the requested page, or a
* \ref libvlc_teletext_key_t. 100 is the default teletext page.
*/
LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
......
......@@ -514,14 +514,31 @@ void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page )
input_thread_t *p_input_thread;
vlc_object_t *p_zvbi = NULL;
int telx;
bool b_key = false;
if( i_page >= 0 && i_page < 1000 )
var_SetInteger( p_mi, "vbi-page", i_page );
else if( i_page != -1 )
else if( i_page < -1 )
{
libvlc_printerr("Invalid page number");
return;
}
else
{
switch (i_page)
{
case libvlc_teletext_key_red:
case libvlc_teletext_key_green:
case libvlc_teletext_key_yellow:
case libvlc_teletext_key_blue:
case libvlc_teletext_key_index:
b_key = true;
break;
default:
libvlc_printerr("Invalid key action");
return;
}
}
p_input_thread = libvlc_get_input_thread( p_mi );
if( !p_input_thread ) return;
......@@ -548,11 +565,13 @@ void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page )
vlc_object_release( p_zvbi );
}
}
else
else if (!b_key)
{
/* the "vbi-page" will be selected on es creation */
teletext_enable( p_input_thread, true );
}
else
libvlc_printerr("Key action sent while the teletext is disabled");
}
vlc_object_release( p_input_thread );
}
......
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