[vlc-commits] vout: handle error without aborting

Rémi Denis-Courmont git at videolan.org
Wed Jul 26 21:41:01 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 26 22:07:54 2017 +0300| [64044438141d433348c57eb0362dc4c99ce7160a] | committer: Rémi Denis-Courmont

vout: handle error without aborting

Use an empty filter chain to denote direct rendering, and no filter
chain to denote failure, instead of the other way around previously.

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

 src/video_output/display.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index fe2c86e75c..7cc8423691 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -414,8 +414,16 @@ typedef struct {
 static int VoutDisplayCreateRender(vout_display_t *vd)
 {
     vout_display_owner_sys_t *osys = vd->owner.sys;
+    filter_owner_t owner = {
+        .sys = vd,
+        .video = {
+            .buffer_new = VideoBufferNew,
+        },
+    };
 
-    osys->filters = NULL;
+    osys->filters = filter_chain_NewVideo(vd, false, &owner);
+    if (unlikely(osys->filters == NULL))
+        return -1;
 
     video_format_t v_src = vd->source;
     v_src.i_sar_num = 0;
@@ -439,17 +447,6 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
     msg_Dbg(vd, "A filter to adapt decoder %4.4s to display %4.4s is needed",
             (const char *)&v_src.i_chroma, (const char *)&v_dst.i_chroma);
 
-    filter_owner_t owner = {
-        .sys = vd,
-        .video = {
-            .buffer_new = VideoBufferNew,
-        },
-    };
-
-    osys->filters = filter_chain_NewVideo(vd, false, &owner);
-    if (unlikely(osys->filters == NULL))
-        abort(); /* TODO critical */
-
     /* */
     es_format_t src;
     es_format_InitFromVideo(&src, &v_src);
@@ -1085,17 +1082,14 @@ bool vout_IsDisplayFiltered(vout_display_t *vd)
 {
     vout_display_owner_sys_t *osys = vd->owner.sys;
 
-    return osys->filters != NULL;
+    return osys->filters == NULL || !filter_chain_IsEmpty(osys->filters);
 }
 
 picture_t *vout_FilterDisplay(vout_display_t *vd, picture_t *picture)
 {
     vout_display_owner_sys_t *osys = vd->owner.sys;
 
-    if (osys->filters == NULL)
-        return picture;
-
-    if (filter_chain_IsEmpty(osys->filters)) {
+    if (osys->filters == NULL) {
         picture_Release(picture);
         return NULL;
     }



More information about the vlc-commits mailing list