Commit 4b00ff6e authored by Laurent Aimar's avatar Laurent Aimar

Use filter helpers.

parent cfe32971
......@@ -122,9 +122,12 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
int i, i_res = -1;
/* Request output picture */
p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
p_pic_dst = filter_NewPicture( p_filter );
if( !p_pic_dst )
{
picture_Release( p_pic );
return NULL;
}
/* Prepare the AVPictures for the conversion */
for( i = 0; i < p_pic->i_planes; i++ )
......@@ -144,7 +147,8 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
if( i_res == -1 )
{
msg_Err( p_filter, "deinterlacing picture failed" );
p_filter->pf_vout_buffer_del( p_filter, p_pic_dst );
filter_DeletePicture( p_filter, p_pic_dst );
picture_Release( p_pic );
return NULL;
}
......
......@@ -215,10 +215,9 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -162,10 +162,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -215,10 +215,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
/* Request output picture */
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -2106,12 +2106,9 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
picture_t *p_pic_dst;
/* Request output picture */
p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
p_pic_dst = filter_NewPicture( p_filter );
if( p_pic_dst == NULL )
{
msg_Warn( p_filter, "can't get output picture" );
return NULL;
}
return p_pic;
switch( p_vout->p_sys->i_mode )
{
......
......@@ -202,10 +202,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -172,10 +172,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -193,10 +193,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -233,10 +233,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -106,10 +106,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -113,7 +113,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
......
......@@ -819,7 +819,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_pic = p_logo->p_pic;
/* Allocate the subpicture internal data. */
p_spu = p_filter->pf_sub_buffer_new( p_filter );
p_spu = filter_NewSubpicture( p_filter );
if( !p_spu )
{
vlc_mutex_unlock( &p_logo_list->lock );
......
......@@ -276,7 +276,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
if( p_sys->b_need_update == false )
goto out;
p_spu = p_filter->pf_sub_buffer_new( p_filter );
p_spu = filter_NewSubpicture( p_filter );
if( !p_spu )
goto out;
......
......@@ -448,11 +448,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
subpicture_region_t *p_region_prev = NULL;
/* Allocate the subpicture internal data. */
p_spu = p_filter->pf_sub_buffer_new( p_filter );
p_spu = filter_NewSubpicture( p_filter );
if( !p_spu )
{
return NULL;
}
/* Initialize subpicture */
p_spu->i_channel = 0;
......
......@@ -137,10 +137,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -151,7 +151,6 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_inpic )
uint8_t *p_oldpix;
uint8_t *p_oldpix_u;
uint8_t *p_oldpix_v;
uint8_t *p_outpix;
uint32_t *p_buf;
uint32_t *p_buf2;
......@@ -180,22 +179,14 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_inpic )
p_buf = p_sys->p_buf;
p_buf2 = p_sys->p_buf2;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_inpic );
return NULL;
}
p_outpix = p_outpic->p[Y_PLANE].p_pixels;
vlc_memcpy( p_outpic->p[Y_PLANE].p_pixels, p_inpic->p[Y_PLANE].p_pixels,
p_inpic->p[Y_PLANE].i_pitch * p_inpic->p[Y_PLANE].i_visible_lines );
vlc_memcpy( p_outpic->p[U_PLANE].p_pixels, p_inpic->p[U_PLANE].p_pixels,
p_inpic->p[U_PLANE].i_pitch * p_inpic->p[U_PLANE].i_visible_lines );
vlc_memcpy( p_outpic->p[V_PLANE].p_pixels, p_inpic->p[V_PLANE].p_pixels,
p_inpic->p[V_PLANE].i_pitch * p_inpic->p[V_PLANE].i_visible_lines );
vout_CopyPicture( p_filter, p_outpic, p_inpic );
vlc_mutex_lock( &p_filter->p_sys->lock );
/**
......@@ -293,33 +284,36 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_inpic )
* Count final number of shapes
* Draw rectangles (there can be more than 1 moving shape in 1 rectangle)
*/
uint8_t *p_outpix = p_outpic->p[Y_PLANE].p_pixels;
const int i_dst_pitch = p_outpic->p[Y_PLANE].i_pitch;
j = 0;
for( i = 1; i < last; i++ )
{
if( colors[i] == i && color_x_min[i] != -1 )
{
if( ( color_y_max[i] - color_y_min[i] ) * ( color_x_max[i] - color_x_min[i] ) < 16 ) continue;
if( ( color_y_max[i] - color_y_min[i] ) * ( color_x_max[i] - color_x_min[i] ) < 16 )
continue;
j++;
int x, y;
y = color_y_min[i];
for( x = color_x_min[i]; x <= color_x_max[i]; x++ )
{
p_outpix[y*i_src_pitch+x] = 0xff;
p_outpix[y*i_dst_pitch+x] = 0xff;
}
y = color_y_max[i];
for( x = color_x_min[i]; x <= color_x_max[i]; x++ )
{
p_outpix[y*i_src_pitch+x] = 0xff;
p_outpix[y*i_dst_pitch+x] = 0xff;
}
x = color_x_min[i];
for( y = color_y_min[i]; y <= color_y_max[i]; y++ )
{
p_outpix[y*i_src_pitch+x] = 0xff;
p_outpix[y*i_dst_pitch+x] = 0xff;
}
x = color_x_max[i];
for( y = color_y_min[i]; y <= color_y_max[i]; y++ )
{
p_outpix[y*i_src_pitch+x] = 0xff;
p_outpix[y*i_dst_pitch+x] = 0xff;
}
}
}
......@@ -395,10 +389,9 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_inpic )
return p_inpic;
}
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_inpic );
return NULL;
}
......
......@@ -119,7 +119,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
......
......@@ -462,8 +462,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
return NULL; /* we are too early, so wait */
/* Allocate the subpicture internal data. */
p_spu = p_filter->pf_sub_buffer_new( p_filter );
if( !p_spu ) return NULL;
p_spu = filter_NewSubpicture( p_filter );
if( !p_spu )
return NULL;
p_spu->b_ephemer = true;
p_spu->b_fade = true;
......
......@@ -274,10 +274,9 @@ static picture_t *PostprocPict( filter_t *p_filter, picture_t *p_pic )
return p_pic;
}
picture_t *p_outpic = p_filter->pf_vout_buffer_new( p_filter );
picture_t *p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
vlc_mutex_unlock( &p_sys->lock );
return NULL;
......
......@@ -142,10 +142,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -1134,7 +1134,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
}
/* Allocate the subpicture internal data. */
p_spu = p_filter->pf_sub_buffer_new( p_filter );
p_spu = filter_NewSubpicture( p_filter );
if( !p_spu )
{
vlc_mutex_unlock( &p_sys->lock );
......
......@@ -121,10 +121,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -172,10 +172,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......@@ -304,10 +303,9 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic )
return NULL;
}
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -429,7 +429,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
}
}
p_spu = p_filter->pf_sub_buffer_new( p_filter );
p_spu = filter_NewSubpicture( p_filter );
if( !p_spu )
{
vlc_mutex_unlock( &p_sys->lock );
......
......@@ -105,10 +105,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
unsigned int j;
/* Request output picture */
p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
p_pic_dst = filter_NewPicture( p_filter );
if( !p_pic_dst )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -124,10 +124,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
return NULL;
/* Request output picture */
p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
p_pic_dst = filter_NewPicture( p_filter );
if( !p_pic_dst )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -172,10 +172,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_filter ) return NULL;
if( !p_filter->p_sys ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -283,13 +283,17 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
int i_nb_planes = p_pic->i_planes;
/* Check if format properties changed */
if( CheckInit( p_filter ) != VLC_SUCCESS ) return NULL;
if( CheckInit( p_filter ) != VLC_SUCCESS )
{
picture_Release( p_pic );
return NULL;
}
/* Request output picture */
p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
p_pic_dst = filter_NewPicture( p_filter );
if( !p_pic_dst )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
......@@ -122,10 +122,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_pic ) return NULL;
p_outpic = p_filter->pf_vout_buffer_new( p_filter );
p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
picture_Release( p_pic );
return NULL;
}
......
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