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 ) { playlist_t *pl = THEPL; var_Destroy (pl, "window"); var_Destroy (pl, "qt4-iface"); playlist_Deactivate (pl); /* release window provider if needed */ } /* And quit */ msg_Dbg( p_this, "requesting exit..." ); QVLCApp::triggerQuit(); msg_Dbg( p_this, "waiting for UI thread..." ); #ifndef Q_OS_MAC vlc_join (p_sys->thread, NULL); #endif delete p_sys; QMutexLocker locker (&lock); assert (busy); busy = false; }
void __osd_MenuDelete( vlc_object_t *p_this, osd_menu_t *p_osd ) { vlc_value_t lockval; if( !p_osd || !p_this ) return; var_Get( p_this->p_libvlc, "osd_mutex", &lockval ); vlc_mutex_lock( lockval.p_address ); if( vlc_internals( VLC_OBJECT(p_osd) )->i_refcount == 1 ) { var_Destroy( p_osd, "osd-menu-visible" ); var_Destroy( p_osd, "osd-menu-update" ); osd_ParserUnload( p_osd ); } vlc_object_release( p_osd ); if( vlc_internals( VLC_OBJECT(p_osd) )->i_refcount > 0 ) { vlc_mutex_unlock( lockval.p_address ); return; } p_osd = NULL; vlc_mutex_unlock( lockval.p_address ); }
/***************************************************************************** * Close: destroy interface window *****************************************************************************/ static void Close( vlc_object_t *p_this ) { vlc_value_t lockval; var_Get( p_this->p_libvlc, "gtk", &lockval ); vlc_mutex_lock( lockval.p_address ); i_refcount--; if( i_refcount > 0 ) { vlc_mutex_unlock( lockval.p_address ); var_Destroy( p_this->p_libvlc, "gtk" ); return; } gtk_main_quit(); vlc_thread_join( p_gtk_main ); vlc_object_destroy( p_gtk_main ); p_gtk_main = NULL; vlc_mutex_unlock( lockval.p_address ); var_Destroy( p_this->p_libvlc, "gtk" ); }
static int transcode_audio_initialize_filters( sout_stream_t *p_stream, sout_stream_id_t *id, sout_stream_sys_t *p_sys, audio_sample_format_t *fmt_last ) { /* Load user specified audio filters */ /* XXX: These variable names come kinda out of nowhere... */ var_Create( p_stream, "audio-time-stretch", VLC_VAR_BOOL ); var_Create( p_stream, "audio-filter", VLC_VAR_STRING ); if( p_sys->psz_af ) var_SetString( p_stream, "audio-filter", p_sys->psz_af ); id->p_af_chain = aout_FiltersNew( p_stream, fmt_last, &id->p_encoder->fmt_in.audio, NULL ); var_Destroy( p_stream, "audio-filter" ); var_Destroy( p_stream, "audio-time-stretch" ); if( id->p_af_chain == NULL ) { msg_Err( p_stream, "Unable to initialize audio filters" ); module_unneed( id->p_encoder, id->p_encoder->p_module ); id->p_encoder->p_module = NULL; module_unneed( id->p_decoder, id->p_decoder->p_module ); id->p_decoder->p_module = NULL; return VLC_EGENERIC; } p_sys->fmt_audio.i_rate = fmt_last->i_rate; p_sys->fmt_audio.i_physical_channels = fmt_last->i_physical_channels; 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 = 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; }
/** * Stops all plugins involved in the audio output. */ void aout_Shutdown (audio_output_t *p_aout) { aout_owner_t *owner = aout_owner (p_aout); aout_input_t *input; struct audio_mixer *mixer; aout_lock( p_aout ); /* Remove the input. */ input = owner->input; if (likely(input != NULL)) aout_InputDelete (p_aout, input); owner->input = NULL; mixer = owner->volume.mixer; owner->volume.mixer = NULL; var_DelCallback (p_aout, "audio-replay-gain-mode", ReplayGainCallback, owner); aout_OutputDelete( p_aout ); var_Destroy( p_aout, "audio-device" ); var_Destroy( p_aout, "audio-channels" ); aout_unlock( p_aout ); aout_MixerDelete (mixer); free (input); }
static void test_strings( libvlc_int_t *p_libvlc ) { int i; char *psz_tmp; for( i = 0; i < i_var_count; i++ ) var_Create( p_libvlc, psz_var_name[i], VLC_VAR_STRING ); for( i = 0; i < i_var_count; i++ ) var_SetString( p_libvlc, psz_var_name[i], psz_var_name[i] ); for( i = 0; i < i_var_count; i++ ) { psz_tmp = var_GetString( p_libvlc, psz_var_name[i] ); assert( !strcmp( psz_tmp, psz_var_name[i] ) ); free( psz_tmp ); } for( i = 0; i < i_var_count; i++ ) var_Destroy( p_libvlc, psz_var_name[i] ); /* Some more test for strings */ var_Create( p_libvlc, "bla", VLC_VAR_STRING ); assert( var_GetNonEmptyString( p_libvlc, "bla" ) == NULL ); var_SetString( p_libvlc, "bla", "" ); assert( var_GetNonEmptyString( p_libvlc, "bla" ) == NULL ); var_SetString( p_libvlc, "bla", "test" ); psz_tmp = var_GetNonEmptyString( p_libvlc, "bla" ); assert( !strcmp( psz_tmp, "test" ) ); free( psz_tmp ); var_Destroy( p_libvlc, "bla" ); }
/** * Destroy the playlist. * * Delete all items in the playlist and free the playlist structure. * \param p_playlist the playlist structure to destroy */ void playlist_Destroy( playlist_t * p_playlist ) { p_playlist->b_die = 1; vlc_thread_join( p_playlist ); var_Destroy( p_playlist, "intf-change" ); var_Destroy( p_playlist, "item-change" ); var_Destroy( p_playlist, "playlist-current" ); var_Destroy( p_playlist, "intf-popmenu" ); var_Destroy( p_playlist, "intf-show" ); var_Destroy( p_playlist, "prevent-skip" ); var_Destroy( p_playlist, "play-and-stop" ); var_Destroy( p_playlist, "random" ); var_Destroy( p_playlist, "repeat" ); var_Destroy( p_playlist, "loop" ); while( p_playlist->i_groups > 0 ) { playlist_DeleteGroup( p_playlist, p_playlist->pp_groups[0]->i_id ); } while( p_playlist->i_size > 0 ) { playlist_Delete( p_playlist, 0 ); } vlc_object_destroy( p_playlist ); }
/***************************************************************************** * 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 ); }
ThemeRepository::~ThemeRepository() { var_DelCallback( getIntf(), "intf-skins", changeSkin, this ); var_DelCallback( getIntf(), "intf-skins-interactive", changeSkin, this ); var_Destroy( getIntf(), "intf-skins" ); var_Destroy( getIntf(), "intf-skins-interactive" ); }
/** * Configures the dummy volume setter. * @note Audio output plugins for which volume is irrelevant * should call this function during activation. */ void aout_VolumeNoneInit (audio_output_t *aout) { /* aout_New() -safely- calls this function without the lock, before any * other thread knows of this audio output instance. aout_assert_locked (aout); */ aout->pf_volume_set = aout_VolumeNoneSet; var_Destroy (aout, "volume"); var_Destroy (aout, "mute"); }
/***************************************************************************** * CloseFilter *****************************************************************************/ static void CloseFilter( vlc_object_t *p_this) { filter_t *p_filter = (filter_t *) p_this; filter_sys_t *p_sys = p_filter->p_sys; var_Destroy( p_this, MONO_CFG "channel" ); var_Destroy( p_this, MONO_CFG "downmix" ); free( p_sys->p_atomic_operations ); free( p_sys->p_overflow_buffer ); free( p_sys ); }
/***************************************************************************** * Close: *****************************************************************************/ static void Close( vlc_object_t *p_this ) { decoder_t *p_dec = (decoder_t*) p_this; decoder_sys_t *p_sys = p_dec->p_sys; arib_instance_destroy( p_sys->p_arib_instance ); free( p_sys->psz_arib_base_dir ); var_Destroy( p_this, ARIBSUB_CFG_PREFIX "ignore-ruby" ); var_Destroy( p_this, ARIBSUB_CFG_PREFIX "use-coretext" ); free( p_sys ); }
static void inputFailure( aout_instance_t * p_aout, aout_input_t * p_input, const char * psz_error_message ) { /* error message */ msg_Err( p_aout, "%s", psz_error_message ); /* clean up */ aout_FiltersDestroyPipeline( p_aout, p_input->pp_filters, p_input->i_nb_filters ); aout_FiltersDestroyPipeline( p_aout, p_input->pp_resamplers, p_input->i_nb_resamplers ); aout_FifoDestroy( p_aout, &p_input->mixer.fifo ); var_Destroy( p_aout, "visual" ); var_Destroy( p_aout, "equalizer" ); var_Destroy( p_aout, "audio-filter" ); var_Destroy( p_aout, "audio-visual" ); var_Destroy( p_aout, "audio-replay-gain-mode" ); var_Destroy( p_aout, "audio-replay-gain-default" ); var_Destroy( p_aout, "audio-replay-gain-preamp" ); var_Destroy( p_aout, "audio-replay-gain-peak-protection" ); /* error flag */ p_input->b_error = 1; }
/***************************************************************************** * aout_DecDelete : delete a decoder *****************************************************************************/ int aout_DecDelete( aout_instance_t * p_aout, aout_input_t * p_input ) { int i_input; /* This function can only be called by the decoder itself, so no need * to lock p_input->lock. */ vlc_mutex_lock( &p_aout->mixer_lock ); for ( i_input = 0; i_input < p_aout->i_nb_inputs; i_input++ ) { if ( p_aout->pp_inputs[i_input] == p_input ) { break; } } if ( i_input == p_aout->i_nb_inputs ) { msg_Err( p_aout, "cannot find an input to delete" ); return -1; } /* Remove the input from the list. */ memmove( &p_aout->pp_inputs[i_input], &p_aout->pp_inputs[i_input + 1], (AOUT_MAX_INPUTS - i_input - 1) * sizeof(aout_input_t *) ); p_aout->i_nb_inputs--; aout_InputDelete( p_aout, p_input ); vlc_mutex_destroy( &p_input->lock ); free( p_input ); if ( !p_aout->i_nb_inputs ) { aout_OutputDelete( p_aout ); aout_MixerDelete( p_aout ); 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" ); } } vlc_mutex_unlock( &p_aout->mixer_lock ); return 0; }
/***************************************************************************** * DestroyFilter: Make a clean exit of this plugin *****************************************************************************/ static void DestroyFilter( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t*)p_this; filter_sys_t *p_sys = p_filter->p_sys; msg_Dbg( p_filter, "DestroyFilter called." ); stop_osdvnc( p_filter ); var_DelCallback( p_filter->p_libvlc, "key-pressed", KeyEvent, p_this ); var_Destroy( p_this, RMTOSD_CFG "host" ); var_Destroy( p_this, RMTOSD_CFG "port" ); var_Destroy( p_this, RMTOSD_CFG "password" ); var_Destroy( p_this, RMTOSD_CFG "update" ); var_Destroy( p_this, RMTOSD_CFG "vnc-polling" ); var_Destroy( p_this, RMTOSD_CFG "mouse-events" ); var_Destroy( p_this, RMTOSD_CFG "key-events" ); var_Destroy( p_this, RMTOSD_CFG "alpha" ); vlc_mutex_destroy( &p_sys->lock ); free( p_sys->psz_host ); free( p_sys->psz_passwd ); free( p_sys ); }
/***************************************************************************** * input_ControlVarTitle: * Create all variables for a title *****************************************************************************/ void input_ControlVarTitle( input_thread_t *p_input, int i_title ) { input_title_t *t = p_input->p->title[i_title]; vlc_value_t text; int i; /* Create/Destroy command variables */ if( t->i_seekpoint <= 1 ) { var_Destroy( p_input, "next-chapter" ); var_Destroy( p_input, "prev-chapter" ); } else if( var_Type( p_input, "next-chapter" ) == 0 ) { var_Create( p_input, "next-chapter", VLC_VAR_VOID ); text.psz_string = _("Next chapter"); var_Change( p_input, "next-chapter", VLC_VAR_SETTEXT, &text, NULL ); var_AddCallback( p_input, "next-chapter", SeekpointCallback, NULL ); var_Create( p_input, "prev-chapter", VLC_VAR_VOID ); text.psz_string = _("Previous chapter"); var_Change( p_input, "prev-chapter", VLC_VAR_SETTEXT, &text, NULL ); var_AddCallback( p_input, "prev-chapter", SeekpointCallback, NULL ); } /* Build chapter list */ var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL, NULL ); for( i = 0; i < t->i_seekpoint; i++ ) { vlc_value_t val; val.i_int = i; if( t->seekpoint[i]->psz_name == NULL || *t->seekpoint[i]->psz_name == '\0' ) { /* Default value */ if( asprintf( &text.psz_string, _("Chapter %i"), i + p_input->p->i_seekpoint_offset ) == -1 ) continue; } else { text.psz_string = strdup( t->seekpoint[i]->psz_name ); } var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val, &text ); free( text.psz_string ); } }
void filter_DelProxyCallbacks( vlc_object_t *obj, filter_t *filter, vlc_callback_t restart_cb ) { char **names = var_GetAllNames(VLC_OBJECT(filter)); if (names == NULL) return; for (char **pname = names; *pname != NULL; pname++) { char *name = *pname; if (!(var_Type(obj, name) & VLC_VAR_ISCOMMAND)) { free(name); continue; } int filter_var_type = var_Type(filter, name); if (filter_var_type & VLC_VAR_ISCOMMAND) var_DelCallback(obj, name, TriggerFilterCallback, filter); else if (filter_var_type) var_DelCallback(obj, name, restart_cb, obj); var_Destroy(obj, name); free(name); } free(names); }
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 test_choices( libvlc_int_t *p_libvlc ) { vlc_value_t val, val2; var_Create( p_libvlc, "bla", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE | VLC_VAR_ISCOMMAND ); val.i_int = 1; val2.psz_string = (char*)"one"; var_Change( p_libvlc, "bla", VLC_VAR_ADDCHOICE, &val, &val2 ); val.i_int = 2; val2.psz_string = (char*)"two"; var_Change( p_libvlc, "bla", VLC_VAR_ADDCHOICE, &val, &val2 ); assert( var_CountChoices( p_libvlc, "bla" ) == 2 ); var_Change( p_libvlc, "bla", VLC_VAR_DELCHOICE, &val, &val2 ); assert( var_CountChoices( p_libvlc, "bla" ) == 1 ); var_Change( p_libvlc, "bla", VLC_VAR_GETCHOICES, &val, &val2 ); assert( val.p_list->i_count == 1 && val.p_list->p_values[0].i_int == 1 && val2.p_list->i_count == 1 && !strcmp( val2.p_list->p_values[0].psz_string, "one" ) ); var_FreeList( &val, &val2 ); var_Change( p_libvlc, "bla", VLC_VAR_CLEARCHOICES, NULL, NULL ); assert( var_CountChoices( p_libvlc, "bla" ) == 0 ); var_Destroy( p_libvlc, "bla" ); }
static void test_callbacks( libvlc_int_t *p_libvlc ) { /* add the callbacks */ int i; for( i = 0; i < i_var_count; i++ ) { var_Create( p_libvlc, psz_var_name[i], VLC_VAR_INTEGER ); var_AddCallback( p_libvlc, psz_var_name[i], callback, psz_var_name ); } /* Set the variables and trigger the callbacks */ for( i = 0; i < i_var_count; i++ ) { int i_temp = rand(); var_SetInteger( p_libvlc, psz_var_name[i], i_temp ); assert( i_temp == var_value[i].i_int ); var_SetInteger( p_libvlc, psz_var_name[i], 0 ); assert( var_value[i].i_int == 0 ); var_value[i].i_int = 1; } /* Only trigger the callback: the value will be 0 again */ for( i = 0; i < i_var_count; i++ ) { var_TriggerCallback( p_libvlc, psz_var_name[i] ); assert( var_value[i].i_int == 0 ); } for( i = 0; i < i_var_count; i++ ) var_Destroy( p_libvlc, psz_var_name[i] ); }
/***************************************************************************** * 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; }
/** * Release the drawable. */ static void Close (vlc_object_t *obj) { vout_window_t *wnd = (vout_window_t *)obj; void **used, *val = wnd->p_sys; size_t n = 0; /* Remove this drawable from the list of busy ones */ vlc_mutex_lock (&serializer); used = var_GetAddress (VLC_OBJECT (obj->p_libvlc), "drawables-in-use"); assert (used); while (used[n] != val) { assert (used[n]); n++; } do used[n] = used[n + 1]; while (used[++n] != NULL); if (n == 0) /* should not be needed (var_Destroy...) but better safe than sorry: */ var_SetAddress (obj->p_libvlc, "drawables-in-use", NULL); vlc_mutex_unlock (&serializer); if (n == 0) free (used); /* Variables are reference-counted... */ var_Destroy (obj->p_libvlc, "drawables-in-use"); }
static void ReleaseDLSys(vlc_object_t *obj) { vlc_object_t *libvlc = VLC_OBJECT(obj->p_libvlc); vlc_mutex_lock(&sys_lock); struct decklink_sys_t *sys = (struct decklink_sys_t*)var_GetAddress(libvlc, "decklink-sys"); if (--sys->users == 0) { msg_Dbg(obj, "Destroying decklink data"); vlc_mutex_destroy(&sys->lock); vlc_cond_destroy(&sys->cond); if (sys->p_output) { sys->p_output->StopScheduledPlayback(0, NULL, 0); sys->p_output->DisableVideoOutput(); sys->p_output->DisableAudioOutput(); sys->p_output->Release(); } free(sys); var_Destroy(libvlc, "decklink-sys"); } vlc_mutex_unlock(&sys_lock); }
/** Remove this drawable from the list of busy ones */ static void ReleaseDrawable (vlc_object_t *obj, xcb_window_t window) { xcb_window_t *used; size_t n = 0; vlc_mutex_lock (&serializer); used = var_GetAddress (obj->p_libvlc, "xid-in-use"); assert (used); while (used[n] != window) { assert (used[n]); n++; } do used[n] = used[n + 1]; while (used[++n]); if (n == 0) var_SetAddress (obj->p_libvlc, "xid-in-use", NULL); vlc_mutex_unlock (&serializer); if (n == 0) free (used); /* Variables are reference-counted... */ var_Destroy (obj->p_libvlc, "xid-in-use"); }
/** * Add an interface plugin and run it */ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, char const *psz_module ) { if( !p_libvlc ) return VLC_EGENERIC; if( !psz_module ) /* requesting the default interface */ { char *psz_interface = var_CreateGetNonEmptyString( p_libvlc, "intf" ); if( !psz_interface ) /* "intf" has not been set */ { #if !defined( WIN32 ) && !defined( __OS2__ ) if( b_daemon ) /* Daemon mode hack. * We prefer the dummy interface if none is specified. */ psz_module = "dummy"; else #endif msg_Info( p_libvlc, "%s", _("Running vlc with the default interface. " "Use 'cvlc' to use vlc without interface.") ); } free( psz_interface ); var_Destroy( p_libvlc, "intf" ); } /* Try to create the interface */ int ret = intf_Create( p_libvlc, psz_module ? psz_module : "$intf" ); if( ret ) msg_Err( p_libvlc, "interface \"%s\" initialization failed", psz_module ? psz_module : "default" ); return ret; }
void osd_MenuDelete( vlc_object_t *p_this, osd_menu_t *p_osd ) { if( !p_osd || !p_this ) return; vlc_mutex_lock( &osd_mutex ); if( vlc_internals( VLC_OBJECT(p_osd) )->i_refcount == 1 ) { var_Destroy( p_osd, "osd-menu-visible" ); var_Destroy( p_osd, "osd-menu-update" ); osd_ParserUnload( p_osd ); var_SetAddress( p_this->p_libvlc, "osd-object", NULL ); } vlc_object_release( p_osd ); vlc_mutex_unlock( &osd_mutex ); }
/***************************************************************************** * SubsdelayDestroy: Destroy subsdelay filter *****************************************************************************/ static void SubsdelayDestroy( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t *) p_this; filter_sys_t *p_sys = p_filter->p_sys; SubsdelayHeapDestroy( &p_sys->heap ); /* destroy parameters */ var_DelCallback( p_filter, CFG_MODE, SubsdelayCallback, p_sys ); var_Destroy( p_filter, CFG_MODE ); var_DelCallback( p_filter, CFG_FACTOR, SubsdelayCallback, p_sys ); var_Destroy( p_filter, CFG_FACTOR ); var_DelCallback( p_filter, CFG_OVERLAP, SubsdelayCallback, p_sys ); var_Destroy( p_filter, CFG_OVERLAP ); var_DelCallback( p_filter, CFG_MIN_ALPHA, SubsdelayCallback, p_sys ); var_Destroy( p_filter, CFG_MIN_ALPHA ); var_DelCallback( p_filter, CFG_MIN_STOPS_INTERVAL, SubsdelayCallback, p_sys ); var_Destroy( p_filter, CFG_MIN_STOPS_INTERVAL ); var_DelCallback( p_filter, CFG_MIN_STOP_START_INTERVAL, SubsdelayCallback, p_sys ); var_Destroy( p_filter, CFG_MIN_STOP_START_INTERVAL ); var_DelCallback( p_filter, CFG_MIN_START_STOP_INTERVAL, SubsdelayCallback, p_sys ); var_Destroy( p_filter, CFG_MIN_START_STOP_INTERVAL ); free( p_sys ); }
VLCVarChoiceModel::~VLCVarChoiceModel() { if (m_object->get()) { var_DelCallback(m_object->get(), qtu(m_varname), VLCVarChoiceModel::on_variable_callback, this); var_DelListCallback(m_object->get(), qtu(m_varname), VLCVarChoiceModel::on_variable_list_callback, this); var_Destroy(m_object->get(), qtu(m_varname)); } }
/***************************************************************************** * 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; }