/**************************************************************************** * DisplayAnchor: displays an anchor on the given video output ****************************************************************************/ static int DisplayAnchor( intf_thread_t *p_intf, vout_thread_t *p_vout, char *psz_anchor_description, char *psz_anchor_url ) { int i_margin_h, i_margin_v; mtime_t i_now; i_margin_h = 0; i_margin_v = 10; i_now = mdate(); if( p_vout ) { text_style_t *p_style = NULL; text_style_t blue_with_underline = default_text_style; blue_with_underline.b_underline = VLC_TRUE; blue_with_underline.i_color = 0x22ff22; if( psz_anchor_url ) { /* Should display subtitle underlined and in blue, * but it looks like VLC doesn't implement any * text styles yet. D'oh! */ p_style = &blue_with_underline; } /* TODO: p_subpicture doesn't have the proper i_x and i_y * coordinates. Need to look at the subpicture display system to * work out why. */ if ( vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN, psz_anchor_description, p_style, OSD_ALIGN_BOTTOM, i_margin_h, i_margin_v, i_now, 0 ) == VLC_SUCCESS ) { /* Displayed successfully */ #ifdef CMML_INTF_SUBPICTURE_DEBUG msg_Dbg( p_intf, "subpicture created at (%d, %d) (%d, %d)", p_subpicture->i_x, p_subpicture->i_y, p_subpicture->i_width, p_subpicture->i_height ); #endif } else { return VLC_EGENERIC; } } else { msg_Dbg( p_intf, "DisplayAnchor couldn't find a video output" ); return VLC_EGENERIC; } return VLC_SUCCESS; }
void mediacontrol_display_text( mediacontrol_Instance *self, const char * message, const mediacontrol_Position * begin, const mediacontrol_Position * end, mediacontrol_Exception *exception ) { vout_thread_t *p_vout = NULL; input_thread_t *p_input; libvlc_exception_t ex; libvlc_exception_init( &ex ); mediacontrol_exception_init( exception ); if( !message ) { RAISE_VOID( mediacontrol_InternalException, "Empty text" ); } p_input = libvlc_get_input_thread( self->p_media_player ); if( ! p_input ) { RAISE_VOID( mediacontrol_InternalException, "No input" ); } p_vout = input_GetVout( p_input ); /*FIXME: take care of the next fixme that can use p_input */ vlc_object_release( p_input ); if( ! p_vout ) { RAISE_VOID( mediacontrol_InternalException, "No video output" ); } if( begin->origin == mediacontrol_RelativePosition && begin->value == 0 && end->origin == mediacontrol_RelativePosition ) { mtime_t i_duration = 0; mtime_t i_now = mdate(); i_duration = 1000 * private_mediacontrol_unit_convert( self->p_media_player, end->key, mediacontrol_MediaTime, end->value ); mediacontrol_showtext( p_vout, DEFAULT_CHAN, message, NULL, OSD_ALIGN_BOTTOM | OSD_ALIGN_LEFT, 0, 0, i_now, i_now + i_duration ); } else { mtime_t i_debut, i_fin, i_now; /* FIXME */ /* i_now = input_ClockGetTS( p_input, NULL, 0 ); */ i_now = mdate(); i_debut = private_mediacontrol_position2microsecond( self->p_media_player, ( mediacontrol_Position* ) begin ); i_debut += i_now; i_fin = private_mediacontrol_position2microsecond( self->p_media_player, ( mediacontrol_Position * ) end ); i_fin += i_now; vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN, message, NULL, OSD_ALIGN_BOTTOM | OSD_ALIGN_LEFT, 0, 0, i_debut, i_fin ); } vlc_object_release( p_vout ); }