Changeset e110b99aac4bc342fb927d9c83197f59a4f867f1

Show
Ignore:
Timestamp:
20/05/08 15:16:27 (7 months ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1211289387 +0200
git-parent:

[a5ff1f926dc6ae6bf2db641b2025a4b5ffdecdf5]

git-author:
Rafaël Carré <funman@videolan.org> 1211288716 +0200
Message:

Use reference counting for pictures

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/misc/image.c

    rcf9c7df re110b99  
    253253{ 
    254254    block_t *p_block; 
    255     void (*pf_release)( picture_t * ); 
    256255 
    257256    /* Check if we can reuse the current encoder */ 
     
    564563static void video_release_buffer( picture_t *p_pic ) 
    565564{ 
    566     if( p_pic ) 
    567     { 
    568         free( p_pic->p_data_orig ); 
    569         free( p_pic->p_sys ); 
    570         free( p_pic ); 
    571     } 
     565    if( --p_pic->i_refcount > 0 ) return; 
     566 
     567    free( p_pic->p_data_orig ); 
     568    free( p_pic->p_sys ); 
     569    free( p_pic ); 
    572570} 
    573571 
     
    589587    } 
    590588 
     589    p_pic->i_refcount = 1; 
    591590    p_pic->pf_release = video_release_buffer; 
    592591    p_pic->i_status = RESERVED_PICTURE; 
     
    599598{ 
    600599    (void)p_dec; 
    601     if( p_pic ) 
    602     { 
    603         free( p_pic->p_data_orig ); 
    604         free( p_pic->p_sys ); 
    605         free( p_pic ); 
    606     } 
     600    free( p_pic->p_data_orig ); 
     601    free( p_pic->p_sys ); 
     602    free( p_pic ); 
    607603} 
    608604 
    609605static void video_link_picture( decoder_t *p_dec, picture_t *p_pic ) 
    610606{ 
     607    (void)p_dec; 
     608    p_pic->i_refcount++; 
     609} 
     610 
     611static void video_unlink_picture( decoder_t *p_dec, picture_t *p_pic ) 
     612{ 
    611613    (void)p_dec; (void)p_pic; 
    612 
    613  
    614 static void video_unlink_picture( decoder_t *p_dec, picture_t *p_pic ) 
    615 
    616     (void)p_dec; (void)p_pic; 
     614    video_release_buffer( p_pic ); 
    617615} 
    618616