Changeset e2da42f9737f1197cd7e8d768266b5e0c6ec87e7

Show
Ignore:
Timestamp:
28/11/02 18:35:01 (6 years ago)
Author:
Sam Hocevar <sam@videolan.org>
git-committer:
Sam Hocevar <sam@videolan.org> 1038504901 +0000
git-parent:

[798e97904d1cc5c42d637616525af9f2c123a023]

git-author:
Sam Hocevar <sam@videolan.org> 1038504901 +0000
Message:
  • ./src/video_output/video_output.c, modules/*: factorized video output
    creation code into vout_Request which looks for existing vout objects
    and spawns a new one if none was found.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/video_output.h

    r22f2fa6 re2da42f  
    66 ***************************************************************************** 
    77 * Copyright (C) 1999, 2000 VideoLAN 
    8  * $Id: video_output.h,v 1.87 2002/11/20 13:37:35 sam Exp $ 
     8 * $Id: video_output.h,v 1.88 2002/11/28 17:34:59 sam Exp $ 
    99 * 
    1010 * Authors: Vincent Seguin <seguin@via.ecp.fr> 
     
    142142 * Prototypes 
    143143 *****************************************************************************/ 
    144 #define vout_CreateThread(a,b,c,d,e) __vout_CreateThread(VLC_OBJECT(a),b,c,d,e) 
    145 VLC_EXPORT( vout_thread_t *, __vout_CreateThread,   ( vlc_object_t *, unsigned int, unsigned int, uint32_t, unsigned int ) ); 
    146 VLC_EXPORT( void,              vout_DestroyThread,  ( vout_thread_t * ) ); 
     144#define vout_Request(a,b,c,d,e,f) __vout_Request(VLC_OBJECT(a),b,c,d,e,f) 
     145VLC_EXPORT( vout_thread_t *, __vout_Request,      ( vlc_object_t *, vout_thread_t *, unsigned int, unsigned int, uint32_t, unsigned int ) ); 
     146#define vout_Create(a,b,c,d,e) __vout_Create(VLC_OBJECT(a),b,c,d,e) 
     147VLC_EXPORT( vout_thread_t *, __vout_Create,       ( vlc_object_t *, unsigned int, unsigned int, uint32_t, unsigned int ) ); 
     148VLC_EXPORT( void,            vout_Destroy,        ( vout_thread_t * ) ); 
    147149 
    148150VLC_EXPORT( int,             vout_ChromaCmp,      ( uint32_t, uint32_t ) ); 
  • modules/codec/cinepak/cinepak.c

    r4c9f239 re2da42f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: cinepak.c,v 1.8 2002/11/27 15:18:24 sam Exp $ 
     5 * $Id: cinepak.c,v 1.9 2002/11/28 17:34:59 sam Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    190190} 
    191191 
    192 static int cinepak_CheckVout( vout_thread_t *p_vout, 
    193                               int i_width, 
    194                               int i_height ) 
    195 { 
    196     if( !p_vout ) 
    197     { 
    198         return( 0 ); 
    199     } 
    200      
    201     if( ( p_vout->render.i_width != i_width )|| 
    202         ( p_vout->render.i_height != i_height )|| 
    203         ( p_vout->render.i_chroma != VLC_FOURCC('I','4','2','0') )|| 
    204         ( p_vout->render.i_aspect != VOUT_ASPECT_FACTOR * i_width / i_height) ) 
    205     { 
    206         return( 0 ); 
    207     } 
    208     else 
    209     { 
    210         return( 1 ); 
    211     } 
    212 } 
    213  
    214 /* Return a Vout */ 
    215  
    216 static vout_thread_t *cinepak_CreateVout( videodec_thread_t *p_vdec, 
    217                                          int i_width, 
    218                                          int i_height ) 
    219 { 
    220     vout_thread_t *p_vout; 
    221  
    222     if( (!i_width)||(!i_height) ) 
    223     { 
    224         return( NULL ); /* Can't create a new vout without display size */ 
    225     } 
    226  
    227     /* Spawn a video output if there is none. First we look for our children, 
    228      * then we look for any other vout that might be available. */ 
    229     p_vout = vlc_object_find( p_vdec->p_fifo, VLC_OBJECT_VOUT, 
    230                                               FIND_CHILD ); 
    231     if( !p_vout ) 
    232     { 
    233         p_vout = vlc_object_find( p_vdec->p_fifo, VLC_OBJECT_VOUT, 
    234                                                   FIND_ANYWHERE ); 
    235     } 
    236  
    237     if( p_vout ) 
    238     { 
    239         if( !cinepak_CheckVout( p_vout, i_width, i_height ) ) 
    240         { 
    241             /* We are not interested in this format, close this vout */ 
    242             vlc_object_detach( p_vout ); 
    243             vlc_object_release( p_vout ); 
    244             vout_DestroyThread( p_vout ); 
    245             p_vout = NULL; 
    246         } 
    247         else 
    248         { 
    249             /* This video output is cool! Hijack it. */ 
    250             vlc_object_detach( p_vout ); 
    251             vlc_object_attach( p_vout, p_vdec->p_fifo ); 
    252             vlc_object_release( p_vout ); 
    253         } 
    254     } 
    255  
    256     if( p_vout == NULL ) 
    257     { 
    258         msg_Dbg( p_vdec->p_fifo, "no vout present, spawning one" ); 
    259      
    260         p_vout = vout_CreateThread( p_vdec->p_fifo, 
    261                                     i_width, 
    262                                     i_height, 
    263                                     VLC_FOURCC('I','4','2','0'), 
    264                                     VOUT_ASPECT_FACTOR * i_width / i_height ); 
    265     } 
    266  
    267     return( p_vout ); 
    268 } 
    269192 
    270193void cinepak_LoadCodebook( cinepak_codebook_t *p_codebook, 
     
    841764        return; 
    842765    } 
    843      
     766 
    844767    /* Check our vout */ 
    845     if( !cinepak_CheckVout( p_vdec->p_vout, 
    846                             p_vdec->p_context->i_width, 
    847                             p_vdec->p_context->i_height ) ) 
    848     { 
    849         p_vdec->p_vout =  
    850           cinepak_CreateVout( p_vdec, 
    851                               p_vdec->p_context->i_width, 
    852                               p_vdec->p_context->i_height ); 
    853  
    854         if( !p_vdec->p_vout ) 
    855         { 
    856             msg_Err( p_vdec->p_fifo, "cannot create vout" ); 
    857             p_vdec->p_fifo->b_error = 1; /* abort */ 
    858             return; 
    859         } 
     768    p_vdec->p_vout = vout_Request( p_vdec->p_fifo, p_vdec->p_vout, 
     769                                   p_vdec->p_context->i_width, 
     770                                   p_vdec->p_context->i_height, 
     771                                   VLC_FOURCC('I','4','2','0'), 
     772                                   p_vdec->p_context->i_width 
     773                                    * VOUT_ASPECT_FACTOR 
     774                                    / p_vdec->p_context->i_height ); 
     775 
     776    if( !p_vdec->p_vout ) 
     777    { 
     778        msg_Err( p_vdec->p_fifo, "cannot create vout" ); 
     779        p_vdec->p_fifo->b_error = VLC_TRUE; /* abort */ 
     780        return; 
    860781    } 
    861782 
     
    906827{ 
    907828    int i; 
    908      
     829 
    909830    if( !p_vdec ) 
    910831    { 
     
    917838        FREE( p_vdec->p_context->p_pix[i] ); 
    918839    } 
    919      
     840 
    920841    free( p_vdec->p_context ); 
    921      
    922     if( p_vdec->p_vout != NULL ) 
    923     { 
    924         /* We are about to die. Reattach video output to p_vlc. */ 
    925         vlc_object_detach( p_vdec->p_vout ); 
    926         vlc_object_attach( p_vdec->p_vout, p_vdec->p_fifo->p_vlc ); 
    927     } 
    928      
     842 
     843    /* Get rid of our video output if we have one. */ 
     844    vout_Request( p_vdec->p_fifo, p_vdec->p_vout, 0, 0, 0, 0 ); 
     845 
    929846    free( p_vdec ); 
    930847} 
  • modules/codec/dv.c

    r4910755 re2da42f  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: dv.c,v 1.2 2002/11/06 09:26:25 sam Exp $ 
     5 * $Id: dv.c,v 1.3 2002/11/28 17:34:59 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
    8  *       
     8 * 
    99 * This program is free software; you can redistribute it and/or modify 
    1010 * it under the terms of the GNU General Public License as published by 
    1111 * the Free Software Foundation; either version 2 of the License, or 
    1212 * (at your option) any later version. 
    13  *  
     13 * 
    1414 * This program is distributed in the hope that it will be useful, 
    1515 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     
    4040static int OpenDecoder ( vlc_object_t * ); 
    4141 
    42 static u32 GetFourCC   ( dv_sample_t ); 
     42static vlc_fourcc_t GetFourCC   ( dv_sample_t ); 
    4343 
    4444/***************************************************************************** 
     
    7474static int RunDecoder ( decoder_fifo_t *p_fifo ) 
    7575{ 
    76     u8 *p_buffer; 
     76    uint8_t *p_buffer; 
    7777    pes_packet_t *p_pes = NULL; 
    7878    int i_data = 120000; 
     
    8282    dv_decoder_t *  p_decoder; 
    8383    vout_thread_t * p_vout; 
    84      
     84 
    8585    p_buffer = malloc( i_data ); 
    8686    if( !p_buffer ) 
     
    150150            p_buffer = realloc( p_buffer, p_decoder->frame_size ); 
    151151        } 
    152      
     152 
    153153        /* Don't trust the sucker */ 
    154154        //p_decoder->quality = p_decoder->video->quality; 
     
    158158        /* Spawn a video output if there is none. First we look amongst our 
    159159         * children, then we look for any other vout that might be available */ 
    160         p_vout = vlc_object_find( p_fifo, VLC_OBJECT_VOUT, FIND_CHILD ); 
    161         if( !p_vout )  
    162         { 
    163             p_vout = vlc_object_find( p_fifo, VLC_OBJECT_VOUT, FIND_ANYWHERE ); 
    164         } 
    165  
    166         if( p_vout ) 
    167         { 
    168             if( p_vout->render.i_width != p_decoder->width 
    169              || p_vout->render.i_height != p_decoder->height 
    170              || p_vout->render.i_chroma != GetFourCC( p_decoder->sampling ) 
    171              || p_vout->render.i_aspect != i_aspect ) 
    172             { 
    173                 /* We are not interested in this format, close this vout */ 
    174                 vlc_object_detach( p_vout ); 
    175                 vlc_object_release( p_vout ); 
    176                 vout_DestroyThread( p_vout ); 
    177                 p_vout = NULL; 
    178             } 
    179             else 
    180             { 
    181                 /* This video output is cool! Hijack it. */ 
    182                 vlc_object_detach( p_vout ); 
    183                 vlc_object_attach( p_vout, p_fifo ); 
    184                 vlc_object_release( p_vout ); 
    185             } 
    186         } 
    187  
    188         if( !p_vout ) 
    189         { 
    190             msg_Dbg( p_fifo, "no vout present, spawning one" ); 
    191  
    192             p_vout = vout_CreateThread( p_fifo, 
    193                                         p_decoder->width, p_decoder->height, 
    194                                         GetFourCC( p_decoder->sampling ), 
    195                                         i_aspect ); 
    196         } 
     160        p_vout = vout_Request( p_fifo, NULL, 
     161                               p_decoder->width, p_decoder->height, 
     162                               GetFourCC( p_decoder->sampling ), i_aspect ); 
    197163 
    198164        /* Main loop */ 
     
    232198            { 
    233199                picture_t *p_pic; 
    234                 u8 *pixels[3]; 
     200                uint8_t *pixels[3]; 
    235201                int pitches[3], i; 
    236202 
     
    240206                    { 
    241207                        break; 
    242                     }  
     208                    } 
    243209                    msleep( VOUT_OUTMEM_SLEEP ); 
    244210                } 
     
    266232        } 
    267233 
    268         if( p_vout ) 
    269         { 
    270             vlc_object_detach( p_vout ); 
    271             vout_DestroyThread( p_vout ); 
    272         } 
     234        vout_Request( p_fifo, p_vout, 0, 0, 0, 0 ); 
    273235    } 
    274236 
     
    290252} 
    291253 
    292 static u32 GetFourCC( dv_sample_t x ) 
     254static vlc_fourcc_t GetFourCC( dv_sample_t x ) 
    293255{ 
    294256    switch( x ) 
  • modules/codec/ffmpeg/video.c

    r798e979 re2da42f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: video.c,v 1.7 2002/11/28 16:44:05 fenrir Exp $ 
     5 * $Id: video.c,v 1.8 2002/11/28 17:35:00 sam Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    100100} 
    101101 
    102 /* Check if we have a Vout with good parameters */ 
    103 static int ffmpeg_CheckVout( vout_thread_t *p_vout, 
    104                              int i_width, 
    105                              int i_height, 
    106                              int i_chroma ) 
    107 { 
    108     if( !p_vout ) 
    109     { 
    110         return( 0 ); 
    111     } 
    112     if( !i_chroma ) 
    113     { 
    114         /* we will try to make conversion */ 
    115         i_chroma = VLC_FOURCC('I','4','2','0'); 
    116     }  
    117  
    118     if( ( p_vout->render.i_width != i_width )|| 
    119         ( p_vout->render.i_height != i_height )|| 
    120         ( p_vout->render.i_chroma != i_chroma ) ) 
    121     { 
    122         return( 0 ); 
    123     } 
    124     else 
    125     { 
    126         return( 1 ); 
    127     } 
    128 } 
    129  
    130102/* Return a Vout */ 
    131103static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t  *p_vdec, 
     
    150122        /* It's mainly for I410 -> I420 conversion that I've made, 
    151123           it's buggy and very slow */ 
    152     }  
     124    } 
    153125 
    154126#if LIBAVCODEC_BUILD >= 4640 
     
    179151    /* Spawn a video output if there is none. First we look for our children, 
    180152     * then we look for any other vout that might be available. */ 
    181     p_vout = vlc_object_find( p_vdec->p_fifo, VLC_OBJECT_VOUT, 
    182                                               FIND_CHILD ); 
    183     if( !p_vout ) 
    184     { 
    185         p_vout = vlc_object_find( p_vdec->p_fifo, VLC_OBJECT_VOUT, 
    186                                                   FIND_ANYWHERE ); 
    187     } 
    188  
    189     if( p_vout ) 
    190     { 
    191         if( !ffmpeg_CheckVout( p_vout, i_width, i_height, i_chroma ) ) 
    192         { 
    193             /* We are not interested in this format, close this vout */ 
    194             vlc_object_detach( p_vout ); 
    195             vlc_object_release( p_vout ); 
    196             vout_DestroyThread( p_vout ); 
    197             p_vout = NULL; 
    198         } 
    199         else 
    200         { 
    201             /* This video output is cool! Hijack it. */ 
    202             vlc_object_detach( p_vout ); 
    203             vlc_object_attach( p_vout, p_vdec->p_fifo ); 
    204             vlc_object_release( p_vout ); 
    205         } 
    206     } 
    207  
    208     if( p_vout == NULL ) 
    209     { 
    210         msg_Dbg( p_vdec->p_fifo, "no vout present, spawning one" ); 
    211  
    212         p_vout = vout_CreateThread( p_vdec->p_fifo, 
    213                                     i_width, i_height, 
    214                                     i_chroma, i_aspect ); 
    215     } 
    216  
    217     return( p_vout ); 
     153    p_vout = vout_Request( p_vdec->p_fifo, NULL, 
     154                           i_width, i_height, i_chroma, i_aspect ); 
     155 
     156    return p_vout; 
    218157} 
    219158 
     
    723662    if( !p_vdec->b_direct_rendering ) 
    724663    { 
    725         /* Check our vout */ 
    726         if( !ffmpeg_CheckVout( p_vdec->p_vout,  
    727                            p_vdec->p_context->width, 
    728                            p_vdec->p_context->height, 
    729                            ffmpeg_PixFmtToChroma(p_vdec->p_context->pix_fmt)) ) 
    730         { 
    731             p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context ); 
    732             if( !p_vdec->p_vout ) 
    733             { 
    734                 msg_Err( p_vdec->p_fifo, "cannot create vout" ); 
    735                 p_vdec->p_fifo->b_error = 1; /* abort */ 
    736                 return; 
    737             } 
     664        p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context ); 
     665        if( !p_vdec->p_vout ) 
     666        { 
     667            msg_Err( p_vdec->p_fifo, "cannot create vout" ); 
     668            p_vdec->p_fifo->b_error = 1; /* abort */ 
     669            return; 
    738670        } 
    739671 
     
    812744    } 
    813745 
    814     if( p_vdec->p_vout != NULL ) 
    815     { 
    816         /* We are about to die. Reattach video output to p_vlc. */ 
    817         vlc_object_detach( p_vdec->p_vout ); 
    818         vlc_object_attach( p_vdec->p_vout, p_vdec->p_fifo->p_vlc ); 
    819     } 
     746    /* We are about to die. Reattach video output to p_vlc. */ 
     747    vout_Request( p_vdec->p_fifo, p_vdec->p_vout, 0, 0, 0, 0 ); 
    820748} 
    821749 
     
    905833 
    906834    /* Check our vout */ 
    907     if( !ffmpeg_CheckVout( p_vdec->p_vout, 
    908                            p_vdec->p_context->width, 
    909                            p_vdec->p_context->height, 
    910                            ffmpeg_PixFmtToChroma(p_vdec->p_context->pix_fmt)) ) 
    911     { 
    912         p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context ); 
    913         if( !p_vdec->p_vout ) 
    914         { 
    915             msg_Err( p_vdec->p_fifo, "cannot create vout" ); 
    916             p_vdec->p_fifo->b_error = 1; /* abort */ 
    917             return -1; 
    918         } 
     835    p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context ); 
     836    if( !p_vdec->p_vout ) 
     837    { 
     838        msg_Err( p_vdec->p_fifo, "cannot create vout" ); 
     839        p_vdec->p_fifo->b_error = 1; /* abort */ 
     840        return -1; 
    919841    } 
    920842 
  • modules/codec/mpeg_video/headers.c

    r22f2fa6 re2da42f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: headers.c,v 1.5 2002/11/20 13:37:35 sam Exp $ 
     5 * $Id: headers.c,v 1.6 2002/11/28 17:35:00 sam Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    312312    int i_aspect; 
    313313 
    314     vout_thread_t *p_vout; 
    315  
    316314    p_vpar->sequence.i_width = GetBits( &p_vpar->bit_stream, 12 ); 
    317315    p_vpar->sequence.i_height = GetBits( &p_vpar->bit_stream, 12 ); 
     
    480478    /* Spawn a video output if there is none. First we look for our children, 
    481479     * then we look for any other vout that might be available. */ 
    482     p_vout = vlc_object_find( p_vpar->p_fifo, VLC_OBJECT_VOUT, FIND_CHILD ); 
    483     if( p_vout == NULL ) 
    484     { 
    485         p_vout = vlc_object_find( p_vpar->p_fifo, VLC_OBJECT_VOUT, 
    486                                                   FIND_ANYWHERE ); 
    487     } 
    488      
    489     if( p_vout ) 
    490     { 
    491         if( p_vout->render.i_width != p_vpar->sequence.i_width 
    492              || p_vout->render.i_height != p_vpar->sequence.i_height 
    493              || p_vout->render.i_chroma != ChromaToFourCC( p_vpar->sequence.i_chroma_format ) 
    494              || p_vout->render.i_aspect != p_vpar->sequence.i_aspect ) 
    495         { 
    496             /* We are not interested in this format, close this vout */ 
    497             vlc_object_detach( p_vout ); 
    498             vlc_object_release( p_vout ); 
    499             vout_DestroyThread( p_vout ); 
    500             p_vout = NULL; 
    501         } 
    502         else 
    503         { 
    504             /* This video output is cool! Hijack it. */ 
    505             if( p_vout != p_vpar->p_vout ) 
    506             { 
    507                 vlc_object_detach( p_vout ); 
    508                 vlc_object_attach( p_vout, p_vpar->p_fifo ); 
    509             } 
    510             vlc_object_release( p_vout ); 
    511         } 
    512     } 
    513  
    514     p_vpar->p_vout = p_vout; 
     480    p_vpar->p_vout = 
     481           vout_Request( p_vpar->p_fifo, p_vpar->p_vout, 
     482                         p_vpar->sequence.i_width, p_vpar->sequence.i_height, 
     483                         ChromaToFourCC( p_vpar->sequence.i_chroma_format ), 
     484                         p_vpar->sequence.i_aspect ); 
    515485 
    516486    if( p_vpar->p_fifo->b_die || p_vpar->p_fifo->b_error ) 
     
    521491    if( p_vpar->p_vout == NULL ) 
    522492    { 
    523         msg_Dbg( p_vpar->p_fifo, "no vout present, spawning one" ); 
    524  
    525         p_vpar->p_vout = vout_CreateThread( p_vpar->p_fifo, 
    526                            p_vpar->sequence.i_width, 
    527                            p_vpar->sequence.i_height, 
    528                            ChromaToFourCC( p_vpar->sequence.i_chroma_format ), 
    529                            p_vpar->sequence.i_aspect ); 
    530  
    531         /* Everything failed */ 
    532         if( p_vpar->p_vout == NULL ) 
    533         { 
    534             msg_Err( p_vpar->p_fifo, "cannot open vout, aborting" ); 
    535             p_vpar->p_fifo->b_error = 1; 
    536             return; 
    537         } 
     493        msg_Err( p_vpar->p_fifo, "cannot open vout, aborting" ); 
     494        p_vpar->p_fifo->b_error = 1; 
     495        return; 
    538496    } 
    539497} 
  • modules/codec/mpeg_video/parser.c

    r22f2fa6 re2da42f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: parser.c,v 1.7 2002/11/20 13:37:35 sam Exp $ 
     5 * $Id: parser.c,v 1.8 2002/11/28 17:35:00 sam Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    300300#endif 
    301301 
    302     if( p_vpar->p_vout != NULL ) 
    303     { 
    304         /* Release used video buffers. */ 
    305         if( p_vpar->sequence.p_forward != NULL ) 
    306         { 
    307             vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_forward ); 
    308         } 
    309         if( p_vpar->sequence.p_backward != NULL ) 
    310         { 
    311             vout_DatePicture( p_vpar->p_vout, p_vpar->sequence.p_backward, 
    312                               vpar_SynchroDate( p_vpar ) ); 
    313             vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward ); 
    314         } 
    315         if( p_vpar->picture.p_picture != NULL ) 
    316         { 
    317             vout_DestroyPicture( p_vpar->p_vout, p_vpar->picture.p_picture ); 
    318         } 
    319  
    320         /* We are about to die. Reattach video output to p_vlc. */ 
    321         vlc_object_detach( p_vpar->p_vout ); 
    322         vlc_object_attach( p_vpar->p_vout, p_vpar->p_fifo->p_vlc ); 
    323     } 
     302    /* Release used video buffers. */ 
     303    if( p_vpar->sequence.p_forward != NULL ) 
     304    { 
     305        vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_forward ); 
     306    } 
     307    if( p_vpar->sequence.p_backward != NULL ) 
     308    { 
     309        vout_DatePicture( p_vpar->p_vout, p_vpar->sequence.p_backward, 
     310                          vpar_SynchroDate( p_vpar ) ); 
     311        vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward ); 
     312    } 
     313    if( p_vpar->picture.p_picture != NULL ) 
     314    { 
     315        vout_DestroyPicture( p_vpar->p_vout, p_vpar->picture.p_picture ); 
     316    } 
     317 
     318    vout_Request( p_vpar->p_fifo, p_vpar->p_vout, 0, 0, 0, 0 ); 
    324319 
    325320    msg_Dbg( p_vpar->p_fifo, "%d loops among %d sequence(s)", 
  • modules/codec/tarkin.c

    r36b7d8e re2da42f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: tarkin.c,v 1.2 2002/11/20 14:09:57 gbazin Exp $ 
     5 * $Id: tarkin.c,v 1.3 2002/11/28 17:34:59 sam Exp $ 
    66 * 
    77 * Authors: Gildas Bazin <gbazin@netcourrier.com> 
     
    8888 
    8989static void tarkin_CopyPicture( dec_thread_t *, picture_t *, uint8_t * ); 
    90 static vout_thread_t *tarkin_SpawnVout( dec_thread_t *, int, int, int, int ); 
     90 
    9191/***************************************************************************** 
    9292 * Module descriptor 
     
    136136    p_dec->p_fifo = p_fifo; 
    137137    p_dec->p_pes  = NULL; 
     138    p_dec->p_vout = NULL; 
    138139 
    139140    /* Take care of the initial Tarkin header */ 
     
    250251        } 
    251252        i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height; 
    252         p_dec->p_vout = tarkin_SpawnVout( p_dec, i_width, i_height, 
    253                                           i_aspect, i_chroma ); 
     253        p_dec->p_vout = vout_Request( p_dec->p_fifo, p_dec->p_vout, 
     254                                      i_width, i_height, i_aspect, i_chroma ); 
    254255 
    255256        /* Get a new picture */ 
     
    313314            input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_dec->p_pes ); 
    314315 
    315         if( p_dec->p_vout ) 
    316         { 
    317             vlc_object_detach( p_dec->p_vout ); 
    318             vout_DestroyThread( p_dec->p_vout ); 
    319         } 
     316        vout_Request( p_dec, p_dec->p_vout, 0, 0, 0, 0 ); 
    320317 
    321318        if( p_dec->tarkin_stream ) 
     
    324321        free( p_dec ); 
    325322    } 
    326 } 
    327  
    328 /***************************************************************************** 
    329  * tarkin_SpawnVout: creates a new video output 
    330  *****************************************************************************/ 
    331 static vout_thread_t *tarkin_SpawnVout( dec_thread_t *p_dec, 
    332                                         int i_width, 
    333                                         int i_height, 
    334                                         int i_aspect, 
    335                                         int i_chroma ) 
    336 { 
    337     vout_thread_t *p_vout; 
    338  
    339     if( !i_width || !i_height ) 
    340         return NULL; 
    341  
    342     if( !i_chroma ) 
    343         return NULL; 
    344  
    345     /* Spawn a video output if there is none. First we look for our children, 
    346      * then we look for any other vout that might be available. */ 
    347     p_vout = vlc_object_find( p_dec->p_fifo, VLC_OBJECT_VOUT, 
    348                                               FIND_CHILD ); 
    349     if( !p_vout ) 
    350     { 
    351         p_vout = vlc_object_find( p_dec->p_fifo, VLC_OBJECT_VOUT, 
    352                                                   FIND_ANYWHERE ); 
    353     } 
    354  
    355     if( p_vout ) 
    356     { 
    357         if( p_vout->render.i_width != i_width 
    358             || p_vout->render.i_height != i_height 
    359             || p_vout->render.i_chroma != i_chroma 
    360             || p_vout->render.i_aspect != i_aspect ) 
    361         { 
    362             /* We are not interested in this format, close this vout */ 
    363             vlc_object_detach( p_vout ); 
    364             vlc_object_release( p_vout ); 
    365             vout_DestroyThread( p_vout ); 
    366             p_vout = NULL; 
    367         } 
    368         else 
    369         { 
    370             /* This video output is cool! Hijack it. */ 
    371             vlc_object_detach( p_vout ); 
    372             vlc_object_attach( p_vout, p_dec->p_fifo ); 
    373             vlc_object_release( p_vout ); 
    374         } 
    375     } 
    376  
    377     if( p_vout == NULL ) 
    378     { 
    379         msg_Dbg( p_dec->p_fifo, "no vout present, spawning one" ); 
    380  
    381         p_vout = vout_CreateThread( p_dec->p_fifo, 
    382                                     i_width, i_height, 
    383                                     i_chroma, i_aspect ); 
    384     } 
    385  
    386     return( p_vout ); 
    387323} 
    388324 
  • modules/codec/theora.c

    r36b7d8e re2da42f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: theora.c,v 1.1 2002/11/20 14:09:57 gbazin Exp $ 
     5 * $Id: theora.c,v 1.2 2002/11/28 17:34:59 sam Exp $ 
    66 * 
    77 * Authors: Gildas Bazin <gbazin@netcourrier.com> 
     
    7777 
    7878static void theora_CopyPicture( dec_thread_t *, picture_t *, yuv_buffer * ); 
    79 static vout_thread_t *theora_SpawnVout( dec_thread_t *, int, int, int, int ); 
     79 
    8080/***************************************************************************** 
    8181 * Module descriptor 
     
    125125    p_dec->p_fifo = p_fifo; 
    126126    p_dec->p_pes  = NULL; 
     127    p_dec->p_vout = NULL; 
    127128 
    128129    /* Take care of the initial Theora header */ 
     
    153154    i_chroma = VLC_FOURCC('Y','V','1','2'); 
    154155 
    155     p_dec->p_vout = theora_SpawnVout( p_dec, p_dec->ti.width, p_dec->ti.height, 
    156                                       i_aspect, i_chroma ); 
     156    p_dec->p_vout = vout_Request( p_dec->p_fifo, p_dec->p_vout, 
     157                                  p_dec->ti.width, p_dec->ti.height, 
     158                                  i_aspect, i_chroma ); 
    157159 
    158160    /* theora decoder thread's main loop */ 
     
    264266            input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_dec->p_pes ); 
    265267 
    266         if( p_dec->p_vout ) 
    267         { 
    268             vlc_object_detach( p_dec->p_vout ); 
    269             vout_DestroyThread( p_dec->p_vout ); 
    270         } 
     268        vout_Request( p_dec->p_fifo, p_dec->p_vout, 0, 0, 0, 0 ); 
    271269 
    272270        free( p_dec ); 
    273271    } 
    274 } 
    275  
    276 /***************************************************************************** 
    277  * theora_SpawnVout: creates a new video output 
    278  *****************************************************************************/ 
    279 static vout_thread_t *theora_SpawnVout( dec_thread_t *p_dec, 
    280                                         int i_width, 
    281                                         int i_height, 
    282                                         int i_aspect, 
    283                                         int i_chroma ) 
    284 { 
    285     vout_thread_t *p_vout; 
    286  
    287     if( !i_width || !i_height ) 
    288         return NULL; 
    289  
    290     if( !i_chroma ) 
    291         return NULL; 
    292  
    293     /* Spawn a video output if there is none. First we look for our children, 
    294      * then we look for any other vout that might be available. */ 
    295     p_vout = vlc_object_find( p_dec->p_fifo, VLC_OBJECT_VOUT, 
    296                                               FIND_CHILD ); 
    297     if( !p_vout ) 
    298     { 
    299         p_vout = vlc_object_find( p_dec->p_fifo, VLC_OBJECT_VOUT, 
    300                                                   FIND_ANYWHERE ); 
    301     } 
    302  
    303     if( p_vout ) 
    304     { 
    305         if( p_vout->render.i_width != i_width 
    306             || p_vout->render.i_height != i_height 
    307             || p_vout->render.i_chroma != i_chroma 
    308             || p_vout->render.i_aspect != i_aspect ) 
    309         { 
    310             /* We are not interested in this format, close this vout */ 
    311             vlc_object_detach( p_vout ); 
    312             vlc_object_release( p_vout ); 
    313             vout_DestroyThread( p_vout ); 
    314             p_vout = NULL; 
    315         } 
    316         else 
    317         { 
    318             /* This video output is cool! Hijack it. */ 
    319             vlc_object_detach( p_vout ); 
    320             vlc_object_attach( p_vout, p_dec->p_fifo ); 
    321             vlc_object_release( p_vout ); 
    322         } 
    323     } 
    324  
    325     if( p_vout == NULL ) 
    326     { 
    327         msg_Dbg( p_dec->p_fifo, "no vout present, spawning one" ); 
    328  
    329         p_vout = vout_CreateThread( p_dec->p_fifo, 
    330                                     i_width, i_height, 
    331                                     i_chroma, i_aspect ); 
    332     } 
    333  
    334     return( p_vout ); 
    335272} 
    336273 
  • modules/codec/xvid.c

    r4910755 re2da42f  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: xvid.c,v 1.2 2002/11/06 09:26:25 sam Exp $ 
     5 * $Id: xvid.c,v 1.3 2002/11/28 17:34:59 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
    8  *       
     8 * 
    99 * This program is free software; you can redistribute it and/or modify 
    1010 * it under the terms of the GNU General Public License as published by 
    1111 * the Free Software Foundation; either version 2 of the License, or 
    1212 * (at your option) any later version. 
    13  *  
     13 * 
    1414 * This program is distributed in the hope that it will be useful, 
    1515 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     
    4949    set_capability( "decoder", 50 ); 
    5050    set_callbacks( OpenDecoder, NULL ); 
    51     add_bool( "xvid-direct-render", 0, NULL, "direct rendering",  
     51    add_bool( "xvid-direct-render", 0, NULL, "direct rendering", 
    5252              "Use libxvidcore's direct rendering feature." ); 
    5353vlc_module_end(); 
     
    148148    /* Spawn a video output if there is none. First we look amongst our 
    149149     * children, then we look for any other vout that might be available */ 
    150     p_vout = vlc_object_find( p_fifo, VLC_OBJECT_VOUT, FIND_CHILD ); 
    151     if( !p_vout )  
    152     { 
    153         p_vout = vlc_object_find( p_fifo, VLC_OBJECT_VOUT, FIND_ANYWHERE ); 
    154     } 
    155  
    156     if( p_vout ) 
    157     { 
    158         if( p_vout->render.i_width != i_width 
    159          || p_vout->render.i_height != i_height 
    160          || p_vout->render.i_chroma != i_chroma 
    161          || p_vout->render.i_aspect != i_aspect ) 
    162         { 
    163             /* We are not interested in this format, close this vout */ 
    164             vlc_object_detach( p_vout ); 
    165             vlc_object_release( p_vout ); 
    166             vout_DestroyThread( p_vout ); 
    167             p_vout = NULL; 
    168         } 
    169         else 
    170         { 
    171             /* This video output is cool! Hijack it. */ 
    172             vlc_object_detach( p_vout ); 
    173             vlc_object_attach( p_vout, p_fifo ); 
    174             vlc_object_release( p_vout ); 
    175         } 
    176     } 
     150    p_vout = vout_Request( p_fifo, NULL, 
     151                           i_width, i_height, i_chroma, i_aspect ); 
    177152 
    178153    if( !p_vout ) 
    179154    { 
    180         msg_Dbg( p_fifo, "no vout present, spawning one" ); 
    181  
    182         p_vout = vout_CreateThread( p_fifo, 
    183                                     i_width, i_height, 
    184                                     i_chroma, i_aspect ); 
    185&nb