]> git.sesse.net Git - vlc/blobdiff - modules/video_output/snapshot.c
Used VLC_CODEC_* and vlc_fourcc_GetCodec when suitable.
[vlc] / modules / video_output / snapshot.c
index 09886bf089f278ec3caa9ed2d98835b6eb7f0c32..49bf815c372a191da54e66b1452a711546a5498f 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 */
@@ -158,8 +168,9 @@ static int Init( vout_thread_t *p_vout )
             msg_Err( p_vout, "snapshot-chroma should be 4 characters long" );
             return VLC_EGENERIC;
         }
-        i_chroma = VLC_FOURCC( psz_chroma[0], psz_chroma[1],
-                               psz_chroma[2], psz_chroma[3] );
+        i_chroma = vlc_fourcc_GetCodec( VIDEO_ES,
+                                        VLC_FOURCC( psz_chroma[0], psz_chroma[1],
+                                                    psz_chroma[2], psz_chroma[3] ) );
         free( psz_chroma );
     }
     else
@@ -182,25 +193,25 @@ static int Init( vout_thread_t *p_vout )
     /* Define the bitmasks */
     switch( i_chroma )
     {
-      case VLC_FOURCC( 'R','V','1','5' ):
+      case VLC_CODEC_RGB15;
         p_vout->output.i_rmask = 0x001f;
         p_vout->output.i_gmask = 0x03e0;
         p_vout->output.i_bmask = 0x7c00;
         break;
 
-      case VLC_FOURCC( 'R','V','1','6' ):
+      case VLC_CODEC_RGB16;
         p_vout->output.i_rmask = 0x001f;
         p_vout->output.i_gmask = 0x07e0;
         p_vout->output.i_bmask = 0xf800;
         break;
 
-      case VLC_FOURCC( 'R','V','2','4' ):
+      case VLC_CODEC_RGB24;
         p_vout->output.i_rmask = 0xff0000;
         p_vout->output.i_gmask = 0x00ff00;
         p_vout->output.i_bmask = 0x0000ff;
         break;
 
-      case VLC_FOURCC( 'R','V','3','2' ):
+      case VLC_CODEC_RGB32:
         p_vout->output.i_rmask = 0xff0000;
         p_vout->output.i_gmask = 0x00ff00;
         p_vout->output.i_bmask = 0x0000ff;
@@ -273,7 +284,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 );