[vlc-commits] objects: add vlc_object_instance()
Rémi Denis-Courmont
git at videolan.org
Tue Feb 19 17:13:47 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb 19 17:31:20 2019 +0200| [e48a8a9eb2b507cbfecce661cf0fc843db05a6bd] | committer: Rémi Denis-Courmont
objects: add vlc_object_instance()
...instead of open-coded access to obj->obj.libvlc
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e48a8a9eb2b507cbfecce661cf0fc843db05a6bd
---
include/vlc_objects.h | 7 ++++++
lib/media_player.c | 5 ++--
modules/access/idummy.c | 2 +-
modules/audio_filter/audiobargraph_a.c | 16 ++++++++-----
modules/control/dbus/dbus.c | 11 ++++-----
modules/control/dbus/dbus_root.c | 2 +-
modules/control/gestures.c | 2 +-
modules/control/globalhotkeys/win32.c | 2 +-
modules/control/globalhotkeys/xcb.c | 2 +-
modules/control/hotkeys.c | 8 +++----
modules/control/lirc.c | 2 +-
modules/control/ntservice.c | 2 +-
modules/control/oldrc.c | 20 ++++++++--------
modules/demux/mkv/events.cpp | 5 ++--
.../gui/macosx/coreinteraction/VLCClickerManager.m | 8 +++----
.../macosx/coreinteraction/VLCCoreInteraction.m | 4 ++--
modules/gui/macosx/panels/VLCPlaylistInfo.m | 4 ++--
modules/gui/macosx/preferences/prefs_widgets.m | 2 +-
.../windows/logging/VLCLogWindowController.m | 10 ++++----
modules/gui/macosx/windows/video/VLCVoutView.m | 6 ++---
modules/gui/ncurses.c | 8 +++----
modules/gui/qt/components/complete_preferences.cpp | 2 +-
modules/gui/qt/dialogs/messages.cpp | 9 +++----
modules/gui/qt/dialogs/vlm.cpp | 2 +-
modules/gui/qt/dialogs_provider.cpp | 4 ++--
modules/gui/qt/input_manager.cpp | 6 ++---
modules/gui/qt/main_interface.cpp | 4 ++--
modules/gui/qt/qt.cpp | 2 +-
modules/gui/qt/util/input_slider.cpp | 4 ++--
modules/gui/skins2/commands/cmd_quit.cpp | 2 +-
modules/gui/skins2/os2/os2_factory.cpp | 2 +-
modules/gui/skins2/win32/win32_factory.cpp | 2 +-
modules/gui/skins2/x11/x11_loop.cpp | 2 +-
modules/lua/libs/misc.c | 2 +-
modules/lua/libs/objects.c | 2 +-
modules/lua/libs/variables.c | 5 ++--
modules/lua/libs/vlm.c | 2 +-
modules/services_discovery/mediadirs.c | 9 ++++---
modules/spu/audiobargraph_v.c | 27 ++++++++++-----------
modules/spu/mosaic.h | 3 ++-
modules/spu/remoteosd.c | 6 +++--
modules/stream_filter/record.c | 2 +-
modules/stream_out/bridge.c | 12 ++++++----
modules/stream_out/mosaic_bridge.c | 4 ++--
modules/stream_out/record.c | 2 +-
modules/video_filter/opencv_example.cpp | 8 +++----
modules/video_output/decklink.cpp | 4 ++--
modules/video_output/win32/win32touch.c | 28 +++++++++++-----------
modules/video_output/xcb/window.c | 14 ++++++-----
src/input/player.c | 2 +-
src/input/vlm.c | 9 ++++---
src/interface/dialog.c | 2 +-
src/interface/interface.c | 2 +-
src/misc/actions.c | 2 +-
src/misc/keystore.c | 2 +-
src/misc/medialibrary.c | 2 +-
src/misc/messages.c | 4 ++--
src/misc/objects.c | 2 +-
src/misc/update.c | 4 ++--
src/playlist_legacy/item.c | 2 +-
src/playlist_legacy/thread.c | 7 +++---
src/video_output/vout_intf.c | 2 +-
src/video_output/window.c | 2 +-
src/win32/mta_holder.h | 12 ++++++----
64 files changed, 191 insertions(+), 164 deletions(-)
diff --git a/include/vlc_objects.h b/include/vlc_objects.h
index cb18fff59e..70ca5c9c74 100644
--- a/include/vlc_objects.h
+++ b/include/vlc_objects.h
@@ -130,6 +130,13 @@ VLC_API char *vlc_object_get_name( const vlc_object_t * ) VLC_USED;
#define vlc_object_release(a) \
vlc_object_release( VLC_OBJECT(a) )
+VLC_USED
+static inline libvlc_int_t *vlc_object_instance(vlc_object_t *obj)
+{
+ return obj->obj.libvlc;
+}
+#define vlc_object_instance(o) vlc_object_instance(VLC_OBJECT(o))
+
/**
* @defgroup objres Object resources
*
diff --git a/lib/media_player.c b/lib/media_player.c
index 4079efd4b0..8bc7a9636f 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -780,7 +780,8 @@ libvlc_media_player_new( libvlc_instance_t *instance )
* FIXME: It's unclear why we want to put this in public API, and why we
* want to expose it in such a limiting and ugly way.
*/
- var_AddCallback(mp->obj.libvlc, "snapshot-file", snapshot_was_taken, mp);
+ var_AddCallback(vlc_object_instance(mp),
+ "snapshot-file", snapshot_was_taken, mp);
libvlc_retain(instance);
return mp;
@@ -814,7 +815,7 @@ static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
assert( p_mi );
/* Detach Callback from the main libvlc object */
- var_DelCallback( p_mi->obj.libvlc,
+ var_DelCallback( vlc_object_instance(p_mi),
"snapshot-file", snapshot_was_taken, p_mi );
/* Detach callback from the media player / input manager object */
diff --git a/modules/access/idummy.c b/modules/access/idummy.c
index 0e7410625f..1b599257f0 100644
--- a/modules/access/idummy.c
+++ b/modules/access/idummy.c
@@ -159,7 +159,7 @@ nop:
msg_Info( p_demux, "command `quit'" );
p_demux->pf_demux = DemuxNoOp;
p_demux->pf_control = DemuxControl;
- libvlc_Quit( p_demux->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_demux) );
return VLC_SUCCESS;
}
diff --git a/modules/audio_filter/audiobargraph_a.c b/modules/audio_filter/audiobargraph_a.c
index 5c57bd9b59..e744b52f24 100644
--- a/modules/audio_filter/audiobargraph_a.c
+++ b/modules/audio_filter/audiobargraph_a.c
@@ -139,8 +139,10 @@ static int Open( vlc_object_t *p_this )
p_filter->fmt_out.audio = p_filter->fmt_in.audio;
p_filter->pf_audio_filter = DoWork;
- var_Create(p_filter->obj.libvlc, "audiobargraph_v-alarm", VLC_VAR_BOOL);
- var_Create(p_filter->obj.libvlc, "audiobargraph_v-i_values", VLC_VAR_STRING);
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_filter));
+
+ var_Create(vlc, "audiobargraph_v-alarm", VLC_VAR_BOOL);
+ var_Create(vlc, "audiobargraph_v-i_values", VLC_VAR_STRING);
return VLC_SUCCESS;
}
@@ -157,7 +159,8 @@ static void SendValues(filter_t *p_filter, float *value, int nbChannels)
}
//msg_Dbg(p_filter, "values: %s", msg);
- var_SetString(p_filter->obj.libvlc, "audiobargraph_v-i_values", msg);
+ var_SetString(vlc_object_instance(p_filter), "audiobargraph_v-i_values",
+ msg);
}
/*****************************************************************************
@@ -224,7 +227,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
sum = sqrtf(sum);
/* 5 - compare it to the threshold */
- var_SetBool(p_filter->obj.libvlc, "audiobargraph_v-alarm",
+ var_SetBool(vlc_object_instance(p_filter), "audiobargraph_v-alarm",
sum < p_sys->alarm_threshold);
p_sys->lastAlarm = p_in_buf->i_pts;
@@ -246,9 +249,10 @@ static void Close( 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 *vlc = VLC_OBJECT(vlc_object_instance(p_filter));
- var_Destroy(p_filter->obj.libvlc, "audiobargraph_v-i_values");
- var_Destroy(p_filter->obj.libvlc, "audiobargraph_v-alarm");
+ var_Destroy(vlc, "audiobargraph_v-i_values");
+ var_Destroy(vlc, "audiobargraph_v-alarm");
while (p_sys->first != NULL) {
ValueDate_t *current = p_sys->first;
diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index 103fda991d..b8e16805c8 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -147,6 +147,7 @@ vlc_module_end ()
static int Open( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t*)p_this;
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_this));
/* initialisation of the connection */
if( !dbus_threads_init_default() )
@@ -194,7 +195,7 @@ static int Open( vlc_object_t *p_this )
/* Try to register org.mpris.MediaPlayer2.vlc */
const unsigned bus_flags = DBUS_NAME_FLAG_DO_NOT_QUEUE;
- var_Create(p_intf->obj.libvlc, "dbus-mpris-name", VLC_VAR_STRING);
+ var_Create(vlc, "dbus-mpris-name", VLC_VAR_STRING);
if( dbus_bus_request_name( p_conn, DBUS_MPRIS_BUS_NAME, bus_flags, NULL )
!= DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER )
{
@@ -212,15 +213,13 @@ static int Open( vlc_object_t *p_this )
== DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER )
{
msg_Dbg( p_intf, "listening on dbus as: %s", unique_service );
- var_SetString(p_intf->obj.libvlc, "dbus-mpris-name",
- unique_service);
+ var_SetString(vlc, "dbus-mpris-name", unique_service);
}
}
else
{
msg_Dbg( p_intf, "listening on dbus as: %s", DBUS_MPRIS_BUS_NAME );
- var_SetString(p_intf->obj.libvlc, "dbus-mpris-name",
- DBUS_MPRIS_BUS_NAME);
+ var_SetString(vlc, "dbus-mpris-name", DBUS_MPRIS_BUS_NAME);
}
dbus_connection_flush( p_conn );
@@ -264,7 +263,7 @@ static int Open( vlc_object_t *p_this )
return VLC_SUCCESS;
error:
- var_Destroy(p_intf->obj.libvlc, "dbus-mpris-name");
+ var_Destroy(vlc, "dbus-mpris-name");
/* The dbus connection is private,
* so we are responsible for closing it
* XXX: Does this make sense when OOM ? */
diff --git a/modules/control/dbus/dbus_root.c b/modules/control/dbus/dbus_root.c
index e9394d6a9f..312c120a9c 100644
--- a/modules/control/dbus/dbus_root.c
+++ b/modules/control/dbus/dbus_root.c
@@ -260,7 +260,7 @@ MarshalSupportedUriSchemes( intf_thread_t *p_intf, DBusMessageIter *container )
DBUS_METHOD( Quit )
{ /* exits vlc */
REPLY_INIT;
- libvlc_Quit(INTF->obj.libvlc);
+ libvlc_Quit(vlc_object_instance(INTF));
REPLY_SEND;
}
diff --git a/modules/control/gestures.c b/modules/control/gestures.c
index 4fcade4620..58ecac7bdc 100644
--- a/modules/control/gestures.c
+++ b/modules/control/gestures.c
@@ -356,7 +356,7 @@ static void ProcessGesture( intf_thread_t *p_intf )
case GESTURE(DOWN,LEFT,NONE,NONE):
/* FIXME: Should close the vout!"*/
- libvlc_Quit( p_intf->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_intf) );
break;
case GESTURE(DOWN,LEFT,UP,RIGHT):
diff --git a/modules/control/globalhotkeys/win32.c b/modules/control/globalhotkeys/win32.c
index f575735a66..6cc3d0264d 100644
--- a/modules/control/globalhotkeys/win32.c
+++ b/modules/control/globalhotkeys/win32.c
@@ -305,7 +305,7 @@ LRESULT CALLBACK WMHOTKEYPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
vlc_action_id_t action = vlc_actions_get_id( psz_atomName );
if( action != ACTIONID_NONE )
{
- var_SetInteger( p_intf->obj.libvlc,
+ var_SetInteger( vlc_object_instance(p_intf),
"key-action", action );
return 1;
}
diff --git a/modules/control/globalhotkeys/xcb.c b/modules/control/globalhotkeys/xcb.c
index 3fa8a10e38..32b2d312c6 100644
--- a/modules/control/globalhotkeys/xcb.c
+++ b/modules/control/globalhotkeys/xcb.c
@@ -402,7 +402,7 @@ static void *Thread( void *p_data )
if( p_map->p_keys[j] == e->detail &&
p_map->i_modifier == e->state )
{
- var_SetInteger( p_intf->obj.libvlc,
+ var_SetInteger( vlc_object_instance(p_intf),
"global-key-pressed", p_map->i_vlc );
goto done;
}
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 2b7bbfcd61..325501f3d1 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -200,7 +200,7 @@ static int ButtonEvent( vlc_object_t *p_this, char const *psz_var,
for (int i = MOUSE_BUTTON_WHEEL_UP; i <= MOUSE_BUTTON_WHEEL_RIGHT; i++)
if (pressed & (1 << i))
- var_SetInteger(p_intf->obj.libvlc, "key-pressed",
+ var_SetInteger(vlc_object_instance(p_intf), "key-pressed",
i - MOUSE_BUTTON_WHEEL_UP + KEY_MOUSEWHEELUP);
return VLC_SUCCESS;
@@ -349,7 +349,7 @@ static int Open( vlc_object_t *p_this )
vlc_mutex_init( &p_sys->lock );
- var_AddCallback( p_intf->obj.libvlc, "key-action", ActionEvent, p_intf );
+ var_AddCallback( vlc_object_instance(p_intf), "key-action", ActionEvent, p_intf );
var_AddCallback( pl_Get(p_intf), "input-current", PlaylistEvent, p_intf );
@@ -366,7 +366,7 @@ static void Close( vlc_object_t *p_this )
var_DelCallback( pl_Get(p_intf), "input-current", PlaylistEvent, p_intf );
- var_DelCallback( p_intf->obj.libvlc, "key-action", ActionEvent, p_intf );
+ var_DelCallback( vlc_object_instance(p_intf), "key-action", ActionEvent, p_intf );
ChangeInput( p_intf, NULL );
@@ -389,7 +389,7 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
{
/* Libvlc / interface actions */
case ACTIONID_QUIT:
- libvlc_Quit( p_intf->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_intf) );
ClearChannels( p_vout, slider_chan );
DisplayMessage( p_vout, _( "Quit" ) );
diff --git a/modules/control/lirc.c b/modules/control/lirc.c
index 4a493a390a..3750b2e9df 100644
--- a/modules/control/lirc.c
+++ b/modules/control/lirc.c
@@ -196,7 +196,7 @@ static void Process( intf_thread_t *p_intf )
{
vlc_action_id_t i_key = vlc_actions_get_id( c );
if( i_key )
- var_SetInteger( p_intf->obj.libvlc, "key-action", i_key );
+ var_SetInteger( vlc_object_instance(p_intf), "key-action", i_key );
else
msg_Err( p_intf, "Unknown hotkey '%s'", c );
}
diff --git a/modules/control/ntservice.c b/modules/control/ntservice.c
index 2215989a3e..22f9fc7030 100644
--- a/modules/control/ntservice.c
+++ b/modules/control/ntservice.c
@@ -170,7 +170,7 @@ static void *Run( void *data )
free( p_intf->p_sys->psz_service );
/* Make sure we exit (In case other interfaces have been spawned) */
- libvlc_Quit( p_intf->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_intf) );
return NULL;
}
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index 2c35a1f60a..062ce72179 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -499,6 +499,7 @@ static void *Run( void *data )
{
intf_thread_t *p_intf = data;
intf_sys_t *p_sys = p_intf->p_sys;
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_intf));
char p_buffer[ MAX_LINE_LENGTH + 1 ];
bool b_showpos = var_InheritBool( p_intf, "rc-show-pos" );
@@ -647,16 +648,16 @@ static void *Run( void *data )
psz_cmd, i_ret, vlc_error( i_ret ) );
}
/* Or maybe it's a global command */
- else if( var_Type( p_intf->obj.libvlc, psz_cmd ) & VLC_VAR_ISCOMMAND )
+ else if( var_Type( vlc, psz_cmd ) & VLC_VAR_ISCOMMAND )
{
int i_ret = VLC_SUCCESS;
/* FIXME: it's a global command, but we should pass the
- * local object as an argument, not p_intf->obj.libvlc. */
- if ((var_Type( p_intf->obj.libvlc, psz_cmd) & VLC_VAR_CLASS) == VLC_VAR_VOID)
+ * local object as an argument, not vlc_object_instance(p_intf). */
+ if ((var_Type( vlc, psz_cmd) & VLC_VAR_CLASS) == VLC_VAR_VOID)
var_TriggerCallback( p_intf, psz_cmd );
else
- i_ret = var_SetString( p_intf->obj.libvlc, psz_cmd, psz_arg );
+ i_ret = var_SetString( vlc, psz_cmd, psz_arg );
if( i_ret != 0 )
{
msg_rc( "%s: returned %i (%s)",
@@ -742,8 +743,7 @@ static void *Run( void *data )
}
else if( !strcmp( psz_cmd, "key" ) || !strcmp( psz_cmd, "hotkey" ) )
{
- var_SetInteger( p_intf->obj.libvlc, "key-action",
- vlc_actions_get_id( psz_arg ) );
+ var_SetInteger( vlc, "key-action", vlc_actions_get_id( psz_arg ) );
}
else switch( psz_cmd[0] )
{
@@ -1015,7 +1015,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
}
else
{
- var_SetInteger( p_intf->obj.libvlc, "key-action", ACTIONID_JUMP_FORWARD_EXTRASHORT );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_JUMP_FORWARD_EXTRASHORT );
}
i_error = VLC_SUCCESS;
}
@@ -1029,7 +1029,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
}
else
{
- var_SetInteger( p_intf->obj.libvlc, "key-action", ACTIONID_JUMP_BACKWARD_EXTRASHORT );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_JUMP_BACKWARD_EXTRASHORT );
}
i_error = VLC_SUCCESS;
}
@@ -1420,7 +1420,7 @@ static int Quit( vlc_object_t *p_this, char const *psz_cmd,
VLC_UNUSED(p_data); VLC_UNUSED(psz_cmd);
VLC_UNUSED(oldval); VLC_UNUSED(newval);
- libvlc_Quit( p_this->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_this) );
return VLC_SUCCESS;
}
@@ -1859,7 +1859,7 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
{
if( read( 0/*STDIN_FILENO*/, p_buffer + *pi_size, 1 ) <= 0 )
{ /* Standard input closed: exit */
- libvlc_Quit( p_intf->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_intf) );
p_buffer[*pi_size] = 0;
return true;
}
diff --git a/modules/demux/mkv/events.cpp b/modules/demux/mkv/events.cpp
index e80bdd2986..66d7855cc3 100644
--- a/modules/demux/mkv/events.cpp
+++ b/modules/demux/mkv/events.cpp
@@ -123,10 +123,11 @@ int event_thread_t::EventKey( vlc_object_t *p_this, char const *,
void event_thread_t::EventThread()
{
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_demux));
int canc = vlc_savecancel ();
/* catch all key event */
- var_AddCallback( p_demux->obj.libvlc, "key-action", EventKey, this );
+ var_AddCallback( vlc, "key-action", EventKey, this );
for( vlc_mutex_locker guard( &lock );; )
{
@@ -155,7 +156,7 @@ void event_thread_t::EventThread()
}
}
- var_DelCallback( p_demux->obj.libvlc, "key-action", EventKey, this );
+ var_DelCallback( vlc, "key-action", EventKey, this );
vlc_restorecancel (canc);
}
diff --git a/modules/gui/macosx/coreinteraction/VLCClickerManager.m b/modules/gui/macosx/coreinteraction/VLCClickerManager.m
index ac5569e67a..dade9fa98b 100644
--- a/modules/gui/macosx/coreinteraction/VLCClickerManager.m
+++ b/modules/gui/macosx/coreinteraction/VLCClickerManager.m
@@ -211,11 +211,11 @@
break;
case kRemoteButtonVolume_Plus_Hold:
if (p_intf)
- var_SetInteger(p_intf->obj.libvlc, "key-action", ACTIONID_VOL_UP);
+ var_SetInteger(vlc_object_instance(p_intf), "key-action", ACTIONID_VOL_UP);
break;
case kRemoteButtonVolume_Minus_Hold:
if (p_intf)
- var_SetInteger(p_intf->obj.libvlc, "key-action", ACTIONID_VOL_DOWN);
+ var_SetInteger(vlc_object_instance(p_intf), "key-action", ACTIONID_VOL_DOWN);
break;
}
if (b_remote_button_hold) {
@@ -254,14 +254,14 @@
[NSSound increaseSystemVolume];
else
if (p_intf)
- var_SetInteger(p_intf->obj.libvlc, "key-action", ACTIONID_VOL_UP);
+ var_SetInteger(vlc_object_instance(p_intf), "key-action", ACTIONID_VOL_UP);
break;
case kRemoteButtonVolume_Minus:
if (config_GetInt("macosx-appleremote-sysvol"))
[NSSound decreaseSystemVolume];
else
if (p_intf)
- var_SetInteger(p_intf->obj.libvlc, "key-action", ACTIONID_VOL_DOWN);
+ var_SetInteger(vlc_object_instance(p_intf), "key-action", ACTIONID_VOL_DOWN);
break;
case kRemoteButtonRight:
if (config_GetInt("macosx-appleremote-prevnext"))
diff --git a/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m b/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m
index 1a014e6fd1..86c058543e 100644
--- a/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m
+++ b/modules/gui/macosx/coreinteraction/VLCCoreInteraction.m
@@ -576,7 +576,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
if (p_input != NULL) {
vout_thread_t *p_vout = input_GetVout(p_input);
if (p_vout != NULL) {
- var_SetInteger(getIntf()->obj.libvlc, "key-action", ACTIONID_POSITION);
+ var_SetInteger(vlc_object_instance(getIntf()), "key-action", ACTIONID_POSITION);
vlc_object_release(p_vout);
}
vlc_object_release(p_input);
@@ -769,7 +769,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
}
if (b_found_key) {
- var_SetInteger(p_intf->obj.libvlc, "key-pressed", val.i_int);
+ var_SetInteger(vlc_object_instance(p_intf), "key-pressed", val.i_int);
return YES;
}
}
diff --git a/modules/gui/macosx/panels/VLCPlaylistInfo.m b/modules/gui/macosx/panels/VLCPlaylistInfo.m
index e5f4989367..4fa73f9df3 100644
--- a/modules/gui/macosx/panels/VLCPlaylistInfo.m
+++ b/modules/gui/macosx/panels/VLCPlaylistInfo.m
@@ -198,7 +198,7 @@
[_imageWell setImage: [NSImage imageNamed: @"noart.png"]];
} else {
if (!input_item_IsPreparsed(p_item))
- libvlc_MetadataRequest(getIntf()->obj.libvlc, p_item, META_REQUEST_OPTION_NONE,
+ libvlc_MetadataRequest(vlc_object_instance(getIntf()), p_item, META_REQUEST_OPTION_NONE,
NULL, NULL, -1, NULL);
/* fill uri info */
@@ -367,7 +367,7 @@ FREENULL( psz_##foo );
- (IBAction)downloadCoverArt:(id)sender
{
if (p_item)
- libvlc_ArtRequest(getIntf()->obj.libvlc, p_item, META_REQUEST_OPTION_NONE,
+ libvlc_ArtRequest(vlc_object_instance(getIntf()), p_item, META_REQUEST_OPTION_NONE,
NULL, NULL);
}
diff --git a/modules/gui/macosx/preferences/prefs_widgets.m b/modules/gui/macosx/preferences/prefs_widgets.m
index 40c14b07c6..a7b52ca94f 100644
--- a/modules/gui/macosx/preferences/prefs_widgets.m
+++ b/modules/gui/macosx/preferences/prefs_widgets.m
@@ -876,7 +876,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
case CONFIG_ITEM_KEY:
/* So you don't need to restart to have the changes take effect */
val.i_int = [self intValue];
- var_Set(getIntf()->obj.libvlc, psz_name, val);
+ var_Set(vlc_object_instance(getIntf()), psz_name, val);
case CONFIG_ITEM_INTEGER:
case CONFIG_ITEM_BOOL:
config_PutInt(psz_name, [self intValue]);
diff --git a/modules/gui/macosx/windows/logging/VLCLogWindowController.m b/modules/gui/macosx/windows/logging/VLCLogWindowController.m
index 9ff7543fa9..30b26026bc 100644
--- a/modules/gui/macosx/windows/logging/VLCLogWindowController.m
+++ b/modules/gui/macosx/windows/logging/VLCLogWindowController.m
@@ -87,7 +87,7 @@ static const struct vlc_logger_operations log_ops = { MsgCallback, NULL };
- (void)dealloc
{
if (getIntf())
- vlc_LogSet( getIntf()->obj.libvlc, NULL, NULL );
+ vlc_LogSet( vlc_object_instance(getIntf()), NULL, NULL );
}
- (void)windowDidLoad
@@ -125,7 +125,7 @@ static const struct vlc_logger_operations log_ops = { MsgCallback, NULL };
}
// Subscribe to LibVLCCore's messages
- vlc_LogSet(getIntf()->obj.libvlc, &log_ops, (__bridge void*)self);
+ vlc_LogSet(vlc_object_instance(getIntf()), &log_ops, (__bridge void*)self);
_refreshTimer = [NSTimer scheduledTimerWithTimeInterval:0.3
target:self
selector:@selector(appendMessageBuffer)
@@ -137,7 +137,7 @@ static const struct vlc_logger_operations log_ops = { MsgCallback, NULL };
- (void)windowWillClose:(NSNotification *)notification
{
// Unsubscribe from LibVLCCore's messages
- vlc_LogSet( getIntf()->obj.libvlc, NULL, NULL );
+ vlc_LogSet( vlc_object_instance(getIntf()), NULL, NULL );
// Remove all messages
[self clearMessageBuffer];
@@ -217,14 +217,14 @@ static const struct vlc_logger_operations log_ops = { MsgCallback, NULL };
- (IBAction)clearLog:(id)sender
{
// Unregister handler
- vlc_LogSet(getIntf()->obj.libvlc, NULL, NULL);
+ vlc_LogSet(vlc_object_instance(getIntf()), NULL, NULL);
// Remove all messages
[self clearMessageBuffer];
[self clearMessageTable];
// Reregister handler, to write new header to log
- vlc_LogSet(getIntf()->obj.libvlc, &log_ops, (__bridge void*)self);
+ vlc_LogSet(vlc_object_instance(getIntf()), &log_ops, (__bridge void*)self);
}
/* Refresh log action
diff --git a/modules/gui/macosx/windows/video/VLCVoutView.m b/modules/gui/macosx/windows/video/VLCVoutView.m
index fee924316d..e53d11cbf0 100644
--- a/modules/gui/macosx/windows/video/VLCVoutView.m
+++ b/modules/gui/macosx/windows/video/VLCVoutView.m
@@ -181,7 +181,7 @@
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
else if (p_vout) {
val.i_int |= (int)CocoaKeyToVLC(key);
- var_Set(p_vout->obj.libvlc, "key-pressed", val);
+ var_Set(vlc_object_instance(p_vout), "key-pressed", val);
}
else
msg_Dbg(getIntf(), "could not send keyevent to VLC core");
@@ -283,7 +283,7 @@
while (ABS(f_cumulatedYScrollValue) >= f_yThreshold) {
f_cumulatedYScrollValue -= (f_cumulatedYScrollValue > 0 ? f_yThreshold : -f_yThreshold);
- var_SetInteger(p_intf->obj.libvlc, "key-pressed", key);
+ var_SetInteger(vlc_object_instance(p_intf), "key-pressed", key);
msg_Dbg(p_intf, "Scrolling in y direction");
}
@@ -297,7 +297,7 @@
while (ABS(f_cumulatedXScrollValue) >= f_xThreshold) {
f_cumulatedXScrollValue -= (f_cumulatedXScrollValue > 0 ? f_xThreshold : -f_xThreshold);
- var_SetInteger(p_intf->obj.libvlc, "key-pressed", key);
+ var_SetInteger(vlc_object_instance(p_intf), "key-pressed", key);
msg_Dbg(p_intf, "Scrolling in x direction");
}
}
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 2826d2d378..fa2b11b765 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -738,7 +738,7 @@ static int SubDrawObject(intf_sys_t *sys, int l, vlc_object_t *p_obj, int i_leve
static int DrawObjects(intf_thread_t *intf, input_thread_t *input)
{
(void) input;
- return SubDrawObject(intf->p_sys, 0, VLC_OBJECT(intf->obj.libvlc), 0, "");
+ return SubDrawObject(intf->p_sys, 0, VLC_OBJECT(vlc_object_instance(intf)), 0, "");
}
static int DrawMeta(intf_thread_t *intf, input_thread_t *p_input)
@@ -1575,7 +1575,7 @@ static void HandleCommonKey(intf_thread_t *intf, input_thread_t *input,
case 'q':
case 'Q':
case KEY_EXIT:
- libvlc_Quit(intf->obj.libvlc);
+ libvlc_Quit(vlc_object_instance(intf));
return;
case 'h':
@@ -1803,7 +1803,7 @@ static int Open(vlc_object_t *p_this)
vlc_mutex_init(&sys->msg_lock);
sys->verbosity = var_InheritInteger(intf, "verbose");
- vlc_LogSet(intf->obj.libvlc, &log_ops, sys);
+ vlc_LogSet(vlc_object_instance(intf), &log_ops, sys);
sys->box_type = BOX_PLAYLIST;
sys->plidx_follow = true;
@@ -1870,7 +1870,7 @@ static void Close(vlc_object_t *p_this)
endwin(); /* Close the ncurses interface */
- vlc_LogSet(p_this->obj.libvlc, NULL, NULL);
+ vlc_LogSet(vlc_object_instance(p_this), NULL, NULL);
vlc_mutex_destroy(&sys->msg_lock);
for(unsigned i = 0; i < sizeof sys->msgs / sizeof *sys->msgs; i++) {
if (sys->msgs[i].item)
diff --git a/modules/gui/qt/components/complete_preferences.cpp b/modules/gui/qt/components/complete_preferences.cpp
index 19ed53564e..3b972aac6c 100644
--- a/modules/gui/qt/components/complete_preferences.cpp
+++ b/modules/gui/qt/components/complete_preferences.cpp
@@ -434,7 +434,7 @@ void PrefsTree::updateLoadedStatus( QTreeWidgetItem *item = NULL,
if( loaded == NULL )
{
- vlc_object_t *p_root = VLC_OBJECT( p_intf->obj.libvlc );
+ vlc_object_t *p_root = VLC_OBJECT( vlc_object_instance(p_intf) );
loaded = new QSet<QString>();
populateLoadedSet( loaded, p_root );
b_release = true;
diff --git a/modules/gui/qt/dialogs/messages.cpp b/modules/gui/qt/dialogs/messages.cpp
index 45180b222f..58e6fdaa07 100644
--- a/modules/gui/qt/dialogs/messages.cpp
+++ b/modules/gui/qt/dialogs/messages.cpp
@@ -137,16 +137,17 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
MessagesDialog::MsgCallback,
NULL
};
+ libvlc_int_t *vlc = vlc_object_instance(p_intf);
- vlc_LogSet( p_intf->obj.libvlc, &log_ops, this );
+ vlc_LogSet( vlc, &log_ops, this );
- buildTree( NULL, VLC_OBJECT( p_intf->obj.libvlc ) );
+ buildTree( NULL, VLC_OBJECT(vlc) );
}
MessagesDialog::~MessagesDialog()
{
saveWidgetPosition( "Messages" );
- vlc_LogSet( p_intf->obj.libvlc, NULL, NULL );
+ vlc_LogSet( vlc_object_instance(p_intf), NULL, NULL );
};
void MessagesDialog::changeVerbosity( int i_verbosity )
@@ -338,7 +339,7 @@ void MessagesDialog::updateOrClear()
if( ui.mainTab->currentIndex() == 1)
{
ui.modulesTree->clear();
- buildTree( NULL, VLC_OBJECT( p_intf->obj.libvlc ) );
+ buildTree( NULL, VLC_OBJECT( vlc_object_instance(p_intf) ) );
}
else if( ui.mainTab->currentIndex() == 0 )
ui.messages->clear();
diff --git a/modules/gui/qt/dialogs/vlm.cpp b/modules/gui/qt/dialogs/vlm.cpp
index f7f4b66ac7..8034bf0edd 100644
--- a/modules/gui/qt/dialogs/vlm.cpp
+++ b/modules/gui/qt/dialogs/vlm.cpp
@@ -54,7 +54,7 @@
VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
- vlm_t *p_vlm = vlm_New( p_intf->obj.libvlc, NULL );
+ vlm_t *p_vlm = vlm_New( vlc_object_instance(p_intf), NULL );
if( !p_vlm )
{
diff --git a/modules/gui/qt/dialogs_provider.cpp b/modules/gui/qt/dialogs_provider.cpp
index 084892aa7f..4bb9118890 100644
--- a/modules/gui/qt/dialogs_provider.cpp
+++ b/modules/gui/qt/dialogs_provider.cpp
@@ -130,7 +130,7 @@ QString DialogsProvider::getSaveFileName( QWidget *parent,
void DialogsProvider::quit()
{
b_isDying = true;
- libvlc_Quit( p_intf->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_intf) );
}
void DialogsProvider::customEvent( QEvent *event )
@@ -846,5 +846,5 @@ void DialogsProvider::sendKey( int key )
}
// forward key to vlc core when not a key accelerator
- var_SetInteger( p_intf->obj.libvlc, "key-pressed", key );
+ var_SetInteger( vlc_object_instance(p_intf), "key-pressed", key );
}
diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index fdb11dae2a..67012f4c0e 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -678,7 +678,7 @@ void InputManager::requestArtUpdate( input_item_t *p_item, bool b_forced )
if ( status & ( ITEM_ART_NOTFOUND|ITEM_ART_FETCHED ) )
return;
}
- libvlc_ArtRequest( p_intf->obj.libvlc, p_item,
+ libvlc_ArtRequest( vlc_object_instance(p_intf), p_item,
(b_forced) ? META_REQUEST_OPTION_SCOPE_ANY
: META_REQUEST_OPTION_NONE,
NULL, NULL );
@@ -896,12 +896,12 @@ void InputManager::faster()
void InputManager::littlefaster()
{
- var_SetInteger( p_intf->obj.libvlc, "key-action", ACTIONID_RATE_FASTER_FINE );
+ var_SetInteger( vlc_object_instance(p_intf), "key-action", ACTIONID_RATE_FASTER_FINE );
}
void InputManager::littleslower()
{
- var_SetInteger( p_intf->obj.libvlc, "key-action", ACTIONID_RATE_SLOWER_FINE );
+ var_SetInteger( vlc_object_instance(p_intf), "key-action", ACTIONID_RATE_SLOWER_FINE );
}
void InputManager::normalRate()
diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index b243b789f2..82ce6e81a8 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -1678,7 +1678,7 @@ void MainInterface::handleKeyPress( QKeyEvent *e )
int i_vlck = qtEventToVLCKey( e );
if( i_vlck > 0 )
{
- var_SetInteger( p_intf->obj.libvlc, "key-pressed", i_vlck );
+ var_SetInteger( vlc_object_instance(p_intf), "key-pressed", i_vlck );
e->accept();
}
else
@@ -1688,7 +1688,7 @@ void MainInterface::handleKeyPress( QKeyEvent *e )
void MainInterface::wheelEvent( QWheelEvent *e )
{
int i_vlckey = qtWheelEventToVLCKey( e );
- var_SetInteger( p_intf->obj.libvlc, "key-pressed", i_vlckey );
+ var_SetInteger( vlc_object_instance(p_intf), "key-pressed", i_vlckey );
e->accept();
}
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index f71d8d7695..00294ecae5 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -428,7 +428,7 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
vlc_sem_init (&ready, 0);
#ifdef Q_OS_MAC
/* Run mainloop on the main thread as Cocoa requires */
- libvlc_SetExitHandler( p_intf->obj.libvlc, Abort, p_intf );
+ libvlc_SetExitHandler( vlc_object_instance(p_intf), Abort, p_intf );
Thread( (void *)p_intf );
#else
if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
diff --git a/modules/gui/qt/util/input_slider.cpp b/modules/gui/qt/util/input_slider.cpp
index 3060163b5e..a93af5f5a5 100644
--- a/modules/gui/qt/util/input_slider.cpp
+++ b/modules/gui/qt/util/input_slider.cpp
@@ -402,8 +402,8 @@ void SeekSlider::wheelEvent( QWheelEvent *event )
/* Don't do anything if we are for somehow reason sliding */
if( !isSliding && isEnabled() )
{
- int64_t i_size = var_InheritInteger( p_intf->obj.libvlc, "short-jump-size" );
- int i_mode = var_InheritInteger( p_intf->obj.libvlc, "hotkeys-x-wheel-mode" );
+ int64_t i_size = var_InheritInteger( vlc_object_instance(p_intf), "short-jump-size" );
+ int i_mode = var_InheritInteger( vlc_object_instance(p_intf), "hotkeys-x-wheel-mode" );
if ( ( event->delta() < 0 && i_mode != 3 ) || ( event->delta() > 0 && i_mode == 3 ) )
i_size = - i_size;
float posOffset = static_cast<float>( i_size ) / static_cast<float>( inputLength );
diff --git a/modules/gui/skins2/commands/cmd_quit.cpp b/modules/gui/skins2/commands/cmd_quit.cpp
index b400ae9839..96e5e412ba 100644
--- a/modules/gui/skins2/commands/cmd_quit.cpp
+++ b/modules/gui/skins2/commands/cmd_quit.cpp
@@ -47,7 +47,7 @@ void CmdQuit::execute()
}
// Kill libvlc
- libvlc_Quit( getIntf()->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(getIntf()) );
}
diff --git a/modules/gui/skins2/os2/os2_factory.cpp b/modules/gui/skins2/os2/os2_factory.cpp
index 5d0e17101b..4d4a26cae3 100644
--- a/modules/gui/skins2/os2/os2_factory.cpp
+++ b/modules/gui/skins2/os2/os2_factory.cpp
@@ -90,7 +90,7 @@ MRESULT EXPENTRY OS2Factory::OS2FrameProc( HWND hwnd, ULONG msg,
// If closing parent window
if( SHORT1FROMMP(mp1) == SC_CLOSE )
{
- libvlc_Quit( p_intf->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_intf) );
return 0;
}
diff --git a/modules/gui/skins2/win32/win32_factory.cpp b/modules/gui/skins2/win32/win32_factory.cpp
index 6f4d5e8bcb..12be516305 100644
--- a/modules/gui/skins2/win32/win32_factory.cpp
+++ b/modules/gui/skins2/win32/win32_factory.cpp
@@ -73,7 +73,7 @@ LRESULT CALLBACK Win32Factory::Win32Proc( HWND hwnd, UINT uMsg,
// If closing parent window
if( (wParam & 0xFFF0) == SC_CLOSE )
{
- libvlc_Quit( p_intf->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_intf) );
return 0;
}
else if( (wParam & 0xFFF0) == SC_MINIMIZE )
diff --git a/modules/gui/skins2/x11/x11_loop.cpp b/modules/gui/skins2/x11/x11_loop.cpp
index 8b6437d32d..b0103e75b3 100644
--- a/modules/gui/skins2/x11/x11_loop.cpp
+++ b/modules/gui/skins2/x11/x11_loop.cpp
@@ -178,7 +178,7 @@ void X11Loop::handleX11Event()
(Atom)event.xclient.data.l[0] == wm_delete )
{
msg_Dbg( getIntf(), "Received WM_DELETE_WINDOW message" );
- libvlc_Quit( getIntf()->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(getIntf()) );
}
}
return;
diff --git a/modules/lua/libs/misc.c b/modules/lua/libs/misc.c
index ee9157f7d7..f07e93b15c 100644
--- a/modules/lua/libs/misc.c
+++ b/modules/lua/libs/misc.c
@@ -123,7 +123,7 @@ static int vlclua_quit( lua_State *L )
vlc_object_t *p_this = vlclua_get_this( L );
/* The rc.c code also stops the playlist ... not sure if this is needed
* though. */
- libvlc_Quit( p_this->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_this) );
return 0;
}
diff --git a/modules/lua/libs/objects.c b/modules/lua/libs/objects.c
index 63c8d7e0b5..d385ed9061 100644
--- a/modules/lua/libs/objects.c
+++ b/modules/lua/libs/objects.c
@@ -58,7 +58,7 @@ static int vlclua_object_find( lua_State *L )
static int vlclua_get_libvlc( lua_State *L )
{
- libvlc_int_t *p_libvlc = vlclua_get_this( L )->obj.libvlc;
+ libvlc_int_t *p_libvlc = vlc_object_instance(vlclua_get_this( L ));
vlc_object_hold( p_libvlc );
vlclua_push_vlc_object( L, p_libvlc );
return 1;
diff --git a/modules/lua/libs/variables.c b/modules/lua/libs/variables.c
index 2240ef7a4d..e724ac2306 100644
--- a/modules/lua/libs/variables.c
+++ b/modules/lua/libs/variables.c
@@ -260,19 +260,20 @@ static int vlclua_var_get_list( lua_State *L )
static int vlclua_libvlc_command( lua_State *L )
{
vlc_object_t * p_this = vlclua_get_this( L );
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_this));
vlc_value_t val_arg;
const char *psz_cmd = luaL_checkstring( L, 1 );
val_arg.psz_string = (char*)luaL_optstring( L, 2, "" );
- int i_type = var_Type( p_this->obj.libvlc, psz_cmd );
+ int i_type = var_Type( vlc, psz_cmd );
if( ! (i_type & VLC_VAR_ISCOMMAND) )
{
return luaL_error( L, "libvlc's \"%s\" is not a command",
psz_cmd );
}
- int i_ret = var_Set( p_this->obj.libvlc, psz_cmd, val_arg );
+ int i_ret = var_Set( vlc, psz_cmd, val_arg );
lua_pop( L, 2 );
return vlclua_push_ret( L, i_ret );
diff --git a/modules/lua/libs/vlm.c b/modules/lua/libs/vlm.c
index 558634e02c..eeb19b164d 100644
--- a/modules/lua/libs/vlm.c
+++ b/modules/lua/libs/vlm.c
@@ -52,7 +52,7 @@ static const luaL_Reg vlclua_vlm_reg[] = {
static int vlclua_vlm_new( lua_State *L )
{
vlc_object_t *p_this = vlclua_get_this( L );
- vlm_t *p_vlm = vlm_New( p_this->obj.libvlc, NULL );
+ vlm_t *p_vlm = vlm_New( vlc_object_instance(p_this), NULL );
if( !p_vlm )
return luaL_error( L, "Cannot start VLM." );
diff --git a/modules/services_discovery/mediadirs.c b/modules/services_discovery/mediadirs.c
index 8570ad6408..6efe265c22 100644
--- a/modules/services_discovery/mediadirs.c
+++ b/modules/services_discovery/mediadirs.c
@@ -161,11 +161,13 @@ static int Open( vlc_object_t *p_this, enum type_e i_type )
p_sd->description = vlc_gettext(desc);
- var_AddCallback( p_sd->obj.libvlc, p_sys->psz_var, onNewFileAdded, p_sd );
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_sd));
+
+ var_AddCallback( vlc, p_sys->psz_var, onNewFileAdded, p_sd );
if( vlc_clone( &p_sys->thread, Run, p_sd, VLC_THREAD_PRIORITY_LOW ) )
{
- var_DelCallback( p_sd->obj.libvlc, p_sys->psz_var, onNewFileAdded, p_sd );
+ var_DelCallback( vlc, p_sys->psz_var, onNewFileAdded, p_sd );
free( p_sys->psz_dir[1] );
free( p_sys->psz_dir[0] );
free( p_sys );
@@ -221,10 +223,11 @@ 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 *vlc = VLC_OBJECT(vlc_object_instance(p_sd));
vlc_join( p_sys->thread, NULL );
- var_DelCallback( p_sd->obj.libvlc, p_sys->psz_var, onNewFileAdded, p_sd );
+ var_DelCallback( vlc, p_sys->psz_var, onNewFileAdded, p_sd );
free( p_sys->psz_dir[1] );
free( p_sys->psz_dir[0] );
diff --git a/modules/spu/audiobargraph_v.c b/modules/spu/audiobargraph_v.c
index bbd361f907..52a876e5e7 100644
--- a/modules/spu/audiobargraph_v.c
+++ b/modules/spu/audiobargraph_v.c
@@ -541,17 +541,17 @@ static int OpenCommon(vlc_object_t *p_this, bool b_sub)
if (!b_sub && p_sys->i_pos_x >= 0 && p_sys->i_pos_y >= 0)
p_sys->i_pos = 0;
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_filter));
+
vlc_mutex_init(&p_sys->lock);
- var_Create(p_filter->obj.libvlc, CFG_PREFIX "alarm", VLC_VAR_BOOL);
- var_Create(p_filter->obj.libvlc, CFG_PREFIX "i_values", VLC_VAR_STRING);
+ var_Create(vlc, CFG_PREFIX "alarm", VLC_VAR_BOOL);
+ var_Create(vlc, CFG_PREFIX "i_values", VLC_VAR_STRING);
- var_AddCallback(p_filter->obj.libvlc, CFG_PREFIX "alarm",
- BarGraphCallback, p_sys);
- var_AddCallback(p_filter->obj.libvlc, CFG_PREFIX "i_values",
- BarGraphCallback, p_sys);
+ var_AddCallback(vlc, CFG_PREFIX "alarm", BarGraphCallback, p_sys);
+ var_AddCallback(vlc, CFG_PREFIX "i_values", BarGraphCallback, p_sys);
- var_TriggerCallback(p_filter->obj.libvlc, CFG_PREFIX "alarm");
- var_TriggerCallback(p_filter->obj.libvlc, CFG_PREFIX "i_values");
+ var_TriggerCallback(vlc, CFG_PREFIX "alarm");
+ var_TriggerCallback(vlc, CFG_PREFIX "i_values");
for (int i = 0; ppsz_filter_callbacks[i]; i++)
var_AddCallback(p_filter, ppsz_filter_callbacks[i],
@@ -588,17 +588,16 @@ static void Close(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 *vlc = VLC_OBJECT(vlc_object_instance(p_filter));
for (int i = 0; ppsz_filter_callbacks[i]; i++)
var_DelCallback(p_filter, ppsz_filter_callbacks[i],
BarGraphCallback, p_sys);
- var_DelCallback(p_filter->obj.libvlc, CFG_PREFIX "i_values",
- BarGraphCallback, p_sys);
- var_DelCallback(p_filter->obj.libvlc, CFG_PREFIX "alarm",
- BarGraphCallback, p_sys);
- var_Destroy(p_filter->obj.libvlc, CFG_PREFIX "i_values");
- var_Destroy(p_filter->obj.libvlc, CFG_PREFIX "alarm");
+ var_DelCallback(vlc, CFG_PREFIX "i_values", BarGraphCallback, p_sys);
+ var_DelCallback(vlc, CFG_PREFIX "alarm", BarGraphCallback, p_sys);
+ var_Destroy(vlc, CFG_PREFIX "i_values");
+ var_Destroy(vlc, CFG_PREFIX "alarm");
if (p_sys->p_blend)
filter_DeleteBlend(p_sys->p_blend);
diff --git a/modules/spu/mosaic.h b/modules/spu/mosaic.h
index 9ddcf882a0..41bd00950d 100644
--- a/modules/spu/mosaic.h
+++ b/modules/spu/mosaic.h
@@ -42,6 +42,7 @@ typedef struct bridge_t
static bridge_t *GetBridge( vlc_object_t *p_object )
{
- return var_GetAddress(VLC_OBJECT(p_object->obj.libvlc), "mosaic-struct");
+ return var_GetAddress(VLC_OBJECT(vlc_object_instance(p_object)),
+ "mosaic-struct");
}
#define GetBridge(a) GetBridge( VLC_OBJECT(a) )
diff --git a/modules/spu/remoteosd.c b/modules/spu/remoteosd.c
index a02dbf33ca..2c71df6841 100644
--- a/modules/spu/remoteosd.c
+++ b/modules/spu/remoteosd.c
@@ -282,7 +282,8 @@ static int CreateFilter ( vlc_object_t *p_this )
p_sys->b_vnc_key_events = var_InheritBool( p_this,
RMTOSD_CFG "key-events" );
if( p_sys->b_vnc_key_events )
- var_AddCallback( p_filter->obj.libvlc, "key-pressed", KeyEvent, p_this );
+ var_AddCallback( vlc_object_instance(p_filter), "key-pressed",
+ KeyEvent, p_this );
msg_Dbg( p_filter, "osdvnc filter started" );
@@ -310,7 +311,8 @@ static void DestroyFilter( vlc_object_t *p_this )
msg_Dbg( p_filter, "DestroyFilter called." );
if( p_sys->b_vnc_key_events )
- var_DelCallback( p_filter->obj.libvlc, "key-pressed", KeyEvent, p_this );
+ var_DelCallback( vlc_object_instance(p_filter), "key-pressed",
+ KeyEvent, p_this );
vlc_cancel( p_sys->worker_thread );
vlc_join( p_sys->worker_thread, NULL );
diff --git a/modules/stream_filter/record.c b/modules/stream_filter/record.c
index db260e92b0..43d71498c0 100644
--- a/modules/stream_filter/record.c
+++ b/modules/stream_filter/record.c
@@ -195,7 +195,7 @@ static int Start( stream_t *s, const char *psz_extension )
}
/* signal new record file */
- var_SetString( s->obj.libvlc, "record-file", psz_file );
+ var_SetString( vlc_object_instance(s), "record-file", psz_file );
msg_Dbg( s, "Recording into %s", psz_file );
free( psz_file );
diff --git a/modules/stream_out/bridge.c b/modules/stream_out/bridge.c
index 3699c5d41b..003c036f5d 100644
--- a/modules/stream_out/bridge.c
+++ b/modules/stream_out/bridge.c
@@ -236,6 +236,7 @@ static void CloseOut( vlc_object_t * p_this )
static void *AddOut( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_stream));
out_sout_stream_sys_t *p_sys = (out_sout_stream_sys_t *)p_stream->p_sys;
bridge_t *p_bridge;
bridged_es_t *p_es;
@@ -250,13 +251,13 @@ static void *AddOut( sout_stream_t *p_stream, const es_format_t *p_fmt )
vlc_mutex_lock( &lock );
- p_bridge = var_GetAddress( p_stream->obj.libvlc, p_sys->psz_name );
+ p_bridge = var_GetAddress( vlc, p_sys->psz_name );
if ( p_bridge == NULL )
{
p_bridge = xmalloc( sizeof( bridge_t ) );
- var_Create( p_stream->obj.libvlc, p_sys->psz_name, VLC_VAR_ADDRESS );
- var_SetAddress( p_stream->obj.libvlc, p_sys->psz_name, p_bridge );
+ var_Create( vlc, p_sys->psz_name, VLC_VAR_ADDRESS );
+ var_SetAddress( vlc, p_sys->psz_name, p_bridge );
p_bridge->i_es_num = 0;
p_bridge->pp_es = NULL;
@@ -502,6 +503,7 @@ static void DelIn( sout_stream_t *p_stream, void *_id )
static int SendIn( sout_stream_t *p_stream, void *_id, block_t *p_buffer )
{
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_stream));
in_sout_stream_sys_t *p_sys = (in_sout_stream_sys_t *)p_stream->p_sys;
sout_stream_id_sys_t *id = (sout_stream_id_sys_t *)_id;
bridge_t *p_bridge;
@@ -516,7 +518,7 @@ static int SendIn( sout_stream_t *p_stream, void *_id, block_t *p_buffer )
/* Then check all bridged streams */
vlc_mutex_lock( &lock );
- p_bridge = var_GetAddress( p_stream->obj.libvlc, p_sys->psz_name );
+ p_bridge = var_GetAddress( vlc, p_sys->psz_name );
if( p_bridge )
{
@@ -658,7 +660,7 @@ static int SendIn( sout_stream_t *p_stream, void *_id, block_t *p_buffer )
free( p_bridge->pp_es[i] );
free( p_bridge->pp_es );
free( p_bridge );
- var_Destroy( p_stream->obj.libvlc, p_sys->psz_name );
+ var_Destroy( vlc, p_sys->psz_name );
}
}
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index 9608422748..707c9ad49c 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -329,7 +329,7 @@ static void *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
p_bridge = GetBridge( p_stream );
if ( p_bridge == NULL )
{
- vlc_object_t *p_libvlc = VLC_OBJECT( p_stream->obj.libvlc );
+ vlc_object_t *p_libvlc = VLC_OBJECT( vlc_object_instance(p_stream) );
vlc_value_t val;
p_bridge = xmalloc( sizeof( bridge_t ) );
@@ -459,7 +459,7 @@ static void Del( sout_stream_t *p_stream, void *id )
if ( b_last_es )
{
- vlc_object_t *p_libvlc = VLC_OBJECT( p_stream->obj.libvlc );
+ vlc_object_t *p_libvlc = VLC_OBJECT( vlc_object_instance(p_stream) );
for ( i = 0; i < p_bridge->i_es_num; i++ )
free( p_bridge->pp_es[i] );
free( p_bridge->pp_es );
diff --git a/modules/stream_out/record.c b/modules/stream_out/record.c
index 50c7b2986e..219775ade3 100644
--- a/modules/stream_out/record.c
+++ b/modules/stream_out/record.c
@@ -356,7 +356,7 @@ static int OutputNew( sout_stream_t *p_stream,
}
if( psz_file && psz_extension )
- var_SetString( p_stream->obj.libvlc, "record-file", psz_file );
+ var_SetString( vlc_object_instance(p_stream), "record-file", psz_file );
free( psz_file );
free( psz_output );
diff --git a/modules/video_filter/opencv_example.cpp b/modules/video_filter/opencv_example.cpp
index 1d787858cc..1334cd4c36 100644
--- a/modules/video_filter/opencv_example.cpp
+++ b/modules/video_filter/opencv_example.cpp
@@ -112,11 +112,11 @@ static int OpenFilter( vlc_object_t *p_this )
//create the VIDEO_FILTER_EVENT_VARIABLE
vlc_value_t val;
- if (var_Create( p_filter->obj.libvlc, VIDEO_FILTER_EVENT_VARIABLE, VLC_VAR_ADDRESS | VLC_VAR_DOINHERIT ) != VLC_SUCCESS)
+ if (var_Create( vlc_object_instance(p_filter), VIDEO_FILTER_EVENT_VARIABLE, VLC_VAR_ADDRESS | VLC_VAR_DOINHERIT ) != VLC_SUCCESS)
msg_Err( p_filter, "Could not create %s", VIDEO_FILTER_EVENT_VARIABLE);
val.p_address = &(p_sys->event_info);
- if (var_Set( p_filter->obj.libvlc, VIDEO_FILTER_EVENT_VARIABLE, val )!=VLC_SUCCESS)
+ if (var_Set( vlc_object_instance(p_filter), VIDEO_FILTER_EVENT_VARIABLE, val )!=VLC_SUCCESS)
msg_Err( p_filter, "Could not set %s", VIDEO_FILTER_EVENT_VARIABLE);
//OpenCV init specific to this example
@@ -145,7 +145,7 @@ static void CloseFilter( vlc_object_t *p_this )
free( p_sys->event_info.p_region );
free( p_sys );
- var_Destroy( p_filter->obj.libvlc, VIDEO_FILTER_EVENT_VARIABLE);
+ var_Destroy( vlc_object_instance(p_filter), VIDEO_FILTER_EVENT_VARIABLE);
}
/****************************************************************************
@@ -210,7 +210,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
}
if (faces && (faces->total > 0)) //raise the video filter event
- var_TriggerCallback( p_filter->obj.libvlc, VIDEO_FILTER_EVENT_VARIABLE );
+ var_TriggerCallback( vlc_object_instance(p_filter), VIDEO_FILTER_EVENT_VARIABLE );
}
else
msg_Err( p_filter, "No cascade - is opencv-haarcascade-file valid?" );
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index e212152a61..2d001868d8 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -289,7 +289,7 @@ static vlc_mutex_t sys_lock = VLC_STATIC_MUTEX;
static decklink_sys_t *HoldDLSys(vlc_object_t *obj, int i_cat)
{
- vlc_object_t *libvlc = VLC_OBJECT(obj->obj.libvlc);
+ vlc_object_t *libvlc = VLC_OBJECT(vlc_object_instance(obj));
decklink_sys_t *sys;
vlc_mutex_lock(&sys_lock);
@@ -335,7 +335,7 @@ static decklink_sys_t *HoldDLSys(vlc_object_t *obj, int i_cat)
static void ReleaseDLSys(vlc_object_t *obj, int i_cat)
{
- vlc_object_t *libvlc = VLC_OBJECT(obj->obj.libvlc);
+ vlc_object_t *libvlc = VLC_OBJECT(vlc_object_instance(obj));
vlc_mutex_lock(&sys_lock);
diff --git a/modules/video_output/win32/win32touch.c b/modules/video_output/win32/win32touch.c
index ece54d5708..809c1d4011 100644
--- a/modules/video_output/win32/win32touch.c
+++ b/modules/video_output/win32/win32touch.c
@@ -98,7 +98,7 @@ static BOOL DecodeGestureAction( vlc_object_t *p_this, win32_gesture_sys_t *p_ge
else
action_id = ACTIONID_JUMP_FORWARD_SHORT;
}
- var_SetInteger( p_this->obj.libvlc, "key-action", action_id );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", action_id );
}
/* Reset the values */
p_gesture->i_action = GESTURE_ACTION_UNDEFINED;
@@ -137,9 +137,9 @@ static BOOL DecodeGestureAction( vlc_object_t *p_this, win32_gesture_sys_t *p_ge
int offset = p_gesture->i_lasty - p_gi->ptsLocation.y;
if( offset > 100)
- var_SetInteger( p_this->obj.libvlc, "key-action", ACTIONID_VOL_UP );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_VOL_UP );
else if( offset < -100)
- var_SetInteger( p_this->obj.libvlc, "key-action", ACTIONID_VOL_DOWN );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_VOL_DOWN );
else
break;
@@ -153,19 +153,19 @@ static BOOL DecodeGestureAction( vlc_object_t *p_this, win32_gesture_sys_t *p_ge
if( p_gesture->i_lasty - p_gesture->i_beginy > 80 )
{
- var_SetInteger( p_this->obj.libvlc, "key-action", ACTIONID_BRIGHTNESS_DOWN );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_BRIGHTNESS_DOWN );
p_gesture->i_lasty = p_gi->ptsLocation.y;
}
else if ( p_gesture->i_lasty - p_gesture->i_beginy < 80 )
{
- var_SetInteger( p_this->obj.libvlc, "key-action", ACTIONID_BRIGHTNESS_UP );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_BRIGHTNESS_UP );
p_gesture->i_lasty = p_gi->ptsLocation.y;
} */
}
break;
case GID_TWOFINGERTAP:
p_gesture->i_type = GID_TWOFINGERTAP;
- var_SetInteger( p_this->obj.libvlc, "key-action", ACTIONID_PLAY_PAUSE );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_PLAY_PAUSE );
bHandled = TRUE;
break;
case GID_ZOOM:
@@ -180,10 +180,10 @@ static BOOL DecodeGestureAction( vlc_object_t *p_this, win32_gesture_sys_t *p_ge
double k = (double)(p_gi->ullArguments) /
(double)(p_gesture->i_ullArguments);
if( k > 1 )
- var_SetInteger( p_this->obj.libvlc, "key-action",
+ var_SetInteger( vlc_object_instance(p_this), "key-action",
ACTIONID_TOGGLE_FULLSCREEN );
else
- var_SetInteger( p_this->obj.libvlc, "key-action",
+ var_SetInteger( vlc_object_instance(p_this), "key-action",
ACTIONID_LEAVE_FULLSCREEN );
}
break;
@@ -227,7 +227,7 @@ static BOOL DecodeGestureProjection( vlc_object_t *p_this, win32_gesture_sys_t *
action_id = ACTIONID_JUMP_BACKWARD_SHORT;
else
action_id = ACTIONID_JUMP_FORWARD_SHORT;
- var_SetInteger( p_this->obj.libvlc, "key-action", action_id );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", action_id );
}
}
/* Reset the values */
@@ -265,9 +265,9 @@ static BOOL DecodeGestureProjection( vlc_object_t *p_this, win32_gesture_sys_t *
int offset = p_gesture->i_lasty - p_gi->ptsLocation.y;
if( offset > 100)
- var_SetInteger( p_this->obj.libvlc, "key-action", ACTIONID_VOL_UP );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_VOL_UP );
else if( offset < -100)
- var_SetInteger( p_this->obj.libvlc, "key-action", ACTIONID_VOL_DOWN );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_VOL_DOWN );
else
break;
@@ -276,7 +276,7 @@ static BOOL DecodeGestureProjection( vlc_object_t *p_this, win32_gesture_sys_t *
break;
case GID_TWOFINGERTAP:
p_gesture->i_type = GID_TWOFINGERTAP;
- var_SetInteger( p_this->obj.libvlc, "key-action", ACTIONID_PLAY_PAUSE );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_PLAY_PAUSE );
bHandled = TRUE;
break;
case GID_ZOOM:
@@ -295,12 +295,12 @@ static BOOL DecodeGestureProjection( vlc_object_t *p_this, win32_gesture_sys_t *
if (k > p_gesture->f_lastzoom * 1.01)
{
- var_SetInteger( p_this->obj.libvlc, "key-action", ACTIONID_VIEWPOINT_FOV_IN );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_VIEWPOINT_FOV_IN );
p_gesture->f_lastzoom = k;
}
else if (k < p_gesture->f_lastzoom * 0.99)
{
- var_SetInteger( p_this->obj.libvlc, "key-action", ACTIONID_VIEWPOINT_FOV_OUT );
+ var_SetInteger( vlc_object_instance(p_this), "key-action", ACTIONID_VIEWPOINT_FOV_OUT );
p_gesture->f_lastzoom = k;
}
break;
diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index 373042453e..231d652050 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -775,16 +775,17 @@ static vlc_mutex_t serializer = VLC_STATIC_MUTEX;
/** Acquire a drawable */
static int AcquireDrawable (vlc_object_t *obj, xcb_window_t window)
{
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(obj));
xcb_window_t *used;
size_t n = 0;
- if (var_Create (obj->obj.libvlc, "xid-in-use", VLC_VAR_ADDRESS))
+ if (var_Create(vlc, "xid-in-use", VLC_VAR_ADDRESS))
return VLC_ENOMEM;
/* Keep a list of busy drawables, so we don't overlap videos if there are
* more than one video track in the stream. */
vlc_mutex_lock (&serializer);
- used = var_GetAddress (obj->obj.libvlc, "xid-in-use");
+ used = var_GetAddress(vlc, "xid-in-use");
if (used != NULL)
{
while (used[n])
@@ -800,7 +801,7 @@ static int AcquireDrawable (vlc_object_t *obj, xcb_window_t window)
{
used[n] = window;
used[n + 1] = 0;
- var_SetAddress (obj->obj.libvlc, "xid-in-use", used);
+ var_SetAddress(vlc, "xid-in-use", used);
}
else
{
@@ -816,11 +817,12 @@ skip:
/** Remove this drawable from the list of busy ones */
static void ReleaseDrawable (vlc_object_t *obj, xcb_window_t window)
{
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(obj));
xcb_window_t *used;
size_t n = 0;
vlc_mutex_lock (&serializer);
- used = var_GetAddress (obj->obj.libvlc, "xid-in-use");
+ used = var_GetAddress(vlc, "xid-in-use");
assert (used);
while (used[n] != window)
{
@@ -832,7 +834,7 @@ static void ReleaseDrawable (vlc_object_t *obj, xcb_window_t window)
while (used[++n]);
if (!used[0])
- var_SetAddress (obj->obj.libvlc, "xid-in-use", NULL);
+ var_SetAddress(vlc, "xid-in-use", NULL);
else
used = NULL;
@@ -841,7 +843,7 @@ static void ReleaseDrawable (vlc_object_t *obj, xcb_window_t window)
free( used );
/* Variables are reference-counted... */
- var_Destroy (obj->obj.libvlc, "xid-in-use");
+ var_Destroy(vlc, "xid-in-use");
}
static void EmClose(vout_window_t *);
diff --git a/src/input/player.c b/src/input/player.c
index 63265a7535..a309a6ab5f 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -966,7 +966,7 @@ vlc_player_input_HandleState(struct vlc_player_input *input,
if (player->input && player->started)
vlc_player_input_Start(player->input);
else
- libvlc_Quit(player->obj.libvlc);
+ libvlc_Quit(vlc_object_instance(player));
break;
case VLC_PLAYER_MEDIA_STOPPED_CONTINUE:
if (player->input && player->started)
diff --git a/src/input/vlm.c b/src/input/vlm.c
index e7a1aa9a9a..745691de6d 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -83,7 +83,7 @@ static int InputEvent( vlc_object_t *p_this, char const *psz_cmd,
VLC_UNUSED(psz_cmd);
VLC_UNUSED(oldval);
input_thread_t *p_input = (input_thread_t *)p_this;
- vlm_t *p_vlm = libvlc_priv( p_input->obj.libvlc )->p_vlm;
+ vlm_t *p_vlm = libvlc_priv( vlc_object_instance(p_input) )->p_vlm;
assert( p_vlm );
vlm_media_sys_t *p_media = p_data;
const char *psz_instance_name = NULL;
@@ -134,8 +134,7 @@ vlm_t *vlm_New( libvlc_int_t *libvlc, const char *psz_vlmconf )
msg_Dbg( p_this, "creating VLM" );
- p_vlm = vlc_custom_create( p_this->obj.libvlc, sizeof( *p_vlm ),
- "vlm daemon" );
+ p_vlm = vlc_custom_create( p_this, sizeof( *p_vlm ), "vlm daemon" );
if( !p_vlm )
{
vlc_mutex_unlock( &vlm_mutex );
@@ -198,7 +197,7 @@ void vlm_Delete( vlm_t *p_vlm )
vlc_mutex_lock( &vlm_mutex );
assert( p_vlm->users > 0 );
if( --p_vlm->users == 0 )
- assert( libvlc_priv(p_vlm->obj.libvlc)->p_vlm == p_vlm );
+ assert( libvlc_priv(vlc_object_instance(p_vlm))->p_vlm == p_vlm );
else
p_vlm = NULL;
@@ -225,7 +224,7 @@ void vlm_Delete( vlm_t *p_vlm )
vlc_object_release( p_vlm->p_vod );
}
- libvlc_priv(p_vlm->obj.libvlc)->p_vlm = NULL;
+ libvlc_priv(vlc_object_instance(p_vlm))->p_vlm = NULL;
vlc_mutex_unlock( &vlm_mutex );
vlc_join( p_vlm->thread, NULL );
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index 459c41602b..44e215686b 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -126,7 +126,7 @@ get_dialog_provider(vlc_object_t *p_obj, bool b_check_interact)
return NULL;
vlc_dialog_provider *p_provider =
- libvlc_priv(p_obj->obj.libvlc)->p_dialog_provider;
+ libvlc_priv(vlc_object_instance(p_obj))->p_dialog_provider;
assert(p_provider != NULL);
return p_provider;
}
diff --git a/src/interface/interface.c b/src/interface/interface.c
index 15dce8f3c5..d86e1a1c20 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -148,7 +148,7 @@ static playlist_t *intf_GetPlaylist(libvlc_int_t *libvlc)
vlc_playlist_t *
vlc_intf_GetMainPlaylist(intf_thread_t *intf)
{
- return libvlc_priv(intf->obj.libvlc)->main_playlist;
+ return libvlc_priv(vlc_object_instance(intf))->main_playlist;
}
/**
diff --git a/src/misc/actions.c b/src/misc/actions.c
index 72a4398334..9bf9a23aba 100644
--- a/src/misc/actions.c
+++ b/src/misc/actions.c
@@ -637,6 +637,6 @@ vlc_actions_get_keycodes(vlc_object_t *p_obj, const char *psz_key_name,
const char* const*
vlc_actions_get_key_names(vlc_object_t *p_obj)
{
- vlc_actions_t *as = libvlc_priv(p_obj->obj.libvlc)->actions;
+ vlc_actions_t *as = libvlc_priv(vlc_object_instance(p_obj))->actions;
return as->ppsz_keys;
}
diff --git a/src/misc/keystore.c b/src/misc/keystore.c
index 53edb35c2c..88168373e8 100644
--- a/src/misc/keystore.c
+++ b/src/misc/keystore.c
@@ -156,7 +156,7 @@ libvlc_InternalKeystoreClean(libvlc_int_t *p_libvlc)
static vlc_keystore *
get_memory_keystore(vlc_object_t *p_obj)
{
- return libvlc_priv(p_obj->obj.libvlc)->p_memory_keystore;
+ return libvlc_priv(vlc_object_instance(p_obj))->p_memory_keystore;
}
static vlc_keystore_entry *
diff --git a/src/misc/medialibrary.c b/src/misc/medialibrary.c
index f84940e2c4..200e0b5370 100644
--- a/src/misc/medialibrary.c
+++ b/src/misc/medialibrary.c
@@ -130,7 +130,7 @@ void libvlc_MlRelease( vlc_medialibrary_t* p_ml )
#undef vlc_ml_instance_get
vlc_medialibrary_t* vlc_ml_instance_get( vlc_object_t* p_obj )
{
- libvlc_priv_t* p_priv = libvlc_priv( p_obj->obj.libvlc );
+ libvlc_priv_t* p_priv = libvlc_priv( vlc_object_instance(p_obj) );
return p_priv->p_media_library;
}
diff --git a/src/misc/messages.c b/src/misc/messages.c
index 311794b295..8effb55c4a 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -135,7 +135,7 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
/* Pass message to the callback */
if (obj != NULL)
- vlc_vaLogCallback(obj->obj.libvlc, type, &msg, format, args);
+ vlc_vaLogCallback(vlc_object_instance(obj), type, &msg, format, args);
}
/**
@@ -254,7 +254,7 @@ static void vlc_LogEarlyClose(void *d)
{
vlc_logger_early_t *sys = d;
vlc_logger_t *logger = sys->sink;
- libvlc_int_t *vlc = logger->obj.libvlc;
+ libvlc_int_t *vlc = vlc_object_instance(logger);
/* Drain early log messages */
for (vlc_log_early_t *log = sys->head, *next; log != NULL; log = next)
diff --git a/src/misc/objects.c b/src/misc/objects.c
index bce646a314..f97bbaeb20 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -220,7 +220,7 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length,
vlc_object_internals_t *papriv = vlc_internals (parent);
obj->obj.flags = parent->obj.flags;
- obj->obj.libvlc = parent->obj.libvlc;
+ obj->obj.libvlc = vlc_object_instance(parent);
/* Attach the child to its parent (no lock needed) */
obj->obj.parent = vlc_object_hold (parent);
diff --git a/src/misc/update.c b/src/misc/update.c
index 854ca08d23..f632b8f609 100644
--- a/src/misc/update.c
+++ b/src/misc/update.c
@@ -110,7 +110,7 @@ update_t *update_New( vlc_object_t *p_this )
vlc_mutex_init( &p_update->lock );
- p_update->p_libvlc = p_this->obj.libvlc;
+ p_update->p_libvlc = vlc_object_instance(p_this);
p_update->release.psz_url = NULL;
p_update->release.psz_desc = NULL;
@@ -731,7 +731,7 @@ static void* update_DownloadReal( void *obj )
MultiByteToWideChar( CP_UTF8, 0, psz_destfile, -1, psz_wdestfile, MAX_PATH );
answer = (int)ShellExecuteW( NULL, L"open", psz_wdestfile, NULL, NULL, SW_SHOW);
if(answer > 32)
- libvlc_Quit(p_udt->obj.libvlc);
+ libvlc_Quit(vlc_object_instance(p_udt));
}
#endif
end:
diff --git a/src/playlist_legacy/item.c b/src/playlist_legacy/item.c
index 5fe96f258a..688a497337 100644
--- a/src/playlist_legacy/item.c
+++ b/src/playlist_legacy/item.c
@@ -749,7 +749,7 @@ static void playlist_Preparse( playlist_t *p_playlist,
if( sys->b_preparse && !input_item_IsPreparsed( input )
&& (EMPTY_STR(psz_artist) || EMPTY_STR(psz_album)) )
- vlc_MetadataRequest( p_playlist->obj.libvlc, input, 0,
+ vlc_MetadataRequest( vlc_object_instance(p_playlist), input, 0,
&input_preparser_callbacks, p_playlist,
-1, p_item );
free( psz_artist );
diff --git a/src/playlist_legacy/thread.c b/src/playlist_legacy/thread.c
index 0707acf410..8feb326c2b 100644
--- a/src/playlist_legacy/thread.c
+++ b/src/playlist_legacy/thread.c
@@ -205,6 +205,7 @@ static void on_input_event(input_thread_t *input,
*/
static bool PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
{
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_playlist));
playlist_private_t *p_sys = pl_priv(p_playlist);
input_item_t *p_input = p_item->p_input;
vlc_renderer_item_t *p_renderer;
@@ -224,7 +225,7 @@ static bool PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
assert( p_sys->p_input == NULL );
PL_UNLOCK;
- libvlc_MetadataCancel( p_playlist->obj.libvlc, p_item );
+ libvlc_MetadataCancel( vlc, p_item );
input_thread_t *p_input_thread = input_Create( p_playlist,
on_input_event, p_playlist,
@@ -255,7 +256,7 @@ static bool PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
if( !b_has_art || strncmp( psz_arturl, "attachment://", 13 ) )
{
PL_DEBUG( "requesting art for new input thread" );
- libvlc_ArtRequest( p_playlist->obj.libvlc, p_input, META_REQUEST_OPTION_NONE, NULL, NULL );
+ libvlc_ArtRequest( vlc, p_input, META_REQUEST_OPTION_NONE, NULL, NULL );
}
free( psz_arturl );
@@ -514,7 +515,7 @@ static void *Thread ( void *data )
if( played && var_InheritBool( p_playlist, "play-and-exit" ) )
{
msg_Info( p_playlist, "end of playlist, exiting" );
- libvlc_Quit( p_playlist->obj.libvlc );
+ libvlc_Quit( vlc_object_instance(p_playlist) );
}
/* Destroy any video display now (XXX: ugly hack) */
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index bb9d335241..260c160ab4 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -428,7 +428,7 @@ static void VoutSaveSnapshot( vout_thread_t *p_vout )
VoutOsdSnapshot( p_vout, p_picture, psz_filename );
/* signal creation of a new snapshot file */
- var_SetString( p_vout->obj.libvlc, "snapshot-file", psz_filename );
+ var_SetString( vlc_object_instance(p_vout), "snapshot-file", psz_filename );
free( psz_filename );
diff --git a/src/video_output/window.c b/src/video_output/window.c
index a09aea5f14..1a23dd10ba 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -247,7 +247,7 @@ static void vout_display_window_MouseEvent(vout_window_t *window,
static void vout_display_window_KeyboardEvent(vout_window_t *window,
unsigned key)
{
- var_SetInteger(window->obj.libvlc, "key-pressed", key);
+ var_SetInteger(vlc_object_instance(window), "key-pressed", key);
}
static void vout_display_window_OutputEvent(vout_window_t *window,
diff --git a/src/win32/mta_holder.h b/src/win32/mta_holder.h
index 1733c5f9a7..08ae78e2ca 100644
--- a/src/win32/mta_holder.h
+++ b/src/win32/mta_holder.h
@@ -61,8 +61,10 @@ static inline void* MtaMainLoop( void* opaque )
*/
static inline bool vlc_mta_acquire( vlc_object_t *p_parent )
{
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_parent));
+
vlc_global_lock( VLC_MTA_MUTEX );
- vlc_mta_holder* p_mta = (vlc_mta_holder*)var_CreateGetAddress( p_parent->obj.libvlc, "mta-holder" );
+ vlc_mta_holder* p_mta = (vlc_mta_holder*)var_CreateGetAddress( vlc, "mta-holder" );
if ( p_mta == NULL )
{
p_mta = (vlc_mta_holder*)malloc( sizeof( *p_mta ) );
@@ -83,7 +85,7 @@ static inline bool vlc_mta_acquire( vlc_object_t *p_parent )
vlc_global_unlock( VLC_MTA_MUTEX );
return false;
}
- var_SetAddress( p_parent->obj.libvlc, "mta-holder", p_mta );
+ var_SetAddress( vlc, "mta-holder", p_mta );
vlc_sem_wait( &p_mta->ready_sem );
}
else
@@ -99,12 +101,14 @@ static inline bool vlc_mta_acquire( vlc_object_t *p_parent )
*/
static inline void vlc_mta_release( vlc_object_t* p_parent )
{
+ vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_parent));
+
vlc_global_lock( VLC_MTA_MUTEX );
- vlc_mta_holder *p_mta = (vlc_mta_holder*)var_InheritAddress( p_parent->obj.libvlc, "mta-holder" );
+ vlc_mta_holder *p_mta = (vlc_mta_holder*)var_InheritAddress( vlc, "mta-holder" );
assert( p_mta != NULL );
int i_refcount = --p_mta->i_refcount;
if ( i_refcount == 0 )
- var_SetAddress( p_parent->obj.libvlc, "mta-holder", NULL );
+ var_SetAddress( vlc, "mta-holder", NULL );
vlc_global_unlock( VLC_MTA_MUTEX );
if ( i_refcount == 0 )
{
More information about the vlc-commits
mailing list