[vlc-devel] [PATCH] lib: add libvlc_video_set_snapshot_options
Mark Lee
mark.lee at capricasoftware.co.uk
Wed Feb 18 16:01:46 CET 2015
This enables the control of whether or not the snapshot preview
window and the snapshot taken on-screen text is displayed in the
video window.
---
NEWS | 2 ++
include/vlc/libvlc_media_player.h | 14 ++++++++++++++
lib/libvlc.sym | 1 +
lib/media_player.c | 4 ++++
lib/video.c | 7 +++++++
src/libvlc-module.c | 6 ++++++
src/video_output/vout_intf.c | 4 +++-
7 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 3b6f5ec..6191067 100644
--- a/NEWS
+++ b/NEWS
@@ -95,6 +95,8 @@ libVLC:
* Add libvlc_media_parse_with_options that uses a flag to specify parse options
* Add libvlc_audio_output_device_get to get the currently selected audio output device
identifier (if there is one available)
+ * Add libvlc_video_set_snapshot_options to control the display of the snapshot preview
+ window and the snapshot taken message in the video window
Logging
* Support for the SystemD Journal
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 3f9441c..ec8ec72 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1232,6 +1232,20 @@ int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
unsigned int i_height );
/**
+ * Set options when taking a snapshot of the current video window.
+ *
+ * \param p_mi media player instance
+ * \param preview if true, show the snapshot preview in the video window
+ * \param message if true, show the snapshot taken message (including the file-
+ * name) in the video window
+ * \return 0 on success, -1 on error
+ * \version LibVLC 3.0.0 or later.
+ */
+LIBVLC_API
+int libvlc_video_set_snapshot_options( libvlc_media_player_t *p_mi,
+ bool preview, bool message );
+
+/**
* Enable or disable deinterlace filter
*
* \param p_mi libvlc media player
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 4fd2378..7b7f546 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -243,6 +243,7 @@ libvlc_video_set_marquee_int
libvlc_video_set_marquee_string
libvlc_video_set_mouse_input
libvlc_video_set_scale
+libvlc_video_set_snapshot_options
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 b41d6f3..6ebad0a 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -580,6 +580,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 */
+ var_Create (mp, "snapshot-preview", VLC_VAR_BOOL);
+ var_Create (mp, "snapshot-message", VLC_VAR_BOOL);
+
/* 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 4abe36e..c8fd6dd 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -165,6 +165,13 @@ libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
return 0;
}
+int libvlc_video_set_snapshot_options( libvlc_media_player_t *p_mi,
+ bool preview, bool message ) {
+ var_SetBool (p_mi, "snapshot-preview", preview);
+ var_SetBool (p_mi, "snapshot-message", message);
+ return 0;
+}
+
int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
unsigned *restrict px, unsigned *restrict py )
{
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 76b1914..bf8b42b 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -396,6 +396,10 @@ static const char *const ppsz_pos_descriptions[] =
#define SNAP_PREVIEW_LONGTEXT N_( \
"Display the snapshot preview in the screen's top-left corner.")
+#define SNAP_MESSAGE_TEXT N_("Display video snapshot filename")
+#define SNAP_MESSAGE_LONGTEXT N_( \
+ "Display the snapshot filename over the video.")
+
#define SNAP_SEQUENTIAL_TEXT N_("Use sequential numbers instead of timestamps")
#define SNAP_SEQUENTIAL_LONGTEXT N_( \
"Use sequential numbers instead of timestamps for snapshot numbering")
@@ -1532,6 +1536,8 @@ vlc_module_begin ()
change_string_list( ppsz_snap_formats, ppsz_snap_formats )
add_bool( "snapshot-preview", true, SNAP_PREVIEW_TEXT,
SNAP_PREVIEW_LONGTEXT, false )
+ add_bool( "snapshot-message", true, SNAP_MESSAGE_TEXT,
+ SNAP_MESSAGE_LONGTEXT, false )
add_bool( "snapshot-sequential", false, SNAP_SEQUENTIAL_TEXT,
SNAP_SEQUENTIAL_LONGTEXT, false )
add_integer( "snapshot-width", -1, SNAP_WIDTH_TEXT,
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index af6d476..17e349e 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -353,7 +353,9 @@ static int VoutSnapshotPip( vout_thread_t *p_vout, picture_t *p_pic )
static void VoutOsdSnapshot( vout_thread_t *p_vout, picture_t *p_pic, const char *psz_filename )
{
msg_Dbg( p_vout, "snapshot taken (%s)", psz_filename );
- vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", psz_filename );
+
+ if ( var_InheritBool( p_vout, "snapshot-message" ) )
+ vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", psz_filename );
if( var_InheritBool( p_vout, "snapshot-preview" ) )
{
--
2.1.0
More information about the vlc-devel
mailing list