[vlc-commits] macosx: helpers: add getVouts

Victorien Le Couviour--Tuffet git at videolan.org
Thu Jul 13 11:23:38 CEST 2017


vlc | branch: master | Victorien Le Couviour--Tuffet <victorien.lecouviour.tuffet at gmail.com> | Fri Jun 16 11:16:10 2017 +0200| [64bae949d811dc8da90b1e4258bf2119be33db3a] | committer: Jean-Baptiste Kempf

macosx: helpers: add getVouts

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/macosx/helpers.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/modules/gui/macosx/helpers.h b/modules/gui/macosx/helpers.h
index fefd0e6c19..d58a761b52 100644
--- a/modules/gui/macosx/helpers.h
+++ b/modules/gui/macosx/helpers.h
@@ -44,6 +44,35 @@ static inline vout_thread_t *getVout(void)
     return p_vout;
 }
 
+/**
+ * Returns an array containing all the vouts.
+ *
+ * \return all vouts or nil if none is found
+ */
+static inline NSArray<NSValue *> *getVouts(void)
+{
+    input_thread_t *p_input = getInput();
+    vout_thread_t **pp_vouts;
+    size_t i_num_vouts;
+
+    if (!p_input
+        || input_Control(p_input, INPUT_GET_VOUTS, &pp_vouts, &i_num_vouts)
+        || !i_num_vouts)
+        return nil;
+
+    NSMutableArray<NSValue *> *vouts =
+        [NSMutableArray arrayWithCapacity:i_num_vouts];
+
+    for (size_t i = 0; i < i_num_vouts; ++i)
+    {
+        assert(pp_vouts[i]);
+        [vouts addObject:[NSValue valueWithPointer:pp_vouts[i]]];
+    }
+
+    free(pp_vouts);
+    return vouts;
+}
+
 static inline vout_thread_t *getVoutForActiveWindow(void)
 {
     vout_thread_t *p_vout = nil;



More information about the vlc-commits mailing list