vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Wed Feb 27 19:27:01 2019 +0200| [d867dac99e4702ede500ad116fb2ade5f4401800] | committer: Rémi Denis-Courmont
Use vlc_object_parent() > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d867dac99e4702ede500ad116fb2ade5f4401800 --- include/vlc_inhibit.h | 2 +- include/vlc_interface.h | 2 +- include/vlc_objects.h | 10 +++++++--- modules/access/http/tunnel.c | 2 +- modules/audio_filter/compressor.c | 4 ++-- modules/audio_filter/equalizer.c | 4 ++-- modules/audio_filter/gain.c | 3 ++- modules/audio_filter/normvol.c | 6 +++--- modules/audio_filter/scaletempo.c | 4 ++-- modules/audio_filter/spatializer/spatializer.cpp | 4 ++-- modules/audio_filter/stereo_widen.c | 4 ++-- modules/audio_output/wasapi.c | 4 ++-- modules/audio_output/winstore.c | 4 ++-- modules/codec/avcodec/d3d11va.c | 2 +- modules/demux/stl.c | 9 ++++++--- modules/gui/macosx/windows/video/VLCVideoOutputProvider.m | 4 ++-- modules/gui/qt/menus.cpp | 2 +- modules/gui/qt/qt.cpp | 2 +- modules/lua/extension.c | 2 +- modules/services_discovery/podcast.c | 10 +++++----- modules/stream_out/chromecast/chromecast_communication.cpp | 2 +- modules/stream_out/chromecast/chromecast_ctrl.cpp | 10 +++++----- modules/stream_out/chromecast/chromecast_demux.cpp | 4 ++-- modules/video_chroma/chain.c | 4 ++-- modules/video_filter/ci_filters.m | 6 +++--- modules/video_output/ios.m | 8 ++++---- modules/video_output/macosx.m | 6 +++--- modules/video_output/splitter.c | 4 ++-- src/audio_output/output.c | 8 ++++---- src/audio_output/volume.c | 2 +- src/input/input.c | 2 +- src/input/stream_extractor.c | 5 +++-- src/input/stream_filter.c | 5 +++-- src/misc/objects.c | 11 ++++++----- src/misc/variables.c | 2 +- src/playlist_legacy/services_discovery.c | 4 ++-- src/stream_output/stream_output.c | 2 +- src/video_output/window.c | 14 +++++++------- 38 files changed, 97 insertions(+), 86 deletions(-) diff --git a/include/vlc_inhibit.h b/include/vlc_inhibit.h index 00abfab0bd..960920063b 100644 --- a/include/vlc_inhibit.h +++ b/include/vlc_inhibit.h @@ -50,7 +50,7 @@ struct vlc_inhibit static inline struct vout_window_t *vlc_inhibit_GetWindow(vlc_inhibit_t *ih) { - return (struct vout_window_t *)(ih->obj.parent); + return (struct vout_window_t *)vlc_object_parent(ih); } static inline void vlc_inhibit_Set (vlc_inhibit_t *ih, unsigned flags) diff --git a/include/vlc_interface.h b/include/vlc_interface.h index 46cc8f07c1..acf82e5938 100644 --- a/include/vlc_interface.h +++ b/include/vlc_interface.h @@ -93,7 +93,7 @@ VLC_API void libvlc_Quit( libvlc_int_t * ); static inline playlist_t *pl_Get( struct intf_thread_t *intf ) { - return (playlist_t *)(intf->obj.parent); + return (playlist_t *)vlc_object_parent(intf); } VLC_API vlc_playlist_t * diff --git a/include/vlc_objects.h b/include/vlc_objects.h index 11b18243e0..582dd7eafa 100644 --- a/include/vlc_objects.h +++ b/include/vlc_objects.h @@ -135,9 +135,13 @@ VLC_API char *vlc_object_get_name( const vlc_object_t * ) VLC_USED; VLC_USED static inline libvlc_int_t *vlc_object_instance(vlc_object_t *obj) { - while (obj->obj.parent != NULL) - obj = obj->obj.parent; - return (libvlc_int_t *)obj; + vlc_object_t *parent; + + do + parent = obj; + while ((obj = vlc_object_parent(obj)) != NULL); + + return (libvlc_int_t *)parent; } #define vlc_object_instance(o) vlc_object_instance(VLC_OBJECT(o)) diff --git a/modules/access/http/tunnel.c b/modules/access/http/tunnel.c index 60c724a3c0..3d607ec732 100644 --- a/modules/access/http/tunnel.c +++ b/modules/access/http/tunnel.c @@ -170,7 +170,7 @@ vlc_tls_t *vlc_https_connect_proxy(void *ctx, vlc_tls_client_t *creds, sock = vlc_https_connect(creds, url.psz_host, url.i_port, &ptwo); else if (!strcasecmp(url.psz_protocol, "http")) - sock = vlc_tls_SocketOpenTCP(creds ? creds->obj.parent : NULL, + sock = vlc_tls_SocketOpenTCP(creds ? vlc_object_parent(creds) : NULL, url.psz_host, url.i_port); else sock = NULL; diff --git a/modules/audio_filter/compressor.c b/modules/audio_filter/compressor.c index 1b29e592aa..402cbb5ed1 100644 --- a/modules/audio_filter/compressor.c +++ b/modules/audio_filter/compressor.c @@ -204,7 +204,7 @@ vlc_module_end () static int Open( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t*)p_this; - vlc_object_t *p_aout = p_filter->obj.parent; + vlc_object_t *p_aout = vlc_object_parent(p_filter); float f_sample_rate = p_filter->fmt_in.audio.i_rate; float f_num; @@ -270,7 +270,7 @@ static int Open( vlc_object_t *p_this ) static void Close( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t*)p_this; - vlc_object_t *p_aout = p_filter->obj.parent; + vlc_object_t *p_aout = vlc_object_parent(p_filter); filter_sys_t *p_sys = p_filter->p_sys; /* Remove our callbacks */ diff --git a/modules/audio_filter/equalizer.c b/modules/audio_filter/equalizer.c index 3e50277d21..c63547f569 100644 --- a/modules/audio_filter/equalizer.c +++ b/modules/audio_filter/equalizer.c @@ -282,7 +282,7 @@ static int EqzInit( filter_t *p_filter, int i_rate ) eqz_config_t cfg; int i, ch; vlc_value_t val1, val2, val3; - vlc_object_t *p_aout = p_filter->obj.parent; + vlc_object_t *p_aout = vlc_object_parent(p_filter); int i_ret = VLC_ENOMEM; bool b_vlcFreqs = var_InheritBool( p_aout, "equalizer-vlcfreqs" ); @@ -451,7 +451,7 @@ static void EqzFilter( filter_t *p_filter, float *out, float *in, static void EqzClean( filter_t *p_filter ) { filter_sys_t *p_sys = p_filter->p_sys; - vlc_object_t *p_aout = p_filter->obj.parent; + vlc_object_t *p_aout = vlc_object_parent(p_filter); var_DelCallback( p_aout, "equalizer-bands", BandsCallback, p_sys ); var_DelCallback( p_aout, "equalizer-preset", PresetCallback, p_sys ); diff --git a/modules/audio_filter/gain.c b/modules/audio_filter/gain.c index 609aa67afe..5a95953bae 100644 --- a/modules/audio_filter/gain.c +++ b/modules/audio_filter/gain.c @@ -93,7 +93,8 @@ static int Open( vlc_object_t *p_this ) return VLC_EGENERIC; } - p_sys->f_gain = var_InheritFloat( p_filter->obj.parent, "gain-value" ); + p_sys->f_gain = var_InheritFloat( vlc_object_parent(p_filter), + "gain-value" ); msg_Dbg( p_filter, "gain multiplier sets to %.2fx", p_sys->f_gain ); p_filter->fmt_out.audio = p_filter->fmt_in.audio; diff --git a/modules/audio_filter/normvol.c b/modules/audio_filter/normvol.c index 653e3818bb..a9aa2b9cfb 100644 --- a/modules/audio_filter/normvol.c +++ b/modules/audio_filter/normvol.c @@ -101,9 +101,9 @@ static int Open( vlc_object_t *p_this ) p_sys = p_filter->p_sys = malloc( sizeof( *p_sys ) ); if( !p_sys ) return VLC_ENOMEM; - p_sys->i_nb = var_CreateGetInteger( p_filter->obj.parent, + p_sys->i_nb = var_CreateGetInteger( vlc_object_parent(p_filter), "norm-buff-size" ); - p_sys->f_max = var_CreateGetFloat( p_filter->obj.parent, + p_sys->f_max = var_CreateGetFloat( vlc_object_parent(p_filter), "norm-max-level" ); if( p_sys->f_max <= 0 ) p_sys->f_max = 0.01; @@ -186,7 +186,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf ) f_average = f_average / p_sys->i_nb; /* Seuil arbitraire */ - p_sys->f_max = var_GetFloat( p_filter->obj.parent, + p_sys->f_max = var_GetFloat( vlc_object_parent(p_filter), "norm-max-level" ); //fprintf(stderr,"Average %f, max %f\n", f_average, p_sys->f_max ); diff --git a/modules/audio_filter/scaletempo.c b/modules/audio_filter/scaletempo.c index 3f47a76ae7..fc4f570c70 100644 --- a/modules/audio_filter/scaletempo.c +++ b/modules/audio_filter/scaletempo.c @@ -501,7 +501,7 @@ static int OpenPitch( vlc_object_t *p_this ) return err; filter_t *p_filter = (filter_t *)p_this; - vlc_object_t *p_aout = p_filter->obj.parent; + vlc_object_t *p_aout = vlc_object_parent(p_filter); filter_sys_t *p_sys = p_filter->p_sys; float pitch_shift = var_CreateGetFloat( p_aout, "pitch-shift" ); @@ -535,7 +535,7 @@ static void ClosePitch( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys = p_filter->p_sys; - vlc_object_t *p_aout = p_filter->obj.parent; + vlc_object_t *p_aout = vlc_object_parent(p_filter); var_DelCallback( p_aout, "pitch-shift", PitchCallback, p_sys ); var_Destroy( p_aout, "pitch-shift" ); module_unneed( p_sys->resampler, p_sys->resampler->p_module ); diff --git a/modules/audio_filter/spatializer/spatializer.cpp b/modules/audio_filter/spatializer/spatializer.cpp index b3397735e3..eccde1331e 100644 --- a/modules/audio_filter/spatializer/spatializer.cpp +++ b/modules/audio_filter/spatializer/spatializer.cpp @@ -141,7 +141,7 @@ static int Open( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys; - vlc_object_t *p_aout = p_filter->obj.parent; + vlc_object_t *p_aout = vlc_object_parent(p_filter); /* Allocate structure */ p_filter->p_sys = p_sys = (filter_sys_t*)malloc( sizeof( *p_sys ) ); @@ -182,7 +182,7 @@ static void Close( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys ); - vlc_object_t *p_aout = p_filter->obj.parent; + vlc_object_t *p_aout = vlc_object_parent(p_filter); /* Delete the callbacks */ for(unsigned i=0;i<num_callbacks;++i) diff --git a/modules/audio_filter/stereo_widen.c b/modules/audio_filter/stereo_widen.c index 69cb7e0e72..1ec29bfffd 100644 --- a/modules/audio_filter/stereo_widen.c +++ b/modules/audio_filter/stereo_widen.c @@ -117,7 +117,7 @@ static int MakeRingBuffer( float **pp_buffer, size_t *pi_buffer, static int Open( vlc_object_t *obj ) { filter_t *p_filter = (filter_t *)obj; - vlc_object_t *p_aout = p_filter->obj.parent; + vlc_object_t *p_aout = vlc_object_parent(p_filter); filter_sys_t *p_sys; if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 || @@ -197,7 +197,7 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block ) static void Close( vlc_object_t *obj ) { filter_t *p_filter = (filter_t *)obj; - vlc_object_t *p_aout = p_filter->obj.parent; + vlc_object_t *p_aout = vlc_object_parent(p_filter); filter_sys_t *p_sys = p_filter->p_sys; #define DEL_VAR(var) \ diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c index 85dea69604..74d5239bd7 100644 --- a/modules/audio_output/wasapi.c +++ b/modules/audio_output/wasapi.c @@ -480,7 +480,7 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt, if (fmt.i_format == VLC_CODEC_DTS) { - b_dtshd = var_GetBool(s->obj.parent, "dtshd"); + b_dtshd = var_GetBool(vlc_object_parent(s), "dtshd"); if (b_dtshd) { b_hdmi = true; @@ -553,7 +553,7 @@ static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt, "fallback to 48kHz (S/PDIF) (error 0x%lx)", hr); IAudioClient_Release(sys->client); free(sys); - var_SetBool(s->obj.parent, "dtshd", false); + var_SetBool(vlc_object_parent(s), "dtshd", false); return Start(s, pfmt, sid); } msg_Err(s, "cannot negotiate audio format (error 0x%lx)%s", hr, diff --git a/modules/audio_output/winstore.c b/modules/audio_output/winstore.c index 5dcad97908..d2afa78844 100644 --- a/modules/audio_output/winstore.c +++ b/modules/audio_output/winstore.c @@ -279,7 +279,7 @@ static int DeviceSelect(audio_output_t *aout, const char* psz_device) if (aout->sys->client == (IAudioClient*)ptr) return VLC_SUCCESS; aout->sys->client = (IAudioClient*)ptr; - var_SetAddress( aout->obj.parent, "winstore-client", aout->sys->client ); + var_SetAddress( vlc_object_parent(aout), "winstore-client", aout->sys->client ); aout_RestartRequest( aout, AOUT_RESTART_OUTPUT ); return VLC_SUCCESS; } @@ -294,7 +294,7 @@ static int Open(vlc_object_t *obj) aout->sys = sys; sys->stream = NULL; - aout->sys->client = var_CreateGetAddress( aout->obj.parent, "winstore-client" ); + aout->sys->client = var_CreateGetAddress( vlc_object_parent(aout), "winstore-client" ); if (aout->sys->client != NULL) msg_Dbg( aout, "Reusing previous client: %p", aout->sys->client ); aout->start = Start; diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c index e7a62cbd83..fe9cabf2a8 100644 --- a/modules/codec/avcodec/d3d11va.c +++ b/modules/codec/avcodec/d3d11va.c @@ -777,7 +777,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, #if !D3D11_DIRECT_DECODE size_t surface_idx; for (surface_idx = 0; surface_idx < surface_count; surface_idx++) { - picture_t *pic = decoder_NewPicture( (decoder_t*) va->obj.parent ); + picture_t *pic = decoder_NewPicture( (decoder_t*) vlc_object_parent(va) ); sys->extern_pics[surface_idx] = pic; dx_sys->hw_surface[surface_idx] = NULL; if (pic==NULL) diff --git a/modules/demux/stl.c b/modules/demux/stl.c index 14c15e7444..02c10cd556 100644 --- a/modules/demux/stl.c +++ b/modules/demux/stl.c @@ -107,7 +107,8 @@ static int Control(demux_t *demux, int query, va_list args) } case DEMUX_GET_TIME: { vlc_tick_t *t = va_arg(args, vlc_tick_t *); - *t = sys->next_date - var_GetInteger(demux->obj.parent, "spu-delay"); + *t = sys->next_date - var_GetInteger(vlc_object_parent(demux), + "spu-delay"); if( *t < 0 ) *t = sys->next_date; return VLC_SUCCESS; @@ -151,7 +152,8 @@ static int Control(demux_t *demux, int query, va_list args) } else if(sys->count > 0 && sys->index[sys->count-1].stop > 0) { - *pf = sys->next_date - var_GetInteger(demux->obj.parent, "spu-delay"); + *pf = sys->next_date - var_GetInteger(vlc_object_parent(demux), + "spu-delay"); if(*pf < 0) *pf = sys->next_date; *pf /= sys->index[sys->count-1].stop; @@ -178,7 +180,8 @@ static int Demux(demux_t *demux) { demux_sys_t *sys = demux->p_sys; - vlc_tick_t i_barrier = sys->next_date - var_GetInteger(demux->obj.parent, "spu-delay"); + vlc_tick_t i_barrier = sys->next_date + - var_GetInteger(vlc_object_parent(demux), "spu-delay"); if(i_barrier < 0) i_barrier = sys->next_date; diff --git a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m index a72af9f4bf..b9e7f0b161 100644 --- a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m +++ b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m @@ -340,7 +340,7 @@ int WindowOpen(vout_window_t *p_wnd) [newVideoWindow setAlphaValue: config_GetFloat("macosx-opaqueness")]; - [voutView setVoutThread:(vout_thread_t *)p_wnd->obj.parent]; + [voutView setVoutThread:(vout_thread_t *)vlc_object_parent(p_wnd)]; [newVideoWindow setHasActiveVideo: YES]; [voutWindows setObject:newVideoWindow forKey:[NSValue valueWithPointer:p_wnd]]; @@ -367,7 +367,7 @@ int WindowOpen(vout_window_t *p_wnd) // this is not set when we start in fullscreen because of // fullscreen settings in video prefs the second time - var_SetBool(p_wnd->obj.parent, "fullscreen", 1); + var_SetBool(vlc_object_parent(p_wnd), "fullscreen", 1); [self setFullscreen:1 forWindow:p_wnd withAnimation:NO]; } diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp index 751707daf2..7efffb4290 100644 --- a/modules/gui/qt/menus.cpp +++ b/modules/gui/qt/menus.cpp @@ -1090,7 +1090,7 @@ QMenu* VLCMenuBar::PopupMenu( intf_thread_t *p_intf, bool show ) /* In skins interface, append some items */ if( p_intf->p_sys->b_isDialogProvider ) { - vlc_object_t* p_object = p_intf->obj.parent; + vlc_object_t* p_object = vlc_object_parent(p_intf); submenu->setTitle( qtr( "Interface" ) ); /* Open skin dialog box */ diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp index d8165a6aea..a390d3b7ae 100644 --- a/modules/gui/qt/qt.cpp +++ b/modules/gui/qt/qt.cpp @@ -420,7 +420,7 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider ) /* set up the playlist to work on */ if( isDialogProvider ) - p_sys->p_playlist = pl_Get( (intf_thread_t *)p_intf->obj.parent ); + p_sys->p_playlist = pl_Get( (intf_thread_t *)vlc_object_parent(p_intf) ); else p_sys->p_playlist = pl_Get( p_intf ); diff --git a/modules/lua/extension.c b/modules/lua/extension.c index 74de17e0e3..619a36b956 100644 --- a/modules/lua/extension.c +++ b/modules/lua/extension.c @@ -819,7 +819,7 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr, } vlclua_set_this( L, p_mgr ); vlclua_set_playlist_internal( L, - pl_Get((intf_thread_t *)(p_mgr->obj.parent)) ); + pl_Get((intf_thread_t *)vlc_object_parent(p_mgr)) ); vlclua_extension_set( L, p_ext ); luaL_openlibs( L ); diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c index ad17ac125b..d3666612f1 100644 --- a/modules/services_discovery/podcast.c +++ b/modules/services_discovery/podcast.c @@ -120,7 +120,7 @@ static void SaveUrls( services_discovery_t *p_sd ); *****************************************************************************/ static int Open( vlc_object_t *p_this ) { - if( strcmp( vlc_object_typename(p_this->obj.parent), "playlist" ) ) + if( strcmp( vlc_object_typename(vlc_object_parent(p_this)), "playlist" ) ) return VLC_EGENERIC; /* FIXME: support LibVLC SD too! */ services_discovery_t *p_sd = ( services_discovery_t* )p_this; @@ -145,7 +145,7 @@ static int Open( vlc_object_t *p_this ) p_sd->description = _("Podcasts"); /* Launch the callback associated with this variable */ - vlc_object_t *pl = p_sd->obj.parent; + vlc_object_t *pl = vlc_object_parent(p_sd); var_Create( pl, "podcast-urls", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_AddCallback( pl, "podcast-urls", UrlsChange, p_sys ); @@ -171,7 +171,7 @@ 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; - vlc_object_t *pl = p_sd->obj.parent; + vlc_object_t *pl = vlc_object_parent(p_sd); vlc_cancel (p_sys->thread); vlc_join (p_sys->thread, NULL); @@ -239,7 +239,7 @@ noreturn static void *Run( void *data ) if( p_sys->update_type == UPDATE_URLS ) { - char *psz_urls = var_GetNonEmptyString( p_sd->obj.parent, + char *psz_urls = var_GetNonEmptyString( vlc_object_parent(p_sd), "podcast-urls" ); ParseUrls( p_sd, psz_urls ); free( psz_urls ); @@ -391,7 +391,7 @@ static void ParseRequest( services_discovery_t *p_sd ) if ( ! p_sys->b_savedurls_loaded ) { - char *psz_urls = var_GetNonEmptyString( p_sd->obj.parent, + char *psz_urls = var_GetNonEmptyString( vlc_object_parent(p_sd), "podcast-urls" ); ParseUrls( p_sd, psz_urls ); free( psz_urls ); diff --git a/modules/stream_out/chromecast/chromecast_communication.cpp b/modules/stream_out/chromecast/chromecast_communication.cpp index 952e4691ea..b6ddd97571 100644 --- a/modules/stream_out/chromecast/chromecast_communication.cpp +++ b/modules/stream_out/chromecast/chromecast_communication.cpp @@ -47,7 +47,7 @@ ChromecastCommunication::ChromecastCommunication( vlc_object_t* p_module, if (devicePort == 0) devicePort = CHROMECAST_CONTROL_PORT; - m_creds = vlc_tls_ClientCreate( m_module->obj.parent ); + m_creds = vlc_tls_ClientCreate( vlc_object_parent(m_module) ); if (m_creds == NULL) throw std::runtime_error( "Failed to create TLS client" ); diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp index 7d816d0491..34cdb6ae33 100644 --- a/modules/stream_out/chromecast/chromecast_ctrl.cpp +++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp @@ -138,23 +138,23 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device m_common.pf_set_pause_state = set_pause_state; m_common.pf_set_meta = set_meta; - assert( var_Type( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME) == 0 ); - if (var_Create( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, VLC_VAR_ADDRESS ) == VLC_SUCCESS ) - var_SetAddress( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, &m_common ); + assert( var_Type( vlc_object_parent(vlc_object_parent(m_module)), CC_SHARED_VAR_NAME) == 0 ); + if (var_Create( vlc_object_parent(vlc_object_parent(m_module)), CC_SHARED_VAR_NAME, VLC_VAR_ADDRESS ) == VLC_SUCCESS ) + var_SetAddress( vlc_object_parent(vlc_object_parent(m_module)), CC_SHARED_VAR_NAME, &m_common ); // Start the Chromecast event thread. if (vlc_clone(&m_chromecastThread, ChromecastThread, this, VLC_THREAD_PRIORITY_LOW)) { vlc_interrupt_destroy( m_ctl_thread_interrupt ); - var_SetAddress( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, NULL ); + var_SetAddress( vlc_object_parent(vlc_object_parent(m_module)), CC_SHARED_VAR_NAME, NULL ); throw std::runtime_error( "error creating cc thread" ); } } intf_sys_t::~intf_sys_t() { - var_Destroy( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME ); + var_Destroy( vlc_object_parent(vlc_object_parent(m_module)), CC_SHARED_VAR_NAME ); m_lock.lock(); if( m_communication ) diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp index 0fe3be6179..7a97b9cadc 100644 --- a/modules/stream_out/chromecast/chromecast_demux.cpp +++ b/modules/stream_out/chromecast/chromecast_demux.cpp @@ -427,7 +427,7 @@ protected: static void on_paused_changed_cb( void *data, bool paused ) { demux_t *p_demux = reinterpret_cast<demux_t*>(data); - vlc_object_t *obj = p_demux->p_next->obj.parent; + vlc_object_t *obj = vlc_object_parent(p_demux->p_next); /* XXX: Ugly: Notify the parent of the input_thread_t that the corks state * changed */ @@ -440,7 +440,7 @@ static void on_paused_changed_cb( void *data, bool paused ) ( paused ? var_IncInteger : var_DecInteger )( obj, "corks" ); return; } - obj = obj->obj.parent; + obj = vlc_object_parent(obj); } } diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c index 7d52ffed99..964c51b8ae 100644 --- a/modules/video_chroma/chain.c +++ b/modules/video_chroma/chain.c @@ -171,7 +171,7 @@ static int Activate( filter_t *p_filter, int (*pf_build)(filter_t *) ) } int type = VLC_VAR_INTEGER; - if( var_Type( p_filter->obj.parent, "chain-level" ) != 0 ) + if( var_Type( vlc_object_parent(p_filter), "chain-level" ) != 0 ) type |= VLC_VAR_DOINHERIT; var_Create( p_filter, "chain-level", type ); @@ -233,7 +233,7 @@ static int ActivateFilter( vlc_object_t *p_this ) if( !p_filter->b_allow_fmt_out_change || p_filter->psz_name == NULL ) return VLC_EGENERIC; - if( var_Type( p_filter->obj.parent, "chain-filter-level" ) != 0 ) + if( var_Type( vlc_object_parent(p_filter), "chain-filter-level" ) != 0 ) return VLC_EGENERIC; var_Create( p_filter, "chain-filter-level", VLC_VAR_INTEGER ); diff --git a/modules/video_filter/ci_filters.m b/modules/video_filter/ci_filters.m index 09e758cccc..5eb4e0408d 100644 --- a/modules/video_filter/ci_filters.m +++ b/modules/video_filter/ci_filters.m @@ -665,8 +665,8 @@ Open(vlc_object_t *obj, char const *psz_filter) if (Open_CreateFilters(filter, &ctx->fchain, filter_types)) goto error; - var_Create(filter->obj.parent, "ci-filters-ctx", VLC_VAR_ADDRESS); - var_SetAddress(filter->obj.parent, "ci-filters-ctx", ctx); + var_Create(vlc_object_parent(filter), "ci-filters-ctx", VLC_VAR_ADDRESS); + var_SetAddress(vlc_object_parent(filter), "ci-filters-ctx", ctx); } else if (Open_CreateFilters(filter, &ctx->fchain, filter_types)) goto error; @@ -753,7 +753,7 @@ Close(vlc_object_t *obj) if (ctx->cvpx_pool) CVPixelBufferPoolRelease(ctx->cvpx_pool); free(ctx); - var_Destroy(filter->obj.parent, "ci-filters-ctx"); + var_Destroy(vlc_object_parent(filter), "ci-filters-ctx"); } free(p_sys); } diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m index 06f319c5f1..6105247e5d 100644 --- a/modules/video_output/ios.m +++ b/modules/video_output/ios.m @@ -159,7 +159,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg, sys->picturePool = NULL; sys->gl = NULL; - var_Create(vd->obj.parent, "ios-eaglcontext", VLC_VAR_ADDRESS); + var_Create(vlc_object_parent(vd), "ios-eaglcontext", VLC_VAR_ADDRESS); @autoreleasepool { /* setup the actual OpenGL ES view */ @@ -171,7 +171,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg, waitUntilDone:YES]; if (!sys->glESView) { msg_Err(vd, "Creating OpenGL ES 2 view failed"); - var_Destroy(vd->obj.parent, "ios-eaglcontext"); + var_Destroy(vlc_object_parent(vd), "ios-eaglcontext"); return VLC_EGENERIC; } @@ -248,7 +248,7 @@ static void Close(vout_display_t *vd) [sys->glESView cleanAndRelease:flushed]; } - var_Destroy(vd->obj.parent, "ios-eaglcontext"); + var_Destroy(vlc_object_parent(vd), "ios-eaglcontext"); } /***************************************************************************** @@ -410,7 +410,7 @@ static void GLESSwap(vlc_gl_t *gl) [self releaseCurrent:previousEaglContext]; /* Set "ios-eaglcontext" to be used by cvpx fitlers/glconv */ - var_SetAddress(_voutDisplay->obj.parent, "ios-eaglcontext", _eaglContext); + var_SetAddress(vlc_object_parent(_voutDisplay), "ios-eaglcontext", _eaglContext); _layer = (CAEAGLLayer *)self.layer; _layer.drawableProperties = [NSDictionary dictionaryWithObject:kEAGLColorFormatRGBA8 forKey: kEAGLDrawablePropertyColorFormat]; diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m index a95d2875e1..3b2cedee33 100644 --- a/modules/video_output/macosx.m +++ b/modules/video_output/macosx.m @@ -151,7 +151,7 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg, sys->vgl = NULL; sys->gl = NULL; - var_Create(vd->obj.parent, "macosx-glcontext", VLC_VAR_ADDRESS); + var_Create(vlc_object_parent(vd), "macosx-glcontext", VLC_VAR_ADDRESS); /* Get the drawable object */ id container = var_CreateGetAddress (vd, "drawable-nsobject"); @@ -219,7 +219,7 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg, sys->gl->swap = OpenglSwap; sys->gl->getProcAddress = OurGetProcAddress; - var_SetAddress(vd->obj.parent, "macosx-glcontext", + var_SetAddress(vlc_object_parent(vd), "macosx-glcontext", [[sys->glView openGLContext] CGLContextObj]); const vlc_fourcc_t *subpicture_chromas; @@ -278,7 +278,7 @@ static void Close(vout_display_t *vd) withObject:nil waitUntilDone:NO]; - var_Destroy(vd->obj.parent, "macosx-glcontext"); + var_Destroy(vlc_object_parent(vd), "macosx-glcontext"); if (sys->vgl != NULL) { vlc_gl_MakeCurrent(sys->gl); diff --git a/modules/video_output/splitter.c b/modules/video_output/splitter.c index 1a08848b80..011962bd0d 100644 --- a/modules/video_output/splitter.c +++ b/modules/video_output/splitter.c @@ -163,7 +163,7 @@ static void vlc_vidsplit_window_MouseEvent(vout_window_t *wnd, const vout_window_mouse_event_t *e) { struct vlc_vidsplit_part *part = wnd->owner.sys; - vout_display_t *vd = (vout_display_t *)wnd->obj.parent; + vout_display_t *vd = (vout_display_t *)vlc_object_parent(wnd); vout_display_sys_t *sys = vd->sys; vout_window_mouse_event_t ev = *e; @@ -176,7 +176,7 @@ static void vlc_vidsplit_window_MouseEvent(vout_window_t *wnd, static void vlc_vidsplit_window_KeyboardEvent(vout_window_t *wnd, unsigned key) { - vout_display_t *vd = (vout_display_t *)wnd->obj.parent; + vout_display_t *vd = (vout_display_t *)vlc_object_parent(wnd); vout_display_sys_t *sys = vd->sys; vlc_mutex_lock(&sys->lock); diff --git a/src/audio_output/output.c b/src/audio_output/output.c index 7c1f90b6ba..95ed7dab97 100644 --- a/src/audio_output/output.c +++ b/src/audio_output/output.c @@ -91,7 +91,7 @@ static void aout_MuteNotify (audio_output_t *aout, bool mute) static void aout_PolicyNotify (audio_output_t *aout, bool cork) { - (cork ? var_IncInteger : var_DecInteger) (aout->obj.parent, "corks"); + (cork ? var_IncInteger : var_DecInteger)(vlc_object_parent(aout), "corks"); } static void aout_DeviceNotify (audio_output_t *aout, const char *id) @@ -373,10 +373,10 @@ void aout_Destroy (audio_output_t *aout) var_DelCallback (aout, "viewpoint", ViewpointCallback, NULL); var_DelCallback (aout, "audio-filter", FilterCallback, NULL); - var_DelCallback (aout, "device", var_CopyDevice, aout->obj.parent); - var_DelCallback (aout, "mute", var_Copy, aout->obj.parent); + var_DelCallback(aout, "device", var_CopyDevice, vlc_object_parent(aout)); + var_DelCallback(aout, "mute", var_Copy, vlc_object_parent(aout)); var_SetFloat (aout, "volume", -1.f); - var_DelCallback (aout, "volume", var_Copy, aout->obj.parent); + var_DelCallback(aout, "volume", var_Copy, vlc_object_parent(aout)); var_DelCallback (aout, "stereo-mode", StereoModeCallback, NULL); vlc_object_release (aout); } diff --git a/src/audio_output/volume.c b/src/audio_output/volume.c index 530da707e2..679a61adce 100644 --- a/src/audio_output/volume.c +++ b/src/audio_output/volume.c @@ -114,7 +114,7 @@ void aout_volume_Delete(aout_volume_t *vol) if (vol->module != NULL) module_unneed(obj, vol->module); - var_DelCallback(obj->obj.parent, "audio-replay-gain-mode", + var_DelCallback(vlc_object_parent(obj), "audio-replay-gain-mode", ReplayGainCallback, vol); vlc_object_release(obj); } diff --git a/src/input/input.c b/src/input/input.c index e156fca6db..5500054cc5 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -1337,7 +1337,7 @@ static int Init( input_thread_t * p_input ) input_ChangeState( p_input, OPENING_S ); input_SendEventCache( p_input, 0.0 ); - if( var_Type( p_input->obj.parent, "meta-file" ) ) + if( var_Type( vlc_object_parent(p_input), "meta-file" ) ) { msg_Dbg( p_input, "Input is a meta file: disabling unneeded options" ); var_SetString( p_input, "sout", "" ); diff --git a/src/input/stream_extractor.c b/src/input/stream_extractor.c index c8e9298ab0..b5bdd0121a 100644 --- a/src/input/stream_extractor.c +++ b/src/input/stream_extractor.c @@ -253,7 +253,8 @@ se_InitDirectory( struct stream_extractor_private* priv, stream_t* s ) static int se_AttachWrapper( struct stream_extractor_private* priv, stream_t* source ) { - stream_t* s = vlc_stream_CommonNew( source->obj.parent, se_StreamDelete ); + stream_t* s = vlc_stream_CommonNew( vlc_object_parent(source), + se_StreamDelete ); if( unlikely( !s ) ) return VLC_ENOMEM; @@ -283,7 +284,7 @@ StreamExtractorAttach( stream_t** source, char const* identifier, : "stream_directory"; struct stream_extractor_private* priv = vlc_custom_create( - (*source)->obj.parent, sizeof( *priv ), capability ); + vlc_object_parent(*source), sizeof( *priv ), capability ); if( unlikely( !priv ) ) return VLC_ENOMEM; diff --git a/src/input/stream_filter.c b/src/input/stream_filter.c index b18eefa4ad..7b190a3739 100644 --- a/src/input/stream_filter.c +++ b/src/input/stream_filter.c @@ -53,8 +53,9 @@ stream_t *vlc_stream_FilterNew( stream_t *p_source, assert(p_source != NULL); struct vlc_stream_filter_private *priv; - stream_t *s = vlc_stream_CustomNew(p_source->obj.parent, StreamDelete, - sizeof (*priv), "stream filter"); + stream_t *s = vlc_stream_CustomNew(vlc_object_parent(p_source), + StreamDelete, sizeof (*priv), + "stream filter"); if( s == NULL ) return NULL; diff --git a/src/misc/objects.c b/src/misc/objects.c index c92d74b88a..fb8c2adec9 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -60,15 +60,16 @@ static void PrintObjectPrefix(vlc_object_t *obj, bool last) { + vlc_object_t *parent = vlc_object_parent(obj); const char *str; - if (obj->obj.parent == NULL) + if (parent == NULL) return; - PrintObjectPrefix(obj->obj.parent, false); + PrintObjectPrefix(parent, false); if (vlc_list_is_last(&vlc_internals(obj)->siblings, - &vlc_internals(obj->obj.parent)->children)) + &vlc_internals(parent)->children)) str = last ? " \xE2\x94\x94" : " "; else str = last ? " \xE2\x94\x9C" : " \xE2\x94\x82"; @@ -174,7 +175,7 @@ static int VarsCommand (vlc_object_t *obj, char const *cmd, vlc_object_hold (obj); printf(" o %p %s, parent %p\n", (void *)obj, vlc_object_typename(obj), - (void *)obj->obj.parent); + (void *)vlc_object_parent(obj)); DumpVariables (obj); vlc_object_release (obj); @@ -453,7 +454,7 @@ void vlc_object_release (vlc_object_t *obj) assert (refs > 0); } - vlc_object_t *parent = obj->obj.parent; + vlc_object_t *parent = vlc_object_parent(obj); if (unlikely(parent == NULL)) { /* Destroying the root object */ diff --git a/src/misc/variables.c b/src/misc/variables.c index 871c463547..2203b702b2 100644 --- a/src/misc/variables.c +++ b/src/misc/variables.c @@ -1037,7 +1037,7 @@ int var_Inherit( vlc_object_t *p_this, const char *psz_name, int i_type, vlc_value_t *p_val ) { i_type &= VLC_VAR_CLASS; - for( vlc_object_t *obj = p_this; obj != NULL; obj = obj->obj.parent ) + for (vlc_object_t *obj = p_this; obj != NULL; obj = vlc_object_parent(obj)) { if( var_GetChecked( obj, psz_name, i_type, p_val ) == VLC_SUCCESS ) return VLC_SUCCESS; diff --git a/src/playlist_legacy/services_discovery.c b/src/playlist_legacy/services_discovery.c index 78df28d558..0b9546af7b 100644 --- a/src/playlist_legacy/services_discovery.c +++ b/src/playlist_legacy/services_discovery.c @@ -46,7 +46,7 @@ static void playlist_sd_item_added(services_discovery_t *sd, assert(parent == NULL || psz_cat == NULL); vlc_sd_internal_t *sds = sd->owner.sys; - playlist_t *playlist = (playlist_t *)sd->obj.parent; + playlist_t *playlist = (playlist_t *)vlc_object_parent(sd); playlist_item_t *node; const char *longname = (sd->description != NULL) ? sd->description : "?"; @@ -80,7 +80,7 @@ static void playlist_sd_item_removed(services_discovery_t *sd, input_item_t *p_input) { vlc_sd_internal_t *sds = sd->owner.sys; - playlist_t *playlist = (playlist_t *)sd->obj.parent; + playlist_t *playlist = (playlist_t *)vlc_object_parent(sd); playlist_item_t *node, *item; msg_Dbg(sd, "removing: %s", p_input->psz_name ? p_input->psz_name : "(null)"); diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c index d859e1931c..730e536768 100644 --- a/src/stream_output/stream_output.c +++ b/src/stream_output/stream_output.c @@ -775,7 +775,7 @@ static void mrl_Clean( mrl_t *p_mrl ) /* Destroy a "stream_out" module */ static void sout_StreamDelete( sout_stream_t *p_stream ) { - sout_instance_t *p_sout = (sout_instance_t *)(p_stream->obj.parent); + sout_instance_t *p_sout = (sout_instance_t *)vlc_object_parent(p_stream); msg_Dbg( p_stream, "destroying chain... (name=%s)", p_stream->psz_name ); diff --git a/src/video_output/window.c b/src/video_output/window.c index 1a23dd10ba..a111d7f4e7 100644 --- a/src/video_output/window.c +++ b/src/video_output/window.c @@ -149,7 +149,7 @@ typedef struct vout_display_window static void vout_display_window_ResizeNotify(vout_window_t *window, unsigned width, unsigned height) { - vout_thread_t *vout = (vout_thread_t *)window->obj.parent; + vout_thread_t *vout = (vout_thread_t *)vlc_object_parent(window); msg_Dbg(window, "resized to %ux%u", width, height); vout_ChangeDisplaySize(vout, width, height); @@ -173,7 +173,7 @@ static void vout_display_window_StateNotify(vout_window_t *window, assert(state < ARRAY_SIZE(states)); msg_Dbg(window, "window state changed: %s", states[state]); - var_SetInteger(window->obj.parent, "window-state", state); + var_SetInteger(vlc_object_parent(window), "window-state", state); } static void vout_display_window_FullscreenNotify(vout_window_t *window, @@ -181,22 +181,22 @@ static void vout_display_window_FullscreenNotify(vout_window_t *window, { msg_Dbg(window, (id != NULL) ? "window set to fullscreen on %s" : "window set to fullscreen", id); - var_SetString(window->obj.parent, "window-fullscreen-output", + var_SetString(vlc_object_parent(window), "window-fullscreen-output", (id != NULL) ? id : ""); - var_SetBool(window->obj.parent, "window-fullscreen", true); + var_SetBool(vlc_object_parent(window), "window-fullscreen", true); } static void vout_display_window_WindowingNotify(vout_window_t *window) { msg_Dbg(window, "window set windowed"); - var_SetBool(window->obj.parent, "window-fullscreen", false); + var_SetBool(vlc_object_parent(window), "window-fullscreen", false); } static void vout_display_window_MouseEvent(vout_window_t *window, const vout_window_mouse_event_t *ev) { vout_display_window_t *state = window->owner.sys; - vout_thread_t *vout = (vout_thread_t *)window->obj.parent; + vout_thread_t *vout = (vout_thread_t *)vlc_object_parent(window); vlc_mouse_t *m = &state->mouse; m->b_double_click = false; @@ -306,7 +306,7 @@ vout_window_t *vout_display_window_New(vout_thread_t *vout) */ void vout_display_window_Delete(vout_window_t *window) { - vout_thread_t *vout = (vout_thread_t *)(window->obj.parent); + vout_thread_t *vout = (vout_thread_t *)vlc_object_parent(window); vout_display_window_t *state = window->owner.sys; vout_window_Disable(window); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
