//--------------------------------------------------------------------------- // DemuxOpen: initialize demux //--------------------------------------------------------------------------- static int DemuxOpen( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t*)p_this; intf_thread_t *p_intf; char *ext; // Needed callbacks p_demux->pf_demux = Demux; p_demux->pf_control = DemuxControl; // Test that we have a valid .vlt file, based on the extension // TODO: an actual check of the contents would be better... if( ( ext = strchr( p_demux->psz_path, '.' ) ) == NULL || strcasecmp( ext, ".vlt" ) ) { return VLC_EGENERIC; } p_intf = (intf_thread_t *)vlc_object_find( p_this, VLC_OBJECT_INTF, FIND_ANYWHERE ); if( p_intf != NULL ) { // Do nothing is skins2 is not the main interface if( var_Type( p_intf, "skin-to-load" ) == VLC_VAR_STRING ) { playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_this, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist != NULL ) { // Make sure the item is deleted afterwards p_playlist->pp_items[p_playlist->i_index]->b_autodeletion = VLC_TRUE; vlc_object_release( p_playlist ); } vlc_value_t val; val.psz_string = p_demux->psz_path; var_Set( p_intf, "skin-to-load", val ); } else { msg_Warn( p_this, "skin could not be loaded (not using skins2 intf)" ); } vlc_object_release( p_intf ); } return VLC_SUCCESS; }
void RefreshAudioMenu( intf_thread_t *p_intf, HMENU hMenu ) { #define MAX_AUDIO_ITEMS 10 vlc_object_t *p_object; char *ppsz_varnames[MAX_AUDIO_ITEMS]; vlc_object_t * pi_objects[MAX_AUDIO_ITEMS]; int i; /* Delete old menu */ int count = wce_GetMenuItemCount( hMenu ); for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION ); if( p_intf->p_sys->p_audio_menu ) MenuItemExt::ClearList( p_intf->p_sys->p_audio_menu ); else p_intf->p_sys->p_audio_menu = new vector<MenuItemExt*>; /* Initializations */ memset( pi_objects, 0, MAX_AUDIO_ITEMS * sizeof(vlc_object_t *) ); i = 0; p_object = (vlc_object_t *) vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( p_object != NULL ) { ppsz_varnames[i] = "audio-es"; pi_objects[i++] = p_object; vlc_object_release( p_object ); } p_object = (vlc_object_t *) vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE ); if( p_object != NULL ) { ppsz_varnames[i] = "audio-device"; pi_objects[i++] = p_object; ppsz_varnames[i] = "audio-channels"; pi_objects[i++] = p_object; ppsz_varnames[i] = "visual"; pi_objects[i++] = p_object; vlc_object_release( p_object ); } /* Build menu */ RefreshMenu( p_intf, p_intf->p_sys->p_audio_menu, hMenu, i, ppsz_varnames, pi_objects, AudioMenu_Events ); }
aout_input_t * __aout_DecNew( vlc_object_t * p_this, aout_instance_t ** pp_aout, audio_sample_format_t * p_format ) { if ( *pp_aout == NULL ) { /* Create an audio output if there is none. */ *pp_aout = vlc_object_find( p_this, VLC_OBJECT_AOUT, FIND_ANYWHERE ); if( *pp_aout == NULL ) { msg_Dbg( p_this, "no aout present, spawning one" ); *pp_aout = aout_New( p_this ); /* Everything failed, I'm a loser, I just wanna die */ if( *pp_aout == NULL ) { return NULL; } vlc_object_attach( *pp_aout, p_this->p_vlc ); } else { vlc_object_release( *pp_aout ); } } return DecNew( p_this, *pp_aout, p_format ); }
void EqualizerBands::onUpdate( Subject<VarPercent> &rBand, void *arg ) { // Make sure we are not called from set() if (!m_isUpdating) { float val; stringstream ss; // Write one digit after the floating point ss << setprecision( 1 ) << setiosflags( ios::fixed ); // Convert the band values to a string val = 40 * ((VarPercent*)m_cBands[0].get())->get() - 20; ss << val; for( int i = 1; i < kNbBands; i++ ) { val = 40 * ((VarPercent*)m_cBands[i].get())->get() - 20; ss << " " << val; } string bands = ss.str(); aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(), VLC_OBJECT_AOUT, FIND_ANYWHERE ); config_PutPsz( getIntf(), "equalizer-bands", bands.c_str() ); if( pAout ) { // Update the audio output var_SetString( pAout, "equalizer-bands", (char*)bands.c_str() ); vlc_object_release( pAout ); } } }
/***************************************************************************** * aout_VolumeGet : get the volume of the output device *****************************************************************************/ int __aout_VolumeGet( vlc_object_t * p_object, audio_volume_t * pi_volume ) { int i_result = 0; aout_instance_t * p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT, FIND_ANYWHERE ); if ( pi_volume == NULL ) return -1; if ( p_aout == NULL ) { *pi_volume = (audio_volume_t)config_GetInt( p_object, "volume" ); return 0; } aout_lock_mixer( p_aout ); if ( !p_aout->mixer.b_error ) { i_result = p_aout->output.pf_volume_get( p_aout, pi_volume ); } else { *pi_volume = (audio_volume_t)config_GetInt( p_object, "volume" ); } aout_unlock_mixer( p_aout ); vlc_object_release( p_aout ); return i_result; }
/***************************************************************************** * aout_FindAndRestart : find the audio output instance and restart ***************************************************************************** * This is used for callbacks of the configuration variables, and we believe * that when those are changed, it is a significant change which implies * rebuilding the audio-device and audio-channels variables. *****************************************************************************/ int aout_FindAndRestart( vlc_object_t * p_this, const char *psz_name, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { aout_instance_t * p_aout = vlc_object_find( p_this, VLC_OBJECT_AOUT, FIND_ANYWHERE ); (void)psz_name; (void)oldval; (void)newval; (void)p_data; if ( p_aout == NULL ) return VLC_SUCCESS; if ( var_Type( p_aout, "audio-device" ) != 0 ) { var_Destroy( p_aout, "audio-device" ); } if ( var_Type( p_aout, "audio-channels" ) != 0 ) { var_Destroy( p_aout, "audio-channels" ); } aout_Restart( p_aout ); vlc_object_release( p_aout ); return VLC_SUCCESS; }
/***************************************************************************** * 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 onClearPlaylist(GtkButton *button, gpointer user_data) { intf_thread_t *p_intf = GtkGetIntf( button ); playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); GtkTreeView *p_tvplaylist; int item; if( p_playlist == NULL ) { return; } for(item = p_playlist->i_size - 1; item >= 0 ;item-- ) { playlist_LockDelete( p_playlist, item); } vlc_object_release( p_playlist ); // Remove all entries from the Playlist widget. p_tvplaylist = (GtkTreeView*) lookup_widget( GTK_WIDGET(button), "tvPlaylist"); if (p_tvplaylist) { GtkTreeModel *p_play_model; p_play_model = gtk_tree_view_get_model(p_tvplaylist); if (p_play_model) { gtk_list_store_clear(GTK_LIST_STORE(p_play_model)); } } }
/***************************************************************************** * Manage: handle aa events ***************************************************************************** * This function should be called regularly by video output thread. It manages * console events. It returns a non null value on error. *****************************************************************************/ static int Manage( vout_thread_t *p_vout ) { int event, x, y, b; event = aa_getevent( p_vout->p_sys->aa_context, 0 ); switch ( event ) { case AA_MOUSE: aa_getmouse( p_vout->p_sys->aa_context, &x, &y, &b ); if ( b & AA_BUTTON3 ) { intf_thread_t *p_intf; p_intf = vlc_object_find( p_vout, VLC_OBJECT_INTF, FIND_ANYWHERE ); if( p_intf ) { p_intf->b_menu_change = 1; vlc_object_release( p_intf ); } } break; case AA_RESIZE: p_vout->i_changes |= VOUT_SIZE_CHANGE; aa_resize( p_vout->p_sys->aa_context ); p_vout->p_sys->i_width = aa_imgwidth( p_vout->p_sys->aa_context ); p_vout->p_sys->i_height = aa_imgheight( p_vout->p_sys->aa_context ); break; default: break; } return( 0 ); }
/***************************************************************************** * Destroy: destroy video thread ***************************************************************************** * Terminate an output method created by Create *****************************************************************************/ static void Destroy( vlc_object_t *p_this ) { vout_thread_t *p_vout = ( vout_thread_t * )p_this; vlc_object_t *p_vlc; int i_index; vlc_object_release( p_vout->p_sys->p_input ); var_Destroy( p_this, "snapshot-width" ); var_Destroy( p_this, "snapshot-height" ); var_Destroy( p_this, "snapshot-datasize" ); p_vlc = vlc_object_find( p_this, VLC_OBJECT_ROOT, FIND_PARENT ); if( p_vlc ) { /* UnRegister the snapshot vout module at the root level */ /* var_Destroy (p_vlc, "snapshot-id"); */ var_Destroy( p_this->p_libvlc, "snapshot-id" ); vlc_object_release( p_vlc ); } for( i_index = 0 ; i_index < p_vout->p_sys->i_size ; i_index++ ) { free( p_vout->p_sys->p_list[ i_index ]->p_data ); } free( p_vout->p_sys->p_list ); /* Destroy structure */ free( p_vout->p_sys ); }
static void ChangeVFiltersString( intf_thread_t *p_intf, char *psz_name, vlc_bool_t b_add ) { vout_thread_t *p_vout; char *psz_parser, *psz_string; psz_string = config_GetPsz( p_intf, "filter" ); if( !psz_string ) psz_string = strdup(""); psz_parser = strstr( psz_string, psz_name ); if( b_add ) { if( !psz_parser ) { psz_parser = psz_string; asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s", psz_string, psz_name ); free( psz_parser ); } else { return; } } else { if( psz_parser ) { memmove( psz_parser, psz_parser + strlen(psz_name) + (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ), strlen(psz_parser + strlen(psz_name)) + 1 ); /* Remove trailing : : */ if( *(psz_string+strlen(psz_string ) -1 ) == ':' ) { *(psz_string+strlen(psz_string ) -1 ) = '\0'; } } else { free( psz_string ); return; } } /* Vout is not kept, so put that in the config */ config_PutPsz( p_intf, "filter", psz_string ); /* Try to set on the fly */ p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); if( p_vout ) { var_SetString( p_vout, "filter", psz_string ); vlc_object_release( p_vout ); } free( psz_string ); }
/** * Register a new session with the announce handler, using a pregenerated SDP * * \param p_sout a sout instance structure * \param psz_sdp the SDP to register * \param psz_uri session URI (needed for SAP address auto detection * \param p_method an announce method descriptor * \return the new session descriptor structure */ session_descriptor_t *sout_AnnounceRegisterSDP( sout_instance_t *p_sout, const char *psz_sdp, const char *psz_uri, announce_method_t *p_method ) { session_descriptor_t *p_session; announce_handler_t *p_announce = (announce_handler_t*) vlc_object_find( p_sout, VLC_OBJECT_ANNOUNCE, FIND_ANYWHERE ); if( !p_announce ) { msg_Dbg( p_sout, "no announce handler found, creating one" ); p_announce = announce_HandlerCreate( p_sout ); if( !p_announce ) { msg_Err( p_sout, "Creation failed" ); return NULL; } vlc_object_yield( p_announce ); } if( p_method->i_type != METHOD_TYPE_SAP ) { msg_Warn( p_sout, "forcing SAP announcement"); } p_session = sout_AnnounceSessionCreate(); p_session->psz_sdp = strdup( psz_sdp ); p_session->psz_uri = strdup( psz_uri ); announce_Register( p_announce, p_session, p_method ); vlc_object_release( p_announce ); return p_session; }
void onUpdatePlaylist(GtkButton *button, gpointer user_data) { intf_thread_t * p_intf = GtkGetIntf( button ); playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); GtkTreeView *p_tvplaylist = NULL; if( p_playlist == NULL ) { return; } p_tvplaylist = (GtkTreeView*) lookup_widget( GTK_WIDGET(button), "tvPlaylist"); if (p_tvplaylist) { GtkListStore *p_model = NULL; /* Rebuild the playlist then. */ p_model = gtk_list_store_new (3, G_TYPE_STRING, /* Filename */ G_TYPE_STRING, /* Time */ G_TYPE_UINT); /* Hidden field */ if (p_model) { PlaylistRebuildListStore(p_model, p_playlist); gtk_tree_view_set_model(GTK_TREE_VIEW(p_tvplaylist), GTK_TREE_MODEL(p_model)); g_object_unref(p_model); } } vlc_object_release( p_playlist ); }
/********************************** * Other functions **********************************/ void ExtraPanel::CheckAout() { aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE); if( p_aout != NULL ) { if( p_aout != p_intf->p_sys->p_aout ) { /* We want to know if someone changes the bands */ if( var_AddCallback( p_aout, "equalizer-bands", IntfBandsCallback, this ) ) { /* The variable does not exist yet, wait */ vlc_object_release( p_aout ); return; } if( var_AddCallback( p_aout, "equalizer-preamp", IntfPreampCallback, this ) ) { vlc_object_release( p_aout ); return; } /* Ok, we have our variables, make a first update round */ p_intf->p_sys->p_aout = p_aout; f_preamp = var_GetFloat( p_aout, "equalizer-preamp" ); psz_bands = var_GetString( p_aout, "equalizer-bands" ); b_update = VLC_TRUE; } vlc_object_release( p_aout ); } }
void __osd_MenuHide( vlc_object_t *p_this ) { osd_menu_t *p_osd = NULL; vlc_value_t lockval; p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE ); if( p_osd == NULL ) { msg_Err( p_this, "osd_MenuNext failed" ); return; } var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); vlc_mutex_lock( lockval.p_address ); #if defined(OSD_MENU_DEBUG) msg_Dbg( p_osd, "menu off" ); #endif osd_UpdateState( p_osd->p_state, p_osd->p_state->i_x, p_osd->p_state->i_y, 0, 0, NULL ); osd_SetMenuUpdate( p_osd, true ); vlc_object_release( (vlc_object_t*) p_osd ); vlc_mutex_unlock( lockval.p_address ); }
void DialogsProvider::OnOpenDirectory( wxCommandEvent& event ) { playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist == NULL ) { return; } if( p_dir_dialog == NULL ) p_dir_dialog = new wxDirDialog( NULL, wxU(_("Select a directory")) ); if( p_dir_dialog && p_dir_dialog->ShowModal() == wxID_OK ) { wxString path = p_dir_dialog->GetPath(); char *psz_utf8 = wxFromLocale( path ); playlist_Add( p_playlist, psz_utf8, psz_utf8, PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0), PLAYLIST_END ); wxLocaleFree( psz_utf8 ); } vlc_object_release( p_playlist ); }
void ExtraPanel::OnEqRestore( wxCommandEvent &event ) { aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE); if( p_aout == NULL ) { vlc_value_t val; vlc_bool_t b_previous = eq_chkbox->IsChecked(); val.f_float = 12.0; IntfPreampCallback( NULL, NULL, val,val, this ); config_PutFloat( p_intf, "equalizer-preamp", 12.0 ); val.psz_string = strdup( "0 0 0 0 0 0 0 0 0 0" ); IntfBandsCallback( NULL, NULL, val,val, this ); config_PutPsz( p_intf, "equalizer-bands", "0 0 0 0 0 0 0 0 0 0"); config_PutPsz( p_intf, "equalizer-preset","flat" ); eq_chkbox->SetValue( b_previous ); } else { var_SetFloat( p_aout, "equalizer-preamp", 12.0 ); config_PutFloat( p_intf, "equalizer-preamp", 12.0 ); var_SetString( p_aout, "equalizer-bands", "0 0 0 0 0 0 0 0 0 0"); config_PutPsz( p_intf, "equalizer-bands", "0 0 0 0 0 0 0 0 0 0"); var_SetString( p_aout , "equalizer-preset" , "flat" ); config_PutPsz( p_intf, "equalizer-preset","flat" ); vlc_object_release( p_aout ); } }
/***************************************************************************** * PlaylistView::SetPlaying *****************************************************************************/ void PlaylistView::RebuildList() { playlist_t * p_playlist; p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( !p_playlist ) { return; } // remove all items BListItem * item; int32 count = CountItems(); while( ( item = RemoveItem( --count ) ) ) delete item; // rebuild listview from VLC's playlist vlc_mutex_lock( &p_playlist->object_lock ); for( int i = 0; i < p_playlist->i_size; i++ ) AddItem( new PlaylistItem( p_playlist->pp_items[i]->input.psz_name ) ); vlc_mutex_unlock( &p_playlist->object_lock ); vlc_object_release( p_playlist ); }
static char *TitleGet( vlc_object_t *p_this ) { char *psz_title = NULL; input_thread_t *p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( p_input ) { char *psz = strrchr( p_input->input.p_item->psz_uri, '/' ); if( psz ) { psz++; } else { psz = p_input->input.p_item->psz_uri; } if( psz && *psz ) { psz_title = strdup( psz ); } vlc_object_release( p_input ); } return psz_title; }
/***************************************************************************** * InitThread: *****************************************************************************/ static int InitThread( intf_thread_t * p_intf ) { /* We might need some locking here */ if( !p_intf->b_die ) { input_thread_t * p_input; p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_PARENT ); /* Maybe the input just died */ if( p_input == NULL ) { return VLC_EGENERIC; } vlc_mutex_lock( &p_intf->change_lock ); p_intf->p_sys->p_input = p_input; p_intf->p_sys->b_move = VLC_FALSE; p_intf->p_sys->b_click = VLC_FALSE; p_intf->p_sys->b_key_pressed = VLC_FALSE; vlc_mutex_unlock( &p_intf->change_lock ); return VLC_SUCCESS; } else { return VLC_EGENERIC; } }
/***************************************************************************** * Run: main thread ***************************************************************************** * This part of the module is in a separate thread so that we do not have * too much system() overhead. *****************************************************************************/ static void Run( intf_thread_t *p_intf ) { int i_lastcall = 0; while( !p_intf->b_die ) { msleep( 100000 ); /* Check screensaver every 30 seconds */ if( ++i_lastcall > 300 ) { vlc_object_t *p_vout; p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); /* If there is a video output, disable xscreensaver */ if( p_vout ) { vlc_object_release( p_vout ); /* http://www.jwz.org/xscreensaver/faq.html#dvd */ system( "xscreensaver-command -deactivate >&- 2>&- &" ); system( "gnome-screensaver-command --poke >&- 2>&- &" ); /* FIXME: add support for other screensavers */ } i_lastcall = 0; } } }
/** * Register a new session with the announce handler * * \param p_sout a sout instance structure * \param p_session a session descriptor * \param p_method an announce method descriptor * \return VLC_SUCCESS or an error */ int sout_AnnounceRegister( sout_instance_t *p_sout, session_descriptor_t *p_session, announce_method_t *p_method ) { int i_ret; announce_handler_t *p_announce = (announce_handler_t*) vlc_object_find( p_sout, VLC_OBJECT_ANNOUNCE, FIND_ANYWHERE ); if( !p_announce ) { msg_Dbg( p_sout, "No announce handler found, creating one" ); p_announce = announce_HandlerCreate( p_sout ); if( !p_announce ) { msg_Err( p_sout, "Creation failed" ); return VLC_ENOMEM; } vlc_object_yield( p_announce ); msg_Dbg( p_sout, "creation done" ); } i_ret = announce_Register( p_announce, p_session, p_method ); vlc_object_release( p_announce ); return i_ret; }
void ExtraPanel::OnEq2Pass( wxCommandEvent &event ) { aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE); vlc_bool_t b_2p = event.IsChecked() ? VLC_TRUE : VLC_FALSE; if( p_aout == NULL ) { config_PutInt( p_intf, "equalizer-2pass", b_2p ); } else { var_SetBool( p_aout, "equalizer-2pass", b_2p ); config_PutInt( p_intf, "equalizer-2pass", b_2p ); if( eq_chkbox->IsChecked() ) { for( int i = 0; i < p_aout->i_nb_inputs; i++ ) { p_aout->pp_inputs[i]->b_restart = VLC_TRUE; } } vlc_object_release( p_aout ); } }
void ExtraPanel::OnNormvol( wxCommandEvent &event ) { aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE); ChangeFiltersString( p_intf , p_aout, "normvol", event.IsChecked() ? VLC_TRUE : VLC_FALSE ); if( p_aout != NULL ) vlc_object_release( p_aout ); }
/***************************************************************************** * RunIntf: main loop *****************************************************************************/ static void RunIntf( intf_thread_t *p_intf ) { int canc = vlc_savecancel( ); /* Main loop */ while( vlc_object_alive( p_intf ) ) { vlc_mutex_lock( &p_intf->p_sys->lock ); /* Notify the interfaces */ if( p_intf->p_sys->b_triggered ) { var_SetBool( p_intf->p_libvlc, "intf-show", true ); p_intf->p_sys->b_triggered = false; } vlc_mutex_unlock( &p_intf->p_sys->lock ); /* Take care of the video output */ if( p_intf->p_sys->p_vout && !vlc_object_alive (p_intf->p_sys->p_vout) ) { var_DelCallback( p_intf->p_sys->p_vout, "mouse-moved", MouseEvent, p_intf ); var_DelCallback( p_intf->p_sys->p_vout, "mouse-button-down", MouseEvent, p_intf ); vlc_object_release( p_intf->p_sys->p_vout ); p_intf->p_sys->p_vout = NULL; } if( p_intf->p_sys->p_vout == NULL ) { p_intf->p_sys->p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); if( p_intf->p_sys->p_vout ) { var_AddCallback( p_intf->p_sys->p_vout, "mouse-moved", MouseEvent, p_intf ); var_AddCallback( p_intf->p_sys->p_vout, "mouse-button-down", MouseEvent, p_intf ); } } /* Wait a bit */ msleep( INTF_IDLE_SLEEP ); } if( p_intf->p_sys->p_vout ) { var_DelCallback( p_intf->p_sys->p_vout, "mouse-moved", MouseEvent, p_intf ); var_DelCallback( p_intf->p_sys->p_vout, "mouse-button-down", MouseEvent, p_intf ); vlc_object_release( p_intf->p_sys->p_vout ); } vlc_restorecancel( canc ); }
void onStop(GtkButton *button, gpointer user_data) { intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET( button ) ); playlist_t *p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if (p_playlist) { playlist_Stop( p_playlist ); vlc_object_release( p_playlist ); gdk_window_raise( p_intf->p_sys->p_window->window ); } }
void RefreshNavigMenu( intf_thread_t *p_intf, HMENU hMenu ) { #define MAX_NAVIG_ITEMS 10 vlc_object_t *p_object; char *ppsz_varnames[MAX_NAVIG_ITEMS]; vlc_object_t * pi_objects[MAX_NAVIG_ITEMS]; int i; /* Delete old menu */ int count = wce_GetMenuItemCount( hMenu ); for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION ); if( p_intf->p_sys->p_navig_menu ) MenuItemExt::ClearList( p_intf->p_sys->p_navig_menu ); else p_intf->p_sys->p_navig_menu = new vector<MenuItemExt*>; /* Initializations */ memset( pi_objects, 0, MAX_NAVIG_ITEMS * sizeof(vlc_object_t *) ); i = 0; p_object = (vlc_object_t *) vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); if( p_object != NULL ) { ppsz_varnames[i] = "title"; pi_objects[i++] = p_object; ppsz_varnames[i] = "chapter"; pi_objects[i++] = p_object; ppsz_varnames[i] = "program"; pi_objects[i++] = p_object; ppsz_varnames[i] = "navigation"; pi_objects[i++] = p_object; ppsz_varnames[i] = "dvd_menus"; pi_objects[i++] = p_object; ppsz_varnames[i] = "prev-title"; pi_objects[i++] = p_object; ppsz_varnames[i] = "next-title"; pi_objects[i++] = p_object; ppsz_varnames[i] = "prev-chapter"; pi_objects[i++] = p_object; ppsz_varnames[i] = "next-chapter"; pi_objects[i++] = p_object; vlc_object_release( p_object ); } /* Build menu */ RefreshMenu( p_intf, p_intf->p_sys->p_navig_menu, hMenu, i, ppsz_varnames, pi_objects, NavigMenu_Events ); }
/***************************************************************************** * OpenDecoder: probe the decoder and return score ***************************************************************************** * Tries to launch a decoder and return score so that the interface is able * to chose. *****************************************************************************/ static int OpenDecoder( vlc_object_t *p_this ) { decoder_t *p_dec = (decoder_t*)p_this; input_thread_t * p_input; decoder_sys_t *p_sys; vlc_value_t val; if( p_dec->fmt_in.i_codec != VLC_FOURCC('c','m','m','l') ) { return VLC_EGENERIC; } p_dec->pf_decode_sub = DecodeBlock; #ifdef CMML_DEBUG msg_Dbg( p_dec, "i am at %p", p_dec ); #endif /* Allocate the memory needed to store the decoder's structure */ if( ( p_dec->p_sys = p_sys = (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) { msg_Err( p_dec, "out of memory" ); return VLC_EGENERIC; } /* Let other interested modules know that we're a CMML decoder * We have to set this variable on the input thread, because there's * typically more than one decoder running so we can't find the CMML * decoder succesfully with vlc_object_find. (Any hints on how to achieve * this would be rather appreciated ;) */ p_input = vlc_object_find( p_dec, VLC_OBJECT_INPUT, FIND_ANYWHERE ); #ifdef CMML_DEBUG msg_Dbg( p_dec, "p_input is at %p", p_input ); #endif val.p_address = p_dec; var_Create( p_input, "has-cmml-decoder", VLC_VAR_ADDRESS|VLC_VAR_DOINHERIT ); if( var_Set( p_input, "has-cmml-decoder", val ) != VLC_SUCCESS ) { msg_Dbg( p_dec, "var_Set of has-cmml-decoder failed" ); } vlc_object_release( p_input ); /* initialise the CMML responder interface */ p_sys->p_intf = intf_Create( p_dec, "cmml", 0, NULL ); p_sys->p_intf->b_block = VLC_FALSE; intf_RunThread( p_sys->p_intf ); return VLC_SUCCESS; }
/***************************************************************************** * ItemChange: Playlist item change callback *****************************************************************************/ static int ItemChange( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *param ) { char psz_tmp[MAX_LENGTH]; playlist_t *p_playlist; char *psz_title = NULL; char *psz_artist = NULL; char *psz_album = NULL; input_thread_t *p_input=NULL; intf_thread_t *p_intf = ( intf_thread_t* ) param; intf_sys_t *p_sys = p_intf->p_sys; p_playlist = (playlist_t *)vlc_object_find( p_this, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( !p_playlist ) return VLC_EGENERIC; p_input = p_playlist->p_input; vlc_object_release( p_playlist ); if( !p_input ) return VLC_SUCCESS; vlc_object_yield( p_input ); if( p_input->b_dead || !p_input->input.p_item->psz_name ) { /* Not playing anything ... */ vlc_object_release( p_input ); return VLC_SUCCESS; } /* Playing something ... */ psz_artist = vlc_input_item_GetInfo( p_input->input.p_item, _("Meta-information"), _(VLC_META_ARTIST) ); psz_album = vlc_input_item_GetInfo( p_input->input.p_item, _("Meta-information"), _("Album/movie/show title" ) ); psz_title = strdup( p_input->input.p_item->psz_name ); vlc_object_release( p_input ); if( psz_title == NULL ) psz_title = strdup( N_("(no title)") ); if( psz_artist == NULL ) psz_artist = strdup( N_("(no artist)") ); if( psz_album == NULL ) psz_album = strdup( N_("(no album)") ); snprintf( psz_tmp, MAX_LENGTH, "<b>%s</b>\n%s - %s", psz_title, psz_artist, psz_album ); free( psz_title ); free( psz_artist ); free( psz_album ); vlc_mutex_lock( &p_sys->lock ); Notify( p_this, psz_tmp ); vlc_mutex_unlock( &p_sys->lock ); return VLC_SUCCESS; }
void ExtraPanel::OnChangeEqualizer( wxScrollEvent &event ) { aout_instance_t *p_aout= (aout_instance_t *)vlc_object_find(p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE); char psz_values[102]; memset( psz_values, 0, 102 ); /* Smoothing */ int i_diff = event.GetPosition() - i_values[ event.GetId() - Band0_Event ]; i_values[ event.GetId() - Band0_Event] = event.GetPosition(); for( int i = event.GetId() + 1 ; i <= Band9_Event ; i++ ) { int i_new = band_sliders[ i-Band0_Event ]->GetValue() + (int)( i_diff * pow( (float)i_smooth / 100 , i- event.GetId() ) ) ; if( i_new < 0 ) i_new = 0; if( i_new > 400 ) i_new = 400; band_sliders[ i-Band0_Event ]->SetValue( i_new ); } for( int i = Band0_Event ; i < event.GetId() ; i++ ) { int i_new = band_sliders[ i-Band0_Event ]->GetValue() + (int)( i_diff * pow( (float)i_smooth / 100 , event.GetId() - i ) ); if( i_new < 0 ) i_new = 0; if( i_new > 400 ) i_new = 400; band_sliders[ i-Band0_Event ]->SetValue( i_new ); } /* Write the new bands values */ for( int i = 0 ; i < 10 ; i++ ) { char psz_val[5]; float f_val = (float)( 400 - band_sliders[i]->GetValue() ) / 10- 20 ; sprintf( psz_values, "%s %f", psz_values, f_val ); sprintf( psz_val, "%.1f", f_val ); band_texts[i]->SetLabel( band_frequencies[i] + wxT("\n") + wxU( psz_val ) + wxT("dB" ) ); } if( p_aout == NULL ) { config_PutPsz( p_intf, "equalizer-bands", psz_values ); } else { var_SetString( p_aout, "equalizer-bands", psz_values ); config_PutPsz( p_intf, "equalizer-bands", psz_values ); b_my_update = VLC_TRUE; vlc_object_release( p_aout ); } }