]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c
Used a sar for picture_New/Setup.
[vlc] / modules / video_filter / dynamicoverlay / dynamicoverlay_commands.c
index 58c9fcdfaa55bc61f62b84ceb1603f6aff7e70df..766c5c5bb3b173075ce6c03af8f30f386b89075b 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2008 the VideoLAN team
  * $Id$
  *
- * Author: Soren Bog <avacore@videolan.org>
+ * Author: Søren Bøg <avacore@videolan.org>
  *         Jean-Paul Saman <jpsaman@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
 
 overlay_t *OverlayCreate( void )
 {
-    overlay_t *p_ovl = malloc( sizeof( overlay_t ) );
+    overlay_t *p_ovl = calloc( 1, sizeof( overlay_t ) );
     if( p_ovl == NULL )
        return NULL;
-    memset( p_ovl, 0, sizeof( overlay_t ) );
 
     p_ovl->i_x = p_ovl->i_y = 0;
     p_ovl->i_alpha = 0xFF;
     p_ovl->b_active = false;
     video_format_Setup( &p_ovl->format, VLC_FOURCC( '\0','\0','\0','\0') , 0, 0,
-                        VOUT_ASPECT_FACTOR );
+                        1, 1 );
     p_ovl->p_fontstyle = text_style_New();
     p_ovl->data.p_text = NULL;
 
@@ -66,8 +65,7 @@ overlay_t *OverlayCreate( void )
 
 int OverlayDestroy( overlay_t *p_ovl )
 {
-    if( p_ovl->data.p_text != NULL )
-        free( p_ovl->data.p_text );
+    free( p_ovl->data.p_text );
     text_style_Delete( p_ovl->p_fontstyle );
 
     return VLC_SUCCESS;
@@ -444,7 +442,7 @@ static int exec_DataSharedMem( filter_t *p_filter,
         if( (p_params->i_height != 1) || (p_params->i_width < 1) )
         {
             msg_Err( p_filter,
-                     "Invalid width and/or height. when specifing text height "
+                     "Invalid width and/or height. when specifying text height "
                      "must be 1 and width the number of bytes in the string, "
                      "including the null terminator" );
             return VLC_EGENERIC;
@@ -466,7 +464,7 @@ static int exec_DataSharedMem( filter_t *p_filter,
         }
 
         video_format_Setup( &p_ovl->format, VLC_CODEC_TEXT,
-                            0, 0, 0 );
+                            0, 0, 0, 1 );
 
         p_data = shmat( p_params->i_shmid, NULL, SHM_RDONLY );
         if( p_data == NULL )
@@ -491,10 +489,12 @@ static int exec_DataSharedMem( filter_t *p_filter,
 
         video_format_Setup( &p_ovl->format, p_params->fourcc,
                             p_params->i_width, p_params->i_height,
-                            VOUT_ASPECT_FACTOR );
+                            1, 1 );
         if( vout_AllocatePicture( p_filter, p_ovl->data.p_pic,
                                   p_ovl->format.i_chroma, p_params->i_width,
-                                  p_params->i_height, p_ovl->format.i_aspect ) )
+                                  p_params->i_height,
+                                  p_ovl->format.i_aspect * p_params->i_height,
+                                  VOUT_ASPECT_FACTOR     * p_params->i_width ) )
         {
             msg_Err( p_filter, "Unable to allocate picture" );
             free( p_ovl->data.p_pic );
@@ -794,7 +794,7 @@ static int exec_StartAtomic( filter_t *p_filter,
 /*****************************************************************************
  * Command functions
  *****************************************************************************/
-static const commanddesc_t p_commands[] =
+static const commanddesc_static_t p_commands[] =
 {
     {   .psz_command = "DataSharedMem",
         .b_atomic = true,