void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned timeout ) { if ( position != libvlc_position_disable ) { var_SetBool( p_mi, "video-title-show", true ); var_SetInteger( p_mi, "video-title-position", position ); var_SetInteger( p_mi, "video-title-timeout", timeout ); } else { var_SetBool( p_mi, "video-title-show", false ); } }
void ActionsManager::doAction( int id_action ) { switch( id_action ) { case PLAY_ACTION: play(); break; case STOP_ACTION: THEMIM->stop(); break; case OPEN_ACTION: THEDP->openDialog(); break; case PREVIOUS_ACTION: THEMIM->prev(); break; case NEXT_ACTION: THEMIM->next(); break; case SLOWER_ACTION: THEMIM->getIM()->slower(); break; case FASTER_ACTION: THEMIM->getIM()->faster(); break; case FULLSCREEN_ACTION: fullscreen(); break; case EXTENDED_ACTION: THEDP->extendedDialog(); break; case PLAYLIST_ACTION: playlist(); break; case SNAPSHOT_ACTION: snapshot(); break; case RECORD_ACTION: record(); break; case FRAME_ACTION: frame(); break; case ATOB_ACTION: THEMIM->getIM()->setAtoB(); break; case REVERSE_ACTION: THEMIM->getIM()->reverse(); break; case SKIP_BACK_ACTION: var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_JUMP_BACKWARD_SHORT ); break; case SKIP_FW_ACTION: var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_JUMP_FORWARD_SHORT ); break; case QUIT_ACTION: THEDP->quit(); break; default: msg_Dbg( p_intf, "Action: %i", id_action ); break; } }
void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned timeout ) { assert( position >= libvlc_position_disable && position <= libvlc_position_bottom_right ); if ( position != libvlc_position_disable ) { var_SetBool( p_mi, "video-title-show", true ); var_SetInteger( p_mi, "video-title-position", position_subpicture_alignment[position] ); var_SetInteger( p_mi, "video-title-timeout", timeout ); } else { var_SetBool( p_mi, "video-title-show", false ); } }
bool VLCVarChoiceModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (!m_object->get()) return false; int row = index.row(); if (role == Qt::CheckStateRole && row >= 0 && row < m_values.count()) { //only update the variable when we select an entry if (!value.toBool()) return false; int ret = VLC_EGENERIC; switch (m_type & VLC_VAR_CLASS) { case VLC_VAR_STRING: ret = var_SetString(m_object->get(), qtu(m_varname), qtu(m_values[row].toString()) ); break; case VLC_VAR_INTEGER: ret = var_SetInteger(m_object->get(), qtu(m_varname), m_values[row].toInt() ); break; case VLC_VAR_FLOAT: ret = var_SetFloat(m_object->get(), qtu(m_varname), m_values[row].toFloat() ); break; case VLC_VAR_BOOL: ret = var_SetBool(m_object->get(), qtu(m_varname), m_values[row].toBool() ); break; default: break; } return ret == VLC_SUCCESS; } return false; }
static void Process( intf_thread_t *p_intf ) { for( ;; ) { char *code, *c; if( lirc_nextcode( &code ) ) return; if( code == NULL ) return; while( vlc_object_alive( p_intf ) && (lirc_code2char( p_intf->p_sys->config, code, &c ) == 0) && (c != NULL) ) { if( !strncmp( "key-", c, 4 ) ) { vlc_action_t i_key = vlc_GetActionId( c ); if( i_key ) var_SetInteger( p_intf->p_libvlc, "key-action", i_key ); else msg_Err( p_intf, "Unknown hotkey '%s'", c ); } else { msg_Err( p_intf, "this doesn't appear to be a valid keycombo " "lirc sent us. Please look at the " "doc/lirc/example.lirc file in VLC" ); break; } } free( code ); } }
/***************************************************************************** * aout_VolumeDown : lower the output volume ***************************************************************************** * If pi_volume != NULL, *pi_volume will contain the volume at the end of the * function. *****************************************************************************/ int __aout_VolumeDown( vlc_object_t * p_object, int i_nb_steps, audio_volume_t * pi_volume ) { vlc_value_t val; aout_instance_t * p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT, FIND_ANYWHERE ); int i_result = 0, i_volume = 0, i_volume_step = 0; i_volume_step = config_GetInt( p_object->p_libvlc, "volume-step" ); i_volume = config_GetInt( p_object, "volume" ); i_volume -= i_volume_step * i_nb_steps; if ( i_volume < AOUT_VOLUME_MIN ) { i_volume = AOUT_VOLUME_MIN; } config_PutInt( p_object, "volume", i_volume ); var_Create( p_object->p_libvlc, "saved-volume", VLC_VAR_INTEGER ); var_SetInteger( p_object->p_libvlc, "saved-volume", (audio_volume_t) i_volume ); if ( pi_volume != NULL ) *pi_volume = (audio_volume_t) i_volume; val.b_bool = true; var_Set( p_object->p_libvlc, "volume-change", val ); if ( p_aout == NULL ) return 0; aout_lock_mixer( p_aout ); if ( !p_aout->mixer.b_error ) { i_result = p_aout->output.pf_volume_set( p_aout, (audio_volume_t) i_volume ); } aout_unlock_mixer( p_aout ); vlc_object_release( p_aout ); return i_result; }
void TopWindow::processEvent( EvtScroll &rEvtScroll ) { // Raise the windows raise(); // Get the control hit by the mouse CtrlGeneric *pNewHitControl = findHitControl( rEvtScroll.getXPos(), rEvtScroll.getYPos()); setLastHit( pNewHitControl ); // Send a mouse event to the hit control, or to the control // that captured the mouse, if any CtrlGeneric *pActiveControl = pNewHitControl; if( m_pCapturingControl ) { pActiveControl = m_pCapturingControl; } if( pActiveControl ) { pActiveControl->handleEvent( rEvtScroll ); } else { // Treat the scroll event as a hotkey plus current modifiers int i = (rEvtScroll.getDirection() == EvtScroll::kUp ? KEY_MOUSEWHEELUP : KEY_MOUSEWHEELDOWN) | m_currModifier; var_SetInteger( getIntf()->p_libvlc, "key-pressed", i ); } }
/***************************************************************************** * aout_VolumeMute : Mute/un-mute the output volume ***************************************************************************** * If pi_volume != NULL, *pi_volume will contain the volume at the end of the * function (muted => 0). *****************************************************************************/ int __aout_VolumeMute( vlc_object_t * p_object, audio_volume_t * pi_volume ) { int i_result; audio_volume_t i_volume; i_volume = (audio_volume_t)config_GetInt( p_object, "volume" ); if ( i_volume != 0 ) { /* Mute */ i_result = aout_VolumeSet( p_object, AOUT_VOLUME_MIN ); var_Create( p_object->p_libvlc, "saved-volume", VLC_VAR_INTEGER ); var_SetInteger( p_object->p_libvlc, "saved-volume", (int)i_volume ); if ( pi_volume != NULL ) *pi_volume = AOUT_VOLUME_MIN; } else { /* Un-mute */ var_Create( p_object->p_libvlc, "saved-volume", VLC_VAR_INTEGER ); i_volume = (audio_volume_t)var_GetInteger( p_object->p_libvlc, "saved-volume" ); i_result = aout_VolumeSet( p_object, i_volume ); if ( pi_volume != NULL ) *pi_volume = i_volume; } return i_result; }
static void UpdateActivity( playlist_t *p_playlist, int i_delta ) { PL_ASSERT_LOCKED; const int i_activity = var_GetInteger( p_playlist, "activity" ) ; var_SetInteger( p_playlist, "activity", i_activity + i_delta ); }
/***************************************************************************** * libvlc_audio_set_track : Set the current audio track *****************************************************************************/ int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track ) { input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi ); vlc_value_t val_list; int i_ret = -1; if( !p_input_thread ) return -1; var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL ); for( int i = 0; i < val_list.p_list->i_count; i++ ) { if( i_track == val_list.p_list->p_values[i].i_int ) { if( var_SetInteger( p_input_thread, "audio-es", i_track ) < 0 ) break; i_ret = 0; goto end; } } libvlc_printerr( "Track identifier not found" ); end: var_FreeList( &val_list, NULL ); vlc_object_release( p_input_thread ); return i_ret; }
void TopWindow::processEvent( EvtScroll &rEvtScroll ) { // Raise the windows raise(); // Get the control hit by the mouse CtrlGeneric *pNewHitControl = findHitControl( rEvtScroll.getXPos(), rEvtScroll.getYPos()); setLastHit( pNewHitControl ); // send a mouse event to the right control when scrollable // if none, send it directly to the vlc core CtrlGeneric *pHitControl = m_pCapturingControl ? m_pCapturingControl : pNewHitControl; if( pHitControl && pHitControl->isScrollable() ) { pHitControl->handleEvent( rEvtScroll ); } else { // Treat the scroll event as a hotkey plus current modifiers int i = (rEvtScroll.getDirection() == EvtScroll::kUp ? KEY_MOUSEWHEELUP : KEY_MOUSEWHEELDOWN) | m_currModifier; var_SetInteger( getIntf()->p_libvlc, "key-pressed", i ); } }
virtual void processEvent( EvtKey &rEvtKey ) { // Only do the action when the key is down if( rEvtKey.getKeyState() == EvtKey::kDown ) var_SetInteger( getIntf()->p_libvlc, "key-pressed", rEvtKey.getModKey() ); }
/** * Remove all the children of a node and removes the node * * \param p_playlist the playlist * \param p_root the node * \param b_delete_items do we have to delete the children items ? * \return VLC_SUCCESS or an error */ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root, bool b_delete_items, bool b_force ) { PL_ASSERT_LOCKED; /* Delete the children */ for( int i = p_root->i_children - 1 ; i >= 0; i-- ) if( b_delete_items || p_root->pp_children[i]->i_children >= 0 ) playlist_NodeDelete( p_playlist, p_root->pp_children[i], b_delete_items, b_force ); /* Delete the node */ if( p_root->i_flags & PLAYLIST_RO_FLAG && !b_force ) return VLC_SUCCESS; pl_priv(p_playlist)->b_reset_currently_playing = true; int i; var_SetInteger( p_playlist, "playlist-item-deleted", p_root->i_id ); ARRAY_BSEARCH( p_playlist->all_items, ->i_id, int, p_root->i_id, i ); if( i != -1 ) ARRAY_REMOVE( p_playlist->all_items, i ); if( p_root->i_children == -1 ) { ARRAY_BSEARCH( p_playlist->items,->i_id, int, p_root->i_id, i ); if( i != -1 ) ARRAY_REMOVE( p_playlist->items, i ); }
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 int EventKey( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { decoder_t *p_dec = p_data; decoder_sys_t *p_sys = p_dec->p_sys; VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED( p_this ); /* FIXME: Capture + and - key for subpage browsing */ if( newval.i_int == '-' || newval.i_int == '+' ) { vlc_mutex_lock( &p_sys->lock ); if( p_sys->i_wanted_subpage == VBI_ANY_SUBNO && newval.i_int == '+' ) p_sys->i_wanted_subpage = vbi_dec2bcd(1); else if ( newval.i_int == '+' ) p_sys->i_wanted_subpage = vbi_add_bcd( p_sys->i_wanted_subpage, 1); else if( newval.i_int == '-') p_sys->i_wanted_subpage = vbi_add_bcd( p_sys->i_wanted_subpage, 0xF9999999); /* BCD complement - 1 */ if ( !vbi_bcd_digits_greater( p_sys->i_wanted_subpage, 0x00 ) || vbi_bcd_digits_greater( p_sys->i_wanted_subpage, 0x99 ) ) p_sys->i_wanted_subpage = VBI_ANY_SUBNO; else msg_Info( p_dec, "subpage: %d", vbi_bcd2dec( p_sys->i_wanted_subpage) ); p_sys->b_update = true; vlc_mutex_unlock( &p_sys->lock ); } /* Capture 0-9 for page selection */ if( newval.i_int < '0' || newval.i_int > '9' ) return VLC_SUCCESS; vlc_mutex_lock( &p_sys->lock ); p_sys->i_key[0] = p_sys->i_key[1]; p_sys->i_key[1] = p_sys->i_key[2]; p_sys->i_key[2] = (int)(newval.i_int - '0'); msg_Info( p_dec, "page: %c%c%c", (char)(p_sys->i_key[0]+'0'), (char)(p_sys->i_key[1]+'0'), (char)(p_sys->i_key[2]+'0') ); int i_new_page = 0; if( p_sys->i_key[0] > 0 && p_sys->i_key[0] <= 8 && p_sys->i_key[1] >= 0 && p_sys->i_key[1] <= 9 && p_sys->i_key[2] >= 0 && p_sys->i_key[2] <= 9 ) { i_new_page = p_sys->i_key[0]*100 + p_sys->i_key[1]*10 + p_sys->i_key[2]; p_sys->i_key[0] = p_sys->i_key[1] = p_sys->i_key[2] = '*' - '0'; } vlc_mutex_unlock( &p_sys->lock ); if( i_new_page > 0 ) var_SetInteger( p_dec, "vbi-page", i_new_page ); return VLC_SUCCESS; }
static void *Thread( void *p_data ) { intf_thread_t *p_intf = p_data; intf_sys_t *p_sys = p_intf->p_sys; xcb_connection_t *p_connection = p_sys->p_connection; int canc = vlc_savecancel(); /* */ xcb_flush( p_connection ); /* */ int fd = xcb_get_file_descriptor( p_connection ); for( ;; ) { /* Wait for x11 event */ vlc_restorecancel( canc ); struct pollfd fds = { .fd = fd, .events = POLLIN, }; if( poll( &fds, 1, -1 ) < 0 ) { if( errno != EINTR ) break; canc = vlc_savecancel(); continue; } canc = vlc_savecancel(); xcb_generic_event_t *p_event; while( ( p_event = xcb_poll_for_event( p_connection ) ) ) { if( ( p_event->response_type & 0x7f ) != XCB_KEY_PRESS ) { free( p_event ); continue; } xcb_key_press_event_t *e = (xcb_key_press_event_t *)p_event; for( int i = 0; i < p_sys->i_map; i++ ) { hotkey_mapping_t *p_map = &p_sys->p_map[i]; for( int j = 0; p_map->p_keys[j] != XCB_NO_SYMBOL; j++ ) if( p_map->p_keys[j] == e->detail && p_map->i_modifier == e->state ) { var_SetInteger( p_intf->p_libvlc, "global-key-pressed", p_map->i_vlc ); goto done; } } done: free( p_event ); } } return NULL; }
/* 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 ); } }
void InputManager::jumpBwd() { int i_interval = var_InheritInteger( p_input, "short-jump-size" ); if( i_interval > 0 && hasInput() ) { mtime_t val = -CLOCK_FREQ * i_interval; var_SetInteger( p_input, "time-offset", val ); } }
/************************************************************************** * set_xwindow **************************************************************************/ void libvlc_media_player_set_xwindow( libvlc_media_player_t *p_mi, uint32_t drawable ) { assert (p_mi != NULL); var_SetString (p_mi, "vout", drawable ? "xid" : "any"); var_SetString (p_mi, "window", drawable ? "embed-xid,any" : "any"); var_SetInteger (p_mi, "drawable-xid", drawable); }
void onPause(GtkButton *button, gpointer user_data) { intf_thread_t *p_intf = GtkGetIntf( button ); if (p_intf->p_sys->p_input != NULL) { var_SetInteger( p_intf->p_sys->p_input, "state", PAUSE_S ); } }
/***************************************************************************** * vcdIntfStillTime: function provided to reset still image *****************************************************************************/ int vcdIntfResetStillTime( intf_thread_t *p_intf ) { vlc_mutex_lock( &p_intf->change_lock ); p_intf->p_sys->m_still_time = 0; var_SetInteger( p_intf->p_sys->p_input, "state", PLAYING_S ); vlc_mutex_unlock( &p_intf->change_lock ); return VLC_SUCCESS; }
/************************************************************************** * set_agl **************************************************************************/ void libvlc_media_player_set_agl( libvlc_media_player_t *p_mi, uint32_t drawable ) { #ifdef __APPLE__ var_SetInteger (p_mi, "drawable-agl", drawable); #else (void) p_mi; (void)drawable; #endif }
void GotoTimeDialog::close() { if ( THEMIM->getIM()->hasInput() ) { int64_t i_time = (int64_t) ( QTime( 0, 0, 0 ).msecsTo( timeEdit->time() ) ) * 1000; var_SetInteger( THEMIM->getInput(), "time", i_time ); } toggleVisible(); }
virtual void processEvent( EvtScroll &rEvtScroll ) { // scroll events sent to core as hotkeys int i_vlck = 0; i_vlck |= rEvtScroll.getMod(); i_vlck |= ( rEvtScroll.getDirection() == EvtScroll::kUp ) ? KEY_MOUSEWHEELUP : KEY_MOUSEWHEELDOWN; var_SetInteger( getIntf()->p_libvlc, "key-pressed", i_vlck ); }
/** * Supply or update the current custom ("hardware") volume. * @note This only makes sense after calling aout_VolumeHardInit(). * @param setter volume setter callback * @param volume current custom volume * @param mute current mute flag * * @warning The caller (i.e. the audio output plug-in) is responsible for * interlocking and synchronizing call to this function and to the * audio_output_t.pf_volume_set callback. This ensures that VLC gets correct * volume information (possibly with a latency). */ void aout_VolumeHardSet (audio_output_t *aout, float volume, bool mute) { audio_volume_t vol = lroundf (volume * (float)AOUT_VOLUME_DEFAULT); /* We cannot acquire the volume lock as this gets called from the audio * output plug-in (it would cause a lock inversion). */ var_SetInteger (aout, "volume", vol); var_SetBool (aout, "mute", mute); var_TriggerCallback (aout, "intf-change"); }
/***************************************************************************** * libvlc_audio_output_set_device_type : Set the audio device type *****************************************************************************/ void libvlc_audio_output_set_device_type( libvlc_media_player_t *mp, int device_type ) { aout_instance_t *p_aout = GetAOut( mp ); if( !p_aout ) return; if( var_SetInteger( p_aout, "audio-device", device_type ) < 0 ) libvlc_printerr( "Error setting audio device" ); vlc_object_release( p_aout ); }
int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num, const char *psz_filepath, unsigned int i_width, unsigned int i_height ) { assert( psz_filepath ); vout_thread_t *p_vout = GetVout (p_mi, num); if (p_vout == NULL) return -1; /* FIXME: This is not atomic. Someone else could change the values, * at least in theory. */ var_SetInteger( p_vout, "snapshot-width", i_width); var_SetInteger( p_vout, "snapshot-height", i_height ); var_SetString( p_vout, "snapshot-path", psz_filepath ); var_SetString( p_vout, "snapshot-format", "png" ); var_TriggerCallback (p_vout, "video-snapshot" ); return 0; }
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; }
static void VariablesInit( playlist_t *p_playlist ) { /* These variables control updates */ var_Create( p_playlist, "intf-change", VLC_VAR_BOOL ); var_SetBool( p_playlist, "intf-change", true ); var_Create( p_playlist, "item-change", VLC_VAR_ADDRESS ); var_Create( p_playlist, "leaf-to-parent", VLC_VAR_INTEGER ); var_Create( p_playlist, "playlist-item-deleted", VLC_VAR_INTEGER ); var_SetInteger( p_playlist, "playlist-item-deleted", -1 ); var_Create( p_playlist, "playlist-item-append", VLC_VAR_ADDRESS ); var_Create( p_playlist, "input-current", VLC_VAR_ADDRESS ); /* Variables to control playback */ var_Create( p_playlist, "playlist-autostart", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_playlist, "random", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_AddCallback( p_playlist, "random", RandomCallback, NULL ); var_Create( p_playlist, "repeat", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_playlist, "loop", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_playlist, "corks", VLC_VAR_INTEGER ); var_AddCallback( p_playlist, "corks", CorksCallback, NULL ); var_Create( p_playlist, "rate", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT ); var_AddCallback( p_playlist, "rate", RateCallback, NULL ); var_Create( p_playlist, "rate-slower", VLC_VAR_VOID ); var_AddCallback( p_playlist, "rate-slower", RateOffsetCallback, NULL ); var_Create( p_playlist, "rate-faster", VLC_VAR_VOID ); var_AddCallback( p_playlist, "rate-faster", RateOffsetCallback, NULL ); var_Create( p_playlist, "video-splitter", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_AddCallback( p_playlist, "video-splitter", VideoSplitterCallback, NULL ); /* sout variables */ var_Create( p_playlist, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_playlist, "demux-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); /* */ var_Create( p_playlist, "album-art", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_playlist, "metadata-network-access", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); /* Variables to preserve video output parameters */ var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_playlist, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_playlist, "video-wallpaper", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); /* Audio output parameters */ var_Create( p_playlist, "audio-device", VLC_VAR_STRING ); var_Create( p_playlist, "mute", VLC_VAR_BOOL ); var_Create( p_playlist, "volume", VLC_VAR_FLOAT ); var_SetFloat( p_playlist, "volume", -1.f ); }
/********************************************************************** * Execute a var command on an object identified by its name **********************************************************************/ int var_Command( vlc_object_t *p_this, const char *psz_name, const char *psz_cmd, const char *psz_arg, char **psz_msg ) { vlc_object_t *p_obj = vlc_object_find_name( p_this->p_libvlc, psz_name ); int i_type, i_ret; if( !p_obj ) { if( psz_msg ) *psz_msg = strdup( "Unknown destination object." ); return VLC_ENOOBJ; } i_type = var_Type( p_obj, psz_cmd ); if( !( i_type&VLC_VAR_ISCOMMAND ) ) { vlc_object_release( p_obj ); if( psz_msg ) *psz_msg = strdup( "Variable doesn't exist or isn't a command." ); return VLC_EGENERIC; } i_type &= VLC_VAR_CLASS; switch( i_type ) { case VLC_VAR_INTEGER: i_ret = var_SetInteger( p_obj, psz_cmd, atoi( psz_arg ) ); break; case VLC_VAR_FLOAT: i_ret = var_SetFloat( p_obj, psz_cmd, us_atof( psz_arg ) ); break; case VLC_VAR_STRING: i_ret = var_SetString( p_obj, psz_cmd, psz_arg ); break; case VLC_VAR_BOOL: i_ret = var_SetBool( p_obj, psz_cmd, atoi( psz_arg ) ); break; default: i_ret = VLC_EGENERIC; break; } vlc_object_release( p_obj ); if( psz_msg ) { if( asprintf( psz_msg, "%s on object %s returned %i (%s)", psz_cmd, psz_name, i_ret, vlc_error( i_ret ) ) == -1) *psz_msg = NULL; } return i_ret; }