X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fdynamicoverlay%2Fdynamicoverlay_commands.c;h=d119ed3290b221758e8dd12ab447eaf3c44c8a4a;hb=96f479ec390681b428e63e900cbfa4274004ef4e;hp=58c9fcdfaa55bc61f62b84ceb1603f6aff7e70df;hpb=c5c06b64c806052086e5772d64e540a8db7e4a9b;p=vlc diff --git a/modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c b/modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c index 58c9fcdfaa..d119ed3290 100644 --- a/modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c +++ b/modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c @@ -4,7 +4,7 @@ * Copyright (C) 2008 the VideoLAN team * $Id$ * - * Author: Soren Bog + * Author: Søren Bøg * Jean-Paul Saman * * This program is free software; you can redistribute it and/or modify @@ -48,16 +48,15 @@ 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 ) @@ -485,22 +483,13 @@ static int exec_DataSharedMem( filter_t *p_filter, uint8_t *p_data, *p_in; size_t i_neededsize = 0; - p_ovl->data.p_pic = malloc( sizeof( picture_t ) ); + p_ovl->data.p_pic = picture_New( p_params->fourcc, + p_params->i_width, p_params->i_height, + 1, 1 ); if( p_ovl->data.p_pic == NULL ) return VLC_ENOMEM; - video_format_Setup( &p_ovl->format, p_params->fourcc, - p_params->i_width, p_params->i_height, - VOUT_ASPECT_FACTOR ); - 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 ) ) - { - msg_Err( p_filter, "Unable to allocate picture" ); - free( p_ovl->data.p_pic ); - p_ovl->data.p_pic = NULL; - return VLC_ENOMEM; - } + p_ovl->format = p_ovl->data.p_pic->format; for( size_t i_plane = 0; i_plane < (size_t)p_ovl->data.p_pic->i_planes; ++i_plane ) @@ -515,7 +504,6 @@ static int exec_DataSharedMem( filter_t *p_filter, "Insufficient data in shared memory. need %zu, got %zu", i_neededsize, i_size ); picture_Release( p_ovl->data.p_pic ); - free( p_ovl->data.p_pic ); p_ovl->data.p_pic = NULL; return VLC_EGENERIC; } @@ -525,7 +513,6 @@ static int exec_DataSharedMem( filter_t *p_filter, { msg_Err( p_filter, "Unable to attach to shared memory" ); picture_Release( p_ovl->data.p_pic ); - free( p_ovl->data.p_pic ); p_ovl->data.p_pic = NULL; return VLC_ENOMEM; } @@ -794,7 +781,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,