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 );
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
* picture_t structure.
......
......@@ -2,7 +2,7 @@
* theora.c: theora decoder module making use of libtheora.
*****************************************************************************
* 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>
*
......@@ -76,7 +76,7 @@ static void DecodePacket ( dec_thread_t * );
static int GetOggPacket ( dec_thread_t *, ogg_packet *, mtime_t * );
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
*****************************************************************************/
......@@ -124,6 +124,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 Theora header */
if( GetOggPacket( p_dec, &oggpacket, &i_pts ) != VLC_SUCCESS )
......@@ -152,8 +153,9 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
i_chroma = VLC_FOURCC('Y','V','1','2');
p_dec->p_vout = theora_SpawnVout( p_dec, p_dec->ti.width, p_dec->ti.height,
i_aspect, i_chroma );
p_dec->p_vout = vout_Request( p_dec->p_fifo, p_dec->p_vout,
p_dec->ti.width, p_dec->ti.height,
i_aspect, i_chroma );
/* theora decoder thread's main loop */
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 )
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_fifo, p_dec->p_vout, 0, 0, 0, 0 );
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
* picture_t structure.
......
......@@ -2,15 +2,15 @@
* xvid.c: a decoder for libxvidcore, the Xvid video codec
*****************************************************************************
* 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>
*
*
* 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
......@@ -48,7 +48,7 @@ vlc_module_begin();
set_description( _("Xvid video decoder") );
set_capability( "decoder", 50 );
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." );
vlc_module_end();
......@@ -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
* 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 != 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 );
}
}
p_vout = vout_Request( p_fifo, NULL,
i_width, i_height, i_chroma, i_aspect );
if( !p_vout )
{
msg_Dbg( p_fifo, "no vout present, spawning one" );
p_vout = vout_CreateThread( p_fifo,
i_width, i_height,
i_chroma, i_aspect );
if( !p_vout )
{
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;
}
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 */
......@@ -278,8 +245,7 @@ static int RunDecoder ( decoder_fifo_t *p_fifo )
}
/* Clean up everything */
vlc_object_detach( p_vout );
vout_DestroyThread( p_vout );
vout_Request( p_fifo, p_vout, 0, 0, 0, 0 );
xvid_decore( p_xvid, XVID_DEC_DESTROY, NULL, NULL );
......
......@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* 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>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -434,7 +434,7 @@ static void Run( intf_thread_t *p_intf )
{
vlc_object_detach( p_vout );
vlc_object_release( p_vout );
vout_DestroyThread( p_vout );
vout_Destroy( p_vout );
}
if( o_prefs != nil )
......
......@@ -2,7 +2,7 @@
* adjust.c : Contrast/Hue/Saturation/Brightness video plugin for vlc
*****************************************************************************
* 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>
*
......@@ -137,10 +137,9 @@ static int Init( vout_thread_t *p_vout )
/* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" );
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
p_vout->p_sys->p_vout = vout_Create( p_vout,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
......@@ -179,7 +178,7 @@ static void Destroy( vlc_object_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 );
}
......
......@@ -2,7 +2,7 @@
* clone.c : Clone video plugin for vlc
*****************************************************************************
* 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>
*
......@@ -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++ )
{
p_vout->p_sys->pp_vout[ i_vout ] =
vout_CreateThread( p_vout,
p_vout->p_sys->pp_vout[ i_vout ] = vout_Create( p_vout,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
if( p_vout->p_sys->pp_vout[ i_vout ] == NULL )
......@@ -250,7 +249,7 @@ static void RemoveAllVout( vout_thread_t *p_vout )
while( 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 @@
* crop.c : Crop video plugin for vlc
*****************************************************************************
* 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>
*
......@@ -232,8 +232,7 @@ static int Init( vout_thread_t *p_vout )
* p_vout->p_sys->i_width / p_vout->output.i_width;
/* Try to open the real video output */
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
p_vout->p_sys->p_vout = vout_Create( p_vout,
p_vout->p_sys->i_width, p_vout->p_sys->i_height,
p_vout->render.i_chroma, p_vout->p_sys->i_aspect );
if( p_vout->p_sys->p_vout == NULL )
......@@ -271,7 +270,7 @@ static void Destroy( vlc_object_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 );
}
......@@ -288,10 +287,9 @@ static int Manage( vout_thread_t *p_vout )
return 0;
}
vout_DestroyThread( p_vout->p_sys->p_vout );
vout_Destroy( p_vout->p_sys->p_vout );
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
p_vout->p_sys->p_vout = vout_Create( p_vout,
p_vout->p_sys->i_width, p_vout->p_sys->i_height,
p_vout->render.i_chroma, p_vout->p_sys->i_aspect );
if( p_vout->p_sys->p_vout == NULL )
......
......@@ -2,7 +2,7 @@
* deinterlace.c : deinterlacer plugin for vlc
*****************************************************************************
* 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>
*
......@@ -210,7 +210,7 @@ static int Init( vout_thread_t *p_vout )
case DEINTERLACE_MEAN:
case DEINTERLACE_DISCARD:
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_chroma, p_vout->output.i_aspect );
break;
......@@ -219,7 +219,7 @@ static int Init( vout_thread_t *p_vout )
case DEINTERLACE_BLEND:
case DEINTERLACE_LINEAR:
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_chroma, p_vout->output.i_aspect );
break;
......@@ -228,7 +228,7 @@ static int Init( vout_thread_t *p_vout )
case VLC_FOURCC('I','4','2','2'):
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
vout_Create( p_vout,
p_vout->output.i_width, p_vout->output.i_height,
VLC_FOURCC('I','4','2','0'), p_vout->output.i_aspect );
break;
......@@ -274,7 +274,7 @@ static void Destroy( vlc_object_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 );
}
......
......@@ -2,7 +2,7 @@
* distort.c : Misc video effects plugin for vlc
*****************************************************************************
* 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>
*
......@@ -183,8 +183,7 @@ static int Init( vout_thread_t *p_vout )
/* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" );
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
p_vout->p_sys->p_vout = vout_Create( p_vout,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
......@@ -195,7 +194,7 @@ static int Init( vout_thread_t *p_vout )
return( 0 );
}
ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
p_vout->p_sys->f_angle = 0.0;
......@@ -228,7 +227,7 @@ static void Destroy( vlc_object_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 );
}
......
......@@ -2,7 +2,7 @@
* invert.c : Invert video plugin for vlc
*****************************************************************************
* 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>
*
......@@ -108,8 +108,7 @@ static int Init( vout_thread_t *p_vout )
/* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" );
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
p_vout->p_sys->p_vout = vout_Create( p_vout,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
......@@ -150,7 +149,7 @@ static void Destroy( vlc_object_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 );
}
......
......@@ -2,7 +2,7 @@
* motion_blur.c : motion blur filter for vlc
*****************************************************************************
* 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>
*
......@@ -144,10 +144,9 @@ static int Init( vout_thread_t *p_vout )
case VLC_FOURCC('I','4','2','0'):
case VLC_FOURCC('I','Y','U','V'):
case VLC_FOURCC('Y','V','1','2'):
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_chroma, p_vout->output.i_aspect );
p_vout->p_sys->p_vout = vout_Create( p_vout,
p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_chroma, p_vout->output.i_aspect );
break;
default:
break;
......@@ -190,7 +189,7 @@ static void Destroy( vlc_object_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 );
}
......
......@@ -2,7 +2,7 @@
* transform.c : transform image plugin for vlc
*****************************************************************************
* 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>
*
......@@ -174,8 +174,7 @@ static int Init( vout_thread_t *p_vout )
if( p_vout->p_sys->b_rotation )
{
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
p_vout->p_sys->p_vout = vout_Create( p_vout,
p_vout->render.i_height, p_vout->render.i_width,
p_vout->render.i_chroma,
(u64)VOUT_ASPECT_FACTOR * (u64)VOUT_ASPECT_FACTOR
......@@ -183,8 +182,7 @@ static int Init( vout_thread_t *p_vout )
}
else
{
p_vout->p_sys->p_vout =
vout_CreateThread( p_vout,
p_vout->p_sys->p_vout = vout_Create( p_vout,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
}
......@@ -225,7 +223,7 @@ static void Destroy( vlc_object_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 );
}
......
......@@ -2,7 +2,7 @@
* wall.c : Wall video plugin for vlc
*****************************************************************************
* 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>
*
......@@ -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 =
vout_CreateThread( p_vout, i_width, i_height,
p_vout->render.i_chroma,
p_vout->render.i_aspect
* p_vout->render.i_height / i_height
* i_width / p_vout->render.i_width );
vout_Create( p_vout, i_width, i_height,
p_vout->render.i_chroma,
p_vout->render.i_aspect
* p_vout->render.i_height / i_height
* i_width / p_vout->render.i_width );
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",
......@@ -413,7 +413,7 @@ static void RemoveAllVout( vout_thread_t *p_vout )
--p_vout->p_sys->i_vout;
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 );
}
}
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -830,7 +830,7 @@ int VLC_Stop( int i_object )
{
vlc_object_detach( p_vout );
vlc_object_release( p_vout );
vout_DestroyThread( p_vout );
vout_Destroy( p_vout );
}
/*
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* 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>
*
......@@ -57,16 +57,83 @@ static void MaskToShift ( int *, int *, uint32_t );
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
* to its description. On error, it returns NULL.
*****************************************************************************/
vout_thread_t * __vout_CreateThread ( vlc_object_t *p_parent,
unsigned int i_width,
unsigned int i_height,
vlc_fourcc_t i_chroma,
unsigned int i_aspect )
vout_thread_t * __vout_Create( vlc_object_t *p_parent,
unsigned int i_width, unsigned int i_height,
vlc_fourcc_t i_chroma, unsigned int i_aspect )
{
vout_thread_t * p_vout; /* thread descriptor */
int i_index; /* loop variable */
......@@ -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.
* 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
* 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 */
p_vout->b_die = 1;
p_vout->b_die = VLC_TRUE;
vlc_thread_join( p_vout );
/* Free structure */
......@@ -314,6 +381,7 @@ static int InitThread( vout_thread_t *p_vout )
msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES );
#if 0
if( !p_vout->psz_filter_chain )
{
char *psz_aspect = config_GetPsz( p_vout, "pixel-ratio" );
......@@ -334,6 +402,7 @@ static int InitThread( vout_thread_t *p_vout )
}
}
}
#endif
i_pgcd = ReduceHeight( p_vout->render.i_aspect );
msg_Dbg( p_vout,
......
......@@ -2,7 +2,7 @@
* vout_pictures.h : picture management definitions
*****************************************************************************
* 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>
*
......@@ -32,16 +32,16 @@
/* Packed RGB for 16, 24, 32bpp */
#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')
/* Packed RGB 16bpp, 0x1f, 0x3e0, 0x7c00 */
/* Packed RGB 16bpp, usually 0xf800, 0x07e0, 0x001f */
#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')
/* Packed RGB 32bpp, 0xff, 0xff00, 0xff0000 */
/* Packed RGB 32bpp, usually 0x00ff0000, 0x0000ff00, 0x000000ff */
#define FOURCC_RV32 VLC_FOURCC('R','V','3','2')
/* 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