]> git.sesse.net Git - vlc/commitdiff
added in libvlc:
authorFilippo Carone <littlejohn@videolan.org>
Fri, 2 Jun 2006 11:27:30 +0000 (11:27 +0000)
committerFilippo Carone <littlejohn@videolan.org>
Fri, 2 Jun 2006 11:27:30 +0000 (11:27 +0000)
 - simple screenshot function
 - an helper function to check if the input item is playing

include/vlc/libvlc.h
src/control/input.c
src/control/video.c

index e9919aa66ae8a5c17efd3b1b738db76bb1b9be1a..a7c0dbe6e0403dc2fc3fd5ca4b897fb629427b95 100644 (file)
@@ -268,6 +268,8 @@ void libvlc_input_free( libvlc_input_t * );
 vlc_int64_t libvlc_input_get_length( libvlc_input_t *, libvlc_exception_t *);
 vlc_int64_t libvlc_input_get_time( libvlc_input_t *, libvlc_exception_t *);
 float libvlc_input_get_position( libvlc_input_t *, libvlc_exception_t *);
+vlc_bool_t libvlc_input_will_play( libvlc_input_t *, libvlc_exception_t *);
+    
 
 
 /** @} */
@@ -301,6 +303,10 @@ void libvlc_set_fullscreen( libvlc_input_t *, int, libvlc_exception_t * );
  */
 int libvlc_get_fullscreen( libvlc_input_t *, libvlc_exception_t * );
 
+
+void libvlc_video_take_snapshot( libvlc_input_t *, char *, libvlc_exception_t * );
+    
+
 /** @} */
 
 /**
index 7a27b13a32f1e14f992d2244f920ae7ad8a267f6..ea4e698af2b60e228c4d87063f2170d7610417ac 100644 (file)
@@ -112,3 +112,32 @@ float libvlc_input_get_position( libvlc_input_t *p_input,
 
     return val.f_float;
 }
+
+vlc_bool_t libvlc_input_will_play( libvlc_input_t *p_input,
+                                   libvlc_exception_t *p_exception) 
+{
+    
+    input_thread_t *p_input_thread;
+    vlc_value_t val;
+
+    if( !p_input )
+    {
+        libvlc_exception_raise( p_exception, "Input is NULL" );
+        return VLC_FALSE;
+    }
+
+    p_input_thread = (input_thread_t*)vlc_object_get(
+                            p_input->p_instance->p_vlc,
+                            p_input->i_input_id );
+
+    if( !p_input_thread )
+    {
+        libvlc_exception_raise( p_exception, "Input does not exist" );
+        return VLC_FALSE;
+    }
+
+    if ( !p_input_thread->b_die && !p_input_thread->b_dead )
+        return VLC_TRUE;
+
+    return VLC_FALSE;
+}
index 9a1a7c9c5868320d66755bdc68965700ba77bb77..4c924a3053d8082f0a167e225f5487fff1ecfd21 100644 (file)
@@ -123,3 +123,38 @@ void libvlc_toggle_fullscreen( libvlc_input_t *p_input,
         libvlc_exception_raise( p_e,
                         "Unexpected error while setting fullscreen value" );
 }
+
+void
+libvlc_video_take_snapshot( libvlc_input_t *p_input, char *filepath,
+                       libvlc_exception_t *p_e )
+{
+    vout_thread_t *p_vout = GetVout( p_input, p_e );
+    input_thread_t *p_input_thread;
+    
+    char path[256];
+
+    /* GetVout will raise the exception for us */
+    if( !p_vout )
+    {
+        return;
+    }
+
+    p_input_thread = (input_thread_t*)vlc_object_get(
+                                 p_input->p_instance->p_vlc,
+                                 p_input->i_input_id );
+    if( !p_input_thread )
+    {
+        libvlc_exception_raise( p_e, "Input does not exist" );
+        return NULL;
+    }
+   
+    snprintf( path, 255, "%s", filepath );
+    var_SetString( p_vout, "snapshot-path", path );
+    var_SetString( p_vout, "snapshot-format", "png" );
+
+    vout_Control( p_vout, VOUT_SNAPSHOT );
+    vlc_object_release( p_vout );
+
+    return;
+    
+}