Changeset 71c1ddb6aa1c9715d1096b3bbee3e7f0abcc7f07

Show
Ignore:
Timestamp:
06/29/08 22:59:01 (2 months ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1214773141 +0000
git-parent:

[bfd381dc4270c0fc139752d4115c5d42ee82438b]

git-author:
Laurent Aimar <fenrir@videolan.org> 1214773141 +0000
Message:

Added ChromaCreate/Destroy? (cosmetic)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/video_output/video_output.c

    rbfd381d r71c1ddb  
    5858 
    5959#include "modules/modules.h" 
     60#include <assert.h> 
    6061 
    6162/***************************************************************************** 
     
    509510 * XXX You have to enter it with change_lock taken. 
    510511 *****************************************************************************/ 
    511 static picture_t *get_pic( filter_t *p_filter ) 
    512 
    513     picture_t *p_pic = (picture_t *)p_filter->p_owner; 
    514     p_filter->p_owner = NULL; 
    515     return p_pic; 
    516 
     512static int ChromaCreate( vout_thread_t *p_vout ); 
     513static void ChromaDestroy( vout_thread_t *p_vout ); 
    517514 
    518515static int InitThread( vout_thread_t *p_vout ) 
     
    649646        p_vout->b_direct = 0; 
    650647 
    651         /* Choose the best module */ 
    652         p_vout->p_chroma = vlc_object_create( p_vout, sizeof(filter_t) ); 
    653         filter_t *p_chroma = p_vout->p_chroma; 
    654         vlc_object_attach( p_chroma, p_vout ); 
    655         /* TODO: Set the fmt_in and fmt_out stuff here */ 
    656         p_chroma->fmt_in.video = p_vout->fmt_render; 
    657         p_chroma->fmt_out.video = p_vout->fmt_out; 
    658  
    659         /* TODO: put in a function */ 
    660         p_chroma->fmt_out.video.i_rmask = p_vout->output.i_rmask; 
    661         p_chroma->fmt_out.video.i_gmask = p_vout->output.i_gmask; 
    662         p_chroma->fmt_out.video.i_bmask = p_vout->output.i_bmask; 
    663         p_chroma->fmt_out.video.i_rrshift = p_vout->output.i_rrshift; 
    664         p_chroma->fmt_out.video.i_lrshift = p_vout->output.i_lrshift; 
    665         p_chroma->fmt_out.video.i_rgshift = p_vout->output.i_rgshift; 
    666         p_chroma->fmt_out.video.i_lgshift = p_vout->output.i_lgshift; 
    667         p_chroma->fmt_out.video.i_rbshift = p_vout->output.i_rbshift; 
    668         p_chroma->fmt_out.video.i_lbshift = p_vout->output.i_lbshift; 
    669         p_chroma->p_module = module_Need( p_chroma, "video filter2", NULL, 0 ); 
    670  
    671         if( p_chroma->p_module == NULL ) 
    672         { 
    673             msg_Err( p_vout, "no chroma module for %4.4s to %4.4s", 
    674                      (char*)&p_vout->render.i_chroma, 
    675                      (char*)&p_vout->output.i_chroma ); 
    676  
    677             vlc_object_release( p_vout->p_chroma ); 
    678             p_vout->p_chroma = NULL; 
     648        if( ChromaCreate( p_vout ) ) 
     649        { 
    679650            p_vout->pf_end( p_vout ); 
    680651            return VLC_EGENERIC; 
    681652        } 
    682         p_chroma->pf_vout_buffer_new = get_pic; 
    683653 
    684654        msg_Dbg( p_vout, "indirect render, mapping " 
     
    12261196 
    12271197    if( !p_vout->b_direct ) 
    1228     { 
    1229         module_Unneed( p_vout->p_chroma, p_vout->p_chroma->p_module ); 
    1230         vlc_object_release( p_vout->p_chroma ); 
    1231         p_vout->p_chroma = NULL; 
    1232     } 
     1198        ChromaDestroy( p_vout ); 
    12331199 
    12341200    /* Destroy all remaining pictures */ 
     
    12511217    p_vout->pf_end( p_vout ); 
    12521218} 
     1219 
     1220/* Thread helpers */ 
     1221static picture_t *ChromaGetPicture( filter_t *p_filter ) 
     1222{ 
     1223    picture_t *p_pic = (picture_t *)p_filter->p_owner; 
     1224    p_filter->p_owner = NULL; 
     1225    return p_pic; 
     1226} 
     1227 
     1228static int ChromaCreate( vout_thread_t *p_vout ) 
     1229{ 
     1230    filter_t *p_chroma; 
     1231 
     1232    /* Choose the best module */ 
     1233    p_chroma = p_vout->p_chroma = vlc_object_create( p_vout, sizeof(filter_t) ); 
     1234 
     1235    vlc_object_attach( p_chroma, p_vout ); 
     1236 
     1237    /* TODO: Set the fmt_in and fmt_out stuff here */ 
     1238    p_chroma->fmt_in.video = p_vout->fmt_render; 
     1239    p_chroma->fmt_out.video = p_vout->fmt_out; 
     1240 
     1241    p_chroma->fmt_out.video.i_rmask = p_vout->output.i_rmask; 
     1242    p_chroma->fmt_out.video.i_gmask = p_vout->output.i_gmask; 
     1243    p_chroma->fmt_out.video.i_bmask = p_vout->output.i_bmask; 
     1244    p_chroma->fmt_out.video.i_rrshift = p_vout->output.i_rrshift; 
     1245    p_chroma->fmt_out.video.i_lrshift = p_vout->output.i_lrshift; 
     1246    p_chroma->fmt_out.video.i_rgshift = p_vout->output.i_rgshift; 
     1247    p_chroma->fmt_out.video.i_lgshift = p_vout->output.i_lgshift; 
     1248    p_chroma->fmt_out.video.i_rbshift = p_vout->output.i_rbshift; 
     1249    p_chroma->fmt_out.video.i_lbshift = p_vout->output.i_lbshift; 
     1250    p_chroma->p_module = module_Need( p_chroma, "video filter2", NULL, 0 ); 
     1251 
     1252    if( p_chroma->p_module == NULL ) 
     1253    { 
     1254        msg_Err( p_vout, "no chroma module for %4.4s to %4.4s", 
     1255                 (char*)&p_vout->render.i_chroma, 
     1256                 (char*)&p_vout->output.i_chroma ); 
     1257 
     1258        vlc_object_release( p_vout->p_chroma ); 
     1259        p_vout->p_chroma = NULL; 
     1260        return VLC_EGENERIC; 
     1261    } 
     1262    p_chroma->pf_vout_buffer_new = ChromaGetPicture; 
     1263    return VLC_SUCCESS; 
     1264} 
     1265static void ChromaDestroy( vout_thread_t *p_vout ) 
     1266{ 
     1267    assert( !p_vout->b_direct && p_vout->p_chroma ); 
     1268 
     1269    module_Unneed( p_vout->p_chroma, p_vout->p_chroma->p_module ); 
     1270    vlc_object_release( p_vout->p_chroma ); 
     1271    p_vout->p_chroma = NULL; 
     1272} 
     1273 
     1274 
    12531275 
    12541276/* following functions are local */