]> git.sesse.net Git - vlc/blobdiff - src/video_output/vout_intf.c
Fixed bug in snapshot format
[vlc] / src / video_output / vout_intf.c
index b764532f8a3b5646bf6c0e6d02191ce319f9e5e5..313ced1137580ef9736b435a28f31f8e2b434742 100644 (file)
@@ -702,35 +702,7 @@ error:
     msg_Err( p_vout, "could not save snapshot" );
     return VLC_EGENERIC;
 }
-/**
- * This function will write a snapshot to memory using a snapshot_t structure
- */
-static void VoutMemorySnapshot( vout_thread_t *p_vout, snapshot_t *p_snapshot,
-                                const block_t *p_image, const video_format_t *p_fmt )
-{
-    VLC_UNUSED( p_vout );
-    /* TODO fix that ugliness */
-
-    vlc_mutex_lock( &p_snapshot->p_mutex );
-    p_snapshot->i_width  = p_image ? p_fmt->i_width : 0;
-    p_snapshot->i_height = p_image ? p_fmt->i_height : 0;
-    p_snapshot->date     = p_image ? p_image->i_pts : 0;
-
-    p_snapshot->i_datasize = 0;
-    p_snapshot->p_data = NULL;
-    if( p_image )
-    {
-        p_snapshot->p_data = malloc( p_image->i_buffer );
-        if( p_snapshot->p_data )
-        {
-            p_snapshot->i_datasize = p_image->i_buffer;
-            memcpy( p_snapshot->p_data, p_image->p_buffer, p_image->i_buffer );
-        }
-    }
 
-    vlc_cond_signal( &p_snapshot->p_condvar );
-    vlc_mutex_unlock( &p_snapshot->p_mutex );
-}
 /**
  * This function will display the name and a PIP of the provided snapshot
  */
@@ -781,8 +753,8 @@ int vout_GetSnapshot( vout_thread_t *p_vout,
     if( pp_image )
     {
         vlc_fourcc_t i_format = VLC_FOURCC('p','n','g',' ');
-        if( psz_format && image_Ext2Fourcc( psz_format ) )
-            i_format = image_Ext2Fourcc( psz_format );
+        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" );
@@ -811,9 +783,6 @@ static void VoutSaveSnapshot( vout_thread_t *p_vout )
     char *psz_format = var_GetNonEmptyString( p_vout, "snapshot-format" );
     char *psz_prefix = var_GetNonEmptyString( p_vout, "snapshot-prefix" );
 
-    void *p_obj;
-    const bool b_embedded = psz_path && sscanf( psz_path, "object:%p", &p_obj ) > 0;
-
     /* */
     picture_t *p_picture;
     block_t *p_image;
@@ -823,43 +792,34 @@ static void VoutSaveSnapshot( vout_thread_t *p_vout )
      * XXX it will cause trouble with low fps video (< 2fps) */
     if( vout_GetSnapshot( p_vout, &p_image, &p_picture, &fmt, psz_format, 500*1000 ) )
     {
-        if( b_embedded )
-            VoutMemorySnapshot( p_vout, p_obj, NULL, NULL );
         p_picture = NULL;
         p_image = NULL;
         goto exit;
     }
 
-    if( b_embedded )
-    {
-        VoutMemorySnapshot( p_vout, p_obj, p_image, &fmt );
-    }
-    else
+    if( !psz_path )
     {
+        psz_path = VoutSnapshotGetDefaultDirectory();
         if( !psz_path )
         {
-            psz_path = VoutSnapshotGetDefaultDirectory();
-            if( !psz_path )
-            {
-                msg_Err( p_vout, "no path specified for snapshots" );
-                goto exit;
-            }
+            msg_Err( p_vout, "no path specified for snapshots" );
+            goto exit;
         }
+    }
 
-        char *psz_filename;
-        if( VoutWriteSnapshot( p_vout, &psz_filename,
-                               p_image,
-                               psz_path, psz_format, psz_prefix ) )
-            goto exit;
+    char *psz_filename;
+    if( VoutWriteSnapshot( p_vout, &psz_filename,
+                           p_image,
+                           psz_path, psz_format, psz_prefix ) )
+        goto exit;
 
-        VoutOsdSnapshot( p_vout, p_picture, psz_filename );
+    VoutOsdSnapshot( p_vout, p_picture, psz_filename );
 
-        /* Generate a media player event  - Right now just trigger a global libvlc var
-            CHECK: Could not find a more local object. The goal is to communicate
-            vout_thread with libvlc_media_player or its input_thread */
-        var_SetString( p_vout->p_libvlc, "vout-snapshottaken", psz_filename );
-        free( psz_filename );
-    }
+    /* Generate a media player event  - Right now just trigger a global libvlc var
+        CHECK: Could not find a more local object. The goal is to communicate
+        vout_thread with libvlc_media_player or its input_thread */
+    var_SetString( p_vout->p_libvlc, "vout-snapshottaken", psz_filename );
+    free( psz_filename );
 
 exit:
     if( p_image )