[vlc-commits] display: convert picture in vout_display_Prepare()

Rémi Denis-Courmont git at videolan.org
Sat Jan 12 14:43:50 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jan  2 14:59:31 2019 +0200| [353ec59c3f7864b3cb5e4dc166eebea6f8924c27] | committer: Rémi Denis-Courmont

display: convert picture in vout_display_Prepare()

This allows non-core vout display usage without assuming DR.

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

 include/vlc_vout_display.h      | 27 +++++++++++++++++++++------
 src/libvlccore.sym              |  1 +
 src/video_output/display.c      | 19 ++++++++++++++-----
 src/video_output/video_output.c |  4 ++--
 4 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 9c343fbcb6..04dc010e3b 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -312,13 +312,28 @@ VLC_API void vout_display_Delete(vout_display_t *);
 
 /**
  * Prepares a picture for display.
+ *
+ * This renders a picture for subsequent display, with vout_display_Display().
+ *
+ * \note A reference to the input picture is consumed by the function, which
+ * returns a reference to an output picture for display. The input and output
+ * picture may or may not be equal depending on the underlying display setup.
+ *
+ * \bug Currently, only one picture can be prepared at a time. It must be
+ * displayed with vout_display_Display() before any picture is prepared or
+ * before the display is destroyd with vout_display_Delete().
+ *
+ \ bug Rendering subpictures is not supported with this function yet.
+ * \c subpic must be @c NULL .
+ *
+ * \param vd display to prepare the picture for
+ * \param picture picure to be prepared
+ * \param subpic reserved, must be NULL
+ * \param date intended time to show the picture
+ * \return The prepared picture is returned, NULL on error.
  */
-static inline void vout_display_Prepare(vout_display_t *vd, picture_t *picture,
-                                        subpicture_t *subpic, vlc_tick_t date)
-{
-    if (vd->prepare != NULL)
-        vd->prepare(vd, picture, subpic, date);
-}
+VLC_API picture_t *vout_display_Prepare(vout_display_t *vd, picture_t *picture,
+                                        subpicture_t *subpic, vlc_tick_t date);
 
 /**
  * Displays a picture.
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 87a656f62d..4551406515 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -752,6 +752,7 @@ vout_display_SendEventPicturesInvalid
 vout_display_SendMouseMovedDisplayCoordinates
 vout_display_New
 vout_display_Delete
+vout_display_Prepare
 xml_Create
 text_style_Copy
 text_style_Create
diff --git a/src/video_output/display.c b/src/video_output/display.c
index d47aa826eb..56c16c1398 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -453,6 +453,17 @@ picture_t *vout_FilterDisplay(vout_display_t *vd, picture_t *picture)
     return picture;
 }
 
+picture_t *vout_display_Prepare(vout_display_t *vd, picture_t *picture,
+                                subpicture_t *subpic, vlc_tick_t date)
+{
+    assert(subpic == NULL); /* TODO */
+    picture = vout_FilterDisplay(vd, picture);
+
+    if (picture != NULL && vd->prepare != NULL)
+        vd->prepare(vd, picture, subpic, date);
+    return picture;
+}
+
 void vout_FilterFlush(vout_display_t *vd)
 {
     vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
@@ -860,11 +871,9 @@ static void SplitterPrepare(vout_display_t *vd,
         return;
     }
 
-    for (int i = 0; i < sys->count; i++) {
-        sys->picture[i] = vout_FilterDisplay(sys->display[i], sys->picture[i]);
-        if (sys->picture[i])
-            vout_display_Prepare(sys->display[i], sys->picture[i], NULL, date);
-    }
+    for (int i = 0; i < sys->count; i++)
+        sys->picture[i] = vout_display_Prepare(sys->display[i],
+                                               sys->picture[i], NULL, date);
 }
 static void SplitterDisplay(vout_display_t *vd, picture_t *picture)
 {
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 41daa5cf51..314e06004f 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1154,8 +1154,8 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
     if (!do_dr_spu && sys->spu_blend != NULL && subpic != NULL)
         picture_BlendSubpicture(todisplay, sys->spu_blend, subpic);
 
-    vout_display_Prepare(vd, todisplay, do_dr_spu ? subpic : NULL,
-                         todisplay->date);
+    if (vd->prepare != NULL)
+        vd->prepare(vd, todisplay, do_dr_spu ? subpic : NULL, todisplay->date);
 
     vout_chrono_Stop(&sys->render);
 #if 0



More information about the vlc-commits mailing list