Commit 4d76e256 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

LibVLC teletext: various fixes

 * allow setting page all the time,
 * remove dummy exception,
 * fix an object leak,
 * remove impossible error,
 * fix apparently inverted logic.
parent 55ba1763
......@@ -725,9 +725,8 @@ VLC_PUBLIC_API int libvlc_video_get_teletext( libvlc_media_player_t * );
*
* \param p_mediaplayer the media player
* \param i_page teletex page number requested
* \param p_e an initialized exception pointer
*/
VLC_PUBLIC_API void libvlc_video_set_teletext( libvlc_media_player_t *, int, libvlc_exception_t * );
VLC_PUBLIC_API void libvlc_video_set_teletext( libvlc_media_player_t *, int );
/**
* Toggle teletext transparent status on video output.
......
......@@ -365,6 +365,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
var_Create (mp, "crop", VLC_VAR_STRING);
var_Create (mp, "deinterlace", VLC_VAR_INTEGER);
var_Create (mp, "deinterlace-mode", VLC_VAR_STRING);
var_Create (mp, "vbi-page", VLC_VAR_INTEGER);
/* Audio */
var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
......
......@@ -390,37 +390,17 @@ void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi,
int libvlc_video_get_teletext( libvlc_media_player_t *p_mi )
{
input_thread_t *p_input_thread;
vlc_object_t *p_zvbi = NULL;
int i_ret = -1, telx;
p_input_thread = libvlc_get_input_thread( p_mi );
if( !p_input_thread ) return i_ret;
if( var_CountChoices( p_input_thread, "teletext-es" ) <= 0 )
{
vlc_object_release( p_input_thread );
return i_ret;
}
telx = var_GetInteger( p_input_thread, "teletext-es" );
if( input_GetEsObjects( p_input_thread, telx, &p_zvbi, NULL, NULL )
!= VLC_SUCCESS )
{
i_ret = var_GetInteger( p_zvbi, "vbi-page" );
vlc_object_release( p_zvbi );
}
vlc_object_release( p_input_thread );
return i_ret;
return var_GetInteger (p_mi, "vbi-page");
}
void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page,
libvlc_exception_t *p_e )
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;
var_SetInteger (p_mi, "vbi-page", i_page);
p_input_thread = libvlc_get_input_thread( p_mi );
if( !p_input_thread ) return;
......@@ -432,15 +412,10 @@ void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page,
telx = var_GetInteger( p_input_thread, "teletext-es" );
if( input_GetEsObjects( p_input_thread, telx, &p_zvbi, NULL, NULL )
!= VLC_SUCCESS )
== VLC_SUCCESS )
{
int i_ret = var_SetInteger( p_zvbi, "vbi-page", i_page );
var_SetInteger( p_zvbi, "vbi-page", i_page );
vlc_object_release( p_zvbi );
if( i_ret )
{
libvlc_exception_raise( p_e );
libvlc_printerr( "Unexpected error while setting teletext page" );
}
}
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