Skip to content

Commit

Permalink
Use picture helpers (Yield,Release,CopyProperties).
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Aimar committed Jul 18, 2008
1 parent af37ba1 commit 5d3c921
Show file tree
Hide file tree
Showing 32 changed files with 80 additions and 132 deletions.
11 changes: 5 additions & 6 deletions modules/video_filter/adjust.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down Expand Up @@ -447,17 +446,17 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic )
{
msg_Warn( p_filter, "Unsupported input chroma (%4s)",
(char*)&(p_pic->format.i_chroma) );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );

picture_Release( p_pic );
return NULL;
}

p_outpic = p_filter->pf_vout_buffer_new( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );

picture_Release( p_pic );
return NULL;
}

Expand Down
6 changes: 3 additions & 3 deletions modules/video_filter/alphamask.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static void Destroy( vlc_object_t *p_this )

vlc_mutex_destroy( &p_sys->mask_lock );
if( p_filter->p_sys->p_mask )
p_filter->p_sys->p_mask->pf_release( p_filter->p_sys->p_mask );
picture_Release( p_filter->p_sys->p_mask );

free( p_filter->p_sys );
}
Expand Down Expand Up @@ -201,7 +201,7 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
memset( &fmt_out, 0, sizeof( video_format_t ) );
fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
if( p_filter->p_sys->p_mask )
p_filter->p_sys->p_mask->pf_release( p_filter->p_sys->p_mask );
picture_Release( p_filter->p_sys->p_mask );
p_image = image_HandlerCreate( p_filter );
p_filter->p_sys->p_mask =
image_ReadUrl( p_image, psz_filename, &fmt_in, &fmt_out );
Expand Down Expand Up @@ -236,7 +236,7 @@ static int MaskCallback( vlc_object_t *p_this, char const *psz_var,
}
else if( p_sys->p_mask )
{
p_sys->p_mask->pf_release( p_sys->p_mask );
picture_Release( p_sys->p_mask );
p_sys->p_mask = NULL;
}
vlc_mutex_unlock( &p_sys->mask_lock );
Expand Down
8 changes: 4 additions & 4 deletions modules/video_filter/blendbench.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ static void Destroy( vlc_object_t *p_this )
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;

p_sys->p_base_image->pf_release( p_sys->p_base_image );
p_sys->p_blend_image->pf_release( p_sys->p_blend_image );
picture_Release( p_sys->p_base_image );
picture_Release( p_sys->p_blend_image );
}

/*****************************************************************************
Expand All @@ -218,7 +218,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_blend = vlc_object_create( p_filter, sizeof(filter_t) );
if( !p_blend )
{
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}
vlc_object_attach( p_blend, p_filter );
Expand All @@ -227,7 +227,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_blend->p_module = module_Need( p_blend, "video blending", 0, 0 );
if( !p_blend->p_module )
{
p_pic->pf_release( p_pic );
picture_Release( p_pic );
vlc_object_detach( p_blend );
vlc_object_release( p_blend );
return NULL;
Expand Down
3 changes: 1 addition & 2 deletions modules/video_filter/colorthres.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down
3 changes: 1 addition & 2 deletions modules/video_filter/croppadd.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down
11 changes: 4 additions & 7 deletions modules/video_filter/deinterlace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2120,7 +2120,7 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
RenderDiscard( p_vout, p_pic_dst, p_pic, 0 );
#endif
msg_Err( p_vout, "discarding lines is not supported yet" );
p_pic_dst->pf_release( p_pic_dst );
picture_Release( p_pic_dst );
return p_pic;
break;

Expand All @@ -2137,7 +2137,7 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
RenderLinear( p_vout, pp_outpic[1], p_pic, 1 );
#endif
msg_Err( p_vout, "doubling the frame rate is not supported yet" );
p_pic_dst->pf_release( p_pic_dst );
picture_Release( p_pic_dst );
return p_pic;
break;

Expand All @@ -2154,13 +2154,10 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
break;
}

p_pic_dst->date = p_pic->date;
p_pic_dst->b_force = p_pic->b_force;
p_pic_dst->i_nb_fields = p_pic->i_nb_fields;
picture_CopyProperties( p_pic_dst, p_pic );
p_pic_dst->b_progressive = true;
p_pic_dst->b_top_field_first = p_pic->b_top_field_first;

p_pic->pf_release( p_pic );
picture_Release( p_pic );
return p_pic_dst;
}

Expand Down
4 changes: 2 additions & 2 deletions modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ static int exec_DataSharedMem( filter_t *p_filter,
msg_Err( p_filter,
"Insufficient data in shared memory. need %zu, got %zu",
i_neededsize, i_size );
p_ovl->data.p_pic->pf_release( p_ovl->data.p_pic );
picture_Release( p_ovl->data.p_pic );
free( p_ovl->data.p_pic );
p_ovl->data.p_pic = NULL;
return VLC_EGENERIC;
Expand All @@ -522,7 +522,7 @@ static int exec_DataSharedMem( filter_t *p_filter,
if( p_data == NULL )
{
msg_Err( p_filter, "Unable to attach to shared memory" );
p_ovl->data.p_pic->pf_release( p_ovl->data.p_pic );
picture_Release( p_ovl->data.p_pic );
free( p_ovl->data.p_pic );
p_ovl->data.p_pic = NULL;
return VLC_ENOMEM;
Expand Down
7 changes: 3 additions & 4 deletions modules/video_filter/erase.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
if( p_filter->p_sys->p_mask )
{
if( p_old_mask )
p_old_mask->pf_release( p_old_mask );
picture_Release( p_old_mask );
}
else if( p_old_mask )
{
Expand Down Expand Up @@ -186,7 +186,7 @@ static void Destroy( vlc_object_t *p_this )
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
if( p_sys->p_mask )
p_sys->p_mask->pf_release( p_sys->p_mask );
picture_Release( p_sys->p_mask );

vlc_mutex_destroy( &p_sys->lock );

Expand All @@ -206,8 +206,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down
6 changes: 2 additions & 4 deletions modules/video_filter/extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down Expand Up @@ -241,8 +240,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
default:
msg_Warn( p_filter, "Unsupported input chroma (%4s)",
(char*)&(p_pic->format.i_chroma) );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down
9 changes: 2 additions & 7 deletions modules/video_filter/filter_picture.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,9 @@ static inline int GetPackedYuvOffsets( vlc_fourcc_t i_chroma,
*****************************************************************************/
static inline picture_t *CopyInfoAndRelease( picture_t *p_outpic, picture_t *p_inpic )
{
p_outpic->date = p_inpic->date;
p_outpic->b_force = p_inpic->b_force;
p_outpic->i_nb_fields = p_inpic->i_nb_fields;
p_outpic->b_progressive = p_inpic->b_progressive;
p_outpic->b_top_field_first = p_inpic->b_top_field_first;
picture_CopyProperties( p_outpic, p_inpic );

if( p_inpic->pf_release )
p_inpic->pf_release( p_inpic );
picture_Release( p_inpic );

return p_outpic;
}
3 changes: 1 addition & 2 deletions modules/video_filter/gaussianblur.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}
#ifdef DONT_USE_FLOATS
Expand Down
3 changes: 1 addition & 2 deletions modules/video_filter/gradient.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down
3 changes: 1 addition & 2 deletions modules/video_filter/grain.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down
3 changes: 1 addition & 2 deletions modules/video_filter/invert.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/video_filter/logo.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static void FreeLogoList( logo_list_t *p_logo_list )
FREENULL( p_logo->psz_file );
if( p_logo->p_pic )
{
p_logo->p_pic->pf_release( p_logo->p_pic );
picture_Release( p_logo->p_pic );
p_logo->p_pic = NULL;
}
}
Expand Down
3 changes: 1 addition & 2 deletions modules/video_filter/magnify.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
p_converted->p[i_plane].i_visible_pitch );
}
}
p_converted->pf_release( p_converted );
picture_Release( p_converted );

/* white rectangle on visualization */
v_w = p_oyp->i_pitch*ZOOM_FACTOR/(VIS_ZOOM*o_zoom);
Expand Down Expand Up @@ -461,7 +461,6 @@ o o X o o o X X X X X o o X X X X o o o X X X X X o o X X X o o o X X X o o X o
}
}
}

vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
}

Expand Down
8 changes: 4 additions & 4 deletions modules/video_filter/mosaic.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static void MosaicReleasePicture( picture_t *p_picture )
{
picture_t *p_original_pic = (picture_t *)p_picture->p_sys;

p_original_pic->pf_release( p_original_pic );
picture_Release( p_original_pic );
}

/*****************************************************************************
Expand Down Expand Up @@ -546,14 +546,14 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
if ( p_es->p_picture->p_next != NULL )
{
picture_t *p_next = p_es->p_picture->p_next;
p_es->p_picture->pf_release( p_es->p_picture );
p_original_pic( p_es->p_picture );
p_es->p_picture = p_next;
}
else if ( p_es->p_picture->date + p_sys->i_delay + BLANK_DELAY <
date )
{
/* Display blank */
p_es->p_picture->pf_release( p_es->p_picture );
picture_Release( p_es->p_picture );
p_es->p_picture = NULL;
p_es->pp_last = &p_es->p_picture;
break;
Expand Down Expand Up @@ -633,7 +633,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
else
{
p_converted = p_es->p_picture;
p_converted->i_refcount++;
picture_Yield( p_converted );
fmt_in.i_width = fmt_out.i_width = p_converted->format.i_width;
fmt_in.i_height = fmt_out.i_height = p_converted->format.i_height;
fmt_in.i_chroma = fmt_out.i_chroma = p_converted->format.i_chroma;
Expand Down
3 changes: 1 addition & 2 deletions modules/video_filter/motionblur.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down
9 changes: 3 additions & 6 deletions modules/video_filter/motiondetect.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_inpic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_inpic->pf_release )
p_inpic->pf_release( p_inpic );
picture_Release( p_inpic );
return NULL;
}

Expand Down Expand Up @@ -372,8 +371,7 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_inpic )
{
msg_Warn( p_filter, "Unsupported input chroma (%4s)",
(char*)&(p_inpic->format.i_chroma) );
if( p_inpic->pf_release )
p_inpic->pf_release( p_inpic );
picture_Release( p_inpic );
return NULL;
}

Expand Down Expand Up @@ -401,8 +399,7 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_inpic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_inpic->pf_release )
p_inpic->pf_release( p_inpic );
picture_Release( p_inpic );
return NULL;
}

Expand Down
3 changes: 1 addition & 2 deletions modules/video_filter/noise.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
return NULL;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/video_filter/opencv_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ static void ReleaseImages(vout_thread_t *p_vout)
/* Release temp picture_t if it exists */
if (p_vout->p_sys->p_to_be_freed)
{
p_vout->p_sys->p_to_be_freed->pf_release( p_vout->p_sys->p_to_be_freed );
picture_Release( p_vout->p_sys->p_to_be_freed );
p_vout->p_sys->p_to_be_freed = NULL;
}
if (p_vout->p_sys->i_verbosity > VERB_WARN)
Expand Down
3 changes: 1 addition & 2 deletions modules/video_filter/postproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,7 @@ static picture_t *PostprocPict( filter_t *p_filter, picture_t *p_pic )
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
picture_Release( p_pic );
vlc_mutex_unlock( &p_sys->lock );
return NULL;
}
Expand Down
Loading

0 comments on commit 5d3c921

Please sign in to comment.