[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: add missing forward declaration
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Wed Feb 9 13:22:18 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
84016b14 by Alexandre Janniaux at 2022-02-09T12:36:10+00:00
qt: add missing forward declaration
intf_thread_t wasn't forward-declared and was available only thanks to
vlc_object_cast forward declaration.
- - - - -
3a526cb3 by Alexandre Janniaux at 2022-02-09T12:36:10+00:00
vlc_objects: simplify VLC_OBJECT cast handling
Like done by _Generic in the C version, use overloading functions to
define the correct casting behaviour depending on whether the pointer
is already a vlc_object_t or possess a vlc_object_t as ->obj.
This removes the need for listing all the objects which need a casting
case, and non-vlc_object_t objects will fail with the following error:
include/vlc_objects.h: In instantiation of ‘vlc_object_t* VLC_OBJECT(T*) [with T = {anonymous}::demux_sys_t; vlc_object_t = vlc_object_t]’:
include/vlc_objects.h:83:18: error: ‘struct {anonymous}::demux_sys_t’ has no member named ‘obj’
or, if there is a obj field which is not a vlc_object_t:
include/vlc_objects.h: In instantiation of ‘vlc_object_t* VLC_OBJECT(T*) [with T = Open(vlc_object_t*)::foo; vlc_object_t = vlc_object_t]’:
include/vlc_objects.h:83:18: error: cannot convert ‘Open(vlc_object_t*)::foo::obj*’ to ‘vlc_object_t*’ in return
83 | { return &d->obj; }
| ~~~^~~
| |
| Open(vlc_object_t*)::foo::obj*
- - - - -
3 changed files:
- include/vlc_objects.h
- modules/gui/qt/qt.hpp
- src/player/player.h
Changes:
=====================================
include/vlc_objects.h
=====================================
@@ -72,42 +72,15 @@ struct vlc_object_t
struct vlc_object_marker *: (x), \
default: (&((x)->obj)) \
)
-# define vlc_object_cast(t)
#else
static inline vlc_object_t *VLC_OBJECT(vlc_object_t *o)
-{
- return o;
-}
+ { return o; }
-# define vlc_object_cast(t) \
-struct t; \
-static inline struct vlc_object_t *VLC_OBJECT(struct t *d) \
-{ \
- return (struct vlc_object_t *)d; \
-}
+template<typename T>
+static inline vlc_object_t *VLC_OBJECT(T *d)
+ { return &d->obj; }
#endif
-vlc_object_cast(libvlc_int_t)
-vlc_object_cast(intf_thread_t)
-vlc_object_cast(stream_t)
-vlc_object_cast(stream_directory_t)
-vlc_object_cast(stream_extractor_t)
-vlc_object_cast(decoder_t)
-vlc_object_cast(filter_t)
-vlc_object_cast(audio_output)
-vlc_object_cast(vout_thread_t)
-vlc_object_cast(vout_display_t)
-vlc_object_cast(vout_window_t)
-vlc_object_cast(sout_stream_t)
-vlc_object_cast(sout_access_out_t)
-vlc_object_cast(extensions_manager_t)
-vlc_object_cast(fingerprinter_thread_t)
-vlc_object_cast(demux_meta_t)
-vlc_object_cast(xml_t)
-vlc_object_cast(services_discovery_t)
-vlc_object_cast(vlc_renderer_discovery_t)
-vlc_object_cast(vlc_medialibrary_module_t)
-
/* The root object */
struct libvlc_int_t
{
=====================================
modules/gui/qt/qt.hpp
=====================================
@@ -62,6 +62,7 @@ enum{
extern "C" {
typedef struct intf_dialog_args_t intf_dialog_args_t;
typedef struct vlc_playlist vlc_playlist_t;
+typedef struct intf_thread_t intf_thread_t;
}
namespace vlc {
@@ -110,8 +111,6 @@ struct qt_intf_t
bool isShuttingDown;
};
-vlc_object_cast(qt_intf_t)
-
/**
* This class may be used for scope-bound locking/unlocking
* of a player_t*. As hinted, the player is locked when
=====================================
src/player/player.h
=====================================
@@ -283,8 +283,6 @@ struct vlc_player_t
struct vlc_player_timer timer;
};
-vlc_object_cast(vlc_player_t);
-
#ifndef NDEBUG
/*
* Assert that the player mutex is locked.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/58202004426ce9ac2d8e32ede722a3353a5cbad1...3a526cb35e8ce5494597bbd3d0be2804b8ddbcbd
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/58202004426ce9ac2d8e32ede722a3353a5cbad1...3a526cb35e8ce5494597bbd3d0be2804b8ddbcbd
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list