]> git.sesse.net Git - vlc/blobdiff - modules/video_output/snapshot.c
X11 common: code factorization
[vlc] / modules / video_output / snapshot.c
index 35b6d6f3ed66b35d544cedd8798ebdb9916a71dd..b5dce2551fd7ae80b7e1207c1bd845dfae986a01 100644 (file)
@@ -77,7 +77,7 @@ static void Display   ( vout_thread_t *, picture_t * );
 
 
 vlc_module_begin ()
-    set_description( N_( "Snapshot module" ) )
+    set_description( N_( "Snapshot output" ) )
     set_shortname( N_("Snapshot") )
 
     set_category( CAT_VIDEO )
@@ -95,6 +95,16 @@ vlc_module_end ()
 /*****************************************************************************
  * vout_sys_t: video output descriptor
  *****************************************************************************/
+typedef struct snapshot_t
+{
+  uint8_t *p_data;   /* Data area */
+
+  int i_width;       /* In pixels */
+  int i_height;      /* In pixels */
+  int i_datasize;    /* In bytes */
+  mtime_t date;      /* Presentation time */
+} snapshot_t;
+
 struct vout_sys_t
 {
     snapshot_t **p_list;    /* List of available snapshots */
@@ -273,7 +283,7 @@ static int Init( vout_thread_t *p_vout )
         p_snapshot->i_height = i_height;
         p_snapshot->i_datasize = i_datasize;
         p_snapshot->date = 0;
-        p_snapshot->p_data = ( char* ) malloc( i_datasize );
+        p_snapshot->p_data = malloc( i_datasize );
         if( p_snapshot->p_data == NULL )
         {
             free( p_snapshot );
@@ -359,19 +369,11 @@ static void Destroy( vlc_object_t *p_this )
 /* Return the position in ms from the start of the movie */
 static mtime_t snapshot_GetMovietime( vout_thread_t *p_vout )
 {
-    input_thread_t* p_input;
-    vlc_value_t val;
-    mtime_t i_result;
-
-    p_input = p_vout->p_sys->p_input;
+    input_thread_t *p_input = p_vout->p_sys->p_input;
     if( !p_input )
         return 0;
 
-    var_Get( p_input, "time", &val );
-
-    i_result = val.i_time - p_input->i_pts_delay;
-
-    return( i_result / 1000 );
+    return var_GetTime( p_input, "time" ) / 1000;
 }
 
 /*****************************************************************************