/* global video settings */
+/* Deprecated use libvlc_media_player_set_drawable() */
void libvlc_video_set_parent( libvlc_instance_t *p_instance, libvlc_drawable_t d,
libvlc_exception_t *p_e )
{
}
}
+/* Deprecated use libvlc_media_player_get_drawable() */
libvlc_drawable_t libvlc_video_get_parent( libvlc_instance_t *p_instance, libvlc_exception_t *p_e )
{
VLC_UNUSED(p_e);
libvlc_drawable_t result;
-
+
result = var_GetInteger( p_instance->p_libvlc_int, "drawable" );
-
+
return result;
}
return i_spu;
}
+int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi,
+ libvlc_exception_t *p_e )
+{
+ input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
+ vlc_value_t val_list;
+
+ if( !p_input_thread )
+ return -1;
+
+ var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
+ vlc_object_release( p_input_thread );
+ return val_list.p_list->i_count;
+}
+
+libvlc_track_description_t *
+ libvlc_video_get_spu_description( libvlc_media_player_t *p_mi,
+ libvlc_exception_t *p_e )
+{
+ return libvlc_get_track_description( p_mi, "spu-es", p_e);
+}
+
void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
libvlc_exception_t *p_e )
{
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
vlc_value_t val_list;
+ vlc_value_t newval;
int i_ret = -1;
- int i;
if( !p_input_thread ) return;
var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
- for( i = 0; i < val_list.p_list->i_count; i++ )
+ if( (i_spu < 0) && (i_spu > val_list.p_list->i_count) )
{
- vlc_value_t val = val_list.p_list->p_values[i];
- if( i_spu == i )
- {
- vlc_value_t new_val;
+ libvlc_exception_raise( p_e, "Subtitle value out of range" );
+ vlc_object_release( p_input_thread );
+ return;
+ }
- new_val.i_int = val.i_int;
- i_ret = var_Set( p_input_thread, "spu-es", new_val );
- if( i_ret < 0 )
- {
- libvlc_exception_raise( p_e, "Setting subtitle value failed" );
- }
- vlc_object_release( p_input_thread );
- return;
- }
+ newval = val_list.p_list->p_values[i_spu];
+ i_ret = var_Set( p_input_thread, "spu-es", newval );
+ if( i_ret < 0 )
+ {
+ libvlc_exception_raise( p_e, "Setting subtitle value failed" );
}
- libvlc_exception_raise( p_e, "Subtitle value out of range" );
vlc_object_release( p_input_thread );
}
if( p_input_thread )
{
- if( input_AddSubtitles( p_input_thread, psz_subtitle, true ) )
+ if( !input_AddSubtitle( p_input_thread, psz_subtitle, true ) )
b_ret = true;
vlc_object_release( p_input_thread );
}
return b_ret;
}
+libvlc_track_description_t *
+ libvlc_video_get_title_description( libvlc_media_player_t *p_mi,
+ libvlc_exception_t * p_e )
+{
+ return libvlc_get_track_description( p_mi, "title", p_e);
+}
+
+libvlc_track_description_t *
+ libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi,
+ int i_title,
+ libvlc_exception_t *p_e )
+{
+ char psz_title[12];
+ sprintf( psz_title, "title %2i", i_title );
+ return libvlc_get_track_description( p_mi, psz_title, p_e);
+}
+
char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e )
{
{
i_ret = var_SetInteger( p_vbi, "vbi-page", i_page );
vlc_object_release( p_vbi );
+ if( i_ret )
+ libvlc_exception_raise( p_e,
+ "Unexpected error while setting teletext page" );
}
- if( i_ret )
- libvlc_exception_raise( p_e,
- "Unexpected error while setting teletext page" );
vlc_object_release( p_vout );
}
void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e )
{
- /* We only work on the first vout */
- vout_thread_t *p_vout = GetVout( p_mi, p_e );
- bool opaque; int i_ret;
+ input_thread_t *p_input_thread;
+ vlc_object_t *p_vbi;
+ int i_ret;
- /* GetVout will raise the exception for us */
- if( !p_vout ) return;
+ p_input_thread = libvlc_get_input_thread(p_mi, p_e);
+ if( !p_input_thread ) return;
- opaque = var_GetBool( p_vout, "vbi-opaque" );
- i_ret = var_SetBool( p_vout, "vbi-opaque", !opaque );
- if( i_ret )
- libvlc_exception_raise( p_e,
- "Unexpected error while setting teletext value" );
+ p_vbi = (vlc_object_t *) vlc_object_find_name( p_input_thread, "zvbi",
+ FIND_ANYWHERE );
+ if( p_vbi )
+ {
+ const int i_teletext_es = var_GetInteger( p_input_thread, "teletext-es" );
+ const int i_spu_es = var_GetInteger( p_input_thread, "spu-es" );
- vlc_object_release( p_vout );
+ if( (i_teletext_es >= 0) && (i_teletext_es == i_spu_es) )
+ {
+ int i_page = 100;
+
+ i_page = var_GetInteger( p_vbi, "vbi-page" );
+ i_page = (i_teletext_es >= 0) ? i_page : 0;
+
+ i_ret = var_SetInteger( p_vbi, "vbi-page", i_page );
+ if( i_ret )
+ libvlc_exception_raise( p_e,
+ "Unexpected error while setting teletext page" );
+ }
+ else if( i_teletext_es >= 0 )
+ {
+ bool opaque = true;
+
+ opaque = var_GetBool( p_vbi, "vbi-opaque" );
+ i_ret = var_SetBool( p_vbi, "vbi-opaque", !opaque );
+ if( i_ret )
+ libvlc_exception_raise( p_e,
+ "Unexpected error while setting teletext transparency" );
+ }
+ vlc_object_release( p_vbi );
+ }
+ else
+ {
+ /* Teletext is not enabled yet, so enable it.
+ * Only after it is enable it is possible to view teletext pages
+ */
+ const int i_teletext_es = var_GetInteger( p_input_thread, "teletext-es" );
+
+ if( i_teletext_es >= 0 )
+ {
+ const int i_spu_es = var_GetInteger( p_input_thread, "spu-es" );
+
+ if( i_teletext_es == i_spu_es )
+ var_SetInteger( p_input_thread, "spu-es", -1 );
+ else
+ var_SetInteger( p_input_thread, "spu-es", i_teletext_es );
+ }
+ }
+ vlc_object_release( p_input_thread );
+}
+
+int libvlc_video_get_track_count( libvlc_media_player_t *p_mi,
+ libvlc_exception_t *p_e )
+{
+ input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
+ vlc_value_t val_list;
+
+ if( !p_input_thread )
+ return -1;
+
+ var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
+ vlc_object_release( p_input_thread );
+ return val_list.p_list->i_count;
+}
+
+libvlc_track_description_t *
+ libvlc_video_get_track_description( libvlc_media_player_t *p_mi,
+ libvlc_exception_t *p_e )
+{
+ return libvlc_get_track_description( p_mi, "video-es", p_e);
+}
+
+int libvlc_video_get_track( libvlc_media_player_t *p_mi,
+ libvlc_exception_t *p_e )
+{
+ input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
+ vlc_value_t val_list;
+ vlc_value_t val;
+ int i_track = -1;
+ int i_ret = -1;
+ int i;
+
+ if( !p_input_thread )
+ return -1;
+
+ i_ret = var_Get( p_input_thread, "video-es", &val );
+ if( i_ret < 0 )
+ {
+ libvlc_exception_raise( p_e, "Getting Video track information failed" );
+ vlc_object_release( p_input_thread );
+ return i_ret;
+ }
+
+ var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
+ for( i = 0; i < val_list.p_list->i_count; i++ )
+ {
+ vlc_value_t track_val = val_list.p_list->p_values[i];
+ if( track_val.i_int == val.i_int )
+ {
+ i_track = i;
+ break;
+ }
+ }
+ vlc_object_release( p_input_thread );
+ return i_track;
+}
+
+void libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track,
+ libvlc_exception_t *p_e )
+{
+ input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
+ vlc_value_t val_list;
+ int i_ret = -1;
+ int i;
+
+ if( !p_input_thread )
+ return;
+
+ var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
+ for( i = 0; i < val_list.p_list->i_count; i++ )
+ {
+ vlc_value_t val = val_list.p_list->p_values[i];
+ if( i_track == val.i_int )
+ {
+ i_ret = var_Set( p_input_thread, "audio-es", val );
+ if( i_ret < 0 )
+ libvlc_exception_raise( p_e, "Setting video track failed" );
+ vlc_object_release( p_input_thread );
+ return;
+ }
+ }
+ libvlc_exception_raise( p_e, "Video track out of range" );
+ vlc_object_release( p_input_thread );
}
int libvlc_video_destroy( libvlc_media_player_t *p_mi,