* 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;
- vout_InitFormat( &p_ovl->format, VLC_FOURCC( '\0','\0','\0','\0') , 0, 0,
- VOUT_ASPECT_FACTOR );
+ video_format_Setup( &p_ovl->format, VLC_FOURCC( '\0','\0','\0','\0') , 0, 0,
+ 1, 1 );
p_ovl->p_fontstyle = text_style_New();
p_ovl->data.p_text = NULL;
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;
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;
return VLC_ENOMEM;
}
- vout_InitFormat( &p_ovl->format, VLC_CODEC_TEXT,
- 0, 0, 0 );
+ video_format_Setup( &p_ovl->format, VLC_CODEC_TEXT,
+ 0, 0, 0, 1 );
p_data = shmat( p_params->i_shmid, NULL, SHM_RDONLY );
if( p_data == NULL )
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;
- vout_InitFormat( &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 )
"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;
}
{
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;
}
/*****************************************************************************
* Command functions
*****************************************************************************/
-static const commanddesc_t p_commands[] =
+static const commanddesc_static_t p_commands[] =
{
{ .psz_command = "DataSharedMem",
.b_atomic = true,