[vlc-commits] qt: action_manager: Support multiple renderers
Hugo Beauzée-Luyssen
git at videolan.org
Tue May 16 17:41:39 CEST 2017
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue May 16 15:06:53 2017 +0200| [fe77ddf757417a0c6d7910d51fad8fe173924fea] | committer: Hugo Beauzée-Luyssen
qt: action_manager: Support multiple renderers
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fe77ddf757417a0c6d7910d51fad8fe173924fea
---
modules/gui/qt/actions_manager.cpp | 34 ++++++++++++----------------------
modules/gui/qt/actions_manager.hpp | 3 ++-
2 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/modules/gui/qt/actions_manager.cpp b/modules/gui/qt/actions_manager.cpp
index f81d9ec7d8..bff6af8f6d 100644
--- a/modules/gui/qt/actions_manager.cpp
+++ b/modules/gui/qt/actions_manager.cpp
@@ -40,12 +40,11 @@
ActionsManager::ActionsManager( intf_thread_t * _p_i )
: p_intf( _p_i )
- , p_rd( NULL )
{ }
ActionsManager::~ActionsManager()
{
- if ( p_rd != NULL )
+ foreach ( vlc_renderer_discovery_t* p_rd, m_rds )
vlc_rd_release( p_rd );
}
@@ -283,7 +282,7 @@ void ActionsManager::renderer_event_item_removed(
void ActionsManager::ScanRendererAction(bool checked)
{
- if (checked == (p_rd != NULL))
+ if (checked == !m_rds.empty())
return; /* nothing changed */
if (checked)
@@ -327,35 +326,26 @@ void ActionsManager::ScanRendererAction(bool checked)
char **ppsz_name = ppsz_names, **ppsz_longname = ppsz_longnames;
for( ; *ppsz_name; ppsz_name++, ppsz_longname++ )
{
- /* TODO launch all discovery services for renderers */
msg_Dbg( p_intf, "starting renderer discovery service %s", *ppsz_longname );
- if ( p_rd == NULL )
+ vlc_renderer_discovery_t* p_rd = vlc_rd_new( VLC_OBJECT(p_intf), *ppsz_name, &owner );
+ if( !p_rd )
+ msg_Err( p_intf, "Could not start renderer discovery services" );
+ else
{
- p_rd = vlc_rd_new( VLC_OBJECT(p_intf), *ppsz_name, &owner );
- if( !p_rd )
- msg_Err( p_intf, "Could not start renderer discovery services" );
+ if ( vlc_rd_start( p_rd ) == VLC_SUCCESS )
+ m_rds.push_back( p_rd );
+ else
+ vlc_rd_release( p_rd );
}
- break;
}
free( ppsz_names );
free( ppsz_longnames );
-
- if ( p_rd != NULL )
- {
- if( vlc_rd_start( p_rd ) != VLC_SUCCESS )
- {
- vlc_rd_release( p_rd );
- p_rd = NULL;
- }
- }
}
else
{
- if ( p_rd != NULL )
- {
+ foreach ( vlc_renderer_discovery_t* p_rd, m_rds )
vlc_rd_release( p_rd );
- p_rd = NULL;
- }
+ m_rds.clear();
}
}
diff --git a/modules/gui/qt/actions_manager.hpp b/modules/gui/qt/actions_manager.hpp
index 04a299bbff..1f11c8d062 100644
--- a/modules/gui/qt/actions_manager.hpp
+++ b/modules/gui/qt/actions_manager.hpp
@@ -30,6 +30,7 @@
#include "qt.hpp"
#include "util/singleton.hpp"
+#include <QVector>
#include <QObject>
class QAction;
@@ -74,7 +75,7 @@ private:
virtual ~ActionsManager();
intf_thread_t* const p_intf;
- vlc_renderer_discovery_t *p_rd;
+ QVector<vlc_renderer_discovery_t*> m_rds;
static void renderer_event_item_added( vlc_renderer_discovery_t *,
vlc_renderer_item_t * );
More information about the vlc-commits
mailing list