[vlc-devel] [PATCH 2/3] snapshot: always use the picture format

Thomas Guillem thomas at gllm.fr
Mon Jun 5 16:22:05 CEST 2017


From: Steve Lhomme <robux4 at videolabs.io>

vd->source may have a different chroma and so we would copy pixels using
the front format.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>
---
 src/video_output/snapshot.c     | 6 +-----
 src/video_output/snapshot.h     | 4 +---
 src/video_output/video_output.c | 2 +-
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
index ceade008cc..3f48541f56 100644
--- a/src/video_output/snapshot.c
+++ b/src/video_output/snapshot.c
@@ -111,15 +111,11 @@ bool vout_snapshot_IsRequested(vout_snapshot_t *snap)
     return has_request;
 }
 void vout_snapshot_Set(vout_snapshot_t *snap,
-                       const video_format_t *fmt,
                        const picture_t *picture)
 {
-    if (!fmt)
-        fmt = &picture->format;
-
     vlc_mutex_lock(&snap->lock);
     while (snap->request_count > 0) {
-        picture_t *dup = picture_NewFromFormat(fmt);
+        picture_t *dup = picture_NewFromFormat(&picture->format);
         if (!dup)
             break;
 
diff --git a/src/video_output/snapshot.h b/src/video_output/snapshot.h
index b27a7212e9..1b361beec2 100644
--- a/src/video_output/snapshot.h
+++ b/src/video_output/snapshot.h
@@ -54,10 +54,8 @@ bool vout_snapshot_IsRequested(vout_snapshot_t *);
  * It set the picture used to create the snapshots.
  *
  * The given picture is only copied and not released.
- * If p_fmt is non NULL it will override the format of the p_picture (mainly
- * used because of aspect/crop problems).
  */
-void vout_snapshot_Set(vout_snapshot_t *, const video_format_t *, const picture_t *);
+void vout_snapshot_Set(vout_snapshot_t *, const picture_t *);
 
 /**
  * This function will return the directory used for snapshots
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 1eae08dc0e..bbd25b631e 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1087,7 +1087,7 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
      * Take a snapshot if requested
      */
     if (do_snapshot)
-        vout_snapshot_Set(&vout->p->snapshot, &vd->source, todisplay);
+        vout_snapshot_Set(&vout->p->snapshot, todisplay);
 
     /* Render the direct buffer */
     vout_UpdateDisplaySourceProperties(vd, &todisplay->format);
-- 
2.11.0



More information about the vlc-devel mailing list