Commit 9e4c6586 authored by Jean-Paul Saman's avatar Jean-Paul Saman
Browse files

libvlc: restore Teletext functionality

Reverts part of 7db94f4d and rewrite the code.
parent 69343b74
/*****************************************************************************
* libvlc_media_player.h: libvlc_media_player external API
*****************************************************************************
* Copyright (C) 1998-2009 the VideoLAN team
* Copyright (C) 1998-2010 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
......@@ -712,6 +712,23 @@ VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_media_player_t * );
VLC_PUBLIC_API
void libvlc_video_set_crop_geometry( libvlc_media_player_t *, const char * );
/**
* Get current teletext page requested.
*
* \param p_mediaplayer the media player
* \return the current teletext page requested.
*/
VLC_PUBLIC_API int libvlc_video_get_teletext( libvlc_media_player_t * );
/**
* Set new teletext page to retrieve.
*
* \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 * );
/**
* Toggle teletext transparent status on video output.
*
......
......@@ -1180,34 +1180,28 @@ STDMETHODIMP VLCVideo::get_teletext(long* page)
libvlc_media_player_t *p_md;
HRESULT hr = getMD(&p_md);
#if 0
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
*page = libvlc_video_get_teletext(p_md);
hr = exception_bridge(&ex);
}
#endif
return hr;
};
STDMETHODIMP VLCVideo::put_teletext(long page)
{
#warning Broken
libvlc_media_player_t *p_md;
HRESULT hr = getMD(&p_md);
#if 0
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_video_set_teletext(p_md, page);
libvlc_video_set_teletext(p_md, page, &ex);
hr = exception_bridge(&ex);
}
#endif
return hr;
};
......
......@@ -1381,12 +1381,11 @@ LibvlcVideoNPObject::getProperty(int index, NPVariant &result)
}
case ID_video_teletext:
{
/* int i_page = libvlc_video_get_teletext(p_md, &ex);
RETURN_ON_EXCEPTION(this,ex);
int i_page = libvlc_video_get_teletext(p_md);
if( i_page < 0 )
return INVOKERESULT_GENERIC_ERROR;
INT32_TO_NPVARIANT(i_page, result);
return INVOKERESULT_NO_ERROR;
*/
return INVOKERESULT_NO_SUCH_METHOD;
}
case ID_video_marquee:
{
......@@ -1491,13 +1490,10 @@ LibvlcVideoNPObject::setProperty(int index, const NPVariant &value)
{
if( isNumberValue(value) )
{
/*
libvlc_video_set_teletext(p_md, numberValue(value), &ex);
RETURN_ON_EXCEPTION(this,ex);
return INVOKERESULT_NO_ERROR;
*/
return INVOKERESULT_NO_SUCH_METHOD;
}
return INVOKERESULT_INVALID_VALUE;
}
......
......@@ -388,6 +388,63 @@ void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi,
free (pp_vouts);
}
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;
}
void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page,
libvlc_exception_t *p_e )
{
input_thread_t *p_input_thread;
vlc_object_t *p_zvbi = NULL;
int telx;
p_input_thread = libvlc_get_input_thread( p_mi );
if( !p_input_thread ) return;
if( var_CountChoices( p_input_thread, "teletext-es" ) <= 0 )
{
vlc_object_release( p_input_thread );
return;
}
telx = var_GetInteger( p_input_thread, "teletext-es" );
if( input_GetEsObjects( p_input_thread, telx, &p_zvbi, NULL, NULL )
!= VLC_SUCCESS )
{
int i_ret = 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 );
}
void libvlc_toggle_teletext( libvlc_media_player_t *p_mi )
{
input_thread_t *p_input_thread;
......
......@@ -176,6 +176,7 @@ libvlc_video_get_scale
libvlc_video_get_spu
libvlc_video_get_spu_count
libvlc_video_get_spu_description
libvlc_video_get_teletext
libvlc_video_get_title_description
libvlc_video_get_track
libvlc_video_get_track_count
......@@ -193,6 +194,7 @@ libvlc_video_set_mouse_input
libvlc_video_set_scale
libvlc_video_set_spu
libvlc_video_set_subtitle_file
libvlc_video_set_teletext
libvlc_video_set_track
libvlc_video_take_snapshot
libvlc_vlm_add_broadcast
......
Supports Markdown
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