Commit 1a674481 authored by Gildas Bazin's avatar Gildas Bazin

* configure.ac: fix for wxWindows headers detection.
* all: changed the prototype of vout_AllocatePicture() and vout_InitPicture().
* src/video_output/vout_pictures.c: new vout_InitFormat() function that initialises a video_frame_format_t structure.
* include/vlc_video.h: extended video_frame_format_t.
* modules/codec/rawvideo.c: ported to the new decoder api.
* modules/video_output/x11/*: simplifications.
parent 170d7aa6
dnl Autoconf settings for vlc dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.93 2003/10/24 16:34:30 sam Exp $ dnl $Id: configure.ac,v 1.94 2003/10/24 21:27:06 gbazin Exp $
AC_INIT(vlc,0.6.3-cvs) AC_INIT(vlc,0.6.3-cvs)
...@@ -2779,6 +2779,7 @@ then ...@@ -2779,6 +2779,7 @@ then
then then
AC_MSG_ERROR([Your development package for wxWindows is too old, you need at least version 2.3.0. Please upgrade and try again. Alternatively you can also configure with --disable-wxwindows.]) AC_MSG_ERROR([Your development package for wxWindows is too old, you need at least version 2.3.0. Please upgrade and try again. Alternatively you can also configure with --disable-wxwindows.])
fi fi
AC_LANG_PUSH(C++)
AX_ADD_CXXFLAGS([wxwindows],[`${WX_CONFIG} --cxxflags`]) AX_ADD_CXXFLAGS([wxwindows],[`${WX_CONFIG} --cxxflags`])
AX_ADD_LDFLAGS([wxwindows],[`${WX_CONFIG} --libs`]) AX_ADD_LDFLAGS([wxwindows],[`${WX_CONFIG} --libs`])
# now look for the wxprec.h header # now look for the wxprec.h header
...@@ -2794,6 +2795,7 @@ then ...@@ -2794,6 +2795,7 @@ then
ALIASES="${ALIASES} wxvlc" ALIASES="${ALIASES} wxvlc"
fi fi
CPPFLAGS="${CPPFLAGS_save}" CPPFLAGS="${CPPFLAGS_save}"
AC_LANG_POP(C++)
fi fi
fi fi
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video_output.h : video output thread * video_output.h : video output thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video_output.h,v 1.99 2003/10/04 15:51:22 sigmunau Exp $ * $Id: video_output.h,v 1.100 2003/10/24 21:27:06 gbazin 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>
...@@ -200,8 +200,9 @@ VLC_EXPORT( int, vout_VarCallback, ( vlc_object_t *, const char *, vlc_value_t, ...@@ -200,8 +200,9 @@ VLC_EXPORT( int, vout_VarCallback, ( vlc_object_t *, const char *, vlc_value_t,
VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) ); VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) );
VLC_EXPORT( picture_t *, vout_CreatePicture, ( vout_thread_t *, vlc_bool_t, vlc_bool_t, unsigned int ) ); VLC_EXPORT( picture_t *, vout_CreatePicture, ( vout_thread_t *, vlc_bool_t, vlc_bool_t, unsigned int ) );
VLC_EXPORT( void, vout_InitPicture, ( vlc_object_t *, picture_t *, int, int, uint32_t ) ); VLC_EXPORT( void, vout_InitFormat, ( video_frame_format_t *, uint32_t, int, int, int ) );
VLC_EXPORT( void, vout_AllocatePicture,( vout_thread_t *, picture_t *, int, int, uint32_t ) ); VLC_EXPORT( void, vout_InitPicture, ( vlc_object_t *, picture_t *, uint32_t, int, int, int ) );
VLC_EXPORT( void, vout_AllocatePicture,( vout_thread_t *, picture_t *, uint32_t, int, int, int ) );
VLC_EXPORT( void, vout_DestroyPicture, ( vout_thread_t *, picture_t * ) ); VLC_EXPORT( void, vout_DestroyPicture, ( vout_thread_t *, picture_t * ) );
VLC_EXPORT( void, vout_DisplayPicture, ( vout_thread_t *, picture_t * ) ); VLC_EXPORT( void, vout_DisplayPicture, ( vout_thread_t *, picture_t * ) );
VLC_EXPORT( void, vout_DatePicture, ( vout_thread_t *, picture_t *, mtime_t ) ); VLC_EXPORT( void, vout_DatePicture, ( vout_thread_t *, picture_t *, mtime_t ) );
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.81 2003/10/08 19:40:42 gbazin Exp $ * $Id: vlc_common.h,v 1.82 2003/10/24 21:27:06 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -250,9 +250,9 @@ typedef struct audio_date_t audio_date_t; ...@@ -250,9 +250,9 @@ typedef struct audio_date_t audio_date_t;
/* Video */ /* Video */
typedef struct vout_thread_t vout_thread_t; typedef struct vout_thread_t vout_thread_t;
typedef struct vout_font_t vout_font_t;
typedef struct vout_sys_t vout_sys_t; typedef struct vout_sys_t vout_sys_t;
typedef struct chroma_sys_t chroma_sys_t; typedef struct chroma_sys_t chroma_sys_t;
typedef struct video_frame_format_t video_frame_format_t;
typedef struct picture_t picture_t; typedef struct picture_t picture_t;
typedef struct picture_sys_t picture_sys_t; typedef struct picture_sys_t picture_sys_t;
typedef struct picture_heap_t picture_heap_t; typedef struct picture_heap_t picture_heap_t;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* includes all common video types and constants. * includes all common video types and constants.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vlc_video.h,v 1.4 2003/10/08 21:01:07 gbazin Exp $ * $Id: vlc_video.h,v 1.5 2003/10/24 21:27:06 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -28,14 +28,21 @@ ...@@ -28,14 +28,21 @@
/** /**
* Description of a video frame * Description of a video frame
*/ */
typedef struct video_frame_format_t struct video_frame_format_t
{ {
unsigned int i_width; /**< picture width */
unsigned int i_height; /**< picture height */
vlc_fourcc_t i_chroma; /**< picture chroma */ vlc_fourcc_t i_chroma; /**< picture chroma */
unsigned int i_aspect; /**< aspect ratio */ unsigned int i_aspect; /**< aspect ratio */
} video_frame_format_t; unsigned int i_width; /**< picture width */
unsigned int i_height; /**< picture height */
unsigned int i_x_offset; /**< start offset of visible area */
unsigned int i_y_offset; /**< start offset of visible area */
unsigned int i_visible_width; /**< width of visible area */
unsigned int i_visible_height; /**< height of visible area */
unsigned int i_bits_per_pixel; /**< number of bits per pixel */
};
/** /**
* Description of a planar graphic field * Description of a planar graphic field
...@@ -66,6 +73,12 @@ typedef struct plane_t ...@@ -66,6 +73,12 @@ typedef struct plane_t
*/ */
struct picture_t struct picture_t
{ {
/** \name Picture format
* Describes the properties of the picture
* @{*/
video_frame_format_t format;
/**@}*/
/** Picture data - data can always be freely modified, but p_data may /** Picture data - data can always be freely modified, but p_data may
* NEVER be modified. A direct buffer can be handled as the plugin * NEVER be modified. A direct buffer can be handled as the plugin
* wishes, it can even swap p_pixels buffers. */ * wishes, it can even swap p_pixels buffers. */
...@@ -224,22 +237,6 @@ struct subpicture_t ...@@ -224,22 +237,6 @@ struct subpicture_t
int i_width; /**< picture width */ int i_width; /**< picture width */
int i_height; /**< picture height */ int i_height; /**< picture height */
/**@}*/ /**@}*/
#if 0
/* Additionnal properties depending of the subpicture type */
union
{
/* Text subpictures properties - text is stored in data area, in ASCIIZ
* format */
struct
{
vout_font_t * p_font; /* font, NULL for default */
int i_style; /* text style */
uint32_t i_char_color; /* character color */
uint32_t i_border_color; /* border color */
uint32_t i_bg_color; /* background color */
} text;
} type;
#endif
/** Pointer to function that renders this subtitle in a picture */ /** Pointer to function that renders this subtitle in a picture */
void ( *pf_render ) ( vout_thread_t *, picture_t *, const subpicture_t * ); void ( *pf_render ) ( vout_thread_t *, picture_t *, const subpicture_t * );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* v4l.c : Video4Linux input module for vlc * v4l.c : Video4Linux input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: v4l.c,v 1.24 2003/09/07 22:49:05 fenrir Exp $ * $Id: v4l.c,v 1.25 2003/10/24 21:27:06 gbazin Exp $
* *
* Author: Laurent Aimar <fenrir@via.ecp.fr> * Author: Laurent Aimar <fenrir@via.ecp.fr>
* Paul Forgey <paulf at aphrodite dot com> * Paul Forgey <paulf at aphrodite dot com>
...@@ -858,8 +858,9 @@ static int AccessOpen( vlc_object_t *p_this ) ...@@ -858,8 +858,9 @@ static int AccessOpen( vlc_object_t *p_this )
else else
{ {
/* Fill in picture_t fields */ /* Fill in picture_t fields */
vout_InitPicture( VLC_OBJECT(p_input), &p_sys->pic, vout_InitPicture( VLC_OBJECT(p_input), &p_sys->pic, p_sys->i_fourcc,
p_sys->i_width, p_sys->i_height, p_sys->i_fourcc ); p_sys->i_width, p_sys->i_height, p_sys->i_width *
VOUT_ASPECT_FACTOR / p_sys->i_height );
if( !p_sys->pic.i_planes ) if( !p_sys->pic.i_planes )
{ {
msg_Err( p_input, "unsupported chroma" ); msg_Err( p_input, "unsupported chroma" );
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_dummy.c: Dummy video output display method for testing purposes * vout_dummy.c: Dummy video output display method for testing purposes
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: vout.c,v 1.4 2003/03/28 11:34:52 sigmunau Exp $ * $Id: vout.c,v 1.5 2003/10/24 21:27:06 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -133,9 +133,9 @@ static int Init( vout_thread_t *p_vout ) ...@@ -133,9 +133,9 @@ static int Init( vout_thread_t *p_vout )
break; break;
} }
vout_AllocatePicture( p_vout, p_pic, p_vout->output.i_width, vout_AllocatePicture( p_vout, p_pic, p_vout->output.i_chroma,
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 );
if( p_pic->i_planes == 0 ) if( p_pic->i_planes == 0 )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* transcode.c * transcode.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: transcode.c,v 1.42 2003/10/09 19:40:29 gbazin Exp $ * $Id: transcode.c,v 1.43 2003/10/24 21:27:06 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -1661,8 +1661,10 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream, ...@@ -1661,8 +1661,10 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
int i_plane; int i_plane;
vout_InitPicture( VLC_OBJECT(p_stream), &pic, vout_InitPicture( VLC_OBJECT(p_stream), &pic,
id->p_encoder->format.video.i_chroma,
id->f_dst.i_width, id->f_dst.i_height, id->f_dst.i_width, id->f_dst.i_height,
id->p_encoder->format.video.i_chroma ); id->f_dst.i_width * VOUT_ASPECT_FACTOR /
id->f_dst.i_height );
for( i_plane = 0; i_plane < pic.i_planes; i_plane++ ) for( i_plane = 0; i_plane < pic.i_planes; i_plane++ )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* filter_common.h: Common filter functions * filter_common.h: Common filter functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002, 2003 VideoLAN * Copyright (C) 2001, 2002, 2003 VideoLAN
* $Id: filter_common.h,v 1.3 2003/10/15 22:49:48 gbazin Exp $ * $Id: filter_common.h,v 1.4 2003/10/24 21:27:06 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -43,10 +43,10 @@ ...@@ -43,10 +43,10 @@
} \ } \
\ \
/* Allocate the picture */ \ /* Allocate the picture */ \
vout_AllocatePicture( p_vout, p_pic, \ vout_AllocatePicture( p_vout, p_pic, p_vout->output.i_chroma, \
p_vout->output.i_width, \ p_vout->output.i_width, \
p_vout->output.i_height, \ p_vout->output.i_height, \
p_vout->output.i_chroma ); \ p_vout->output.i_aspect ); \
\ \
if( !p_pic->i_planes ) \ if( !p_pic->i_planes ) \
{ \ { \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xcommon.c: Functions common to the X11 and XVideo plugins * xcommon.c: Functions common to the X11 and XVideo plugins
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.c,v 1.32 2003/10/08 21:03:35 gbazin Exp $ * $Id: xcommon.c,v 1.33 2003/10/24 21:27:06 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>
...@@ -1146,6 +1146,10 @@ static void DestroyWindow( vout_thread_t *p_vout, x11_window_t *p_win ) ...@@ -1146,6 +1146,10 @@ static void DestroyWindow( vout_thread_t *p_vout, x11_window_t *p_win )
*****************************************************************************/ *****************************************************************************/
static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
#ifdef MODULE_NAME_IS_xvideo
int i_plane;
#endif
/* We know the chroma, allocate a buffer which will be used /* We know the chroma, allocate a buffer which will be used
* directly by the decoder */ * directly by the decoder */
p_pic->p_sys = malloc( sizeof( picture_sys_t ) ); p_pic->p_sys = malloc( sizeof( picture_sys_t ) );
...@@ -1155,6 +1159,11 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1155,6 +1159,11 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
return -1; return -1;
} }
/* Fill in picture_t fields */
vout_InitPicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma,
p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_aspect );
#ifdef HAVE_SYS_SHM_H #ifdef HAVE_SYS_SHM_H
if( p_vout->p_sys->b_shm ) if( p_vout->p_sys->b_shm )
{ {
...@@ -1178,6 +1187,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1178,6 +1187,7 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
CreateImage( p_vout, p_vout->p_sys->p_display, CreateImage( p_vout, p_vout->p_sys->p_display,
#ifdef MODULE_NAME_IS_xvideo #ifdef MODULE_NAME_IS_xvideo
p_vout->p_sys->i_xvport, p_vout->output.i_chroma, p_vout->p_sys->i_xvport, p_vout->output.i_chroma,
p_pic->format.i_bits_per_pixel,
#else #else
p_vout->p_sys->p_visual, p_vout->p_sys->p_visual,
p_vout->p_sys->i_screen_depth, p_vout->p_sys->i_screen_depth,
...@@ -1196,148 +1206,50 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1196,148 +1206,50 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
#ifdef MODULE_NAME_IS_xvideo #ifdef MODULE_NAME_IS_xvideo
case VLC_FOURCC('I','4','2','0'): case VLC_FOURCC('I','4','2','0'):
p_pic->Y_PIXELS = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[0];
p_pic->p[Y_PLANE].i_lines = p_vout->output.i_height;
p_pic->p[Y_PLANE].i_pitch = p_pic->p_sys->p_image->pitches[0];
p_pic->p[Y_PLANE].i_pixel_pitch = 1;
p_pic->p[Y_PLANE].i_visible_pitch = p_vout->output.i_width;
p_pic->U_PIXELS = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[1];
p_pic->p[U_PLANE].i_lines = p_vout->output.i_height / 2;
p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_image->pitches[1];
p_pic->p[U_PLANE].i_pixel_pitch = 1;
p_pic->p[U_PLANE].i_visible_pitch = p_vout->output.i_width / 2;
p_pic->V_PIXELS = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[2];
p_pic->p[V_PLANE].i_lines = p_vout->output.i_height / 2;
p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_image->pitches[2];
p_pic->p[V_PLANE].i_pixel_pitch = 1;
p_pic->p[V_PLANE].i_visible_pitch = p_vout->output.i_width / 2;
p_pic->i_planes = 3;
break;
case VLC_FOURCC('Y','V','1','2'): case VLC_FOURCC('Y','V','1','2'):
p_pic->Y_PIXELS = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[0];
p_pic->p[Y_PLANE].i_lines = p_vout->output.i_height;
p_pic->p[Y_PLANE].i_pitch = p_pic->p_sys->p_image->pitches[0];
p_pic->p[Y_PLANE].i_pixel_pitch = 1;
p_pic->p[Y_PLANE].i_visible_pitch = p_pic->p[Y_PLANE].i_pitch;
p_pic->p[Y_PLANE].i_visible_pitch = p_vout->output.i_width;
p_pic->U_PIXELS = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[2];
p_pic->p[U_PLANE].i_lines = p_vout->output.i_height / 2;
p_pic->p[U_PLANE].i_pitch = p_pic->p_sys->p_image->pitches[2];
p_pic->p[U_PLANE].i_pixel_pitch = 1;
p_pic->p[U_PLANE].i_visible_pitch = p_vout->output.i_width / 2;
p_pic->V_PIXELS = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[1];
p_pic->p[V_PLANE].i_lines = p_vout->output.i_height / 2;
p_pic->p[V_PLANE].i_pitch = p_pic->p_sys->p_image->pitches[1];
p_pic->p[V_PLANE].i_pixel_pitch = 1;
p_pic->p[V_PLANE].i_visible_pitch = p_vout->output.i_width / 2;
p_pic->i_planes = 3;
break;
case VLC_FOURCC('Y','2','1','1'): case VLC_FOURCC('Y','2','1','1'):
p_pic->p->p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[0];
p_pic->p->i_lines = p_vout->output.i_height;
/* XXX: this just looks so plain wrong... check it out ! */
p_pic->p->i_pitch = p_pic->p_sys->p_image->pitches[0] / 4;
p_pic->p->i_pixel_pitch = 4;
p_pic->p->i_visible_pitch = p_vout->output.i_width * 4;
p_pic->i_planes = 1;
break;
case VLC_FOURCC('Y','U','Y','2'): case VLC_FOURCC('Y','U','Y','2'):
case VLC_FOURCC('U','Y','V','Y'): case VLC_FOURCC('U','Y','V','Y'):
p_pic->p->p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[0];
p_pic->p->i_lines = p_vout->output.i_height;
p_pic->p->i_pitch = p_pic->p_sys->p_image->pitches[0];
p_pic->p->i_pixel_pitch = 2;
p_pic->p->i_visible_pitch = p_vout->output.i_width * 2;
p_pic->i_planes = 1;
break;
case VLC_FOURCC('R','V','1','5'): case VLC_FOURCC('R','V','1','5'):
p_pic->p->p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[0];
p_pic->p->i_lines = p_vout->output.i_height;
p_pic->p->i_pitch = p_pic->p_sys->p_image->pitches[0];
p_pic->p->i_pixel_pitch = 2;
p_pic->p->i_visible_pitch = p_vout->output.i_width * 2;
p_pic->i_planes = 1;
break;
case VLC_FOURCC('R','V','1','6'): case VLC_FOURCC('R','V','1','6'):
case VLC_FOURCC('R','V','2','4'): /* Fixme: pixel pitch == 4 ? */
case VLC_FOURCC('R','V','3','2'):
p_pic->p->p_pixels = p_pic->p_sys->p_image->data for( i_plane = 0; i_plane < p_pic->p_sys->p_image->num_planes;
+ p_pic->p_sys->p_image->offsets[0]; i_plane++ )
p_pic->p->i_lines = p_vout->output.i_height; {
p_pic->p->i_pitch = p_pic->p_sys->p_image->pitches[0]; p_pic->p[i_plane].p_pixels = p_pic->p_sys->p_image->data
p_pic->p->i_pixel_pitch = 2; + p_pic->p_sys->p_image->offsets[i_plane];
p_pic->p->i_visible_pitch = p_vout->output.i_width * 2; p_pic->p[i_plane].i_pitch =
p_pic->p_sys->p_image->pitches[i_plane];
p_pic->i_planes = 1; }
if( p_vout->output.i_chroma == VLC_FOURCC('Y','V','1','2') )
{
/* U and V inverted compared to I420
* Fixme: this should be handled by the vout core */
p_pic->U_PIXELS = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[2];
p_pic->V_PIXELS = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[1];
}
break; break;
#else #else
case VLC_FOURCC('R','G','B','2'): case VLC_FOURCC('R','G','B','2'):
p_pic->p->p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->xoffset;
p_pic->p->i_lines = p_pic->p_sys->p_image->height;
p_pic->p->i_pitch = p_pic->p_sys->p_image->bytes_per_line;
p_pic->p->i_pixel_pitch = p_pic->p_sys->p_image->depth;
p_pic->p->i_visible_pitch = p_pic->p_sys->p_image->width;
p_pic->i_planes = 1;
break;
case VLC_FOURCC('R','V','1','6'): case VLC_FOURCC('R','V','1','6'):
case VLC_FOURCC('R','V','1','5'): case VLC_FOURCC('R','V','1','5'):
p_pic->p->p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->xoffset;
p_pic->p->i_lines = p_pic->p_sys->p_image->height;
p_pic->p->i_pitch = p_pic->p_sys->p_image->bytes_per_line;
p_pic->p->i_pixel_pitch = p_pic->p_sys->p_image->depth;
p_pic->p->i_visible_pitch = 2 * p_pic->p_sys->p_image->width;
p_pic->i_planes = 1;
break;
case VLC_FOURCC('R','V','3','2'):
case VLC_FOURCC('R','V','2','4'): case VLC_FOURCC('R','V','2','4'):
case VLC_FOURCC('R','V','3','2'):
p_pic->p->i_lines = p_pic->p_sys->p_image->height;
p_pic->p->p_pixels = p_pic->p_sys->p_image->data p_pic->p->p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->xoffset; + p_pic->p_sys->p_image->xoffset;
p_pic->p->i_lines = p_pic->p_sys->p_image->height;
p_pic->p->i_pitch = p_pic->p_sys->p_image->bytes_per_line; p_pic->p->i_pitch = p_pic->p_sys->p_image->bytes_per_line;
p_pic->p->i_pixel_pitch = p_pic->p_sys->p_image->depth;
p_pic->p->i_visible_pitch = 4 * p_pic->p_sys->p_image->width;
p_pic->i_planes = 1;
/* p_pic->p->i_pixel_pitch = 4 for RV24 but this should be set
* properly by vout_InitPicture() */
p_pic->p->i_visible_pitch = p_pic->p->i_pixel_pitch
* p_pic->p_sys->p_image->width;
break; break;
#endif #endif
...@@ -2148,7 +2060,7 @@ static IMAGE_TYPE * CreateImage( vout_thread_t *p_vout, ...@@ -2148,7 +2060,7 @@ static IMAGE_TYPE * CreateImage( vout_thread_t *p_vout,
/* Allocate memory for image */ /* Allocate memory for image */
#ifdef MODULE_NAME_IS_xvideo #ifdef MODULE_NAME_IS_xvideo
p_data = (byte_t *) malloc( i_width * i_height * 2 ); /* XXX */ p_data = (byte_t *) malloc( i_width * i_height * i_bits_per_pixel / 8 );
#else #else
i_bytes_per_line = i_width * i_bytes_per_pixel; i_bytes_per_line = i_width * i_bytes_per_pixel;
p_data = (byte_t *) malloc( i_bytes_per_line * i_height ); p_data = (byte_t *) malloc( i_bytes_per_line * i_height );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xcommon.h: Defines common to the X11 and XVideo plugins * xcommon.h: Defines common to the X11 and XVideo plugins
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.h,v 1.8 2003/08/03 23:11:21 gbazin Exp $ * $Id: xcommon.h,v 1.9 2003/10/24 21:27:06 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>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
*****************************************************************************/ *****************************************************************************/
#ifdef MODULE_NAME_IS_xvideo #ifdef MODULE_NAME_IS_xvideo
# define IMAGE_TYPE XvImage # define IMAGE_TYPE XvImage
# define EXTRA_ARGS int i_xvport, int i_chroma # define EXTRA_ARGS int i_xvport, int i_chroma, int i_bits_per_pixel
# define EXTRA_ARGS_SHM int i_xvport, int i_chroma, XShmSegmentInfo *p_shm # define EXTRA_ARGS_SHM int i_xvport, int i_chroma, XShmSegmentInfo *p_shm
# define DATA_SIZE(p) (p)->data_size # define DATA_SIZE(p) (p)->data_size
# define IMAGE_FREE XFree /* There is nothing like XvDestroyImage */ # define IMAGE_FREE XFree /* There is nothing like XvDestroyImage */
......
...@@ -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.42 2003/08/28 21:11:54 gbazin Exp $ * $Id: vout_pictures.c,v 1.43 2003/10/24 21:27:07 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>
...@@ -44,8 +44,8 @@ static void CopyPicture( vout_thread_t *, picture_t *, picture_t * ); ...@@ -44,8 +44,8 @@ static void CopyPicture( vout_thread_t *, picture_t *, picture_t * );
/***************************************************************************** /*****************************************************************************
* vout_DisplayPicture: display a picture * vout_DisplayPicture: display a picture
***************************************************************************** *****************************************************************************
* Remove the reservation flag of a picture, which will cause it to be ready for * Remove the reservation flag of a picture, which will cause it to be ready
* display. The picture won't be displayed until vout_DatePicture has been * for display. The picture won't be displayed until vout_DatePicture has been
* called. * called.
*****************************************************************************/ *****************************************************************************/
void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic ) void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
...@@ -102,8 +102,9 @@ void vout_DatePicture( vout_thread_t *p_vout, ...@@ -102,8 +102,9 @@ void vout_DatePicture( vout_thread_t *p_vout,
***************************************************************************** *****************************************************************************
* This function creates a reserved image in the video output heap. * This function creates a reserved image in the video output heap.
* A null pointer is returned if the function fails. This method provides an * A null pointer is returned if the function fails. This method provides an
* already allocated zone of memory in the picture data fields. It needs locking * already allocated zone of memory in the picture data fields.
* since several pictures can be created by several producers threads. * It needs locking since several pictures can be created by several producers
* threads.
*****************************************************************************/ *****************************************************************************/
picture_t *vout_CreatePicture( vout_thread_t *p_vout, picture_t *vout_CreatePicture( vout_thread_t *p_vout,
vlc_bool_t b_progressive, vlc_bool_t b_progressive,
...@@ -164,9 +165,9 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, ...@@ -164,9 +165,9 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout,
*/ */
if( p_freepic != NULL ) if( p_freepic != NULL )
{ {
vout_AllocatePicture( p_vout, p_freepic, vout_AllocatePicture( p_vout, p_freepic, p_vout->render.i_chroma,
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 );
if( p_freepic->i_planes ) if( p_freepic->i_planes )
{ {
...@@ -250,7 +251,7 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -250,7 +251,7 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
/***************************************************************************** /*****************************************************************************
* vout_UnlinkPicture: decrement reference counter of a picture * vout_UnlinkPicture: decrement reference counter of a picture
***************************************************************************** *****************************************************************************
* This function decrement the reference counter of a picture in the video heap. * This function decrement the reference counter of a picture in the video heap
*****************************************************************************/ *****************************************************************************/
void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
...@@ -455,17 +456,17 @@ void vout_PlacePicture( vout_thread_t *p_vout, ...@@ -455,17 +456,17 @@ void vout_PlacePicture( vout_thread_t *p_vout,
* how it gets displayed. * how it gets displayed.
*****************************************************************************/ *****************************************************************************/
void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic, void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic,
int i_width, int i_height, vlc_fourcc_t i_chroma ) vlc_fourcc_t i_chroma,
int i_width, int i_height, int i_aspect )
{ {
int i_bytes, i_index; int i_bytes, i_index;
vout_InitPicture( VLC_OBJECT(p_vout), p_pic, i_width, i_height, i_chroma ); vout_InitPicture( VLC_OBJECT(p_vout), p_pic, i_chroma,
i_width, i_height, i_aspect );
/* Calculate how big the new image should be */ /* Calculate how big the new image should be */
for( i_bytes = 0, i_index = 0; i_index < p_pic->i_planes; i_index++ ) i_bytes = p_pic->format.i_bits_per_pixel *
{ p_pic->format.i_width * p_pic->format.i_height / 8;
i_bytes += p_pic->p[ i_index ].i_lines * p_pic->p[ i_index ].i_pitch;
}
p_pic->p_data = vlc_memalign( &p_pic->p_data_orig, 16, i_bytes ); p_pic->p_data = vlc_memalign( &p_pic->p_data_orig, 16, i_bytes );
...@@ -486,6 +487,76 @@ void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -486,6 +487,76 @@ void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic,
} }
} }
/*****************************************************************************
* vout_InitFormat: initialise the video format fields given chroma/size.
*****************************************************************************
* This function initializes all the video_frame_format_t fields given the
* static properties of a picture (chroma and size).
*****************************************************************************/
void vout_InitFormat( video_frame_format_t *p_format, vlc_fourcc_t i_chroma,
int i_width, int i_height, int i_aspect )
{
p_format->i_chroma = i_chroma;
p_format->i_width = p_format->i_visible_width = i_width;
p_format->i_height = p_format->i_visible_height = i_height;
p_format->i_x_offset = p_format->i_y_offset = 0;
p_format->i_aspect = i_aspect;
#if 0
/* Assume we have square pixels */
if( i_width && i_height )
p_format->i_aspect = i_width * VOUT_ASPECT_FACTOR / i_height;
else
p_format->i_aspect = 0;
#endif
switch( i_chroma )
{
case FOURCC_I444:
p_format->i_bits_per_pixel = 24;
break;
case FOURCC_I422:
case FOURCC_YUY2:
p_format->i_bits_per_pixel = 16;
p_format->i_bits_per_pixel = 16;
break;
case FOURCC_I411:
case FOURCC_YV12:
case FOURCC_I420:
case FOURCC_IYUV:
p_format->i_bits_per_pixel = 12;
break;
case FOURCC_I410:
p_format->i_bits_per_pixel = 9;
break;
case FOURCC_Y211:
p_format->i_bits_per_pixel = 8;
break;
case FOURCC_RV32:
p_format->i_bits_per_pixel = 32;
break;
case FOURCC_RV24:
/* FIXME: Should be 24 here but x11 and our chroma conversion
* routines assume 32. */
#ifdef WIN32
p_format->i_bits_per_pixel = 24;
#else
p_format->i_bits_per_pixel = 32;
#endif
break;
case FOURCC_RV15:
case FOURCC_RV16:
p_format->i_bits_per_pixel = 16;
break;
case FOURCC_RGB2:
p_format->i_bits_per_pixel = 8;
break;
default:
p_format->i_bits_per_pixel = 0;
break;
}
}
/***************************************************************************** /*****************************************************************************
* vout_InitPicture: initialise the picture_t fields given chroma/size. * vout_InitPicture: initialise the picture_t fields given chroma/size.
***************************************************************************** *****************************************************************************
...@@ -493,7 +564,8 @@ void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -493,7 +564,8 @@ void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic,
* size. It makes the assumption that stride == width. * size. It makes the assumption that stride == width.
*****************************************************************************/ *****************************************************************************/
void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic, void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
int i_width, int i_height, vlc_fourcc_t i_chroma ) vlc_fourcc_t i_chroma,
int i_width, int i_height, int i_aspect )
{ {
int i_index; int i_index;
...@@ -504,6 +576,8 @@ void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic, ...@@ -504,6 +576,8 @@ void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
p_pic->p[i_index].i_pixel_pitch = 1; p_pic->p[i_index].i_pixel_pitch = 1;
} }
vout_InitFormat( &p_pic->format, i_chroma, i_width, i_height, i_aspect );
/* Calculate coordinates */ /* Calculate coordinates */
switch( i_chroma ) switch( i_chroma )
{ {
...@@ -624,9 +698,17 @@ void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic, ...@@ -624,9 +698,17 @@ void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
case FOURCC_RV24: case FOURCC_RV24:
p_pic->p->i_lines = i_height; p_pic->p->i_lines = i_height;
/* FIXME: Should be 3 here but x11 and our chroma conversion
* routines assume 4. */
#ifdef WIN32
p_pic->p->i_pitch = i_width * 3; p_pic->p->i_pitch = i_width * 3;
p_pic->p->i_visible_pitch = p_pic->p->i_pitch;
p_pic->p->i_pixel_pitch = 3; p_pic->p->i_pixel_pitch = 3;
#else
p_pic->p->i_pitch = i_width * 4;
p_pic->p->i_pixel_pitch = 4;
#endif
p_pic->p->i_visible_pitch = p_pic->p->i_pitch;
/* FIXME: p_heap isn't always reachable /* FIXME: p_heap isn't always reachable
p_pic->p_heap->i_rmask = 0xff0000; p_pic->p_heap->i_rmask = 0xff0000;
p_pic->p_heap->i_gmask = 0x00ff00; p_pic->p_heap->i_gmask = 0x00ff00;
...@@ -652,14 +734,13 @@ void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic, ...@@ -652,14 +734,13 @@ void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
p_pic->i_planes = 0; p_pic->i_planes = 0;
return; return;
} }
} }
/***************************************************************************** /*****************************************************************************
* vout_ChromaCmp: compare two chroma values * vout_ChromaCmp: compare two chroma values
***************************************************************************** *****************************************************************************
* This function returns 1 if the two fourcc values given as argument are * This function returns 1 if the two fourcc values given as argument are
* the same format (eg. UYVY / UYNV) or almost the same format (eg. I420/YV12) * the same format (eg. UYVY/UYNV) or almost the same format (eg. I420/YV12)
*****************************************************************************/ *****************************************************************************/
int vout_ChromaCmp( vlc_fourcc_t i_chroma, vlc_fourcc_t i_amorhc ) int vout_ChromaCmp( vlc_fourcc_t i_chroma, vlc_fourcc_t i_amorhc )
{ {
......
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