/* Open Interface */ static int Open( vlc_object_t *p_this, bool isDialogProvider ) { intf_thread_t *p_intf = (intf_thread_t *)p_this; #ifdef Q_WS_X11 if( !vlc_xlib_init( p_this ) ) return VLC_EGENERIC; char *display = var_CreateGetNonEmptyString( p_intf, "x11-display" ); Display *p_display = XOpenDisplay( x11_display ); if( !p_display ) { msg_Err( p_intf, "Could not connect to X server" ); free (display); return VLC_EGENERIC; } XCloseDisplay( p_display ); #else char *display = NULL; #endif QMutexLocker locker (&lock); if (busy) { msg_Err (p_this, "cannot start Qt4 multiple times"); free (display); return VLC_EGENERIC; } /* Allocations of p_sys */ intf_sys_t *p_sys = p_intf->p_sys = new intf_sys_t; p_intf->p_sys->b_isDialogProvider = isDialogProvider; p_sys->p_mi = NULL; p_sys->p_playlist = pl_Get( p_intf ); /* */ #ifdef Q_WS_X11 x11_display = display; #endif vlc_sem_init (&ready, 0); if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) ) { delete p_sys; free (display); return VLC_ENOMEM; } /* */ vlc_sem_wait (&ready); vlc_sem_destroy (&ready); busy = active = true; if( !p_sys->b_isDialogProvider ) { playlist_t *pl = pl_Get(p_this); var_Create (pl, "qt4-iface", VLC_VAR_ADDRESS); var_SetAddress (pl, "qt4-iface", p_this); } return VLC_SUCCESS; }
/***************************************************************************** * Open: initialize and create stuff *****************************************************************************/ static int Open(vlc_object_t *p_this) { intf_thread_t *p_intf = (intf_thread_t*) p_this; intf_sys_t *p_sys = calloc(1, sizeof(intf_sys_t)); if (!p_sys) return VLC_ENOMEM; p_intf->p_sys = p_sys; vlc_mutex_init(&p_sys->lock); vlc_cond_init(&p_sys->wait); if (vlc_clone(&p_sys->thread, Run, p_intf, VLC_THREAD_PRIORITY_LOW)) { vlc_cond_destroy(&p_sys->wait); vlc_mutex_destroy(&p_sys->lock); free(p_sys); return VLC_ENOMEM; } var_AddCallback(pl_Get(p_intf), "activity", ItemChange, p_intf); return VLC_SUCCESS; }
/* Sets Moviesoap::p_input */ static void* EP_SetMoviesoapP_Input(void *data) { // require Moviesoap::p_playlist if (Moviesoap::p_playlist == NULL) { playlist_t * p_playlist = pl_Get( Moviesoap::p_obj ); if (p_playlist) { vlc_mutex_lock( &Moviesoap::lock ); Moviesoap::p_playlist = p_playlist; vlc_mutex_unlock( &Moviesoap::lock ); } else { return NULL; } } // get p_input input_thread_t * p_input = playlist_CurrentInput( p_playlist ); if (p_input) { // set Moviesoap::p_input vlc_mutex_lock( &Moviesoap::lock ); Moviesoap::p_input = p_input; vlc_mutex_unlock( &Moviesoap::lock ); // Add callback(s) to input thread var_AddCallback( p_input, "position", InputCbPosition, NULL ); var_AddCallback( p_input, "time", InputCbTime, NULL ); var_AddCallback( p_input, "intf-event", InputCbGeneric, NULL ); var_AddCallback( p_input, "state", InputCbState, NULL ); // start filter object if one exists if (Moviesoap::p_loadedFilter) Moviesoap::p_loadedFilter->Restart(); } return p_input; }
// Initialize interface. static int Open(vlc_object_t* p_this) { intf_thread_t* const p_intf = (intf_thread_t*)p_this; // Limit to one instance. if (FindWindow(L"CD Art Display IPC Class", L"VLC")) { p_intf->p_sys = NULL; return VLC_SUCCESS; } OutputDebugString(L"VLC Open"); intf_sys_t* const p_sys = (intf_sys_t*)calloc(1, sizeof(intf_sys_t)); if (!p_sys) { return VLC_ENOMEM; } p_intf->p_sys = p_sys; vlc_mutex_init(&p_sys->lock); if (vlc_clone(&p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW)) { vlc_mutex_destroy(&p_sys->lock); free(p_sys); p_intf->p_sys = NULL; return VLC_ENOMEM; } var_AddCallback(pl_Get(p_intf->p_libvlc), "input-current", PlaylistEvent, p_intf); return VLC_SUCCESS; }
/***************************************************************************** * Close: destroy interface stuff *****************************************************************************/ static void Close( vlc_object_t *p_this ) { intf_thread_t *p_intf = (intf_thread_t *)p_this; playlist_t *p_playlist = pl_Get( p_this ); input_thread_t *p_input = NULL; var_DelCallback( p_playlist, "item-change", ItemChange, p_intf ); var_DelCallback( p_playlist, "item-current", ItemChange, p_intf ); if( (p_input = playlist_CurrentInput( p_playlist )) ) { var_DelCallback( p_input, "state", StateChange, p_intf ); vlc_object_release( p_input ); } /* Clears the Presence message ... else it looks like we're still playing * something although VLC (or the Telepathy plugin) is closed */ /* Do not check for VLC_ENOMEM as we're closing */ SendToTelepathy( p_intf, "" ); /* we won't use the DBus connection anymore */ dbus_connection_unref( p_intf->p_sys->p_conn ); /* Destroy structure */ free( p_intf->p_sys->psz_format ); free( p_intf->p_sys ); }
/***************************************************************************** * Close: *****************************************************************************/ static void Close( vlc_object_t *p_this ) { services_discovery_t *p_sd = ( services_discovery_t* )p_this; services_discovery_sys_t *p_sys = p_sd->p_sys; playlist_t *pl = pl_Get( p_this ); int i; vlc_cancel (p_sys->thread); vlc_join (p_sys->thread, NULL); var_DelCallback( pl, "podcast-urls", UrlsChange, p_sys ); var_DelCallback( pl, "podcast-request", Request, p_sys ); vlc_cond_destroy( &p_sys->wait ); vlc_mutex_destroy( &p_sys->lock ); for( i = 0; i < p_sys->i_input; i++ ) { input_thread_t *p_input = p_sd->p_sys->pp_input[i]; if( !p_input ) continue; input_Stop( p_input, true ); input_Close( p_input ); p_sd->p_sys->pp_input[i] = NULL; } free( p_sd->p_sys->pp_input ); for( i = 0; i < p_sys->i_urls; i++ ) free( p_sys->ppsz_urls[i] ); free( p_sys->ppsz_urls ); for( i = 0; i < p_sys->i_items; i++ ) vlc_gc_decref( p_sys->pp_items[i] ); free( p_sys->pp_items ); free( p_sys->psz_request ); free( p_sys ); }
static int WallpaperCallback(vlc_object_t *object, char const *cmd, vlc_value_t oldval, vlc_value_t newval, void *data) { vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys = vd->sys; VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(data); vlc_mutex_lock(&sys->lock); const bool ch_wallpaper = !sys->wallpaper_requested != !newval.b_bool; sys->ch_wallpaper |= ch_wallpaper; sys->wallpaper_requested = newval.b_bool; vlc_mutex_unlock(&sys->lock); /* FIXME we should have a way to export variable to be saved */ if (ch_wallpaper) { playlist_t *p_playlist = pl_Get(vd); /* Modify playlist as well because the vout might have to be * restarted */ var_Create(p_playlist, "video-wallpaper", VLC_VAR_BOOL); var_SetBool(p_playlist, "video-wallpaper", newval.b_bool); } return VLC_SUCCESS; }
static void WINAPI ServiceDispatch( DWORD numArgs, char **args ) { (void)numArgs; (void)args; intf_thread_t *p_intf = (intf_thread_t *)p_global_intf; intf_sys_t *p_sys = p_intf->p_sys; char *psz_modules, *psz_parser; /* We have to initialize the service-specific stuff */ memset( &p_sys->status, 0, sizeof(SERVICE_STATUS) ); p_sys->status.dwServiceType = SERVICE_WIN32; p_sys->status.dwCurrentState = SERVICE_START_PENDING; p_sys->status.dwControlsAccepted = SERVICE_ACCEPT_STOP; p_sys->hStatus = RegisterServiceCtrlHandlerA( p_sys->psz_service, &ServiceCtrlHandler ); if( p_sys->hStatus == (SERVICE_STATUS_HANDLE)0 ) { msg_Err( p_intf, "failed to register service control handler" ); return; } /* * Load background interfaces */ psz_modules = var_InheritString( p_intf, "ntservice-extraintf" ); psz_parser = psz_modules; while( psz_parser && *psz_parser ) { char *psz_module, *psz_temp; psz_module = psz_parser; psz_parser = strchr( psz_module, ',' ); if( psz_parser ) { *psz_parser = '\0'; psz_parser++; } if( asprintf( &psz_temp, "%s,none", psz_module ) != -1 ) { /* Try to create the interface */ if( intf_Create( pl_Get(p_intf), psz_temp ) ) { msg_Err( p_intf, "interface \"%s\" initialization failed", psz_temp ); free( psz_temp ); continue; } free( psz_temp ); } } free( psz_modules ); /* Initialization complete - report running status */ p_sys->status.dwCurrentState = SERVICE_RUNNING; p_sys->status.dwCheckPoint = 0; p_sys->status.dwWaitHint = 0; SetServiceStatus( p_sys->hStatus, &p_sys->status ); }
static int MarshalMetadata( intf_thread_t *p_intf, DBusMessageIter *container ) { playlist_t *playlist = pl_Get( p_intf ); playlist_item_t *item; int result = VLC_SUCCESS; playlist_Lock( playlist ); item = playlist_CurrentPlayingItem( playlist ); if( item != NULL ) result = GetInputMeta( item, container ); else { // avoid breaking the type marshalling DBusMessageIter a; if( !dbus_message_iter_open_container( container, DBUS_TYPE_ARRAY, "{sv}", &a ) || !dbus_message_iter_close_container( container, &a ) ) result = VLC_ENOMEM; } playlist_Unlock( playlist ); return result; }
/***************************************************************************** * GetFilenames: parse command line options which are not flags ***************************************************************************** * Parse command line for input files as well as their associated options. * An option always follows its associated input and begins with a ":". *****************************************************************************/ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n, const char *const args[] ) { while( n > 0 ) { /* Count the input options */ unsigned i_options = 0; while( args[--n][0] == ':' ) { i_options++; if( n == 0 ) { msg_Warn( p_vlc, "options %s without item", args[n] ); return; /* syntax!? */ } } char *mrl = NULL; if( strstr( args[n], "://" ) == NULL ) { mrl = vlc_path2uri( args[n], NULL ); if( !mrl ) continue; } playlist_AddExt( pl_Get( p_vlc ), (mrl != NULL) ? mrl : args[n], NULL, PLAYLIST_INSERT, 0, -1, i_options, ( i_options ? &args[n + 1] : NULL ), VLC_INPUT_OPTION_TRUSTED, true, pl_Unlocked ); free( mrl ); } }
/***************************************************************************** * Activate: initialize and create stuff *****************************************************************************/ static int Activate( vlc_object_t *p_this ) { intf_thread_t *p_intf = (intf_thread_t*)p_this; intf_sys_t *p_sys; DBusError error; p_sys = p_intf->p_sys = (intf_sys_t *) calloc( 1, sizeof( intf_sys_t ) ); if( !p_sys ) return VLC_ENOMEM; p_sys->i_cookie[FREEDESKTOP] = 0; p_sys->i_cookie[GNOME] = 0; p_sys->p_input = NULL; dbus_error_init( &error ); /* connect privately to the session bus * the connection will not be shared with other vlc modules which use dbus, * thus avoiding a whole class of concurrency issues */ p_sys->p_conn = dbus_bus_get_private( DBUS_BUS_SESSION, &error ); if( !p_sys->p_conn ) { msg_Err( p_this, "Failed to connect to the D-Bus session daemon: %s", error.message ); dbus_error_free( &error ); free( p_sys ); return VLC_EGENERIC; } p_sys->p_playlist = pl_Get( p_intf ); var_AddCallback( p_sys->p_playlist, "item-current", InputChange, p_intf ); return VLC_SUCCESS; }
/***************************************************************************** * Close: destroy interface stuff *****************************************************************************/ static void Close(vlc_object_t *p_this) { intf_thread_t *p_intf = (intf_thread_t*) p_this; intf_sys_t *p_sys = p_intf->p_sys; var_DelCallback(pl_Get(p_intf), "activity", ItemChange, p_intf); vlc_cancel(p_sys->thread); vlc_join(p_sys->thread, NULL); input_thread_t *p_input = pl_CurrentInput(p_intf); if (p_input) { if (p_sys->b_state_cb) var_DelCallback(p_input, "intf-event", PlayingChange, p_intf); vlc_object_release(p_input); } int i; for (i = 0; i < p_sys->i_songs; i++) DeleteSong(&p_sys->p_queue[i]); vlc_UrlClean(&p_sys->p_submit_url); #if 0 //NOT USED free(p_sys->psz_nowp_host); free(p_sys->psz_nowp_file); #endif vlc_cond_destroy(&p_sys->wait); vlc_mutex_destroy(&p_sys->lock); free(p_sys); }
/***************************************************************************** * Close: destroy interface stuff *****************************************************************************/ static void Close( vlc_object_t *p_this ) { playlist_t *p_playlist = pl_Get( p_this ); input_thread_t *p_input; intf_thread_t *p_intf = ( intf_thread_t* ) p_this; intf_sys_t *p_sys = p_intf->p_sys; var_DelCallback( p_playlist, "item-current", ItemChange, p_intf ); p_input = playlist_CurrentInput( p_playlist ); if ( p_input ) { if( p_sys->b_state_cb ) var_DelCallback( p_input, "intf-event", PlayingChange, p_intf ); vlc_object_release( p_input ); } int i; for( i = 0; i < p_sys->i_songs; i++ ) DeleteSong( &p_sys->p_queue[i] ); free( p_sys->psz_submit_host ); free( p_sys->psz_submit_file ); #if 0 //NOT USED free( p_sys->psz_nowp_host ); free( p_sys->psz_nowp_file ); #endif vlc_cond_destroy( &p_sys->wait ); vlc_mutex_destroy( &p_sys->lock ); free( p_sys ); }
void InputManager::requestArtUpdate( input_item_t *p_item ) { bool b_current_item = false; if ( !p_item && hasInput() ) { /* default to current item */ p_item = input_GetItem( p_input ); b_current_item = true; } if ( p_item ) { /* check if it has already been enqueued */ if ( p_item->p_meta ) { int status = vlc_meta_GetStatus( p_item->p_meta ); if ( status & ( ITEM_ART_NOTFOUND|ITEM_ART_FETCHED ) ) return; } playlist_AskForArtEnqueue( pl_Get(p_intf), p_item ); /* No input will signal the cover art to update, * let's do it ourself */ if ( b_current_item ) UpdateArt(); else emit artChanged( p_item ); } }
/***************************************************************************** * Close: destroy interface stuff *****************************************************************************/ static void Close(vlc_object_t *p_this) { intf_thread_t *p_intf = (intf_thread_t*) p_this; intf_sys_t *p_sys = p_intf->p_sys; vlc_cancel(p_sys->thread); vlc_join(p_sys->thread, NULL); var_DelCallback(pl_Get(p_intf), "input-current", ItemChange, p_intf); if (p_sys->p_input != NULL) { var_DelCallback(p_sys->p_input, "intf-event", PlayingChange, p_intf); vlc_object_release(p_sys->p_input); } int i; for (i = 0; i < p_sys->i_songs; i++) DeleteSong(&p_sys->p_queue[i]); vlc_UrlClean(&p_sys->p_submit_url); vlc_UrlClean(&p_sys->p_nowp_url); vlc_cond_destroy(&p_sys->wait); vlc_mutex_destroy(&p_sys->lock); free(p_sys); }
/***************************************************************************** * OpenIntf: initialize interface *****************************************************************************/ static int Open ( vlc_object_t *p_this ) { intf_thread_t *p_intf = (intf_thread_t *)p_this; /* Allocate instance and initialize some members */ intf_sys_t *p_sys = p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) ); // sunqueen modify if( unlikely(p_sys == NULL) ) return VLC_ENOMEM; // Configure the module vlc_mutex_init( &p_sys->lock ); p_sys->p_input = NULL; p_sys->p_vout = NULL; p_sys->b_button_pressed = false; p_sys->i_threshold = var_InheritInteger( p_intf, "gestures-threshold" ); // Choose the tight button to use char *psz_button = var_InheritString( p_intf, "gestures-button" ); if( psz_button && !strcmp( psz_button, "left" ) ) p_sys->i_button_mask = 1; else if( psz_button && !strcmp( psz_button, "middle" ) ) p_sys->i_button_mask = 2; else // psz_button == "right" p_sys->i_button_mask = 4; free( psz_button ); p_sys->i_pattern = 0; p_sys->i_num_gestures = 0; var_AddCallback( pl_Get(p_intf), "input-current", PlaylistEvent, p_intf ); return VLC_SUCCESS; }
/***************************************************************************** * CloseIntf: destroy dummy interface *****************************************************************************/ static void Close ( vlc_object_t *p_this ) { intf_thread_t *p_intf = (intf_thread_t *)p_this; intf_sys_t *p_sys = p_intf->p_sys; /* Destroy the callbacks (the order matters!) */ var_DelCallback( pl_Get(p_intf), "input-current", PlaylistEvent, p_intf ); if( p_sys->p_input ) { var_DelCallback( p_sys->p_input, "intf-event", InputEvent, p_intf ); vlc_object_release( p_sys->p_input ); } if( p_sys->p_vout ) { var_DelCallback( p_sys->p_vout, "mouse-moved", MovedEvent, p_intf ); var_DelCallback( p_sys->p_vout, "mouse-button-down", ButtonEvent, p_intf ); vlc_object_release( p_sys->p_vout ); } /* Destroy structure */ vlc_mutex_destroy( &p_sys->lock ); free( p_sys ); }
/** * Save the MetaData, triggered by parent->save Button **/ void MetaPanel::saveMeta() { if( p_input == NULL ) return; /* now we read the modified meta data */ input_item_SetTitle( p_input, qtu( title_text->text() ) ); input_item_SetArtist( p_input, qtu( artist_text->text() ) ); input_item_SetAlbum( p_input, qtu( collection_text->text() ) ); input_item_SetGenre( p_input, qtu( genre_text->text() ) ); input_item_SetTrackNum( p_input, qtu( seqnum_text->text() ) ); input_item_SetTrackTotal( p_input, qtu( seqtot_text->text() ) ); input_item_SetDate( p_input, qtu( date_text->text() ) ); input_item_SetLanguage( p_input, qtu( language_text->text() ) ); input_item_SetCopyright( p_input, qtu( copyright_text->text() ) ); input_item_SetPublisher( p_input, qtu( publisher_text->text() ) ); input_item_SetDescription( p_input, qtu( description_text->toPlainText() ) ); playlist_t *p_playlist = pl_Get( p_intf ); input_item_WriteMeta( VLC_OBJECT(p_playlist), p_input ); /* Reset the status of the mode. No need to emit any signal because parent is the only caller */ b_inEditMode = false; }
/* libnotify callback, called when the "Previous" button is pressed */ static void Prev( NotifyNotification *notification, gchar *psz, gpointer p ) { vlc_object_t *p_object = (vlc_object_t*)p; VLC_UNUSED(psz); notify_notification_close( notification, NULL ); playlist_Prev( pl_Get( p_object ) ); }
/* libnotify callback, called when the "Next" button is pressed */ static void Next( NotifyNotification *notification, gchar *psz, gpointer p ) { intf_thread_t *p_object = (intf_thread_t *)p; VLC_UNUSED(psz); notify_notification_close( notification, NULL ); playlist_Next( pl_Get( p_object ) ); }
/* ****************************************************************************/ static void ReadMetaData(intf_thread_t *p_this) { input_thread_t *p_input; input_item_t *p_item; intf_sys_t *p_sys = p_this->p_sys; p_input = playlist_CurrentInput(pl_Get(p_this)); if (!p_input) return; p_item = input_GetItem(p_input); if (!p_item) { vlc_object_release(p_input); return; } #define ALLOC_ITEM_META(a, b) do { \ char *psz_meta = input_item_Get##b(p_item); \ if (psz_meta && *psz_meta) \ a = encode_URI_component(psz_meta); \ free(psz_meta); \ } while (0) vlc_mutex_lock(&p_sys->lock); p_sys->b_meta_read = true; ALLOC_ITEM_META(p_sys->p_current_item.psz_n, Name); if (!p_sys->p_current_item.psz_n) { msg_Dbg(p_this, "No name.."); DeleteItem(&p_sys->p_current_item); goto end; } ALLOC_ITEM_META(p_sys->p_current_item.psz_u, URI); if (!p_sys->p_current_item.psz_u) { msg_Dbg(p_this, "No URI.."); DeleteItem(&p_sys->p_current_item); goto end; } /* Now we have read the mandatory meta data, so we can submit that info */ p_sys->b_submit = true; /* Duration in seconds */ p_sys->p_current_item.i_l = input_item_GetDuration(p_item) / 1000000; #undef ALLOC_ITEM_META end: vlc_mutex_unlock(&p_sys->lock); vlc_object_release(p_input); }
/* volumeSlider changed value event slot */ void SoundWidget::userUpdateVolume( int i_sliderVolume ) { /* Only if volume is set by user action on slider */ setMuted( false ); playlist_t *p_playlist = pl_Get( p_intf ); int i_res = i_sliderVolume * QT_VOLUME_MAX / VOLUME_MAX; aout_VolumeSet( p_playlist, i_res ); refreshLabels(); }
/* libvlc mute/unmute event slot */ void SoundWidget::updateMuteStatus() { playlist_t *p_playlist = pl_Get( p_intf ); b_is_muted = aout_IsMuted( VLC_OBJECT(p_playlist) ); SoundSlider *soundSlider = qobject_cast<SoundSlider *>(volumeSlider); if( soundSlider ) soundSlider->setMuted( b_is_muted ); refreshLabels(); }
static void Run(intf_thread_t *intf) { intf_sys_t *sys = intf->p_sys; int fd; int canc = vlc_savecancel(); RegisterCallbacks(intf); while(1) { msg_Info(intf, "Creating IRC connection..."); fd = net_ConnectTCP(VLC_OBJECT(intf), sys->server, 6667); if(fd == -1) { msg_Err(intf, "Error connecting to server"); return; } msg_Info(intf, "Connected to server"); /* initialize context */ sys->fd = fd; sys->line_loc = 0; SendBufferInit(intf); SendBufferAppend(intf, "NICK "); SendBufferAppend(intf, sys->nick); SendBufferAppend(intf, "\r\n"); SendBufferAppend(intf, "USER "); SendBufferAppend(intf, sys->nick); SendBufferAppend(intf, " 8 * vlc\r\n"); sys->playlist = pl_Get(intf); #ifdef STOP_HACK playlist_Pause(sys->playlist); input_thread_t * input = playlist_CurrentInput(sys->playlist); var_SetFloat(input, "position", 0.0); #endif EventLoop(fd, intf); free(sys->send_buffer->buffer); sleep(30); } free(sys); vlc_restorecancel(canc); }
void InputManager::requestArtUpdate() { if( hasInput() ) { playlist_AskForArtEnqueue( pl_Get(p_intf), input_GetItem( p_input ) ); } else { /* No input will signal the cover art to update, * let's do it ourself */ UpdateArt(); } }
void CmdFullscreen::execute() { bool fs = var_ToggleBool( pl_Get( getIntf() ), "fullscreen" ); if( getIntf()->p_sys->p_input == NULL ) return; vout_thread_t *pVout = input_GetVout( getIntf()->p_sys->p_input ); if( pVout ) { // Switch fullscreen var_SetBool( pVout, "fullscreen", fs ); vlc_object_release( pVout ); } }
static void Close( vlc_object_t *p_this ) { intf_thread_t *p_intf = (intf_thread_t *)p_this; intf_sys_t *p_sys = p_intf->p_sys; if( !p_sys->b_isDialogProvider ) { var_Destroy (pl_Get(p_this), "window"); var_Destroy (pl_Get(p_this), "qt4-iface"); } QVLCApp::triggerQuit(); vlc_join (p_sys->thread, NULL); #ifdef Q_WS_X11 free (x11_display); x11_display = NULL; #endif delete p_sys; vlc_mutex_lock (&one.lock); one.busy = false; vlc_mutex_unlock (&one.lock); }
/***************************************************************************** * 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 *p_data ) { input_thread_t *p_input; intf_thread_t *p_intf = ( intf_thread_t* ) p_data; intf_sys_t *p_sys = p_intf->p_sys; input_item_t *p_item; VLC_UNUSED( p_this ); VLC_UNUSED( psz_var ); VLC_UNUSED( oldval ); VLC_UNUSED( newval ); p_sys->b_state_cb = false; p_sys->b_meta_read = false; p_sys->b_submit = false; p_input = playlist_CurrentInput( pl_Get( p_intf ) ); if( !p_input || p_input->b_dead ) return VLC_SUCCESS; p_item = input_GetItem( p_input ); if( !p_item ) { vlc_object_release( p_input ); return VLC_SUCCESS; } if( var_CountChoices( p_input, "video-es" ) ) { msg_Dbg( p_this, "Not an audio-only input, not submitting"); vlc_object_release( p_input ); return VLC_SUCCESS; } p_sys->time_total_pauses = 0; time( &p_sys->p_current_song.date ); /* to be sent to last.fm */ p_sys->p_current_song.i_start = mdate(); /* only used locally */ var_AddCallback( p_input, "intf-event", PlayingChange, p_intf ); p_sys->b_state_cb = true; if( input_item_IsPreparsed( p_item ) ) ReadMetaData( p_intf ); /* if the input item was not preparsed, we'll do it in PlayingChange() * callback, when "state" == PLAYING_S */ vlc_object_release( p_input ); return VLC_SUCCESS; }
/***************************************************************************** * 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 = findAout( pl_Get(p_this) ); (void)psz_name; (void)oldval; (void)newval; (void)p_data; if ( p_aout == NULL ) return VLC_SUCCESS; var_Destroy( p_aout, "audio-device" ); var_Destroy( p_aout, "audio-channels" ); aout_Restart( p_aout ); vlc_object_release( p_aout ); return VLC_SUCCESS; }
/***************************************************************************** * Close: destroy interface stuff *****************************************************************************/ static void Close( vlc_object_t *p_this ) { intf_thread_t *p_intf = (intf_thread_t *)p_this; playlist_t *p_playlist = pl_Get( p_intf ); var_DelCallback( p_playlist, "item-current", PlaylistNext, p_this ); var_DelCallback( p_playlist, "item-change", PlaylistNext, p_this ); /* Uninitialize library */ xosd_destroy( p_intf->p_sys->p_osd ); /* Destroy structure */ vlc_cond_destroy( &p_intf->p_sys->cond ); vlc_mutex_destroy( &p_intf->p_sys->lock ); free( p_intf->p_sys ); }