diff --git a/modules/gui/qt/network/networksourcelistener.cpp b/modules/gui/qt/network/networksourcelistener.cpp index e4a386fe1c8ce5f15ce62923554893f05c693d40..bc0d2b5633fd415efb1eb4960b05cc6140efd8d4 100644 --- a/modules/gui/qt/network/networksourcelistener.cpp +++ b/modules/gui/qt/network/networksourcelistener.cpp @@ -1,50 +1,52 @@ #include "networksourcelistener.hpp" -NetworkSourceListener::NetworkSourceListener(MediaSourcePtr s, SourceListenerCb* m) - : source( s ) - , listener( nullptr, [s]( vlc_media_tree_listener_id* l ) { - vlc_media_tree_RemoveListener( s->tree, l ); - } ) - , cb( m ) -{ - static const vlc_media_tree_callbacks cbs { - &NetworkSourceListener::onItemCleared, - &NetworkSourceListener::onItemAdded, - &NetworkSourceListener::onItemRemoved, - &NetworkSourceListener::onItemPreparseEnded - }; - auto l = vlc_media_tree_AddListener( s->tree, &cbs, this, true ); - if ( l == nullptr ) - return; - listener.reset( l ); -} - -void NetworkSourceListener::onItemCleared( vlc_media_tree_t*, input_item_node_t* node, - void* userdata) +static void onItemCleared(vlc_media_tree_t*, input_item_node_t *node, + void* userdata) { auto* self = static_cast<NetworkSourceListener*>( userdata ); self->cb->onItemCleared( self->source, node ); } -void NetworkSourceListener::onItemAdded( vlc_media_tree_t *, input_item_node_t * parent, - input_item_node_t *const children[], size_t count, - void *userdata ) +static void onItemAdded(vlc_media_tree_t *, input_item_node_t *parent, + input_item_node_t *const children[], size_t count, + void *userdata) { auto* self = static_cast<NetworkSourceListener*>( userdata ); auto source = self->source; self->cb->onItemAdded( self->source, parent, children, count ); } -void NetworkSourceListener::onItemRemoved( vlc_media_tree_t *, input_item_node_t * node, - input_item_node_t *const children[], size_t count, - void *userdata ) +static void onItemRemoved(vlc_media_tree_t *, input_item_node_t *node, + input_item_node_t *const children[], size_t count, + void *userdata) { auto* self = static_cast<NetworkSourceListener*>( userdata ); self->cb->onItemRemoved( self->source, node, children, count ); } -void NetworkSourceListener::onItemPreparseEnded(vlc_media_tree_t *, input_item_node_t * node, enum input_item_preparse_status status, void *userdata) +static void onItemPreparseEnded(vlc_media_tree_t *, input_item_node_t * node, + enum input_item_preparse_status status, + void *userdata) { auto* self = static_cast<NetworkSourceListener*>( userdata ); self->cb->onItemPreparseEnded( self->source, node, status ); } + +NetworkSourceListener::NetworkSourceListener(MediaSourcePtr s, SourceListenerCb* m) + : source( s ) + , listener( nullptr, [s]( vlc_media_tree_listener_id* l ) { + vlc_media_tree_RemoveListener( s->tree, l ); + } ) + , cb( m ) +{ + static const vlc_media_tree_callbacks cbs { + &onItemCleared, + &onItemAdded, + &onItemRemoved, + &onItemPreparseEnded + }; + auto l = vlc_media_tree_AddListener( s->tree, &cbs, this, true ); + if ( l == nullptr ) + return; + listener.reset( l ); +} diff --git a/modules/gui/qt/network/networksourcelistener.hpp b/modules/gui/qt/network/networksourcelistener.hpp index 54d72766bbd1e77e40ac5e75abad1b0076748f0c..0b49b37c72a9b24261f1b30ae7098d674f1e01cf 100644 --- a/modules/gui/qt/network/networksourcelistener.hpp +++ b/modules/gui/qt/network/networksourcelistener.hpp @@ -58,19 +58,6 @@ public: NetworkSourceListener( const NetworkSourceListener& ) = delete; NetworkSourceListener& operator=( const NetworkSourceListener& ) = delete; - static void onItemCleared( vlc_media_tree_t* tree, input_item_node_t* node, - void* userdata ); - static void onItemAdded( vlc_media_tree_t *tree, input_item_node_t *node, - input_item_node_t *const children[], size_t count, - void *userdata ); - static void onItemRemoved( vlc_media_tree_t *tree, input_item_node_t *node, - input_item_node_t *const children[], size_t count, - void *userdata ); - - static void onItemPreparseEnded( vlc_media_tree_t *tree, input_item_node_t *node, - enum input_item_preparse_status status, - void *userdata ); - MediaSourcePtr source; ListenerPtr listener = nullptr; SourceListenerCb *cb = nullptr;