Commit 15fb1485 authored by Gildas Bazin's avatar Gildas Bazin

* src/video_output/video_output.c: small bugfix + vout_Create() is now blocking until InitThread() has been run.
* src/video_output/vout_pictures.[ch]: added support for FOURCC I411.
* modules/codec/rawvideo.c: support for more chroma formats.
parent 8c1779bb
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* rawvideo.c: Pseudo audio decoder; for raw video data * rawvideo.c: Pseudo audio decoder; for raw video data
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: rawvideo.c,v 1.2 2003/04/26 12:26:46 gbazin Exp $ * $Id: rawvideo.c,v 1.3 2003/04/27 17:53:20 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -80,9 +80,25 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -80,9 +80,25 @@ static int OpenDecoder( vlc_object_t *p_this )
switch( p_fifo->i_fourcc ) switch( p_fifo->i_fourcc )
{ {
case VLC_FOURCC('I','4','2','0'): /* Planar YUV */
case VLC_FOURCC('I','4','4','4'):
case VLC_FOURCC('I','4','2','2'): case VLC_FOURCC('I','4','2','2'):
case VLC_FOURCC('I','4','2','0'):
case VLC_FOURCC('Y','V','1','2'):
case VLC_FOURCC('I','Y','U','V'):
case VLC_FOURCC('I','4','1','1'):
case VLC_FOURCC('I','4','1','0'):
/* Packed YUV */
case VLC_FOURCC('Y','U','Y','2'): case VLC_FOURCC('Y','U','Y','2'):
case VLC_FOURCC('U','Y','V','Y'):
/* RGB */
case VLC_FOURCC('R','V','3','2'):
case VLC_FOURCC('R','V','2','4'):
case VLC_FOURCC('R','V','1','6'):
case VLC_FOURCC('R','V','1','5'):
p_fifo->pf_run = RunDecoder; p_fifo->pf_run = RunDecoder;
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -145,7 +161,8 @@ static int RunDecoder( decoder_fifo_t *p_fifo ) ...@@ -145,7 +161,8 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
*****************************************************************************/ *****************************************************************************/
static int InitThread( vdec_thread_t * p_vdec ) static int InitThread( vdec_thread_t * p_vdec )
{ {
vlc_fourcc_t i_chroma; picture_t *p_pic;
int i;
#define bih ((BITMAPINFOHEADER*)p_vdec->p_fifo->p_bitmapinfoheader) #define bih ((BITMAPINFOHEADER*)p_vdec->p_fifo->p_bitmapinfoheader)
if( bih == NULL ) if( bih == NULL )
...@@ -162,29 +179,11 @@ static int InitThread( vdec_thread_t * p_vdec ) ...@@ -162,29 +179,11 @@ static int InitThread( vdec_thread_t * p_vdec )
return( VLC_EGENERIC ); return( VLC_EGENERIC );
} }
switch( p_vdec->p_fifo->i_fourcc )
{
case VLC_FOURCC( 'I', '4', '2', '0' ):
i_chroma = VLC_FOURCC( 'I', '4', '2', '0' );
p_vdec->i_raw_size = bih->biWidth * bih->biHeight * 3 / 2;
break;
case VLC_FOURCC( 'I', '4', '2', '2' ):
i_chroma = VLC_FOURCC( 'I', '4', '2', '2' );
p_vdec->i_raw_size = bih->biWidth * bih->biHeight * 2;
break;
case VLC_FOURCC( 'Y', 'U', 'Y', '2' ):
i_chroma = VLC_FOURCC( 'Y', 'U', 'Y', '2' );
p_vdec->i_raw_size = bih->biWidth * bih->biHeight * 2;
break;
default:
msg_Err( p_vdec->p_fifo, "invalid codec=%4.4s", (char*)&p_vdec->p_fifo->i_fourcc );
return( VLC_EGENERIC );
}
p_vdec->p_vout = vout_Request( p_vdec->p_fifo, NULL, p_vdec->p_vout = vout_Request( p_vdec->p_fifo, NULL,
bih->biWidth, bih->biHeight, bih->biWidth, bih->biHeight,
i_chroma, p_vdec->p_fifo->i_fourcc,
VOUT_ASPECT_FACTOR * bih->biWidth / bih->biHeight ); VOUT_ASPECT_FACTOR * bih->biWidth /
bih->biHeight );
if( p_vdec->p_vout == NULL ) if( p_vdec->p_vout == NULL )
{ {
...@@ -192,6 +191,23 @@ static int InitThread( vdec_thread_t * p_vdec ) ...@@ -192,6 +191,23 @@ static int InitThread( vdec_thread_t * p_vdec )
return( VLC_EGENERIC ); return( VLC_EGENERIC );
} }
/* Get a 1 picture to be able to compute p_vdec->i_raw_size */
p_pic = vout_CreatePicture( p_vdec->p_vout, 0, 0, 0 );
if( p_pic == NULL )
{
msg_Err( p_vdec->p_fifo, "failled to get a vout picture" );
return( VLC_EGENERIC );
}
p_vdec->i_raw_size = 0;
for( i = 0; i < p_pic->i_planes; i++ )
{
p_vdec->i_raw_size += p_pic->p[i].i_lines * p_pic->p[i].i_visible_pitch
* p_pic->p[i].i_pixel_pitch;
}
vout_DestroyPicture( p_vdec->p_vout, p_pic );
return( VLC_SUCCESS ); return( VLC_SUCCESS );
#undef bih #undef bih
} }
......
...@@ -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.218 2003/04/14 22:22:32 massiot Exp $ * $Id: video_output.c,v 1.219 2003/04/27 17:53:20 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -394,7 +394,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, ...@@ -394,7 +394,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
vlc_object_attach( p_vout, p_parent ); vlc_object_attach( p_vout, p_parent );
if( vlc_thread_create( p_vout, "video output", RunThread, if( vlc_thread_create( p_vout, "video output", RunThread,
VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE ) ) VLC_THREAD_PRIORITY_OUTPUT, VLC_TRUE ) )
{ {
msg_Err( p_vout, "out of memory" ); msg_Err( p_vout, "out of memory" );
module_Unneed( p_vout, p_vout->p_module ); module_Unneed( p_vout, p_vout->p_module );
...@@ -620,6 +620,10 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -620,6 +620,10 @@ static void RunThread( vout_thread_t *p_vout)
* Initialize thread * Initialize thread
*/ */
p_vout->b_error = InitThread( p_vout ); p_vout->b_error = InitThread( p_vout );
/* signal the creation of the vout */
vlc_thread_ready( p_vout );
if( p_vout->b_error ) if( p_vout->b_error )
{ {
/* Destroy thread structures allocated by Create and InitThread */ /* Destroy thread structures allocated by Create and InitThread */
...@@ -885,7 +889,8 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -885,7 +889,8 @@ static void RunThread( vout_thread_t *p_vout)
} }
/* Need to reinitialise the chroma plugin */ /* Need to reinitialise the chroma plugin */
p_vout->chroma.p_module->pf_deactivate( VLC_OBJECT(p_vout) ); if( p_vout->chroma.p_module->pf_deactivate )
p_vout->chroma.p_module->pf_deactivate( VLC_OBJECT(p_vout) );
p_vout->chroma.p_module->pf_activate( VLC_OBJECT(p_vout) ); p_vout->chroma.p_module->pf_activate( VLC_OBJECT(p_vout) );
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_pictures.c : picture management functions * vout_pictures.c : picture management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* $Id: vout_pictures.c,v 1.37 2003/04/20 12:59:02 massiot Exp $ * $Id: vout_pictures.c,v 1.38 2003/04/27 17:53:21 gbazin 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>
...@@ -448,6 +448,19 @@ void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -448,6 +448,19 @@ void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic,
/* Calculate coordinates */ /* Calculate coordinates */
switch( i_chroma ) switch( i_chroma )
{ {
case FOURCC_I411:
p_pic->p[ Y_PLANE ].i_lines = i_height;
p_pic->p[ Y_PLANE ].i_pitch = i_width;
p_pic->p[ Y_PLANE ].i_visible_pitch = p_pic->p[ Y_PLANE ].i_pitch;
p_pic->p[ U_PLANE ].i_lines = i_height;
p_pic->p[ U_PLANE ].i_pitch = i_width / 4;
p_pic->p[ U_PLANE ].i_visible_pitch = p_pic->p[ U_PLANE ].i_pitch;
p_pic->p[ V_PLANE ].i_lines = i_height;
p_pic->p[ V_PLANE ].i_pitch = i_width / 4;
p_pic->p[ V_PLANE ].i_visible_pitch = p_pic->p[ V_PLANE ].i_pitch;
p_pic->i_planes = 3;
break;
case FOURCC_I410: case FOURCC_I410:
p_pic->p[ Y_PLANE ].i_lines = i_height; p_pic->p[ Y_PLANE ].i_lines = i_height;
p_pic->p[ Y_PLANE ].i_pitch = i_width; p_pic->p[ Y_PLANE ].i_pitch = i_width;
......
...@@ -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.3 2002/11/28 17:35:01 sam Exp $ * $Id: vout_pictures.h,v 1.4 2003/04/27 17:53:21 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -72,6 +72,9 @@ ...@@ -72,6 +72,9 @@
/* Packed YUV 2:1:1, Y:U:Y:V */ /* Packed YUV 2:1:1, Y:U:Y:V */
#define FOURCC_Y211 VLC_FOURCC('Y','2','1','1') #define FOURCC_Y211 VLC_FOURCC('Y','2','1','1')
/* Planar YUV 4:1:1, Y:U:V */
#define FOURCC_I411 VLC_FOURCC('I','4','1','1')
/* Planar YUV 4:1:0, Y:U:V */ /* Planar YUV 4:1:0, Y:U:V */
#define FOURCC_I410 VLC_FOURCC('I','4','1','0') #define FOURCC_I410 VLC_FOURCC('I','4','1','0')
......
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