static int DeinterlaceCallback(vlc_object_t *object, char const *cmd, vlc_value_t oldval, vlc_value_t newval, void *data) { VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(newval); VLC_UNUSED(data); vout_thread_t *vout = (vout_thread_t *)object; /* */ const int deinterlace_state = var_GetInteger(vout, "deinterlace"); char *mode = var_GetString(vout, "deinterlace-mode"); const bool is_needed = var_GetBool(vout, "deinterlace-needed"); if (!mode || !DeinterlaceIsModeValid(mode)) return VLC_EGENERIC; /* */ char *old = var_CreateGetString(vout, "sout-deinterlace-mode"); var_SetString(vout, "sout-deinterlace-mode", mode); msg_Dbg(vout, "deinterlace %d, mode %s, is_needed %d", deinterlace_state, mode, is_needed); if (deinterlace_state == 0 || (deinterlace_state < 0 && !is_needed)) vout_control_PushBool(&vout->p->control, VOUT_CONTROL_CHANGE_INTERLACE, false); else vout_control_PushBool(&vout->p->control, VOUT_CONTROL_CHANGE_INTERLACE, true); /* */ free(old); free(mode); return VLC_SUCCESS; }
static int MarshalPlaybackStatus( intf_thread_t *p_intf, DBusMessageIter *container ) { input_thread_t *p_input = pl_CurrentInput( p_intf ); const char *psz_playback_status; if( p_input != NULL ) { switch( var_GetInteger( p_input, "state" ) ) { case OPENING_S: case PLAYING_S: psz_playback_status = PLAYBACK_STATUS_PLAYING; break; case PAUSE_S: psz_playback_status = PLAYBACK_STATUS_PAUSED; break; default: psz_playback_status = PLAYBACK_STATUS_STOPPED; } vlc_object_release( (vlc_object_t*) p_input ); } else psz_playback_status = PLAYBACK_STATUS_STOPPED; if( !dbus_message_iter_append_basic( container, DBUS_TYPE_STRING, &psz_playback_status ) ) return VLC_ENOMEM; return VLC_SUCCESS; }
static void test_change( libvlc_int_t *p_libvlc ) { /* Add min, max and step Yes we can have min > max but we don't really care */ vlc_value_t val; int i_min, i_max, i_step; var_Create( p_libvlc, "bla", VLC_VAR_INTEGER ); val.i_int = i_min = rand(); var_Change( p_libvlc, "bla", VLC_VAR_SETMIN, &val, NULL ); val.i_int = i_max = rand(); var_Change( p_libvlc, "bla", VLC_VAR_SETMAX, &val, NULL ); val.i_int = i_step = rand(); var_Change( p_libvlc, "bla", VLC_VAR_SETSTEP, &val, NULL ); /* Do something */ var_SetInteger( p_libvlc, "bla", rand() ); val.i_int = var_GetInteger( p_libvlc, "bla" ); /* dummy read */ /* Test everything is right */ var_Change( p_libvlc, "bla", VLC_VAR_GETMIN, &val, NULL ); assert( val.i_int = i_min ); var_Change( p_libvlc, "bla", VLC_VAR_GETMAX, &val, NULL ); assert( val.i_int = i_max ); var_Change( p_libvlc, "bla", VLC_VAR_GETSTEP, &val, NULL ); assert( val.i_int = i_step ); var_Destroy( p_libvlc, "bla" ); }
static void MarshalPlaybackStatus( intf_thread_t *p_intf, DBusMessageIter *container ) { input_thread_t *p_input; const char *psz_playback_status; if( ( p_input = playlist_CurrentInput( p_intf->p_sys->p_playlist ) ) ) { switch( var_GetInteger( p_input, "state" ) ) { case OPENING_S: case PLAYING_S: psz_playback_status = PLAYBACK_STATUS_PLAYING; break; case PAUSE_S: psz_playback_status = PLAYBACK_STATUS_PAUSED; break; default: psz_playback_status = PLAYBACK_STATUS_STOPPED; } vlc_object_release( (vlc_object_t*) p_input ); } else psz_playback_status = PLAYBACK_STATUS_STOPPED; dbus_message_iter_append_basic( container, DBUS_TYPE_STRING, &psz_playback_status ); }
/***************************************************************************** * sout_MuxSendBuffer: *****************************************************************************/ void sout_MuxSendBuffer( sout_mux_t *p_mux, sout_input_t *p_input, block_t *p_buffer ) { block_FifoPut( p_input->p_fifo, p_buffer ); if( p_mux->p_sout->i_out_pace_nocontrol ) { mtime_t current_date = mdate(); if ( current_date > p_buffer->i_dts ) msg_Warn( p_mux, "late buffer for mux input (%"PRId64")", current_date - p_buffer->i_dts ); } if( p_mux->b_waiting_stream ) { const int64_t i_caching = var_GetInteger( p_mux->p_sout, "sout-mux-caching" ) * INT64_C(1000); if( p_mux->i_add_stream_start < 0 ) p_mux->i_add_stream_start = p_buffer->i_dts; /* Wait until we have enought data before muxing */ if( p_mux->i_add_stream_start < 0 || p_buffer->i_dts < p_mux->i_add_stream_start + i_caching ) return; p_mux->b_waiting_stream = false; } p_mux->pf_mux( p_mux ); }
void InputManager::UpdateTeletext() { if( hasInput() ) { const bool b_enabled = var_CountChoices( p_input, "teletext-es" ) > 0; const int i_teletext_es = var_GetInteger( p_input, "teletext-es" ); /* Teletext is possible. Show the buttons */ emit teletextPossible( b_enabled ); /* If Teletext is selected */ if( b_enabled && i_teletext_es >= 0 ) { /* Then, find the current page */ int i_page = 100; bool b_transparent = false; if( p_input_vbi ) { var_DelCallback( p_input_vbi, "vbi-page", VbiEvent, this ); vlc_object_release( p_input_vbi ); } if( input_GetEsObjects( p_input, i_teletext_es, &p_input_vbi, NULL, NULL ) ) p_input_vbi = NULL; if( p_input_vbi ) { /* This callback is not remove explicitly, but interfaces * are guaranted to outlive input */ var_AddCallback( p_input_vbi, "vbi-page", VbiEvent, this ); i_page = var_GetInteger( p_input_vbi, "vbi-page" ); b_transparent = !var_GetBool( p_input_vbi, "vbi-opaque" ); } emit newTelexPageSet( i_page ); emit teletextTransparencyActivated( b_transparent ); } emit teletextActivated( b_enabled && i_teletext_es >= 0 ); } else { emit teletextActivated( false ); emit teletextPossible( false ); } }
/***************************************************************************** * MouseEvent: callback for mouse events *****************************************************************************/ static int MouseEvent( vlc_object_t *p_this, char const *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { VLC_UNUSED(p_this); VLC_UNUSED(oldval); VLC_UNUSED(newval); int i_mouse_x, i_mouse_y; intf_thread_t *p_intf = (intf_thread_t *)p_data; /* Do nothing when the interface is already requested */ if( p_intf->p_sys->b_triggered ) return VLC_SUCCESS; /* Nothing to do when not in fullscreen mode */ if( !var_GetBool( p_intf->p_sys->p_vout, "fullscreen" ) ) return VLC_SUCCESS; vlc_mutex_lock( &p_intf->p_sys->lock ); if( !strcmp( psz_var, "mouse-moved" ) && !p_intf->p_sys->b_button_pressed ) { i_mouse_x = var_GetInteger( p_intf->p_sys->p_vout, "mouse-x" ); i_mouse_y = var_GetInteger( p_intf->p_sys->p_vout, "mouse-y" ); /* Very basic test, we even ignore the x value :) */ if ( i_mouse_y < p_intf->p_sys->i_threshold ) { msg_Dbg( p_intf, "interface showing requested" ); p_intf->p_sys->b_triggered = true; } } /* We keep track of the button state to avoid interferences with the * gestures plugin */ if( !p_intf->p_sys->b_button_pressed && !strcmp( psz_var, "mouse-button-down" ) ) { p_intf->p_sys->b_button_pressed = true; } if( p_intf->p_sys->b_button_pressed && !strcmp( psz_var, "mouse-button-down" ) ) { p_intf->p_sys->b_button_pressed = false; } vlc_mutex_unlock( &p_intf->p_sys->lock ); return VLC_SUCCESS; }
void input_SendEventProgramScrambled( input_thread_t *p_input, int i_group, bool b_scrambled ) { if( var_GetInteger( p_input, "program" ) != i_group ) return; var_SetBool( p_input, "program-scrambled", b_scrambled ); Trigger( p_input, INPUT_EVENT_PROGRAM ); }
std::string StreamTime::getAsStringDuration( bool bShortFormat ) const { if( !havePosition() ) return "-:--:--"; vlc_tick_t time = var_GetInteger( getIntf()->p_sys->p_input, "length" ); return formatTime( SEC_FROM_VLC_TICK(time), bShortFormat ); }
string StreamTime::getAsStringDuration( bool bShortFormat ) const { if( !havePosition() ) return "-:--:--"; mtime_t time = var_GetInteger( getIntf()->p_sys->p_input, "length" ); return formatTime( time / CLOCK_FREQ, bShortFormat ); }
/***************************************************************************** * vout_RequestWindow: Create/Get a video window if possible. ***************************************************************************** * This function looks for the main interface and tries to request * a new video window. If it fails then the vout will still need to create the * window by itself. *****************************************************************************/ void *vout_RequestWindow( vout_thread_t *p_vout, int *pi_x_hint, int *pi_y_hint, unsigned int *pi_width_hint, unsigned int *pi_height_hint ) { /* Small kludge */ if( !var_Type( p_vout, "aspect-ratio" ) ) vout_IntfInit( p_vout ); /* Get requested coordinates */ *pi_x_hint = var_GetInteger( p_vout, "video-x" ); *pi_y_hint = var_GetInteger( p_vout, "video-y" ); *pi_width_hint = p_vout->i_window_width; *pi_height_hint = p_vout->i_window_height; /* Check whether someone provided us with a window ID */ int drawable = var_CreateGetInteger( p_vout, "drawable" ); if( drawable ) return (void *)(intptr_t)drawable; vout_window_t *wnd = vlc_custom_create (VLC_OBJECT(p_vout), sizeof (*wnd), VLC_OBJECT_GENERIC, "window"); if (wnd == NULL) return NULL; wnd->vout = p_vout; wnd->width = *pi_width_hint; wnd->height = *pi_height_hint; wnd->pos_x = *pi_x_hint; wnd->pos_y = *pi_y_hint; vlc_object_attach (wnd, p_vout); wnd->module = module_Need (wnd, "vout window", 0, 0); if (wnd->module == NULL) { msg_Dbg (wnd, "no window provider available"); vlc_object_release (wnd); return NULL; } p_vout->p_window = wnd; *pi_width_hint = wnd->width; *pi_height_hint = wnd->height; *pi_x_hint = wnd->pos_x; *pi_y_hint = wnd->pos_y; return wnd->handle; }
/* User togglePlayPause */ void InputManager::togglePlayPause() { if( hasInput() ) { int state = var_GetInteger( p_input, "state" ); state = ( state != PLAYING_S ) ? PLAYING_S : PAUSE_S; var_SetInteger( p_input, "state", state ); } }
/************************************************************************** * get_agl **************************************************************************/ uint32_t libvlc_media_player_get_agl( libvlc_media_player_t *p_mi ) { assert (p_mi != NULL); #ifdef __APPLE__ return var_GetInteger (p_mi, "drawable-agl"); #else return 0; #endif }
void VlcProc::on_sample_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal ) { input_thread_t* pInput = (input_thread_t*) p_obj; assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput ); int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000; SET_TEXT( m_cVarStreamSampleRate, UString::fromInt(getIntf(),sampleRate) ); }
/***************************************************************************** * Activate: allocate a chroma function ***************************************************************************** * This function allocates and initializes a chroma function *****************************************************************************/ static int Activate( filter_t *p_filter, int (*pf_build)(filter_t *) ) { filter_sys_t *p_sys; int i_ret = VLC_EGENERIC; p_sys = p_filter->p_sys = calloc( 1, sizeof( *p_sys ) ); if( !p_sys ) return VLC_ENOMEM; filter_owner_t owner = { .video = &filter_video_chain_cbs, .sys = p_filter, }; p_sys->p_chain = filter_chain_NewVideo( p_filter, p_filter->b_allow_fmt_out_change, &owner ); if( !p_sys->p_chain ) { free( p_sys ); return VLC_EGENERIC; } int type = VLC_VAR_INTEGER; if( var_Type( p_filter->obj.parent, "chain-level" ) != 0 ) type |= VLC_VAR_DOINHERIT; var_Create( p_filter, "chain-level", type ); /* Note: atomicity is not actually needed here. */ var_IncInteger( p_filter, "chain-level" ); int level = var_GetInteger( p_filter, "chain-level" ); if( level < 0 || level > CHAIN_LEVEL_MAX ) msg_Err( p_filter, "Too high level of recursion (%d)", level ); else i_ret = pf_build( p_filter ); var_Destroy( p_filter, "chain-level" ); if( i_ret ) { /* Hum ... looks like this really isn't going to work. Too bad. */ if (p_sys->p_video_filter) filter_DelProxyCallbacks( p_filter, p_sys->p_video_filter, RestartFilterCallback ); filter_chain_Delete( p_sys->p_chain ); free( p_sys ); return VLC_EGENERIC; } if( p_filter->b_allow_fmt_out_change ) { es_format_Clean( &p_filter->fmt_out ); es_format_Copy( &p_filter->fmt_out, filter_chain_GetFmtOut( p_sys->p_chain ) ); } /* */ p_filter->pf_video_filter = Chain; return VLC_SUCCESS; }
/************************************************************************** * get_hwnd **************************************************************************/ void *libvlc_media_player_get_hwnd( libvlc_media_player_t *p_mi ) { assert (p_mi != NULL); #if defined (_WIN32) || defined (__OS2__) return (void *)(uintptr_t)var_GetInteger (p_mi, "drawable-hwnd"); #else return NULL; #endif }
/** HACK for the navigation submenu: * "title %2i" variables take the value 0 if not set */ static bool CheckTitle( vlc_object_t *p_object, const char *psz_var ) { int i_title = 0; if( sscanf( psz_var, "title %2i", &i_title ) <= 0 ) return true; int i_current_title = var_GetInteger( p_object, "title" ); return ( i_title == i_current_title ); }
/***************************************************************************** * libvlc_audio_get_channel : Get the current audio channel *****************************************************************************/ int libvlc_audio_get_channel( libvlc_media_player_t *mp ) { aout_instance_t *p_aout = GetAOut( mp ); if( !p_aout ) return 0; int val = var_GetInteger( p_aout, "audio-channels" ); vlc_object_release( p_aout ); return val; }
/* 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; }
/***************************************************************************** * libvlc_audio_get_channel : Get the current audio channel *****************************************************************************/ int libvlc_audio_get_channel( libvlc_media_player_t *mp ) { audio_output_t *p_aout = GetAOut( mp ); if( !p_aout ) return 0; int val = var_GetInteger( p_aout, "stereo-mode" ); vlc_object_release( p_aout ); return val; }
void VlcProc::on_bit_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal ) { (void)newVal; input_thread_t* pInput = (input_thread_t*) p_obj; assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput ); int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000; SET_TEXT( m_cVarStreamBitRate, UString::fromInt( getIntf(), bitrate ) ); }
/***************************************************************************** * libvlc_audio_get_track : Get the current audio track *****************************************************************************/ int libvlc_audio_get_track( libvlc_media_player_t *p_mi ) { input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi ); if( !p_input_thread ) return -1; int id = var_GetInteger( p_input_thread, "audio-es" ); vlc_object_release( p_input_thread ); return id; }
void InputManager::UpdateStatus() { /* Update playing status */ int state = var_GetInteger( p_input, "state" ); if( i_old_playing_status != state ) { i_old_playing_status = state; emit playingStatusChanged( state ); } }
static int inputStateCallback( vlc_object_t *obj, const char *var, vlc_value_t old, vlc_value_t cur, void *p_data ) { VLC_UNUSED(obj);VLC_UNUSED(var);VLC_UNUSED(old); fingerprinter_sys_t *p_sys = (fingerprinter_sys_t *) p_data; if ( cur.i_int != INPUT_EVENT_STATE ) return VLC_SUCCESS; p_sys->condwait.i_input_state = var_GetInteger( p_sys->p_input, "state" ); vlc_cond_signal( & p_sys->condwait.wait ); return VLC_SUCCESS; }
/***************************************************************************** * VLCView::VLCView *****************************************************************************/ VLCView::VLCView(BRect bounds, vout_thread_t *p_vout_instance ) : BView(bounds, "video view", B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED), fLastMouseMovedTime(mdate()), fCursorHidden(false), fCursorInside(false), fIgnoreDoubleClick(false) { p_vout = p_vout_instance; fMouseHideTimeout = var_GetInteger(p_vout, "mouse-hide-timeout") * 1000; SetViewColor(B_TRANSPARENT_32_BIT); }
/***************************************************************************** * libvlc_audio_get_delay : Get the current audio delay *****************************************************************************/ int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi ) { input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi ); int64_t val = 0; if( p_input_thread != NULL ) { val = var_GetInteger( p_input_thread, "audio-delay" ); vlc_object_release( p_input_thread ); } return val; }
/***************************************************************************** * libvlc_audio_get_channel : Get the current audio channel *****************************************************************************/ int libvlc_audio_get_channel( libvlc_instance_t *p_instance, libvlc_exception_t *p_e ) { aout_instance_t *p_aout = GetAOut( p_instance, p_e ); if( !p_aout ) return 0; int val = var_GetInteger( p_aout, "audio-channels" ); vlc_object_release( p_aout ); return val; }
/***************************************************************************** * libvlc_audio_output_get_device_type : Get the current audio device type *****************************************************************************/ int libvlc_audio_output_get_device_type( libvlc_media_player_t *mp ) { aout_instance_t *p_aout = GetAOut( mp ); if( p_aout ) { int i_device_type = var_GetInteger( p_aout, "audio-device" ); vlc_object_release( p_aout ); return i_device_type; } return libvlc_AudioOutputDevice_Error; }
static int PPNameCallback( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { VLC_UNUSED(psz_var); VLC_UNUSED(oldval); VLC_UNUSED(p_data); filter_t *p_filter = (filter_t *)p_this; int i_quality = var_GetInteger( p_filter, FILTER_PREFIX "q" ); PPChangeMode( p_filter, *newval.psz_string ? newval.psz_string : NULL, i_quality ); return VLC_SUCCESS; }
static int TimeOffsetCallback( vlc_object_t *obj, char const *varname, vlc_value_t prev, vlc_value_t cur, void *data ) { VLC_UNUSED(varname); VLC_UNUSED(prev); VLC_UNUSED(data); int64_t i_time = var_GetInteger( obj, "time" ) + cur.i_int; if( i_time < 0 ) i_time = 0; var_SetInteger( obj, "time", i_time ); return VLC_SUCCESS; }