[vlc-devel] [PATCH 2/2] lib: add libvlc_video_set_snapshot_preview

Mark Lee mark.lee at capricasoftware.co.uk
Thu Feb 19 10:39:30 CET 2015


This API controls whether or not the snapshot preview window is displayed
over the video when taking a snapshot.
---
 NEWS                              |  2 ++
 include/vlc/libvlc_media_player.h | 10 ++++++++++
 lib/libvlc.sym                    |  1 +
 lib/media_player.c                |  4 ++++
 lib/video.c                       |  5 +++++
 5 files changed, 22 insertions(+)

diff --git a/NEWS b/NEWS
index 7b09dcb..b2c715a 100644
--- a/NEWS
+++ b/NEWS
@@ -97,6 +97,8 @@ libVLC:
    identifier (if there is one available)
  * Add libvlc_video_set_osd to control whether or not the OSD (now disabled by default
    for a libVLC application) is enabled
+ * Add libvlc_video_set_snapshot_preview to control whether or not a preview window is
+   displayed when taking a video snapshot
 
 Logging
  * Support for the SystemD Journal
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 25e5b3b..0d35b06 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1214,6 +1214,16 @@ LIBVLC_API
 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
 
 /**
+ * Enable/disable the preview window when taking a snapshot.
+ *
+ * \param p_mi media player
+ * \param enable true to enable the preview; false to disable it
+ * \since LibVLC 3.0.0 or later
+ */
+LIBVLC_API
+void libvlc_video_set_snapshot_preview( libvlc_media_player_t *p_mi, bool enable );
+
+/**
  * Take a snapshot of the current video window.
  *
  * If i_width AND i_height is 0, original size is used.
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 6460ea3..29488f9 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -244,6 +244,7 @@ libvlc_video_set_marquee_string
 libvlc_video_set_mouse_input
 libvlc_video_set_osd
 libvlc_video_set_scale
+libvlc_video_set_snapshot_preview
 libvlc_video_set_spu
 libvlc_video_set_spu_delay
 libvlc_video_set_subtitle_file
diff --git a/lib/media_player.c b/lib/media_player.c
index 09e3d6e..e8b7245 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -582,6 +582,10 @@ libvlc_media_player_new( libvlc_instance_t *instance )
     var_Create (mp, "video-title-position", VLC_VAR_INTEGER);
     var_Create (mp, "video-title-timeout", VLC_VAR_INTEGER);
 
+    /* Snapshot Preview */
+    var_Create (mp, "snapshot-preview", VLC_VAR_BOOL);
+    var_SetBool (mp, "snapshot-preview", true);
+
     /* Equalizer */
     var_Create (mp, "equalizer-preamp", VLC_VAR_FLOAT);
     var_Create (mp, "equalizer-vlcfreqs", VLC_VAR_BOOL);
diff --git a/lib/video.c b/lib/video.c
index 84dd7e70..9cb789c 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -137,6 +137,11 @@ void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on )
     var_SetBool (p_mi, "mouse-events", !!on);
 }
 
+void libvlc_video_set_snapshot_preview( libvlc_media_player_t *p_mi, bool enable )
+{
+    var_SetBool (p_mi, "snapshot-preview", enable);
+}
+
 int
 libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
                             const char *psz_filepath,
-- 
2.1.0




More information about the vlc-devel mailing list