]> git.sesse.net Git - vlc/commitdiff
libvlc_video_take_snapshot: removed kludge and fixed path_sanitize for win32
authorDamien Fouilleul <damienf@videolan.org>
Tue, 10 Apr 2007 18:21:57 +0000 (18:21 +0000)
committerDamien Fouilleul <damienf@videolan.org>
Tue, 10 Apr 2007 18:21:57 +0000 (18:21 +0000)
src/control/video.c
src/text/strings.c

index d05c94fadcb4b498a5423ae3ba688c4a2cbd4f52..962244bdc5ed0832340bfa1b291ec8f48b13a968 100644 (file)
@@ -158,14 +158,19 @@ libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath,
     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;
     }
 
+    if( !psz_filepath )
+    {
+        libvlc_exception_raise( p_e, "filepath is null" );
+        return;
+    }
+
+
     p_input_thread = (input_thread_t*)vlc_object_get(
                                  p_input->p_instance->p_libvlc_int,
                                  p_input->i_input_id );
@@ -175,8 +180,7 @@ libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath,
         return;
     }
 
-    snprintf( path, 255, "%s", psz_filepath );
-    var_SetString( p_vout, "snapshot-path", path );
+    var_SetString( p_vout, "snapshot-path", psz_filepath );
     var_SetString( p_vout, "snapshot-format", "png" );
 
     vout_Control( p_vout, VOUT_SNAPSHOT );
index d49e8bb6e6ec62703e10361d23d0b4f0e6fb875c..8da2e33f2457243b770edce78885c375f11315cf 100644 (file)
@@ -840,6 +840,11 @@ void path_sanitize( char *str )
      * want to.
      */
     char *prev = str - 1;
+#endif
+#ifdef WIN32
+    /* check drive prefix if path is absolute */
+    if( isalpha(*str) && (':' == *(str+1)) )
+        str += 2;
 #endif
     while( *str )
     {