[vlc-commits] qt: add get-media wrapper

Rémi Denis-Courmont git at videolan.org
Sun Jul 23 18:58:16 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 23 19:17:13 2017 +0300| [fc802f004ae4d4949756a2284acbd61b17bb6439] | committer: Rémi Denis-Courmont

qt: add get-media wrapper

(leaks are left untouched)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fc802f004ae4d4949756a2284acbd61b17bb6439
---

 modules/gui/qt/dialogs/vlm.cpp | 11 +++++++++--
 modules/gui/qt/dialogs/vlm.hpp |  7 ++-----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt/dialogs/vlm.cpp b/modules/gui/qt/dialogs/vlm.cpp
index e7787b07fa..8e21a02e9a 100644
--- a/modules/gui/qt/dialogs/vlm.cpp
+++ b/modules/gui/qt/dialogs/vlm.cpp
@@ -284,13 +284,12 @@ void VLMDialog::mediasPopulator()
 {
     if( p_vlm )
     {
-        int i_nMedias;
         QString typeShortName;
         int vlmItemCount;
         vlm_media_t **pp_dsc;
 
         /* Get medias information and numbers */
-        vlm_Control( p_vlm, VLM_GET_MEDIAS, &pp_dsc, &i_nMedias );
+        int i_nMedias = VLMWrapper::GetMedias( pp_dsc );
 
         /* Loop on all of them */
         for( int i = 0; i < i_nMedias; i++ )
@@ -660,6 +659,14 @@ VLMWrapper::~VLMWrapper()
     p_vlm = NULL;
 }
 
+int VLMWrapper::GetMedias( vlm_media_t **& array )
+{
+    int count;
+
+    vlm_Control( p_vlm, VLM_GET_MEDIAS, &array, &count );
+    return count;
+}
+
 void VLMWrapper::AddBroadcast( const QString& name, const QString& input,
                                const QString& inputOptions, const QString& output,
                                bool b_enabled, bool b_loop  )
diff --git a/modules/gui/qt/dialogs/vlm.hpp b/modules/gui/qt/dialogs/vlm.hpp
index 2f31de2a40..602eb99c5f 100644
--- a/modules/gui/qt/dialogs/vlm.hpp
+++ b/modules/gui/qt/dialogs/vlm.hpp
@@ -114,6 +114,8 @@ public:
     VLMWrapper( vlm_t * );
     virtual ~VLMWrapper();
 
+    static int GetMedias( vlm_media_t **& );
+
     static void AddBroadcast( const QString&, const QString&,
                               const QString&, const QString&,
                               bool b_enabled = true, bool b_loop = false );
@@ -143,11 +145,6 @@ public:
     static void SaveConfig( const QString& );
     static bool LoadConfig( const QString& );
 
-    /* We don't have yet the accessors in the core, so the following is commented */
-    //unsigned int NbMedia() { if( p_vlm ) return p_vlm->i_media; return 0; }
-   /* vlm_media_t *GetMedia( int i )
-    { if( p_vlm ) return p_vlm->media[i]; return NULL; }*/
-
 private:
     static vlm_t *p_vlm;
 };



More information about the vlc-commits mailing list