[vlc-commits] vout: factor format check

Rémi Denis-Courmont git at videolan.org
Wed Jan 23 17:04:24 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jan 21 21:52:14 2019 +0200| [efc7ce594f4ef64cb2c9872cc39b6ec53e9843e8] | committer: Rémi Denis-Courmont

vout: factor format check

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

 src/video_output/video_output.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index f95a6af2dc..d17ed4a75d 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -112,9 +112,6 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
                                  const vout_configuration_t *cfg,
                                  input_thread_t *input)
 {
-    if (!VoutCheckFormat(cfg->fmt))
-        return NULL;
-
     /* Allocate descriptor */
     vout_thread_t *vout = vlc_custom_create(object,
                                             sizeof(*vout) + sizeof(*vout->p),
@@ -229,6 +226,12 @@ vout_thread_t *vout_Request(vlc_object_t *object,
 
     assert(cfg->fmt != NULL);
 
+    if (!VoutCheckFormat(cfg->fmt)) {
+        if (vout != NULL)
+            vout_Close(vout);
+        return NULL;
+    }
+
     /* If a vout is provided, try reusing it */
     if (vout) {
         if (vout->p->input == NULL) {
@@ -1512,11 +1515,6 @@ static int ThreadReinit(vout_thread_t *vout,
     vout->p->pause.is_on = false;
     vout->p->pause.date  = VLC_TICK_INVALID;
 
-    if (!VoutCheckFormat(cfg->fmt)) {
-        ThreadStop(vout, NULL);
-        return VLC_EGENERIC;
-    }
-
     VoutFixFormat(&original, cfg->fmt);
 
     /* We ignore ar changes at this point, they are dynamically supported.



More information about the vlc-commits mailing list