Commit e2da42f9 authored by Sam Hocevar's avatar Sam Hocevar

* ./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.
parent 798e9790
......@@ -5,7 +5,7 @@
* thread, and destroy a previously opened video output thread.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_output.h,v 1.87 2002/11/20 13:37:35 sam Exp $
* $Id: video_output.h,v 1.88 2002/11/28 17:34:59 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -141,9 +141,11 @@ struct vout_thread_t
/*****************************************************************************
* Prototypes
*****************************************************************************/
#define vout_CreateThread(a,b,c,d,e) __vout_CreateThread(VLC_OBJECT(a),b,c,d,e)
VLC_EXPORT( vout_thread_t *, __vout_CreateThread, ( vlc_object_t *, unsigned int, unsigned int, uint32_t, unsigned int ) );
VLC_EXPORT( void, vout_DestroyThread, ( vout_thread_t * ) );
#define vout_Request(a,b,c,d,e,f) __vout_Request(VLC_OBJECT(a),b,c,d,e,f)
VLC_EXPORT( vout_thread_t *, __vout_Request, ( vlc_object_t *, vout_thread_t *, unsigned int, unsigned int, uint32_t, unsigned int ) );
#define vout_Create(a,b,c,d,e) __vout_Create(VLC_OBJECT(a),b,c,d,e)
VLC_EXPORT( vout_thread_t *, __vout_Create, ( vlc_object_t *, unsigned int, unsigned int, uint32_t, unsigned int ) );
VLC_EXPORT( void, vout_Destroy, ( vout_thread_t * ) );
VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) );
......
......@@ -2,7 +2,7 @@
* cinepak.c: cinepak video decoder
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: cinepak.c,v 1.8 2002/11/27 15:18:24 sam Exp $
* $Id: cinepak.c,v 1.9 2002/11/28 17:34:59 sam Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -189,83 +189,6 @@ static void GetPESData( u8 *p_buf, int i_max, pes_packet_t *p_pes )
}
}
static int cinepak_CheckVout( vout_thread_t *p_vout,
int i_width,
int i_height )
{
if( !p_vout )
{
return( 0 );
}
if( ( p_vout->render.i_width != i_width )||
( p_vout->render.i_height != i_height )||
( p_vout->render.i_chroma != VLC_FOURCC('I','4','2','0') )||
( p_vout->render.i_aspect != VOUT_ASPECT_FACTOR * i_width / i_height) )
{
return( 0 );
}
else
{
return( 1 );
}
}
/* Return a Vout */
static vout_thread_t *cinepak_CreateVout( videodec_thread_t *p_vdec,
int i_width,
int i_height )
{
vout_thread_t *p_vout;
if( (!i_width)||(!i_height) )
{
return( NULL ); /* Can't create a new vout without display size */
}
/* Spawn a video output if there is none. First we look for our children,
* then we look for any other vout that might be available. */
p_vout = vlc_object_find( p_vdec->p_fifo, VLC_OBJECT_VOUT,
FIND_CHILD );
if( !p_vout )
{
p_vout = vlc_object_find( p_vdec->p_fifo, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
}
if( p_vout )
{
if( !cinepak_CheckVout( p_vout, i_width, i_height ) )
{
/* We are not interested in this format, close this vout */
vlc_object_detach( p_vout );
vlc_object_release( p_vout );
vout_DestroyThread( p_vout );
p_vout = NULL;
}
else
{
/* This video output is cool! Hijack it. */
vlc_object_detach( p_vout );
vlc_object_attach( p_vout, p_vdec->p_fifo );
vlc_object_release( p_vout );
}
}
if( p_vout == NULL )
{
msg_Dbg( p_vdec->p_fifo, "no vout present, spawning one" );
p_vout = vout_CreateThread( p_vdec->p_fifo,
i_width,
i_height,
VLC_FOURCC('I','4','2','0'),
VOUT_ASPECT_FACTOR * i_width / i_height );
}
return( p_vout );
}
void cinepak_LoadCodebook( cinepak_codebook_t *p_codebook,
u8 *p_data,
......@@ -840,23 +763,21 @@ static void DecodeThread( videodec_thread_t *p_vdec )
i_frame_size );
return;
}
/* Check our vout */
if( !cinepak_CheckVout( p_vdec->p_vout,
p_vdec->p_context->i_width,
p_vdec->p_context->i_height ) )
{
p_vdec->p_vout =
cinepak_CreateVout( p_vdec,
p_vdec->p_context->i_width,
p_vdec->p_context->i_height );
if( !p_vdec->p_vout )
{
msg_Err( p_vdec->p_fifo, "cannot create vout" );
p_vdec->p_fifo->b_error = 1; /* abort */
return;
}
/* Check our vout */
p_vdec->p_vout = vout_Request( p_vdec->p_fifo, p_vdec->p_vout,
p_vdec->p_context->i_width,
p_vdec->p_context->i_height,
VLC_FOURCC('I','4','2','0'),
p_vdec->p_context->i_width
* VOUT_ASPECT_FACTOR
/ p_vdec->p_context->i_height );
if( !p_vdec->p_vout )
{
msg_Err( p_vdec->p_fifo, "cannot create vout" );
p_vdec->p_fifo->b_error = VLC_TRUE; /* abort */
return;
}
/* Send decoded frame to vout */
......@@ -905,7 +826,7 @@ static void DecodeThread( videodec_thread_t *p_vdec )
static void EndThread( videodec_thread_t *p_vdec )
{
int i;
if( !p_vdec )
{
return;
......@@ -916,16 +837,12 @@ static void EndThread( videodec_thread_t *p_vdec )
{
FREE( p_vdec->p_context->p_pix[i] );
}
free( p_vdec->p_context );
if( p_vdec->p_vout != NULL )
{
/* We are about to die. Reattach video output to p_vlc. */
vlc_object_detach( p_vdec->p_vout );
vlc_object_attach( p_vdec->p_vout, p_vdec->p_fifo->p_vlc );
}
/* Get rid of our video output if we have one. */
vout_Request( p_vdec->p_fifo, p_vdec->p_vout, 0, 0, 0, 0 );
free( p_vdec );
}
......
......@@ -2,15 +2,15 @@
* dv.c: a decoder for DV video
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: dv.c,v 1.2 2002/11/06 09:26:25 sam Exp $
* $Id: dv.c,v 1.3 2002/11/28 17:34:59 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -39,7 +39,7 @@
static int RunDecoder ( decoder_fifo_t * );
static int OpenDecoder ( vlc_object_t * );
static u32 GetFourCC ( dv_sample_t );
static vlc_fourcc_t GetFourCC ( dv_sample_t );
/*****************************************************************************
* Module descriptor
......@@ -73,7 +73,7 @@ static int OpenDecoder ( vlc_object_t *p_this )
*****************************************************************************/
static int RunDecoder ( decoder_fifo_t *p_fifo )
{
u8 *p_buffer;
uint8_t *p_buffer;
pes_packet_t *p_pes = NULL;
int i_data = 120000;
int i_aspect;
......@@ -81,7 +81,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
bit_stream_t bit_stream;
dv_decoder_t * p_decoder;
vout_thread_t * p_vout;
p_buffer = malloc( i_data );
if( !p_buffer )
{
......@@ -149,7 +149,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
{
p_buffer = realloc( p_buffer, p_decoder->frame_size );
}
/* Don't trust the sucker */
//p_decoder->quality = p_decoder->video->quality;
p_decoder->quality = DV_QUALITY_BEST;
......@@ -157,43 +157,9 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
/* Spawn a video output if there is none. First we look amongst our
* children, then we look for any other vout that might be available */
p_vout = vlc_object_find( p_fifo, VLC_OBJECT_VOUT, FIND_CHILD );
if( !p_vout )
{
p_vout = vlc_object_find( p_fifo, VLC_OBJECT_VOUT, FIND_ANYWHERE );
}
if( p_vout )
{
if( p_vout->render.i_width != p_decoder->width
|| p_vout->render.i_height != p_decoder->height
|| p_vout->render.i_chroma != GetFourCC( p_decoder->sampling )
|| p_vout->render.i_aspect != i_aspect )
{
/* We are not interested in this format, close this vout */
vlc_object_detach( p_vout );
vlc_object_release( p_vout );
vout_DestroyThread( p_vout );
p_vout = NULL;
}
else
{
/* This video output is cool! Hijack it. */
vlc_object_detach( p_vout );
vlc_object_attach( p_vout, p_fifo );
vlc_object_release( p_vout );
}
}
if( !p_vout )
{
msg_Dbg( p_fifo, "no vout present, spawning one" );
p_vout = vout_CreateThread( p_fifo,
p_decoder->width, p_decoder->height,
GetFourCC( p_decoder->sampling ),
i_aspect );
}
p_vout = vout_Request( p_fifo, NULL,
p_decoder->width, p_decoder->height,
GetFourCC( p_decoder->sampling ), i_aspect );
/* Main loop */
while( !p_fifo->b_die && !p_fifo->b_error )
......@@ -231,7 +197,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
|| dv_frame_changed( p_decoder ) ) )
{
picture_t *p_pic;
u8 *pixels[3];
uint8_t *pixels[3];
int pitches[3], i;
while( !(p_pic = vout_CreatePicture( p_vout, 0, 0, 0 ) ) )
......@@ -239,7 +205,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
if( p_fifo->b_die || p_fifo->b_error )
{
break;
}
}
msleep( VOUT_OUTMEM_SLEEP );
}
......@@ -265,11 +231,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
i_data = 0;
}
if( p_vout )
{
vlc_object_detach( p_vout );
vout_DestroyThread( p_vout );
}
vout_Request( p_fifo, p_vout, 0, 0, 0, 0 );
}
if( p_pes )
......@@ -289,7 +251,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
return 0;
}
static u32 GetFourCC( dv_sample_t x )
static vlc_fourcc_t GetFourCC( dv_sample_t x )
{
switch( x )
{
......
......@@ -2,7 +2,7 @@
* video.c: video decoder using ffmpeg library
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: video.c,v 1.7 2002/11/28 16:44:05 fenrir Exp $
* $Id: video.c,v 1.8 2002/11/28 17:35:00 sam Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -99,34 +99,6 @@ static inline int ffmpeg_FfAspect( int i_width, int i_height, int i_ffaspect )
}
}
/* Check if we have a Vout with good parameters */
static int ffmpeg_CheckVout( vout_thread_t *p_vout,
int i_width,
int i_height,
int i_chroma )
{
if( !p_vout )
{
return( 0 );
}
if( !i_chroma )
{
/* we will try to make conversion */
i_chroma = VLC_FOURCC('I','4','2','0');
}
if( ( p_vout->render.i_width != i_width )||
( p_vout->render.i_height != i_height )||
( p_vout->render.i_chroma != i_chroma ) )
{
return( 0 );
}
else
{
return( 1 );
}
}
/* Return a Vout */
static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec,
AVCodecContext *p_context )
......@@ -149,7 +121,7 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec,
msg_Warn( p_vdec->p_fifo, "Internal chroma conversion (FIXME)");
/* It's mainly for I410 -> I420 conversion that I've made,
it's buggy and very slow */
}
}
#if LIBAVCODEC_BUILD >= 4640
i_aspect = (int) ( VOUT_ASPECT_FACTOR * p_vdec->p_context->aspect_ratio );
......@@ -178,43 +150,10 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec,
#endif
/* Spawn a video output if there is none. First we look for our children,
* then we look for any other vout that might be available. */
p_vout = vlc_object_find( p_vdec->p_fifo, VLC_OBJECT_VOUT,
FIND_CHILD );
if( !p_vout )
{
p_vout = vlc_object_find( p_vdec->p_fifo, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
}
if( p_vout )
{
if( !ffmpeg_CheckVout( p_vout, i_width, i_height, i_chroma ) )
{
/* We are not interested in this format, close this vout */
vlc_object_detach( p_vout );
vlc_object_release( p_vout );
vout_DestroyThread( p_vout );
p_vout = NULL;
}
else
{
/* This video output is cool! Hijack it. */
vlc_object_detach( p_vout );
vlc_object_attach( p_vout, p_vdec->p_fifo );
vlc_object_release( p_vout );
}
}
if( p_vout == NULL )
{
msg_Dbg( p_vdec->p_fifo, "no vout present, spawning one" );
p_vout = vout_CreateThread( p_vdec->p_fifo,
i_width, i_height,
i_chroma, i_aspect );
}
p_vout = vout_Request( p_vdec->p_fifo, NULL,
i_width, i_height, i_chroma, i_aspect );
return( p_vout );
return p_vout;
}
/* FIXME FIXME FIXME this is a big shit
......@@ -722,19 +661,12 @@ usenextdata:
if( !p_vdec->b_direct_rendering )
{
/* Check our vout */
if( !ffmpeg_CheckVout( p_vdec->p_vout,
p_vdec->p_context->width,
p_vdec->p_context->height,
ffmpeg_PixFmtToChroma(p_vdec->p_context->pix_fmt)) )
p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context );
if( !p_vdec->p_vout )
{
p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context );
if( !p_vdec->p_vout )
{
msg_Err( p_vdec->p_fifo, "cannot create vout" );
p_vdec->p_fifo->b_error = 1; /* abort */
return;
}
msg_Err( p_vdec->p_fifo, "cannot create vout" );
p_vdec->p_fifo->b_error = 1; /* abort */
return;
}
/* Get a new picture */
......@@ -811,12 +743,8 @@ void E_( EndThread_Video )( vdec_thread_t *p_vdec )
p_vdec->p_pp = NULL;
}
if( p_vdec->p_vout != NULL )
{
/* We are about to die. Reattach video output to p_vlc. */
vlc_object_detach( p_vdec->p_vout );
vlc_object_attach( p_vdec->p_vout, p_vdec->p_fifo->p_vlc );
}
/* We are about to die. Reattach video output to p_vlc. */
vout_Request( p_vdec->p_fifo, p_vdec->p_vout, 0, 0, 0, 0 );
}
/*****************************************************************************
......@@ -904,18 +832,12 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *avctx, int width,
picture_t *p_pic;
/* Check our vout */
if( !ffmpeg_CheckVout( p_vdec->p_vout,
p_vdec->p_context->width,
p_vdec->p_context->height,
ffmpeg_PixFmtToChroma(p_vdec->p_context->pix_fmt)) )
p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context );
if( !p_vdec->p_vout )
{
p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context );
if( !p_vdec->p_vout )
{
msg_Err( p_vdec->p_fifo, "cannot create vout" );
p_vdec->p_fifo->b_error = 1; /* abort */
return -1;
}
msg_Err( p_vdec->p_fifo, "cannot create vout" );
p_vdec->p_fifo->b_error = 1; /* abort */
return -1;
}
/* Get a new picture */
......
......@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: headers.c,v 1.5 2002/11/20 13:37:35 sam Exp $
* $Id: headers.c,v 1.6 2002/11/28 17:35:00 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -311,8 +311,6 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
int i_aspect;
vout_thread_t *p_vout;
p_vpar->sequence.i_width = GetBits( &p_vpar->bit_stream, 12 );
p_vpar->sequence.i_height = GetBits( &p_vpar->bit_stream, 12 );
i_aspect = GetBits( &p_vpar->bit_stream, 4 );
......@@ -479,39 +477,11 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
/* Spawn a video output if there is none. First we look for our children,
* then we look for any other vout that might be available. */
p_vout = vlc_object_find( p_vpar->p_fifo, VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout == NULL )
{
p_vout = vlc_object_find( p_vpar->p_fifo, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
}
if( p_vout )
{
if( p_vout->render.i_width != p_vpar->sequence.i_width
|| p_vout->render.i_height != p_vpar->sequence.i_height
|| p_vout->render.i_chroma != ChromaToFourCC( p_vpar->sequence.i_chroma_format )
|| p_vout->render.i_aspect != p_vpar->sequence.i_aspect )
{
/* We are not interested in this format, close this vout */
vlc_object_detach( p_vout );
vlc_object_release( p_vout );
vout_DestroyThread( p_vout );
p_vout = NULL;
}
else
{
/* This video output is cool! Hijack it. */
if( p_vout != p_vpar->p_vout )
{
vlc_object_detach( p_vout );
vlc_object_attach( p_vout, p_vpar->p_fifo );
}
vlc_object_release( p_vout );
}
}
p_vpar->p_vout = p_vout;
p_vpar->p_vout =
vout_Request( p_vpar->p_fifo, p_vpar->p_vout,
p_vpar->sequence.i_width, p_vpar->sequence.i_height,
ChromaToFourCC( p_vpar->sequence.i_chroma_format ),
p_vpar->sequence.i_aspect );
if( p_vpar->p_fifo->b_die || p_vpar->p_fifo->b_error )
{
......@@ -520,21 +490,9 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
if( p_vpar->p_vout == NULL )
{
msg_Dbg( p_vpar->p_fifo, "no vout present, spawning one" );
p_vpar->p_vout = vout_CreateThread( p_vpar->p_fifo,
p_vpar->sequence.i_width,
p_vpar->sequence.i_height,
ChromaToFourCC( p_vpar->sequence.i_chroma_format ),
p_vpar->sequence.i_aspect );
/* Everything failed */
if( p_vpar->p_vout == NULL )
{
msg_Err( p_vpar->p_fifo, "cannot open vout, aborting" );
p_vpar->p_fifo->b_error = 1;
return;
}
msg_Err( p_vpar->p_fifo, "cannot open vout, aborting" );
p_vpar->p_fifo->b_error = 1;
return;
}
}
......
......@@ -2,7 +2,7 @@
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: parser.c,v 1.7 2002/11/20 13:37:35 sam Exp $
* $Id: parser.c,v 1.8 2002/11/28 17:35:00 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -299,28 +299,23 @@ static void EndThread( vpar_thread_t *p_vpar )
times( &cpu_usage );
#endif
if( p_vpar->p_vout != NULL )
/* Release used video buffers. */
if( p_vpar->sequence.p_forward != NULL )
{
/* Release used video buffers. */
if( p_vpar->sequence.p_forward != NULL )
{
vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_forward );
}
if( p_vpar->sequence.p_backward != NULL )
{
vout_DatePicture( p_vpar->p_vout, p_vpar->sequence.p_backward,
vpar_SynchroDate( p_vpar ) );
vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward );
}
if( p_vpar->picture.p_picture != NULL )
{
vout_DestroyPicture( p_vpar->p_vout, p_vpar->picture.p_picture );
}
/* We are about to die. Reattach video output to p_vlc. */
vlc_object_detach( p_vpar->p_vout );
vlc_object_attach( p_vpar->p_vout, p_vpar->p_fifo->p_vlc );
vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_forward );
}
if( p_vpar->sequence.p_backward != NULL )
{
vout_DatePicture( p_vpar->p_vout, p_vpar->sequence.p_backward,
vpar_SynchroDate( p_vpar ) );
vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward );
}
if( p_vpar->picture.p_picture != NULL )
{
vout_DestroyPicture( p_vpar->p_vout, p_vpar->picture.p_picture );
}
vout_Request( p_vpar->p_fifo, p_vpar->p_vout, 0, 0, 0, 0 );
msg_Dbg( p_vpar->p_fifo, "%d loops among %d sequence(s)",
p_vpar->c_loops, p_vpar->c_sequences );
......
......@@ -2,7 +2,7 @@
* tarkin.c: tarkin decoder module making use of libtarkin.
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: tarkin.c,v 1.2 2002/11/20 14:09:57 gbazin Exp $
* $Id: tarkin.c,v 1.3 2002/11/28 17:34:59 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -87,7 +87,7 @@ static void DecodePacket ( dec_thread_t * );
static int GetOggPacket ( dec_thread_t *, ogg_packet *, mtime_t * );
static void tarkin_CopyPicture( dec_thread_t *, picture_t *, uint8_t * );
static vout_thread_t *tarkin_SpawnVout( dec_thread_t *, int, int, int, int );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -135,6 +135,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
memset( p_dec, 0, sizeof(dec_thread_t) );
p_dec->p_fifo = p_fifo;
p_dec->p_pes = NULL;
p_dec->p_vout = NULL;
/* Take care of the initial Tarkin header */
p_dec->tarkin_stream = tarkin_stream_new();
......@@ -249,8 +250,8 @@ static void DecodePacket( dec_thread_t *p_dec )
break;
}
i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
p_dec->p_vout = tarkin_SpawnVout( p_dec, i_width, i_height,
i_aspect, i_chroma );
p_dec->p_vout = vout_Request( p_dec->p_fifo, p_dec->p_vout,
i_width, i_height, i_aspect, i_chroma );
/* Get a new picture */
while( !(p_pic = vout_CreatePicture( p_dec->p_vout, 0, 0, 0 ) ) )
......@@ -312,11 +313,7 @@ static void CloseDecoder( dec_thread_t * p_dec )
if( p_dec->p_pes )
input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_dec->p_pes );
if( p_dec->p_vout )
{
vlc_object_detach( p_dec->p_vout );
vout_DestroyThread( p_dec->p_vout );
}
vout_Request( p_dec, p_dec->p_vout, 0, 0, 0, 0 );
if( p_dec->tarkin_stream )
tarkin_stream_destroy( p_dec->tarkin_stream );
......@@ -325,67 +322,6 @@ static void CloseDecoder( dec_thread_t * p_dec )
}
}
/*****************************************************************************
* tarkin_SpawnVout: creates a new video output
*****************************************************************************/
static vout_thread_t *tarkin_SpawnVout( dec_thread_t *p_dec,
int i_width,
int i_height,
int i_aspect,
int i_chroma )
{
vout_thread_t *p_vout;
if( !i_width || !i_height )
return NULL;
if( !i_chroma )
return NULL;
/* Spawn a video output if there is none. First we look for our children,
* then we look for any other vout that might be available. */
p_vout = vlc_object_find( p_dec->p_fifo, VLC_OBJECT_VOUT,
FIND_CHILD );
if( !p_vout )
{
p_vout = vlc_object_find( p_dec->p_fifo, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
}
if( p_vout )
{
if( p_vout->render.i_width != i_width
|| p_vout->render.i_height != i_height
|| p_vout->render.i_chroma != i_chroma
|| p_vout->render.i_aspect != i_aspect )
{
/* We are not interested in this format, close this vout */
vlc_object_detach( p_vout );
vlc_object_release( p_vout );
vout_DestroyThread( p_vout );
p_vout = NULL;
}
else
{
/* This video output is cool! Hijack it. */
vlc_object_detach( p_vout );