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 $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)
......@@ -2779,6 +2779,7 @@ 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.])
fi
AC_LANG_PUSH(C++)
AX_ADD_CXXFLAGS([wxwindows],[`${WX_CONFIG} --cxxflags`])
AX_ADD_LDFLAGS([wxwindows],[`${WX_CONFIG} --libs`])
# now look for the wxprec.h header
......@@ -2794,6 +2795,7 @@ then
ALIASES="${ALIASES} wxvlc"
fi
CPPFLAGS="${CPPFLAGS_save}"
AC_LANG_POP(C++)
fi
fi
......
......@@ -2,7 +2,7 @@
* video_output.h : video output thread
*****************************************************************************
* 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>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -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( 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_AllocatePicture,( vout_thread_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_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_DisplayPicture, ( vout_thread_t *, picture_t * ) );
VLC_EXPORT( void, vout_DatePicture, ( vout_thread_t *, picture_t *, mtime_t ) );
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* 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>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -250,9 +250,9 @@ typedef struct audio_date_t audio_date_t;
/* Video */
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 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_sys_t picture_sys_t;
typedef struct picture_heap_t picture_heap_t;
......
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* 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>
*
......@@ -28,14 +28,21 @@
/**
* 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 */
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
......@@ -66,6 +73,12 @@ typedef struct plane_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
* NEVER be modified. A direct buffer can be handled as the plugin
* wishes, it can even swap p_pixels buffers. */
......@@ -224,22 +237,6 @@ struct subpicture_t
int i_width; /**< picture width */
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 */
void ( *pf_render ) ( vout_thread_t *, picture_t *, const subpicture_t * );
......
......@@ -2,7 +2,7 @@
* v4l.c : Video4Linux input module for vlc
*****************************************************************************
* 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>
* Paul Forgey <paulf at aphrodite dot com>
......@@ -858,8 +858,9 @@ static int AccessOpen( vlc_object_t *p_this )
else
{
/* Fill in picture_t fields */
vout_InitPicture( VLC_OBJECT(p_input), &p_sys->pic,
p_sys->i_width, p_sys->i_height, p_sys->i_fourcc );
vout_InitPicture( VLC_OBJECT(p_input), &p_sys->pic, 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 )
{
msg_Err( p_input, "unsupported chroma" );
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* vout_dummy.c: Dummy video output display method for testing purposes
*****************************************************************************
* 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>
*
......@@ -133,9 +133,9 @@ static int Init( vout_thread_t *p_vout )
break;
}
vout_AllocatePicture( p_vout, p_pic, p_vout->output.i_width,
p_vout->output.i_height,
p_vout->output.i_chroma );
vout_AllocatePicture( p_vout, p_pic, p_vout->output.i_chroma,
p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_aspect );
if( p_pic->i_planes == 0 )
{
......
......@@ -2,7 +2,7 @@
* transcode.c
*****************************************************************************
* 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>
*
......@@ -1661,8 +1661,10 @@ static int transcode_video_ffmpeg_process( sout_stream_t *p_stream,
int i_plane;
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->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++ )
{
......
......@@ -2,7 +2,7 @@
* filter_common.h: Common filter functions
*****************************************************************************
* 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>
*
......@@ -43,10 +43,10 @@
} \
\
/* 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_height, \
p_vout->output.i_chroma ); \
p_vout->output.i_aspect ); \
\
if( !p_pic->i_planes ) \
{ \
......
......@@ -2,7 +2,7 @@
* xcommon.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -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 )
{
#ifdef MODULE_NAME_IS_xvideo
int i_plane;
#endif
/* We know the chroma, allocate a buffer which will be used
* directly by the decoder */
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 )
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
if( p_vout->p_sys->b_shm )
{
......@@ -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,
#ifdef MODULE_NAME_IS_xvideo
p_vout->p_sys->i_xvport, p_vout->output.i_chroma,
p_pic->format.i_bits_per_pixel,
#else
p_vout->p_sys->p_visual,
p_vout->p_sys->i_screen_depth,
......@@ -1196,148 +1206,50 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
#ifdef MODULE_NAME_IS_xvideo
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'):
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'):
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('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'):
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','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
+ 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;
for( i_plane = 0; i_plane < p_pic->p_sys->p_image->num_planes;
i_plane++ )
{
p_pic->p[i_plane].p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->offsets[i_plane];
p_pic->p[i_plane].i_pitch =
p_pic->p_sys->p_image->pitches[i_plane];
}
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;
#else
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','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','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_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 = 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;
#endif
......@@ -2148,7 +2060,7 @@ static IMAGE_TYPE * CreateImage( vout_thread_t *p_vout,
/* Allocate memory for image */
#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
i_bytes_per_line = i_width * i_bytes_per_pixel;
p_data = (byte_t *) malloc( i_bytes_per_line * i_height );
......
......@@ -2,7 +2,7 @@
* xcommon.h: Defines common to the X11 and XVideo plugins
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -29,7 +29,7 @@
*****************************************************************************/
#ifdef MODULE_NAME_IS_xvideo
# 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 DATA_SIZE(p) (p)->data_size
# define IMAGE_FREE XFree /* There is nothing like XvDestroyImage */
......
......@@ -2,7 +2,7 @@
* vout_pictures.c : picture management functions
*****************************************************************************
* 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>
* Samuel Hocevar <sam@zoy.org>
......@@ -44,8 +44,8 @@ static void CopyPicture( vout_thread_t *, picture_t *, picture_t * );
/*****************************************************************************
* vout_DisplayPicture: display a picture
*****************************************************************************
* Remove the reservation flag of a picture, which will cause it to be ready for
* display. The picture won't be displayed until vout_DatePicture has been
* Remove the reservation flag of a picture, which will cause it to be ready
* for display. The picture won't be displayed until vout_DatePicture has been
* called.
*****************************************************************************/
void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
......@@ -102,8 +102,9 @@ void vout_DatePicture( vout_thread_t *p_vout,
*****************************************************************************
* This function creates a reserved image in the video output heap.
* 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
* since several pictures can be created by several producers threads.
* already allocated zone of memory in the picture data fields.
* It needs locking since several pictures can be created by several producers
* threads.
*****************************************************************************/
picture_t *vout_CreatePicture( vout_thread_t *p_vout,
vlc_bool_t b_progressive,
......@@ -164,9 +165,9 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout,
*/
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_chroma );
p_vout->render.i_aspect );
if( p_freepic->i_planes )
{
......@@ -250,7 +251,7 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
/*****************************************************************************
* 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 )
{
......@@ -455,17 +456,17 @@ void vout_PlacePicture( vout_thread_t *p_vout,
* how it gets displayed.
*****************************************************************************/
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;
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 */
for( i_bytes = 0, i_index = 0; i_index < p_pic->i_planes; i_index++ )
{
i_bytes += p_pic->p[ i_index ].i_lines * p_pic->p[ i_index ].i_pitch;
}
i_bytes = p_pic->format.i_bits_per_pixel *
p_pic->format.i_width * p_pic->format.i_height / 8;
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,
}
}
/*****************************************************************************
* 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.
*****************************************************************************
......@@ -493,7 +564,8 @@ void vout_AllocatePicture( vout_thread_t *p_vout, picture_t *p_pic,
* size. It makes the assumption that stride == width.
*****************************************************************************/
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;
......@@ -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;
}
vout_InitFormat( &p_pic->format, i_chroma, i_width, i_height, i_aspect );
/* Calculate coordinates */
switch( i_chroma )
{
......@@ -624,9 +698,17 @@ void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
case FOURCC_RV24:
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_visible_pitch = p_pic->p->i_pitch;
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
p_pic->p_heap->i_rmask = 0xff0000;
p_pic->p_heap->i_gmask = 0x00ff00;
......@@ -652,14 +734,13 @@ void vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
p_pic->i_planes = 0;
return;
}
}
/*****************************************************************************
* vout_ChromaCmp: compare two chroma values
*****************************************************************************
* 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 )
{
......
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