Commit f4995beb authored by Jean-Paul Saman's avatar Jean-Paul Saman

Rename LoadImage() to blendbench_LoadImage() because of naming conflicts with...

Rename LoadImage() to blendbench_LoadImage() because of naming conflicts with Windows API and small cleanup/malloc checks.
parent 79ee9250
......@@ -117,8 +117,8 @@ struct filter_sys_t
vlc_fourcc_t i_blend_chroma;
};
static int LoadImage( vlc_object_t *p_this, picture_t **pp_pic,
vlc_fourcc_t i_chroma, char *psz_file, const char *psz_name )
static int blendbench_LoadImage( vlc_object_t *p_this, picture_t **pp_pic,
vlc_fourcc_t i_chroma, char *psz_file, const char *psz_name )
{
image_handler_t *p_image;
video_format_t fmt_in, fmt_out;
......@@ -131,7 +131,8 @@ static int LoadImage( vlc_object_t *p_this, picture_t **pp_pic,
*pp_pic = image_ReadUrl( p_image, psz_file, &fmt_in, &fmt_out );
image_HandlerDelete( p_image );
if( *pp_pic == NULL ) {
if( *pp_pic == NULL )
{
msg_Err( p_this, "Unable to load %s image", psz_name );
return VLC_EGENERIC;
}
......@@ -155,10 +156,8 @@ static int Create( vlc_object_t *p_this )
/* Allocate structure */
p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
if( p_filter->p_sys == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
}
p_sys = p_filter->p_sys;
p_sys->b_done = VLC_FALSE;
......@@ -177,7 +176,7 @@ static int Create( vlc_object_t *p_this )
psz_temp = var_CreateGetStringCommand( p_filter, CFG_PREFIX "base-chroma" );
p_sys->i_base_chroma = VLC_FOURCC( psz_temp[0], psz_temp[1],
psz_temp[2], psz_temp[3] );
LoadImage( p_this, &p_sys->p_base_image, p_sys->i_base_chroma,
blendbench_LoadImage( p_this, &p_sys->p_base_image, p_sys->i_base_chroma,
var_CreateGetStringCommand( p_filter, CFG_PREFIX "base-image" ),
"Base" );
......@@ -185,7 +184,7 @@ static int Create( vlc_object_t *p_this )
CFG_PREFIX "blend-chroma" );
p_sys->i_blend_chroma = VLC_FOURCC( psz_temp[0], psz_temp[1],
psz_temp[2], psz_temp[3] );
LoadImage( p_this, &p_sys->p_blend_image, p_sys->i_blend_chroma,
blendbench_LoadImage( p_this, &p_sys->p_blend_image, p_sys->i_blend_chroma,
var_CreateGetStringCommand( p_filter, CFG_PREFIX "blend-image" ),
"Blend" );
......@@ -210,26 +209,35 @@ static void Destroy( vlc_object_t *p_this )
static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
{
filter_sys_t *p_sys = p_filter->p_sys;
filter_t *p_blend;
if( p_sys->b_done )
{
return p_pic;
}
filter_t *p_blend;
p_blend = vlc_object_create( p_filter, VLC_OBJECT_FILTER );
if( !p_blend )
{
p_pic->pf_release( p_pic );
return NULL;
}
vlc_object_attach( p_blend, p_filter );
p_blend->fmt_out.video = p_sys->p_base_image->format;
p_blend->fmt_in.video = p_sys->p_blend_image->format;
p_blend->p_module = module_Need( p_blend, "video blending", 0, 0 );
if( !p_blend->p_module )
{
p_pic->pf_release( p_pic );
vlc_object_detach( p_blend );
vlc_object_release( p_blend );
return NULL;
}
mtime_t time = mdate();
for( int i_iter = 0; i_iter < p_sys->i_loops; ++i_iter )
{
p_blend->pf_video_blend( p_blend, p_sys->p_base_image,
p_sys->p_base_image, p_sys->p_blend_image, 0,
0, p_sys->i_alpha );
p_sys->p_base_image, p_sys->p_blend_image,
0, 0, p_sys->i_alpha );
}
time = mdate() - time;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment