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 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously opened video output thread. * thread, and destroy a previously opened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -141,9 +141,11 @@ struct vout_thread_t ...@@ -141,9 +141,11 @@ struct vout_thread_t
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
#define vout_CreateThread(a,b,c,d,e) __vout_CreateThread(VLC_OBJECT(a),b,c,d,e) #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_CreateThread, ( vlc_object_t *, unsigned int, unsigned int, uint32_t, unsigned int ) ); VLC_EXPORT( vout_thread_t *, __vout_Request, ( vlc_object_t *, vout_thread_t *, unsigned int, unsigned int, uint32_t, unsigned int ) );
VLC_EXPORT( void, vout_DestroyThread, ( vout_thread_t * ) ); #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 ) ); VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* cinepak.c: cinepak video decoder * cinepak.c: cinepak video decoder
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * 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 ) ...@@ -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, void cinepak_LoadCodebook( cinepak_codebook_t *p_codebook,
u8 *p_data, u8 *p_data,
...@@ -840,23 +763,21 @@ static void DecodeThread( videodec_thread_t *p_vdec ) ...@@ -840,23 +763,21 @@ static void DecodeThread( videodec_thread_t *p_vdec )
i_frame_size ); i_frame_size );
return; 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 ) /* Check our vout */
{ p_vdec->p_vout = vout_Request( p_vdec->p_fifo, p_vdec->p_vout,
msg_Err( p_vdec->p_fifo, "cannot create vout" ); p_vdec->p_context->i_width,
p_vdec->p_fifo->b_error = 1; /* abort */ p_vdec->p_context->i_height,
return; 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 */ /* Send decoded frame to vout */
...@@ -905,7 +826,7 @@ static void DecodeThread( videodec_thread_t *p_vdec ) ...@@ -905,7 +826,7 @@ static void DecodeThread( videodec_thread_t *p_vdec )
static void EndThread( videodec_thread_t *p_vdec ) static void EndThread( videodec_thread_t *p_vdec )
{ {
int i; int i;
if( !p_vdec ) if( !p_vdec )
{ {
return; return;
...@@ -916,16 +837,12 @@ static void EndThread( videodec_thread_t *p_vdec ) ...@@ -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->p_pix[i] );
} }
free( p_vdec->p_context ); free( p_vdec->p_context );
if( p_vdec->p_vout != NULL ) /* Get rid of our video output if we have one. */
{ vout_Request( p_vdec->p_fifo, p_vdec->p_vout, 0, 0, 0, 0 );
/* 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 );
}
free( p_vdec ); free( p_vdec );
} }
......
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
* dv.c: a decoder for DV video * dv.c: a decoder for DV video
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
static int RunDecoder ( decoder_fifo_t * ); static int RunDecoder ( decoder_fifo_t * );
static int OpenDecoder ( vlc_object_t * ); static int OpenDecoder ( vlc_object_t * );
static u32 GetFourCC ( dv_sample_t ); static vlc_fourcc_t GetFourCC ( dv_sample_t );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -73,7 +73,7 @@ static int OpenDecoder ( vlc_object_t *p_this ) ...@@ -73,7 +73,7 @@ static int OpenDecoder ( vlc_object_t *p_this )
*****************************************************************************/ *****************************************************************************/
static int RunDecoder ( decoder_fifo_t *p_fifo ) static int RunDecoder ( decoder_fifo_t *p_fifo )
{ {
u8 *p_buffer; uint8_t *p_buffer;
pes_packet_t *p_pes = NULL; pes_packet_t *p_pes = NULL;
int i_data = 120000; int i_data = 120000;
int i_aspect; int i_aspect;
...@@ -81,7 +81,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo ) ...@@ -81,7 +81,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
bit_stream_t bit_stream; bit_stream_t bit_stream;
dv_decoder_t * p_decoder; dv_decoder_t * p_decoder;
vout_thread_t * p_vout; vout_thread_t * p_vout;
p_buffer = malloc( i_data ); p_buffer = malloc( i_data );
if( !p_buffer ) if( !p_buffer )
{ {
...@@ -149,7 +149,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo ) ...@@ -149,7 +149,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
{ {
p_buffer = realloc( p_buffer, p_decoder->frame_size ); p_buffer = realloc( p_buffer, p_decoder->frame_size );
} }
/* Don't trust the sucker */ /* Don't trust the sucker */
//p_decoder->quality = p_decoder->video->quality; //p_decoder->quality = p_decoder->video->quality;
p_decoder->quality = DV_QUALITY_BEST; p_decoder->quality = DV_QUALITY_BEST;
...@@ -157,43 +157,9 @@ static int RunDecoder ( decoder_fifo_t *p_fifo ) ...@@ -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 /* 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 */ * children, then we look for any other vout that might be available */
p_vout = vlc_object_find( p_fifo, VLC_OBJECT_VOUT, FIND_CHILD ); p_vout = vout_Request( p_fifo, NULL,
if( !p_vout ) p_decoder->width, p_decoder->height,
{ GetFourCC( p_decoder->sampling ), i_aspect );
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 );
}
/* Main loop */ /* Main loop */
while( !p_fifo->b_die && !p_fifo->b_error ) while( !p_fifo->b_die && !p_fifo->b_error )
...@@ -231,7 +197,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo ) ...@@ -231,7 +197,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
|| dv_frame_changed( p_decoder ) ) ) || dv_frame_changed( p_decoder ) ) )
{ {
picture_t *p_pic; picture_t *p_pic;
u8 *pixels[3]; uint8_t *pixels[3];
int pitches[3], i; int pitches[3], i;
while( !(p_pic = vout_CreatePicture( p_vout, 0, 0, 0 ) ) ) while( !(p_pic = vout_CreatePicture( p_vout, 0, 0, 0 ) ) )
...@@ -239,7 +205,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo ) ...@@ -239,7 +205,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
if( p_fifo->b_die || p_fifo->b_error ) if( p_fifo->b_die || p_fifo->b_error )
{ {
break; break;
} }
msleep( VOUT_OUTMEM_SLEEP ); msleep( VOUT_OUTMEM_SLEEP );
} }
...@@ -265,11 +231,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo ) ...@@ -265,11 +231,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
i_data = 0; i_data = 0;
} }
if( p_vout ) vout_Request( p_fifo, p_vout, 0, 0, 0, 0 );
{
vlc_object_detach( p_vout );
vout_DestroyThread( p_vout );
}
} }
if( p_pes ) if( p_pes )
...@@ -289,7 +251,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo ) ...@@ -289,7 +251,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
return 0; return 0;
} }
static u32 GetFourCC( dv_sample_t x ) static vlc_fourcc_t GetFourCC( dv_sample_t x )
{ {
switch( x ) switch( x )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video.c: video decoder using ffmpeg library * video.c: video decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -99,34 +99,6 @@ static inline int ffmpeg_FfAspect( int i_width, int i_height, int i_ffaspect ) ...@@ -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 */ /* Return a Vout */
static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec, static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec,
AVCodecContext *p_context ) AVCodecContext *p_context )
...@@ -149,7 +121,7 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec, ...@@ -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)"); msg_Warn( p_vdec->p_fifo, "Internal chroma conversion (FIXME)");
/* It's mainly for I410 -> I420 conversion that I've made, /* It's mainly for I410 -> I420 conversion that I've made,
it's buggy and very slow */ it's buggy and very slow */
} }
#if LIBAVCODEC_BUILD >= 4640 #if LIBAVCODEC_BUILD >= 4640
i_aspect = (int) ( VOUT_ASPECT_FACTOR * p_vdec->p_context->aspect_ratio ); 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, ...@@ -178,43 +150,10 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec,
#endif #endif
/* Spawn a video output if there is none. First we look for our children, /* 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. */ * then we look for any other vout that might be available. */
p_vout = vlc_object_find( p_vdec->p_fifo, VLC_OBJECT_VOUT, p_vout = vout_Request( p_vdec->p_fifo, NULL,
FIND_CHILD ); i_width, i_height, i_chroma, i_aspect );
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 );
}
return( p_vout ); return p_vout;
} }
/* FIXME FIXME FIXME this is a big shit /* FIXME FIXME FIXME this is a big shit
...@@ -722,19 +661,12 @@ usenextdata: ...@@ -722,19 +661,12 @@ usenextdata:
if( !p_vdec->b_direct_rendering ) if( !p_vdec->b_direct_rendering )
{ {
/* Check our vout */ p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context );
if( !ffmpeg_CheckVout( p_vdec->p_vout, if( !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 ); msg_Err( p_vdec->p_fifo, "cannot create vout" );
if( !p_vdec->p_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 */ /* Get a new picture */
...@@ -811,12 +743,8 @@ void E_( EndThread_Video )( vdec_thread_t *p_vdec ) ...@@ -811,12 +743,8 @@ void E_( EndThread_Video )( vdec_thread_t *p_vdec )
p_vdec->p_pp = NULL; p_vdec->p_pp = NULL;
} }
if( p_vdec->p_vout != NULL ) /* 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 );
/* 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 );
}
} }
/***************************************************************************** /*****************************************************************************
...@@ -904,18 +832,12 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *avctx, int width, ...@@ -904,18 +832,12 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *avctx, int width,
picture_t *p_pic; picture_t *p_pic;
/* Check our vout */ /* Check our vout */
if( !ffmpeg_CheckVout( p_vdec->p_vout, p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context );
p_vdec->p_context->width, if( !p_vdec->p_vout )
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 ); msg_Err( p_vdec->p_fifo, "cannot create vout" );
if( !p_vdec->p_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 */ /* Get a new picture */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing * vpar_headers.c : headers parsing
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -311,8 +311,6 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) ...@@ -311,8 +311,6 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
int i_aspect; int i_aspect;
vout_thread_t *p_vout;
p_vpar->sequence.i_width = GetBits( &p_vpar->bit_stream, 12 ); p_vpar->sequence.i_width = GetBits( &p_vpar->bit_stream, 12 );
p_vpar->sequence.i_height = 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 ); i_aspect = GetBits( &p_vpar->bit_stream, 4 );
...@@ -479,39 +477,11 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) ...@@ -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, /* 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. */ * 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 ); p_vpar->p_vout =
if( p_vout == NULL ) vout_Request( p_vpar->p_fifo, p_vpar->p_vout,
{ p_vpar->sequence.i_width, p_vpar->sequence.i_height,
p_vout = vlc_object_find( p_vpar->p_fifo, VLC_OBJECT_VOUT, ChromaToFourCC( p_vpar->sequence.i_chroma_format ),
FIND_ANYWHERE ); p_vpar->sequence.i_aspect );
}
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;
if( p_vpar->p_fifo->b_die || p_vpar->p_fifo->b_error ) 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 ) ...@@ -520,21 +490,9 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
if( p_vpar->p_vout == NULL ) if( p_vpar->p_vout == NULL )
{ {
msg_Dbg( p_vpar->p_fifo, "no vout present, spawning one" ); msg_Err( p_vpar->p_fifo, "cannot open vout, aborting" );
p_vpar->p_fifo->b_error = 1;
p_vpar->p_vout = vout_CreateThread( p_vpar->p_fifo, return;
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;
}
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video_parser.c : video parser thread * video_parser.c : video parser thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -299,28 +299,23 @@ static void EndThread( vpar_thread_t *p_vpar ) ...@@ -299,28 +299,23 @@ static void EndThread( vpar_thread_t *p_vpar )
times( &cpu_usage ); times( &cpu_usage );
#endif #endif
if( p_vpar->p_vout != NULL ) /* Release used video buffers. */
if( p_vpar->sequence.p_forward != NULL )
{ {
/* Release used video buffers. */ vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_forward );
if( p_vpar->sequence.p_forward != NULL ) }
{ if( p_vpar->sequence.p_backward != NULL )
vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_forward ); {
} vout_DatePicture( p_vpar->p_vout, p_vpar->sequence.p_backward,
if( p_vpar->sequence.p_backward != NULL ) vpar_SynchroDate( p_vpar ) );
{ vout_UnlinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward );
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 );
} }
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)", msg_Dbg( p_vpar->p_fifo, "%d loops among %d sequence(s)",
p_vpar->c_loops, p_vpar->c_sequences ); p_vpar->c_loops, p_vpar->c_sequences );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* tarkin.c: tarkin decoder module making use of libtarkin. * tarkin.c: tarkin decoder module making use of libtarkin.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -87,7 +87,7 @@ static void DecodePacket ( dec_thread_t * ); ...@@ -87,7 +87,7 @@ static void DecodePacket ( dec_thread_t * );
static int GetOggPacket ( dec_thread_t *, ogg_packet *, mtime_t * ); static int GetOggPacket ( dec_thread_t *, ogg_packet *, mtime_t * );
static void tarkin_CopyPicture( dec_thread_t *, picture_t *, uint8_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 * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -135,6 +135,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo ) ...@@ -135,6 +135,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
memset( p_dec, 0, sizeof(dec_thread_t) ); memset( p_dec, 0, sizeof(dec_thread_t) );
p_dec->p_fifo = p_fifo; p_dec->p_fifo = p_fifo;
p_dec->p_pes = NULL; p_dec->p_pes = NULL;
p_dec->p_vout = NULL;
/* Take care of the initial Tarkin header */ /* Take care of the initial Tarkin header */
p_dec->tarkin_stream = tarkin_stream_new(); p_dec->tarkin_stream = tarkin_stream_new();
...@@ -249,8 +250,8 @@ static void DecodePacket( dec_thread_t *p_dec ) ...@@ -249,8 +250,8 @@ static void DecodePacket( dec_thread_t *p_dec )
break; break;
} }
i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height; i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
p_dec->p_vout = tarkin_SpawnVout( p_dec, i_width, i_height, p_dec->p_vout = vout_Request( p_dec->p_fifo, p_dec->p_vout,
i_aspect, i_chroma ); i_width, i_height, i_aspect, i_chroma );
/* Get a new picture */ /* Get a new picture */
while( !(p_pic = vout_CreatePicture( p_dec->p_vout, 0, 0, 0 ) ) ) while( !(p_pic = vout_CreatePicture( p_dec->p_vout, 0, 0, 0 ) ) )
...@@ -312,11 +313,7 @@ static void CloseDecoder( dec_thread_t * p_dec ) ...@@ -312,11 +313,7 @@ static void CloseDecoder( dec_thread_t * p_dec )
if( p_dec->p_pes ) if( p_dec->p_pes )
input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_dec->p_pes ); input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_dec->p_pes );
if( p_dec->p_vout ) vout_Request( p_dec, p_dec->p_vout, 0, 0, 0, 0 );
{
vlc_object_detach( p_dec->p_vout );
vout_DestroyThread( p_dec->p_vout );
}
if( p_dec->tarkin_stream ) if( p_dec->tarkin_stream )
tarkin_stream_destroy( p_dec->tarkin_stream ); tarkin_stream_destroy( p_dec->tarkin_stream );
...@@ -325,67 +322,6 @@ static void CloseDecoder( dec_thread_t * p_dec ) ...@@ -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 );
vlc_object_attach( p_vout, p_dec->p_fifo );
vlc_object_release( p_vout );
}
}
if( p_vout == NULL )
{
msg_Dbg( p_dec->p_fifo, "no vout present, spawning one" );
p_vout = vout_CreateThread( p_dec->p_fifo,
i_width, i_height,
i_chroma, i_aspect );
}
return( p_vout );
}
/***************************************************************************** /*****************************************************************************
* tarkin_CopyPicture: copy a picture from tarkin internal buffers to a * tarkin_CopyPicture: copy a picture from tarkin internal buffers to a
* picture_t structure. * picture_t structure.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* theora.c: theora decoder module making use of libtheora. * theora.c: theora decoder module making use of libtheora.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: theora.c,v 1.1 2002/11/20 14:09:57 gbazin Exp $ * $Id: theora.c,v 1.2 2002/11/28 17:34:59 sam Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -76,7 +76,7 @@ static void DecodePacket ( dec_thread_t * ); ...@@ -76,7 +76,7 @@ static void DecodePacket ( dec_thread_t * );
static int GetOggPacket ( dec_thread_t *, ogg_packet *, mtime_t * ); static int GetOggPacket ( dec_thread_t *, ogg_packet *, mtime_t * );
static void theora_CopyPicture( dec_thread_t *, picture_t *, yuv_buffer * ); static void theora_CopyPicture( dec_thread_t *, picture_t *, yuv_buffer * );
static vout_thread_t *theora_SpawnVout( dec_thread_t *, int, int, int, int );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
...@@ -124,6 +124,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo ) ...@@ -124,6 +124,7 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
memset( p_dec, 0, sizeof(dec_thread_t) ); memset( p_dec, 0, sizeof(dec_thread_t) );
p_dec->p_fifo = p_fifo; p_dec->p_fifo = p_fifo;
p_dec->p_pes = NULL; p_dec->p_pes = NULL;
p_dec->p_vout = NULL;
/* Take care of the initial Theora header */ /* Take care of the initial Theora header */
if( GetOggPacket( p_dec, &oggpacket, &i_pts ) != VLC_SUCCESS ) if( GetOggPacket( p_dec, &oggpacket, &i_pts ) != VLC_SUCCESS )
...@@ -152,8 +153,9 @@ static int RunDecoder( decoder_fifo_t *p_fifo ) ...@@ -152,8 +153,9 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
i_chroma = VLC_FOURCC('Y','V','1','2'); i_chroma = VLC_FOURCC('Y','V','1','2');
p_dec->p_vout = theora_SpawnVout( p_dec, p_dec->ti.width, p_dec->ti.height, p_dec->p_vout = vout_Request( p_dec->p_fifo, p_dec->p_vout,
i_aspect, i_chroma ); p_dec->ti.width, p_dec->ti.height,
i_aspect, i_chroma );
/* theora decoder thread's main loop */ /* theora decoder thread's main loop */
while( (!p_dec->p_fifo->b_die) && (!p_dec->p_fifo->b_error) ) while( (!p_dec->p_fifo->b_die) && (!p_dec->p_fifo->b_error) )
...@@ -263,77 +265,12 @@ static void CloseDecoder( dec_thread_t * p_dec ) ...@@ -263,77 +265,12 @@ static void CloseDecoder( dec_thread_t * p_dec )
if( p_dec->p_pes ) if( p_dec->p_pes )
input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_dec->p_pes ); input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_dec->p_pes );
if( p_dec->p_vout ) vout_Request( p_dec->p_fifo, p_dec->p_vout, 0, 0, 0, 0 );
{
vlc_object_detach( p_dec->p_vout );
vout_DestroyThread( p_dec->p_vout );
}
free( p_dec ); free( p_dec );
} }
} }
/*****************************************************************************
* theora_SpawnVout: creates a new video output
*****************************************************************************/
static vout_thread_t *theora_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 );
vlc_object_attach( p_vout, p_dec->p_fifo );
vlc_object_release( p_vout );
}
}
if( p_vout == NULL )
{
msg_Dbg( p_dec->p_fifo, "no vout present, spawning one" );
p_vout = vout_CreateThread( p_dec->p_fifo,
i_width, i_height,
i_chroma, i_aspect );
}
return( p_vout );
}
/***************************************************************************** /*****************************************************************************
* theora_CopyPicture: copy a picture from theora internal buffers to a * theora_CopyPicture: copy a picture from theora internal buffers to a
* picture_t structure. * picture_t structure.
......
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
* xvid.c: a decoder for libxvidcore, the Xvid video codec * xvid.c: a decoder for libxvidcore, the Xvid video codec
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: xvid.c,v 1.2 2002/11/06 09:26:25 sam Exp $ * $Id: xvid.c,v 1.3 2002/11/28 17:34:59 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
...@@ -48,7 +48,7 @@ vlc_module_begin(); ...@@ -48,7 +48,7 @@ vlc_module_begin();
set_description( _("Xvid video decoder") ); set_description( _("Xvid video decoder") );
set_capability( "decoder", 50 ); set_capability( "decoder", 50 );
set_callbacks( OpenDecoder, NULL ); set_callbacks( OpenDecoder, NULL );
add_bool( "xvid-direct-render", 0, NULL, "direct rendering", add_bool( "xvid-direct-render", 0, NULL, "direct rendering",
"Use libxvidcore's direct rendering feature." ); "Use libxvidcore's direct rendering feature." );
vlc_module_end(); vlc_module_end();
...@@ -147,51 +147,18 @@ static int RunDecoder ( decoder_fifo_t *p_fifo ) ...@@ -147,51 +147,18 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
/* Spawn a video output if there is none. First we look amongst our /* 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 */ * children, then we look for any other vout that might be available */
p_vout = vlc_object_find( p_fifo, VLC_OBJECT_VOUT, FIND_CHILD ); p_vout = vout_Request( p_fifo, NULL,
if( !p_vout ) i_width, i_height, i_chroma, i_aspect );
{
p_vout = vlc_object_find( 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 );
vlc_object_attach( p_vout, p_fifo );
vlc_object_release( p_vout );
}
}
if( !p_vout ) if( !p_vout )
{ {
msg_Dbg( p_fifo, "no vout present, spawning one" ); msg_Err( p_fifo, "could not spawn vout" );
p_fifo->b_error = VLC_TRUE;
p_vout = vout_CreateThread( p_fifo, xvid_decore( p_xvid, XVID_DEC_DESTROY, NULL, NULL );
i_width, i_height, free( p_buffer );
i_chroma, i_aspect ); CloseBitstream( &bit_stream );
if( !p_vout ) DecoderError( p_fifo );
{ return VLC_EGENERIC;
msg_Err( p_fifo, "could not spawn vout" );
p_fifo->b_error = VLC_TRUE;
xvid_decore( p_xvid, XVID_DEC_DESTROY, NULL, NULL );
free( p_buffer );
CloseBitstream( &bit_stream );
DecoderError( p_fifo );
return VLC_EGENERIC;
}
} }
/* Main loop */ /* Main loop */
...@@ -278,8 +245,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo ) ...@@ -278,8 +245,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
} }
/* Clean up everything */ /* Clean up everything */
vlc_object_detach( p_vout ); vout_Request( p_fifo, p_vout, 0, 0, 0, 0 );
vout_DestroyThread( p_vout );
xvid_decore( p_xvid, XVID_DEC_DESTROY, NULL, NULL ); xvid_decore( p_xvid, XVID_DEC_DESTROY, NULL, NULL );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin * intf.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: intf.m,v 1.4 2002/11/05 03:57:16 jlj Exp $ * $Id: intf.m,v 1.5 2002/11/28 17:35:01 sam Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -434,7 +434,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -434,7 +434,7 @@ static void Run( intf_thread_t *p_intf )
{ {
vlc_object_detach( p_vout ); vlc_object_detach( p_vout );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
vout_DestroyThread( p_vout ); vout_Destroy( p_vout );
} }
if( o_prefs != nil ) if( o_prefs != nil )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* adjust.c : Contrast/Hue/Saturation/Brightness video plugin for vlc * adjust.c : Contrast/Hue/Saturation/Brightness video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: adjust.c,v 1.1 2002/11/23 00:11:17 garf Exp $ * $Id: adjust.c,v 1.2 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Simon Latapie <garf@via.ecp.fr>, Samuel Hocevar <sam@zoy.org> * Authors: Simon Latapie <garf@via.ecp.fr>, Samuel Hocevar <sam@zoy.org>
* *
...@@ -137,10 +137,9 @@ static int Init( vout_thread_t *p_vout ) ...@@ -137,10 +137,9 @@ static int Init( vout_thread_t *p_vout )
/* Try to open the real video output */ /* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" ); msg_Dbg( p_vout, "spawning the real video output" );
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout = vout_Create( p_vout,
vout_CreateThread( p_vout, p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_width, p_vout->render.i_height, p_vout->render.i_chroma, p_vout->render.i_aspect );
p_vout->render.i_chroma, p_vout->render.i_aspect );
/* Everything failed */ /* Everything failed */
if( p_vout->p_sys->p_vout == NULL ) if( p_vout->p_sys->p_vout == NULL )
...@@ -179,7 +178,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -179,7 +178,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_thread_t *p_vout = (vout_thread_t *)p_this;
vout_DestroyThread( p_vout->p_sys->p_vout ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* clone.c : Clone video plugin for vlc * clone.c : Clone video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: clone.c,v 1.2 2002/11/23 02:40:30 sam Exp $ * $Id: clone.c,v 1.3 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -135,8 +135,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -135,8 +135,7 @@ static int Init( vout_thread_t *p_vout )
for( i_vout = 0; i_vout < p_vout->p_sys->i_clones; i_vout++ ) for( i_vout = 0; i_vout < p_vout->p_sys->i_clones; i_vout++ )
{ {
p_vout->p_sys->pp_vout[ i_vout ] = p_vout->p_sys->pp_vout[ i_vout ] = vout_Create( p_vout,
vout_CreateThread( p_vout,
p_vout->render.i_width, p_vout->render.i_height, p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect ); p_vout->render.i_chroma, p_vout->render.i_aspect );
if( p_vout->p_sys->pp_vout[ i_vout ] == NULL ) if( p_vout->p_sys->pp_vout[ i_vout ] == NULL )
...@@ -250,7 +249,7 @@ static void RemoveAllVout( vout_thread_t *p_vout ) ...@@ -250,7 +249,7 @@ static void RemoveAllVout( vout_thread_t *p_vout )
while( p_vout->p_sys->i_clones ) while( p_vout->p_sys->i_clones )
{ {
--p_vout->p_sys->i_clones; --p_vout->p_sys->i_clones;
vout_DestroyThread( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones] ); vout_Destroy( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones] );
} }
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* crop.c : Crop video plugin for vlc * crop.c : Crop video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: crop.c,v 1.3 2002/11/23 02:40:30 sam Exp $ * $Id: crop.c,v 1.4 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -232,8 +232,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -232,8 +232,7 @@ static int Init( vout_thread_t *p_vout )
* p_vout->p_sys->i_width / p_vout->output.i_width; * p_vout->p_sys->i_width / p_vout->output.i_width;
/* Try to open the real video output */ /* Try to open the real video output */
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout = vout_Create( p_vout,
vout_CreateThread( p_vout,
p_vout->p_sys->i_width, p_vout->p_sys->i_height, p_vout->p_sys->i_width, p_vout->p_sys->i_height,
p_vout->render.i_chroma, p_vout->p_sys->i_aspect ); p_vout->render.i_chroma, p_vout->p_sys->i_aspect );
if( p_vout->p_sys->p_vout == NULL ) if( p_vout->p_sys->p_vout == NULL )
...@@ -271,7 +270,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -271,7 +270,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_thread_t *p_vout = (vout_thread_t *)p_this;
vout_DestroyThread( p_vout->p_sys->p_vout ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
...@@ -288,10 +287,9 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -288,10 +287,9 @@ static int Manage( vout_thread_t *p_vout )
return 0; return 0;
} }
vout_DestroyThread( p_vout->p_sys->p_vout ); vout_Destroy( p_vout->p_sys->p_vout );
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout = vout_Create( p_vout,
vout_CreateThread( p_vout,
p_vout->p_sys->i_width, p_vout->p_sys->i_height, p_vout->p_sys->i_width, p_vout->p_sys->i_height,
p_vout->render.i_chroma, p_vout->p_sys->i_aspect ); p_vout->render.i_chroma, p_vout->p_sys->i_aspect );
if( p_vout->p_sys->p_vout == NULL ) if( p_vout->p_sys->p_vout == NULL )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* deinterlace.c : deinterlacer plugin for vlc * deinterlace.c : deinterlacer plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: deinterlace.c,v 1.4 2002/10/16 11:35:52 sam Exp $ * $Id: deinterlace.c,v 1.5 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -210,7 +210,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -210,7 +210,7 @@ static int Init( vout_thread_t *p_vout )
case DEINTERLACE_MEAN: case DEINTERLACE_MEAN:
case DEINTERLACE_DISCARD: case DEINTERLACE_DISCARD:
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout =
vout_CreateThread( p_vout, vout_Create( p_vout,
p_vout->output.i_width, p_vout->output.i_height / 2, p_vout->output.i_width, p_vout->output.i_height / 2,
p_vout->output.i_chroma, p_vout->output.i_aspect ); p_vout->output.i_chroma, p_vout->output.i_aspect );
break; break;
...@@ -219,7 +219,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -219,7 +219,7 @@ static int Init( vout_thread_t *p_vout )
case DEINTERLACE_BLEND: case DEINTERLACE_BLEND:
case DEINTERLACE_LINEAR: case DEINTERLACE_LINEAR:
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout =
vout_CreateThread( p_vout, vout_Create( p_vout,
p_vout->output.i_width, p_vout->output.i_height, p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_chroma, p_vout->output.i_aspect ); p_vout->output.i_chroma, p_vout->output.i_aspect );
break; break;
...@@ -228,7 +228,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -228,7 +228,7 @@ static int Init( vout_thread_t *p_vout )
case VLC_FOURCC('I','4','2','2'): case VLC_FOURCC('I','4','2','2'):
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout =
vout_CreateThread( p_vout, vout_Create( p_vout,
p_vout->output.i_width, p_vout->output.i_height, p_vout->output.i_width, p_vout->output.i_height,
VLC_FOURCC('I','4','2','0'), p_vout->output.i_aspect ); VLC_FOURCC('I','4','2','0'), p_vout->output.i_aspect );
break; break;
...@@ -274,7 +274,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -274,7 +274,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_thread_t *p_vout = (vout_thread_t *)p_this;
vout_DestroyThread( p_vout->p_sys->p_vout ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* distort.c : Misc video effects plugin for vlc * distort.c : Misc video effects plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: distort.c,v 1.3 2002/11/23 02:40:30 sam Exp $ * $Id: distort.c,v 1.4 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -183,8 +183,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -183,8 +183,7 @@ static int Init( vout_thread_t *p_vout )
/* Try to open the real video output */ /* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" ); msg_Dbg( p_vout, "spawning the real video output" );
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout = vout_Create( p_vout,
vout_CreateThread( p_vout,
p_vout->render.i_width, p_vout->render.i_height, p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect ); p_vout->render.i_chroma, p_vout->render.i_aspect );
...@@ -195,7 +194,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -195,7 +194,7 @@ static int Init( vout_thread_t *p_vout )
return( 0 ); return( 0 );
} }
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES ); ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
p_vout->p_sys->f_angle = 0.0; p_vout->p_sys->f_angle = 0.0;
...@@ -228,7 +227,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -228,7 +227,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_thread_t *p_vout = (vout_thread_t *)p_this;
vout_DestroyThread( p_vout->p_sys->p_vout ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* invert.c : Invert video plugin for vlc * invert.c : Invert video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: invert.c,v 1.2 2002/11/23 02:40:30 sam Exp $ * $Id: invert.c,v 1.3 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -108,8 +108,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -108,8 +108,7 @@ static int Init( vout_thread_t *p_vout )
/* Try to open the real video output */ /* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" ); msg_Dbg( p_vout, "spawning the real video output" );
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout = vout_Create( p_vout,
vout_CreateThread( p_vout,
p_vout->render.i_width, p_vout->render.i_height, p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect ); p_vout->render.i_chroma, p_vout->render.i_aspect );
...@@ -150,7 +149,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -150,7 +149,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_thread_t *p_vout = (vout_thread_t *)p_this;
vout_DestroyThread( p_vout->p_sys->p_vout ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* motion_blur.c : motion blur filter for vlc * motion_blur.c : motion blur filter for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: motionblur.c,v 1.3 2002/11/23 02:40:30 sam Exp $ * $Id: motionblur.c,v 1.4 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -144,10 +144,9 @@ static int Init( vout_thread_t *p_vout ) ...@@ -144,10 +144,9 @@ static int Init( vout_thread_t *p_vout )
case VLC_FOURCC('I','4','2','0'): case VLC_FOURCC('I','4','2','0'):
case VLC_FOURCC('I','Y','U','V'): case VLC_FOURCC('I','Y','U','V'):
case VLC_FOURCC('Y','V','1','2'): case VLC_FOURCC('Y','V','1','2'):
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout = vout_Create( p_vout,
vout_CreateThread( p_vout, p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_width, p_vout->output.i_height, p_vout->output.i_chroma, p_vout->output.i_aspect );
p_vout->output.i_chroma, p_vout->output.i_aspect );
break; break;
default: default:
break; break;
...@@ -190,7 +189,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -190,7 +189,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_thread_t *p_vout = (vout_thread_t *)p_this;
vout_DestroyThread( p_vout->p_sys->p_vout ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* transform.c : transform image plugin for vlc * transform.c : transform image plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: transform.c,v 1.3 2002/11/23 02:40:30 sam Exp $ * $Id: transform.c,v 1.4 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -174,8 +174,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -174,8 +174,7 @@ static int Init( vout_thread_t *p_vout )
if( p_vout->p_sys->b_rotation ) if( p_vout->p_sys->b_rotation )
{ {
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout = vout_Create( p_vout,
vout_CreateThread( p_vout,
p_vout->render.i_height, p_vout->render.i_width, p_vout->render.i_height, p_vout->render.i_width,
p_vout->render.i_chroma, p_vout->render.i_chroma,
(u64)VOUT_ASPECT_FACTOR * (u64)VOUT_ASPECT_FACTOR (u64)VOUT_ASPECT_FACTOR * (u64)VOUT_ASPECT_FACTOR
...@@ -183,8 +182,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -183,8 +182,7 @@ static int Init( vout_thread_t *p_vout )
} }
else else
{ {
p_vout->p_sys->p_vout = p_vout->p_sys->p_vout = vout_Create( p_vout,
vout_CreateThread( p_vout,
p_vout->render.i_width, p_vout->render.i_height, p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect ); p_vout->render.i_chroma, p_vout->render.i_aspect );
} }
...@@ -225,7 +223,7 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -225,7 +223,7 @@ static void Destroy( vlc_object_t *p_this )
{ {
vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_thread_t *p_vout = (vout_thread_t *)p_this;
vout_DestroyThread( p_vout->p_sys->p_vout ); vout_Destroy( p_vout->p_sys->p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wall.c : Wall video plugin for vlc * wall.c : Wall video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: wall.c,v 1.3 2002/11/23 02:40:30 sam Exp $ * $Id: wall.c,v 1.4 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -248,11 +248,11 @@ static int Init( vout_thread_t *p_vout ) ...@@ -248,11 +248,11 @@ static int Init( vout_thread_t *p_vout )
} }
p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout = p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout =
vout_CreateThread( p_vout, i_width, i_height, vout_Create( p_vout, i_width, i_height,
p_vout->render.i_chroma, p_vout->render.i_chroma,
p_vout->render.i_aspect p_vout->render.i_aspect
* p_vout->render.i_height / i_height * p_vout->render.i_height / i_height
* i_width / p_vout->render.i_width ); * i_width / p_vout->render.i_width );
if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout == NULL ) if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout == NULL )
{ {
msg_Err( p_vout, "failed to get %ix%i vout threads", msg_Err( p_vout, "failed to get %ix%i vout threads",
...@@ -413,7 +413,7 @@ static void RemoveAllVout( vout_thread_t *p_vout ) ...@@ -413,7 +413,7 @@ static void RemoveAllVout( vout_thread_t *p_vout )
--p_vout->p_sys->i_vout; --p_vout->p_sys->i_vout;
if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active ) if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].b_active )
{ {
vout_DestroyThread( vout_Destroy(
p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout ); p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source * libvlc.c: main libvlc source
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.47 2002/11/14 15:07:49 sigmunau Exp $ * $Id: libvlc.c,v 1.48 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -830,7 +830,7 @@ int VLC_Stop( int i_object ) ...@@ -830,7 +830,7 @@ int VLC_Stop( int i_object )
{ {
vlc_object_detach( p_vout ); vlc_object_detach( p_vout );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
vout_DestroyThread( p_vout ); vout_Destroy( p_vout );
} }
/* /*
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread. * thread, and destroy a previously oppened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.201 2002/11/28 14:34:39 sam Exp $ * $Id: video_output.c,v 1.202 2002/11/28 17:35:00 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -57,16 +57,83 @@ static void MaskToShift ( int *, int *, uint32_t ); ...@@ -57,16 +57,83 @@ static void MaskToShift ( int *, int *, uint32_t );
static void InitWindowSize ( vout_thread_t *, int *, int * ); static void InitWindowSize ( vout_thread_t *, int *, int * );
/***************************************************************************** /*****************************************************************************
* vout_CreateThread: creates a new video output thread * vout_Request: find a video output thread, create one, or destroy one.
*****************************************************************************
* This function looks for a video output thread matching the current
* properties. If not found, it spawns a new one.
*****************************************************************************/
vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
unsigned int i_width, unsigned int i_height,
vlc_fourcc_t i_chroma, unsigned int i_aspect )
{
if( !i_width || !i_height || !i_chroma )
{
/* Reattach video output to p_vlc before bailing out */
if( p_vout )
{
vlc_object_detach( p_vout );
vlc_object_attach( p_vout, p_this->p_vlc );
}
return NULL;
}
/* If a video output was provided, lock it, otherwise look for one. */
if( p_vout )
{
vlc_object_yield( p_vout );
}
else
{
p_vout = vlc_object_find( p_this, VLC_OBJECT_VOUT, FIND_CHILD );
if( !p_vout )
{
p_vout = vlc_object_find( p_this, VLC_OBJECT_VOUT, FIND_ANYWHERE );
}
}
/* If we now have a video output, check it has the right properties */
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 ) )
{
/* We are not interested in this format, close this vout */
vlc_object_detach( p_vout );
vlc_object_release( p_vout );
vout_Destroy( p_vout );
p_vout = NULL;
}
else
{
/* This video output is cool! Hijack it. */
vlc_object_detach( p_vout );
vlc_object_attach( p_vout, p_this );
vlc_object_release( p_vout );
}
}
if( !p_vout )
{
msg_Dbg( p_this, "no usable vout present, spawning one" );
p_vout = vout_Create( p_this, i_width, i_height, i_chroma, i_aspect );
}
return p_vout;
}
/*****************************************************************************
* vout_Create: creates a new video output thread
***************************************************************************** *****************************************************************************
* This function creates a new video output thread, and returns a pointer * This function creates a new video output thread, and returns a pointer
* to its description. On error, it returns NULL. * to its description. On error, it returns NULL.
*****************************************************************************/ *****************************************************************************/
vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent, vout_thread_t * __vout_Create( vlc_object_t *p_parent,
unsigned int i_width, unsigned int i_width, unsigned int i_height,
unsigned int i_height, vlc_fourcc_t i_chroma, unsigned int i_aspect )
vlc_fourcc_t i_chroma,
unsigned int i_aspect )
{ {
vout_thread_t * p_vout; /* thread descriptor */ vout_thread_t * p_vout; /* thread descriptor */
int i_index; /* loop variable */ int i_index; /* loop variable */
...@@ -253,17 +320,17 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent, ...@@ -253,17 +320,17 @@ vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent,
} }
/***************************************************************************** /*****************************************************************************
* vout_DestroyThread: destroys a previously created thread * vout_Destroy: destroys a previously created video output
***************************************************************************** *****************************************************************************
* Destroy a terminated thread. * Destroy a terminated thread.
* The function will request a destruction of the specified thread. If pi_error * The function will request a destruction of the specified thread. If pi_error
* is NULL, it will return once the thread is destroyed. Else, it will be * is NULL, it will return once the thread is destroyed. Else, it will be
* update using one of the THREAD_* constants. * update using one of the THREAD_* constants.
*****************************************************************************/ *****************************************************************************/
void vout_DestroyThread( vout_thread_t *p_vout ) void vout_Destroy( vout_thread_t *p_vout )
{ {
/* Request thread destruction */ /* Request thread destruction */
p_vout->b_die = 1; p_vout->b_die = VLC_TRUE;
vlc_thread_join( p_vout ); vlc_thread_join( p_vout );
/* Free structure */ /* Free structure */
...@@ -314,6 +381,7 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -314,6 +381,7 @@ static int InitThread( vout_thread_t *p_vout )
msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES ); msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES );
#if 0
if( !p_vout->psz_filter_chain ) if( !p_vout->psz_filter_chain )
{ {
char *psz_aspect = config_GetPsz( p_vout, "pixel-ratio" ); char *psz_aspect = config_GetPsz( p_vout, "pixel-ratio" );
...@@ -334,6 +402,7 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -334,6 +402,7 @@ static int InitThread( vout_thread_t *p_vout )
} }
} }
} }
#endif
i_pgcd = ReduceHeight( p_vout->render.i_aspect ); i_pgcd = ReduceHeight( p_vout->render.i_aspect );
msg_Dbg( p_vout, msg_Dbg( p_vout,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_pictures.h : picture management definitions * vout_pictures.h : picture management definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: vout_pictures.h,v 1.2 2002/07/31 20:56:53 sam Exp $ * $Id: vout_pictures.h,v 1.3 2002/11/28 17:35:01 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -32,16 +32,16 @@ ...@@ -32,16 +32,16 @@
/* Packed RGB for 16, 24, 32bpp */ /* Packed RGB for 16, 24, 32bpp */
#define FOURCC_BI_BITFIELDS 0x00000003 #define FOURCC_BI_BITFIELDS 0x00000003
/* Packed RGB 15bpp, 0x1f, 0x7e0, 0xf800 */ /* Packed RGB 15bpp, usually 0x7c00, 0x03e0, 0x001f */
#define FOURCC_RV15 VLC_FOURCC('R','V','1','5') #define FOURCC_RV15 VLC_FOURCC('R','V','1','5')
/* Packed RGB 16bpp, 0x1f, 0x3e0, 0x7c00 */ /* Packed RGB 16bpp, usually 0xf800, 0x07e0, 0x001f */
#define FOURCC_RV16 VLC_FOURCC('R','V','1','6') #define FOURCC_RV16 VLC_FOURCC('R','V','1','6')
/* Packed RGB 24bpp, 0xff, 0xff00, 0xff0000 */ /* Packed RGB 24bpp, usually 0x00ff0000, 0x0000ff00, 0x000000ff */
#define FOURCC_RV24 VLC_FOURCC('R','V','2','4') #define FOURCC_RV24 VLC_FOURCC('R','V','2','4')
/* Packed RGB 32bpp, 0xff, 0xff00, 0xff0000 */ /* Packed RGB 32bpp, usually 0x00ff0000, 0x0000ff00, 0x000000ff */
#define FOURCC_RV32 VLC_FOURCC('R','V','3','2') #define FOURCC_RV32 VLC_FOURCC('R','V','3','2')
/* Planar YUV 4:2:0, Y:U:V */ /* Planar YUV 4:2:0, Y:U:V */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment