[vlc-commits] vout: vout_Request() return success/error status

Rémi Denis-Courmont git at videolan.org
Sun Feb 24 14:57:52 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 24 15:50:19 2019 +0200| [b0fa967d270ec38073d20ec58d9cac800bed8a1d] | committer: Rémi Denis-Courmont

vout: vout_Request() return success/error status

...rather than a video output thread pointer.

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

 src/audio_output/filters.c       |  2 +-
 src/input/resource.c             |  4 ++--
 src/video_output/video_output.c  | 11 +++++------
 src/video_output/vout_internal.h |  6 +++---
 4 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 0dc1fe8864..b62cf93f04 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -393,7 +393,7 @@ vout_thread_t *aout_filter_GetVout(filter_t *filter, const video_format_t *fmt)
 
     video_format_AdjustColorSpace(&adj_fmt);
 
-    if (vout_Request(&cfg, NULL) == NULL) {
+    if (vout_Request(&cfg, NULL)) {
         vout_Close(vout);
         vout = NULL;
     }
diff --git a/src/input/resource.c b/src/input/resource.c
index 0127a853d2..51455e66f8 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -399,8 +399,8 @@ vout_thread_t *input_resource_GetVout(input_resource_t *p_resource,
         vlc_mutex_unlock(&p_resource->lock_hold);
     }
 
-    vout = vout_Request(cfg, p_resource->p_input);
-    if (vout != NULL) {
+    if (vout_Request(cfg, p_resource->p_input) == 0) {
+        vout =  cfg->vout;
         DisplayVoutTitle(p_resource, vout);
 
         /* Send original viewpoint to the input in order to update other ESes */
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 68553773e1..bb7f2b6417 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1731,8 +1731,7 @@ vout_thread_t *vout_Create(vlc_object_t *object)
     return vout;
 }
 
-vout_thread_t *vout_Request(const vout_configuration_t *cfg,
-                            input_thread_t *input)
+int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
 {
     vout_thread_t *vout = cfg->vout;
 
@@ -1740,7 +1739,7 @@ vout_thread_t *vout_Request(const vout_configuration_t *cfg,
     assert(cfg->fmt != NULL);
 
     if (!VoutCheckFormat(cfg->fmt))
-        return NULL;
+        return -1;
 
     video_format_t original;
     VoutFixFormat(&original, cfg->fmt);
@@ -1752,7 +1751,7 @@ vout_thread_t *vout_Request(const vout_configuration_t *cfg,
         if (cfg->dpb_size <= vout->p->dpb_size) {
             video_format_Clean(&original);
             /* It is assumed that the SPU input matches input already. */
-            return vout;
+            return 0;
         }
         msg_Warn(vout, "DPB need to be increased");
     }
@@ -1800,11 +1799,11 @@ vout_thread_t *vout_Request(const vout_configuration_t *cfg,
 error:
         msg_Err(vout, "video output creation failed");
         video_format_Clean(&sys->original);
-        return NULL;
+        return -1;
     }
 
     if (input != NULL)
         spu_Attach(vout->p->spu, input);
     vout_IntfReinit(vout);
-    return vout;
+    return 0;
 }
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 8b1f7231a9..f0506e69a1 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -193,10 +193,10 @@ vout_thread_t *vout_Create(vlc_object_t *obj) VLC_USED;
  *
  * \param cfg the video configuration requested.
  * \param input used to get attachments for spu filters
- * \return a vout
+ * \retval 0 on success
+ * \retval -1 on error
  */
-vout_thread_t * vout_Request(const vout_configuration_t *cfg,
-                             input_thread_t *input);
+int vout_Request(const vout_configuration_t *cfg, input_thread_t *input);
 
 /**
  * Disables a vout.



More information about the vlc-commits mailing list