[vlc-commits] commit: Moved vout_GetSnapshot() to video_output.c (Laurent Aimar )

git at videolan.org git at videolan.org
Mon Oct 25 20:41:53 CEST 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Oct 22 20:51:50 2010 +0200| [cfe5b8d598c744338c3975ff58cd33ba1b013aa5] | committer: Laurent Aimar 

Moved vout_GetSnapshot() to video_output.c

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

 src/video_output/video_output.c |   35 +++++++++++++++++++++++++++++++
 src/video_output/vout_intf.c    |   43 ---------------------------------------
 2 files changed, 35 insertions(+), 43 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 31bd7cb..ddf4308 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -44,6 +44,7 @@
 
 #include <vlc_filter.h>
 #include <vlc_vout_osd.h>
+#include <vlc_image.h>
 
 #include <libvlc.h>
 #include "vout_internal.h"
@@ -440,6 +441,40 @@ void vout_HoldPicture(vout_thread_t *vout, picture_t *picture)
     vlc_mutex_unlock(&vout->p->picture_lock);
 }
 
+/* */
+int vout_GetSnapshot(vout_thread_t *vout,
+                     block_t **image_dst, picture_t **picture_dst,
+                     video_format_t *fmt,
+                     const char *type, mtime_t timeout)
+{
+    picture_t *picture = vout_snapshot_Get(&vout->p->snapshot, timeout);
+    if (!picture) {
+        msg_Err(vout, "Failed to grab a snapshot");
+        return VLC_EGENERIC;
+    }
+
+    if (image_dst) {
+        vlc_fourcc_t codec = VLC_CODEC_PNG;
+        if (type && image_Type2Fourcc(type))
+            codec = image_Type2Fourcc(type);
+
+        const int override_width  = var_GetInteger(vout, "snapshot-width");
+        const int override_height = var_GetInteger(vout, "snapshot-height");
+
+        if (picture_Export(VLC_OBJECT(vout), image_dst, fmt,
+                           picture, codec, override_width, override_height)) {
+            msg_Err(vout, "Failed to convert image for snapshot");
+            picture_Release(picture);
+            return VLC_EGENERIC;
+        }
+    }
+    if (picture_dst)
+        *picture_dst = picture;
+    else
+        picture_Release(picture);
+    return VLC_SUCCESS;
+}
+
 /* vout_Control* are usable by anyone at anytime */
 void vout_ControlChangeFullscreen(vout_thread_t *vout, bool fullscreen)
 {
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index bdcdd92..cd1e6a9 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -32,18 +32,12 @@
 
 #include <stdio.h>
 #include <stdlib.h>                                                /* free() */
-#include <sys/types.h>                                          /* opendir() */
-#include <dirent.h>                                             /* opendir() */
 #include <assert.h>
-#include <time.h>                                           /* strftime */
 
-#include <vlc_interface.h>
 #include <vlc_block.h>
-#include <vlc_playlist.h>
 #include <vlc_modules.h>
 
 #include <vlc_vout.h>
-#include <vlc_image.h>
 #include <vlc_vout_osd.h>
 #include <vlc_strings.h>
 #include <vlc_charset.h>
@@ -396,43 +390,6 @@ static void VoutOsdSnapshot( vout_thread_t *p_vout, picture_t *p_pic, const char
     }
 }
 
-/* */
-int vout_GetSnapshot( vout_thread_t *p_vout,
-                      block_t **pp_image, picture_t **pp_picture,
-                      video_format_t *p_fmt,
-                      const char *psz_format, mtime_t i_timeout )
-{
-    picture_t *p_picture = vout_snapshot_Get( &p_vout->p->snapshot, i_timeout );
-    if( !p_picture )
-    {
-        msg_Err( p_vout, "Failed to grab a snapshot" );
-        return VLC_EGENERIC;
-    }
-
-    if( pp_image )
-    {
-        vlc_fourcc_t i_format = VLC_CODEC_PNG;
-        if( psz_format && image_Type2Fourcc( psz_format ) )
-            i_format = image_Type2Fourcc( psz_format );
-
-        const int i_override_width  = var_GetInteger( p_vout, "snapshot-width" );
-        const int i_override_height = var_GetInteger( p_vout, "snapshot-height" );
-
-        if( picture_Export( VLC_OBJECT(p_vout), pp_image, p_fmt,
-                            p_picture, i_format, i_override_width, i_override_height ) )
-        {
-            msg_Err( p_vout, "Failed to convert image for snapshot" );
-            picture_Release( p_picture );
-            return VLC_EGENERIC;
-        }
-    }
-    if( pp_picture )
-        *pp_picture = p_picture;
-    else
-        picture_Release( p_picture );
-    return VLC_SUCCESS;
-}
-
 /**
  * This function will handle a snapshot request
  */



More information about the vlc-commits mailing list