Commit 4c8afc76 authored by Sam Hocevar's avatar Sam Hocevar

  * ./plugins/chroma/i420_rgb8.c: plain C 8 bpp transformation.
  * ./plugins/chroma/i420_rgb16.c: plain C 24/32 bpp transformations.
  * ./plugins/ggi/ggi.c: support for 8 bpp displays.
  * ./plugins/sdl/vout_sdl.c: support for 8 bpp displays.
  * ./plugins/x11/xcommon.c: support for 8 bpp displays.
  * ./src/video_output/video_output.c: fixed a segfault.
parent 279de2ef
This diff is collapsed.
......@@ -1111,11 +1111,13 @@ dnl
dnl Linux framebuffer module
dnl
AC_ARG_ENABLE(fb,
[ --enable-fb Linux framebuffer support (default disabled)],
[ if test x$enable_fb = xyes
[ --enable-fb Linux framebuffer support (default enabled on Linux)])
if test x$enable_fb != xno
then
PLUGINS="${PLUGINS} fb"
fi ])
AC_CHECK_HEADERS(linux/fb.h, [
PLUGINS="${PLUGINS} fb"
])
fi
dnl
dnl Linux MGA module
......
......@@ -238,6 +238,9 @@
/* Define if you have the <linux/cdrom.h> header file. */
#undef HAVE_LINUX_CDROM_H
/* Define if you have the <linux/fb.h> header file. */
#undef HAVE_LINUX_FB_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
......
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video.h,v 1.46 2002/03/16 23:03:19 sam Exp $
* $Id: video.h,v 1.47 2002/03/17 17:00:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -103,13 +103,16 @@ typedef struct picture_heap_s
u32 i_chroma; /* picture chroma */
int i_aspect; /* aspect ratio */
/* Variables used for RGB planes */
/* Real pictures */
picture_t* pp_picture[VOUT_MAX_PICTURES]; /* pictures */
/* Stuff used for truecolor RGB planes */
int i_rmask, i_rrshift, i_lrshift;
int i_gmask, i_rgshift, i_lgshift;
int i_bmask, i_rbshift, i_lbshift;
/* Real pictures */
picture_t* pp_picture[VOUT_MAX_PICTURES]; /* pictures */
/* Stuff used for palettized RGB planes */
void (* pf_setpalette) ( struct vout_thread_s *, u16 *, u16 *, u16 * );
} picture_heap_t;
......@@ -143,7 +146,7 @@ typedef struct picture_heap_s
/* Packed RGB formats */
#define FOURCC_BI_RGB 0x00000000 /* RGB for 8bpp */
#define FOURCC_RGB 0x32424752 /* alias for BI_RGB */
#define FOURCC_RGB2 0x32424752 /* alias for BI_RGB */
#define FOURCC_BI_BITFIELDS 0x00000003 /* RGB, for 16, 24, 32bpp */
#define FOURCC_RV15 0x35315652 /* RGB 15bpp, 0x1f, 0x7e0, 0xf800 */
#define FOURCC_RV16 0x36315652 /* RGB 16bpp, 0x1f, 0x3e0, 0x7c00 */
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* i420_rgb.h : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: i420_rgb.h,v 1.4 2002/03/16 23:03:19 sam Exp $
* $Id: i420_rgb.h,v 1.5 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -34,13 +34,10 @@ typedef struct chroma_sys_s
#ifdef MODULE_NAME_IS_chroma_i420_rgb
/* Pre-calculated conversion tables */
void * p_base; /* base for all conversion tables */
union
{
u8 * p_rgb8; /* RGB 8 bits table */
u16 * p_rgb16; /* RGB 16 bits table */
u32 * p_rgb32; /* RGB 32 bits table */
} yuv;
void *p_base; /* base for all conversion tables */
u8 *p_rgb8; /* RGB 8 bits table */
u16 *p_rgb16; /* RGB 16 bits table */
u32 *p_rgb32; /* RGB 32 bits table */
#endif
} chroma_sys_t;
......
......@@ -2,7 +2,7 @@
* i420_rgb16.c : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: i420_rgb16.c,v 1.4 2002/03/16 23:03:19 sam Exp $
* $Id: i420_rgb16.c,v 1.5 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -73,7 +73,7 @@ void _M( I420_RGB15 )( vout_thread_t *p_vout, picture_t *p_src,
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
u16 * p_yuv = p_vout->chroma.p_sys->yuv.p_rgb16;
u16 * p_yuv = p_vout->chroma.p_sys->p_rgb16;
u16 * p_ybase; /* Y dependant conversion table */
#endif
......@@ -208,7 +208,7 @@ void _M( I420_RGB16 )( vout_thread_t *p_vout, picture_t *p_src,
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
u16 * p_yuv = p_vout->chroma.p_sys->yuv.p_rgb16;
u16 * p_yuv = p_vout->chroma.p_sys->p_rgb16;
u16 * p_ybase; /* Y dependant conversion table */
#endif
......@@ -340,6 +340,12 @@ void _M( I420_RGB32 )( vout_thread_t *p_vout, picture_t *p_src,
int i_scale_count; /* scale modulo counter */
int i_chroma_width = p_vout->render.i_width / 2; /* chroma width */
u32 * p_pic_start; /* beginning of the current line for copy */
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
int i_uval, i_vval; /* U and V samples */
int i_red, i_green, i_blue; /* U and V modified samples */
u32 * p_yuv = p_vout->chroma.p_sys->p_rgb32;
u32 * p_ybase; /* Y dependant conversion table */
#endif
/* Conversion buffer pointer */
u32 * p_buffer_start = (u32*)p_vout->chroma.p_sys->p_buffer;
......@@ -374,11 +380,6 @@ void _M( I420_RGB32 )( vout_thread_t *p_vout, picture_t *p_src,
p_vout->output.i_width, p_vout->output.i_height,
&b_hscale, &i_vscale, p_offset_start );
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
intf_ErrMsg( "vout error: I420_RGB32 unimplemented, "
"please harass sam@zoy.org" );
#endif
/*
* Perform conversion
*/
......@@ -392,7 +393,10 @@ void _M( I420_RGB32 )( vout_thread_t *p_vout, picture_t *p_src,
for ( i_x = p_vout->render.i_width / 8; i_x--; )
{
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
/* FIXME: TODO */
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
#elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
__asm__( MMX_INIT_32
: : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
......@@ -419,7 +423,10 @@ void _M( I420_RGB32 )( vout_thread_t *p_vout, picture_t *p_src,
p_v -= i_rewind >> 1;
p_buffer -= i_rewind;
#if defined (MODULE_NAME_IS_chroma_i420_rgb)
/* FIXME: TODO */
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
CONVERT_YUV_PIXEL(4); CONVERT_Y_PIXEL(4);
#elif defined (MODULE_NAME_IS_chroma_i420_rgb_mmx)
__asm__( MMX_INIT_32
: : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
......@@ -494,7 +501,7 @@ static void SetOffset( int i_width, int i_height, int i_pic_width,
p_offset++;
i_scale_count += i_width;
}
}
}
/*
* Set vertical scaling indicator
......
......@@ -2,7 +2,7 @@
* i420_rgb8.c : YUV to bitmap RGB conversion module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: i420_rgb8.c,v 1.2 2002/01/12 01:25:57 sam Exp $
* $Id: i420_rgb8.c,v 1.3 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -42,43 +42,66 @@ static void SetOffset( int, int, int, int, boolean_t *, int *, int * );
/*****************************************************************************
* I420_RGB8: color YUV 4:2:0 to RGB 8 bpp
*****************************************************************************/
void _M( I420_RGB8 )( vout_thread_t *p_vout, picture_t *p_source,
void _M( I420_RGB8 )( vout_thread_t *p_vout, picture_t *p_src,
picture_t *p_dest )
{
/* We got this one from the old arguments */
u16 *p_pic = (u16*)p_dest->p->p_pixels;
u8 *p_y = p_source->Y_PIXELS;
u8 *p_u = p_source->U_PIXELS, *p_v = p_source->V_PIXELS;
/* FIXME: add margins here */
int i_pic_line_width = p_dest->p->i_pitch / 2;
u8 *p_pic = (u8*)p_dest->p->p_pixels;
u8 *p_y = p_src->Y_PIXELS;
u8 *p_u = p_src->U_PIXELS;
u8 *p_v = p_src->V_PIXELS;
boolean_t b_hscale; /* horizontal scaling type */
int i_vscale; /* vertical scaling type */
int i_x, i_y; /* horizontal and vertical indexes */
int i_real_y; /* y % 4 */
int i_right_margin;
int i_rewind;
int i_scale_count; /* scale modulo counter */
int i_chroma_width; /* chroma width */
u16 * p_pic_start; /* beginning of the current line for copy */
u16 * p_buffer_start; /* conversion buffer start */
u16 * p_buffer; /* conversion buffer pointer */
int * p_offset_start; /* offset array start */
int * p_offset; /* offset array pointer */
int i_chroma_width = p_vout->render.i_width / 2; /* chroma width */
/* Lookup table */
u8 * p_lookup = p_vout->chroma.p_sys->p_base;
/* Offset array pointer */
int * p_offset_start = p_vout->chroma.p_sys->p_offset;
int * p_offset;
/* The dithering matrices */
static int dither10[4] = { 0x0, 0x8, 0x2, 0xa };
static int dither11[4] = { 0xc, 0x4, 0xe, 0x6 };
static int dither12[4] = { 0x3, 0xb, 0x1, 0x9 };
static int dither13[4] = { 0xf, 0x7, 0xd, 0x5 };
static int dither20[4] = { 0x0, 0x10, 0x4, 0x14 };
static int dither21[4] = { 0x18, 0x8, 0x1c, 0xc };
static int dither22[4] = { 0x6, 0x16, 0x2, 0x12 };
static int dither23[4] = { 0x1e, 0xe, 0x1a, 0xa };
/*
* Initialize some values - i_pic_line_width will store the line skip
*/
i_pic_line_width -= p_vout->output.i_width;
i_chroma_width = p_vout->render.i_width / 2;
p_buffer_start = (u16*)p_vout->chroma.p_sys->p_buffer;
p_offset_start = p_vout->chroma.p_sys->p_offset;
SetOffset( p_vout->render.i_width, p_vout->render.i_height,
p_vout->output.i_width, p_vout->output.i_height,
&b_hscale, &i_vscale, p_offset_start );
/* FIXME */
#warning "Please ignore the following warnings, I already know about them"
intf_ErrMsg( "vout error: I420_RGB8 unimplemented, "
"please harass sam@zoy.org" );
if( p_dest->p->b_margin )
{
i_right_margin = (p_dest->p->i_pitch - p_dest->p->i_visible_bytes);
}
else
{
i_right_margin = 0;
}
/*
* Perform conversion
*/
i_scale_count = ( i_vscale == 1 ) ?
p_vout->output.i_height : p_vout->render.i_height;
for( i_y = 0, i_real_y = 0; i_y < p_vout->render.i_height; i_y++ )
{
/* Do horizontal and vertical scaling */
SCALE_WIDTH_DITHER( 420 );
SCALE_HEIGHT_DITHER( 420 );
}
}
/* Following functions are local */
......@@ -145,7 +168,7 @@ static void SetOffset( int i_width, int i_height, int i_pic_width,
i_remainder = i_jump & 1;
i_scale_count += i_width;
}
}
}
/*
* Set vertical scaling indicator
......
......@@ -2,7 +2,7 @@
* vout_directx.c: Windows DirectX video output display method
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_directx.c,v 1.25 2002/03/16 23:03:19 sam Exp $
* $Id: vout_directx.c,v 1.26 2002/03/17 17:00:38 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -963,15 +963,15 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic,
switch( )
{
case 8: /* FIXME: set the palette */
p_vout->output.i_chroma = FOURCC_BI_RGB; break;
p_vout->output.i_chroma = FOURCC_RGB2; break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15; break;
case 16:
p_vout->output.i_chroma = FOURCC_RV16; break;
case 24:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV24; break;
case 32:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV32; break;
default:
intf_ErrMsg( "vout error: unknown screen depth" );
return( 0 );
......
......@@ -2,7 +2,7 @@
* fb.c : framebuffer plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: fb.c,v 1.15 2002/03/16 23:03:19 sam Exp $
* $Id: fb.c,v 1.16 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -261,15 +261,15 @@ static int vout_Init( vout_thread_t *p_vout )
switch( p_vout->p_sys->var_info.bits_per_pixel )
{
case 8: /* FIXME: set the palette */
p_vout->output.i_chroma = FOURCC_BI_RGB; break;
p_vout->output.i_chroma = FOURCC_RGB2; break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15; break;
case 16:
p_vout->output.i_chroma = FOURCC_RV16; break;
case 24:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV24; break;
case 32:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV32; break;
default:
intf_ErrMsg( "vout error: unknown screen depth" );
return 0;
......
......@@ -2,7 +2,7 @@
* ggi.c : GGI plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: ggi.c,v 1.17 2002/03/16 23:03:19 sam Exp $
* $Id: ggi.c,v 1.18 2002/03/17 17:00:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -54,6 +54,7 @@ static void vout_Display ( vout_thread_t *, picture_t * );
static int OpenDisplay ( vout_thread_t * );
static void CloseDisplay ( vout_thread_t * );
static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * );
/*****************************************************************************
* Building configuration tree
......@@ -145,6 +146,7 @@ int vout_Create( vout_thread_t *p_vout )
*****************************************************************************/
int vout_Init( vout_thread_t *p_vout )
{
#define p_b p_vout->p_sys->pp_buffer
int i_index;
picture_t *p_pic;
......@@ -158,16 +160,18 @@ int vout_Init( vout_thread_t *p_vout )
switch( p_vout->p_sys->i_bits_per_pixel )
{
case 8: /* FIXME: set the palette */
p_vout->output.i_chroma = FOURCC_BI_RGB; break;
case 8:
p_vout->output.i_chroma = FOURCC_RGB2;
p_vout->output.pf_setpalette = SetPalette;
break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15; break;
case 16:
p_vout->output.i_chroma = FOURCC_RV16; break;
case 24:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV24; break;
case 32:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV32; break;
default:
intf_ErrMsg( "vout error: unknown screen depth" );
return 0;
......@@ -195,7 +199,6 @@ int vout_Init( vout_thread_t *p_vout )
return 0;
}
#define p_b p_vout->p_sys->pp_buffer
/* We know the chroma, allocate a buffer which will be used
* directly by the decoder */
p_vout->p_sys->i_index = 0;
......@@ -514,3 +517,28 @@ static void CloseDisplay( vout_thread_t *p_vout )
/* Exit library */
ggiExit();
}
/*****************************************************************************
* SetPalette: sets an 8 bpp palette
*****************************************************************************/
static void SetPalette( vout_thread_t *p_vout, u16 *red, u16 *green, u16 *blue )
{
ggi_color colors[256];
int i;
/* Fill colors with color information */
for( i = 0; i < 256; i++ )
{
colors[ i ].r = red[ i ];
colors[ i ].g = green[ i ];
colors[ i ].b = blue[ i ];
colors[ i ].a = 0;
}
/* Set palette */
if( ggiSetPalette( p_vout->p_sys->p_display, 0, 256, colors ) < 0 )
{
intf_ErrMsg( "vout error: failed setting palette" );
}
}
......@@ -2,7 +2,7 @@
* kde.cpp : KDE plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: kde.cpp,v 1.8 2002/03/01 16:07:00 sam Exp $
* $Id: kde.cpp,v 1.9 2002/03/17 17:00:38 sam Exp $
*
* Authors: Andres Krapf <dae@chez.com> Sun Mar 25 2001
*
......@@ -52,7 +52,16 @@ MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( "KDE interface module" )
ADD_CAPABILITY( INTF, 80 )
#ifndef WIN32
if( getenv( "DISPLAY" ) == NULL )
{
ADD_CAPABILITY( INTF, 8 )
}
else
#endif
{
ADD_CAPABILITY( INTF, 85 )
}
ADD_SHORTCUT( "kde" )
ADD_PROGRAM( "kvlc" )
MODULE_INIT_STOP
......
......@@ -2,7 +2,7 @@
* xmga.c : X11 MGA plugin for vlc
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: xmga.c,v 1.8 2002/03/17 13:53:21 gbazin Exp $
* $Id: xmga.c,v 1.9 2002/03/17 17:00:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -372,15 +372,15 @@ static int vout_Init( vout_thread_t *p_vout )
switch( p_vout->p_sys->i_screen_depth )
{
case 8: /* FIXME: set the palette */
p_vout->output.i_chroma = FOURCC_BI_RGB; break;
p_vout->output.i_chroma = FOURCC_RGB2; break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15; break;
case 16:
p_vout->output.i_chroma = FOURCC_RV16; break;
case 24:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV24; break;
case 32:
p_vout->output.i_chroma = FOURCC_BI_BITFIELDS; break;
p_vout->output.i_chroma = FOURCC_RV32; break;
default:
intf_ErrMsg( "vout error: unknown screen depth" );
return( 0 );
......
......@@ -2,7 +2,7 @@
* vpar_blocks.c : blocks parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vpar_blocks.c,v 1.6 2002/01/04 14:01:34 sam Exp $
* $Id: vpar_blocks.c,v 1.7 2002/03/17 17:00:38 sam Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
* Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
......@@ -535,7 +535,7 @@ coeff_2:
if( i_coeff >= 64 )
{
/* Illegal, but needed to avoid overflow */
intf_WarnMsg( 2, "MPEG2NonIntra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG2NonIntra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......@@ -589,7 +589,7 @@ coeff_2:
}
}
intf_WarnMsg( 2, "MPEG2NonIntra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG2NonIntra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......@@ -693,7 +693,7 @@ store_coeff:
if( i_coeff >= 64 )
{
/* Illegal, but needed to avoid overflow */
intf_WarnMsg( 2, "MPEG1Intra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG1Intra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......@@ -755,7 +755,7 @@ store_coeff:
}
}
intf_WarnMsg( 2, "MPEG1Intra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG1Intra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......@@ -848,7 +848,7 @@ coeff_2:
if( i_coeff >= 64 )
{
/* Illegal, but needed to avoid overflow */
intf_WarnMsg( 2, "MPEG1NonIntra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG1NonIntra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......@@ -910,7 +910,7 @@ coeff_2:
}
}
intf_WarnMsg( 2, "MPEG1NonIntra coeff is out of bound" );
intf_WarnMsg( 2, "vpar warning: MPEG1NonIntra coeff is out of bound" );
p_vpar->picture.b_error = 1;
break;
}
......
......@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vpar_headers.c,v 1.16 2002/03/14 01:35:28 stef Exp $
* $Id: vpar_headers.c,v 1.17 2002/03/17 17:00:38 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -422,7 +422,8 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
}
/* check whether the input gives a particular aspect ratio */
if( p_vpar->p_config->p_demux_data )
if( p_vpar->p_config->p_demux_data
&& *(int*)(p_vpar->p_config->p_demux_data) )
{
i_aspect = *(int*)(p_vpar->p_config->p_demux_data);
}
......
......@@ -2,7 +2,7 @@
* qt.cpp : Qt plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: qt.cpp,v 1.8 2002/03/01 16:07:00 sam Exp $
* $Id: qt.cpp,v 1.9 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -44,7 +44,16 @@ MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( "Qt interface module" )
ADD_CAPABILITY( INTF, 80 )
#ifndef WIN32
if( getenv( "DISPLAY" ) == NULL )
{
ADD_CAPABILITY( INTF, 7 )
}
else
#endif
{
ADD_CAPABILITY( INTF, 80 )
}
ADD_PROGRAM( "qvlc" )
ADD_SHORTCUT( "qt" )
MODULE_INIT_STOP
......
......@@ -2,7 +2,7 @@
* vout_sdl.c: SDL video output display method
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vout_sdl.c,v 1.83 2002/03/16 23:03:19 sam Exp $
* $Id: vout_sdl.c,v 1.84 2002/03/17 17:00:38 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org>
......@@ -125,9 +125,10 @@ static int vout_Manage ( struct vout_thread_s * );
static void vout_Render ( struct vout_thread_s *, struct picture_s * );
static void vout_Display ( struct vout_thread_s *, struct picture_s * );
static int SDLOpenDisplay ( vout_thread_t *p_vout );
static void SDLCloseDisplay ( vout_thread_t *p_vout );
static int SDLNewPicture ( vout_thread_t *p_vout, picture_t *p_pic );
static int OpenDisplay ( struct vout_thread_s * );
static void CloseDisplay ( struct vout_thread_s * );
static int NewPicture ( struct vout_thread_s *, struct picture_s * );
static void SetPalette ( struct vout_thread_s *, u16 *, u16 *, u16 * );
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
......@@ -215,7 +216,7 @@ static int vout_Create( vout_thread_t *p_vout )
}
#endif
if( SDLOpenDisplay( p_vout ) )
if( OpenDisplay( p_vout ) )
{
intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
SDL_QuitSubSystem( SDL_INIT_VIDEO );
......@@ -275,7 +276,7 @@ static int vout_Init( vout_thread_t *p_vout )
}
/* Allocate the picture if we found one */
if( p_pic == NULL || SDLNewPicture( p_vout, p_pic ) )
if( p_pic == NULL || NewPicture( p_vout, p_pic ) )
{
break;
}
......@@ -326,7 +327,7 @@ static void vout_End( vout_thread_t *p_vout )
*****************************************************************************/
static void vout_Destroy( vout_thread_t *p_vout )
{
SDLCloseDisplay( p_vout );
CloseDisplay( p_vout );
SDL_QuitSubSystem( SDL_INIT_VIDEO );
......@@ -351,8 +352,8 @@ static int vout_Manage( vout_thread_t *p_vout )
case SDL_VIDEORESIZE: /* Resizing of window */
p_vout->p_sys->i_width = event.resize.w;
p_vout->p_sys->i_height = event.resize.h;
SDLCloseDisplay( p_vout );
SDLOpenDisplay( p_vout );
CloseDisplay( p_vout );
OpenDisplay( p_vout );
break;
case SDL_MOUSEMOTION:
......@@ -547,12 +548,12 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
/* following functions are local */
/*****************************************************************************
* SDLOpenDisplay: open and initialize SDL device
* OpenDisplay: open and initialize SDL device
*****************************************************************************
* Open and initialize display according to preferences specified in the vout
* thread fields.
*****************************************************************************/
static int SDLOpenDisplay( vout_thread_t *p_vout )
static int OpenDisplay( vout_thread_t *p_vout )
{
Uint32 i_flags;
int i_bpp;
......@@ -607,7 +608,6 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
p_vout->p_sys->p_overlay =
SDL_CreateYUVOverlay( 32, 32, p_vout->output.i_chroma,
p_vout->p_sys->p_display );
/* FIXME: if the first overlay we find is software, don't stop,
* because we may find a hardware one later ... */
......@@ -645,7 +645,8 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
switch( p_vout->p_sys->p_display->format->BitsPerPixel )
{
case 8:
p_vout->output.i_chroma = FOURCC_RGB;
p_vout->output.i_chroma = FOURCC_RGB2;
p_vout->output.pf_setpalette = SetPalette;
break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15;
......@@ -693,12 +694,12 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
}
/*****************************************************************************
* SDLCloseDisplay: close and reset SDL device
* CloseDisplay: close and reset SDL device
*****************************************************************************
* This function returns all resources allocated by SDLOpenDisplay and restore
* This function returns all resources allocated by OpenDisplay and restore
* the original state of the device.
*****************************************************************************/
static void SDLCloseDisplay( vout_thread_t *p_vout )
static void CloseDisplay( vout_thread_t *p_vout )
{
SDL_FreeYUVOverlay( p_vout->p_sys->p_overlay );
SDL_UnlockSurface ( p_vout->p_sys->p_display );
......@@ -706,11 +707,11 @@ static void SDLCloseDisplay( vout_thread_t *p_vout )
}
/*****************************************************************************
* SDLNewPicture: allocate a picture
* NewPicture: allocate a picture
*****************************************************************************
* Returns 0 on success, -1 otherwise
*****************************************************************************/
static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
int i_width = p_vout->output.i_width;
int i_height = p_vout->output.i_height;
......@@ -731,12 +732,29 @@ static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
return -1;
}
switch( p_vout->p_sys->p_display->format->BitsPerPixel )
{
case 8:
p_pic->p->i_pixel_bytes = 1;
break;
case 15:
case 16:
p_pic->p->i_pixel_bytes = 2;
break;
case 24:
case 32:
p_pic->p->i_pixel_bytes = 4;
break;
default:
return( -1 );
}
p_pic->p->p_pixels = p_vout->p_sys->p_display->pixels;
p_pic->p->i_lines = p_vout->p_sys->p_display->h;
p_pic->p->i_pitch = p_vout->p_sys->p_display->pitch;
p_pic->p->i_pixel_bytes = 2;
if( p_pic->p->i_pitch == 2 * p_vout->p_sys->p_display->w )
if( p_pic->p->i_pitch ==
p_pic->p->i_pixel_bytes * p_vout->p_sys->p_display->w )
{
p_pic->p->b_margin = 0;
}
......@@ -744,7 +762,8 @@ static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
p_pic->p->b_margin = 1;
p_pic->p->b_hidden = 1;
p_pic->p->i_visible_bytes = 2 * p_vout->p_sys->p_display->w;
p_pic->p->i_visible_bytes =
p_pic->p->i_pixel_bytes * p_vout->p_sys->p_display->w;
}
p_vout->p_sys->i_surfaces++;
......@@ -829,3 +848,26 @@ static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
return 0;
}
/*****************************************************************************
* SetPalette: sets an 8 bpp palette
*****************************************************************************/
static void SetPalette( vout_thread_t *p_vout, u16 *red, u16 *green, u16 *blue )
{
SDL_Color colors[256];
int i;
/* Fill colors with color information */
for( i = 0; i < 256; i++ )
{
colors[ i ].r = red[ i ] >> 8;
colors[ i ].g = green[ i ] >> 8;
colors[ i ].b = blue[ i ] >> 8;
}
/* Set palette */
if( SDL_SetColors( p_vout->p_sys->p_display, colors, 0, 256 ) == 0 )
{
intf_ErrMsg( "vout error: failed setting palette" );
}
}
......@@ -2,7 +2,7 @@
* xcommon.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.c,v 1.23 2002/03/17 13:53:21 gbazin Exp $
* $Id: xcommon.c,v 1.24 2002/03/17 17:00:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -125,6 +125,10 @@ static int XVideoGetPort ( Display *, u32, u32 * );
static void XVideoReleasePort ( Display *, int );
#endif
#ifdef MODULE_NAME_IS_x11
static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * );
#endif
/*****************************************************************************
* vout_sys_t: video output method descriptor
*****************************************************************************
......@@ -453,7 +457,7 @@ static int vout_Init( vout_thread_t *p_vout )
switch( p_vout->p_sys->i_screen_depth )
{
case 8: /* FIXME: set the palette */
p_vout->output.i_chroma = FOURCC_RGB; break;
p_vout->output.i_chroma = FOURCC_RGB2; break;
case 15:
p_vout->output.i_chroma = FOURCC_RV15; break;
case 16:
......@@ -1307,6 +1311,29 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
break;
#else
case FOURCC_RGB2:
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_bytes = p_pic->p_sys->p_image->depth;
if( p_pic->p->i_pitch == p_pic->p_sys->p_image->width )
{
p_pic->p->b_margin = 0;
}
else
{
p_pic->p->b_margin = 1;
p_pic->p->b_hidden = 1;
p_pic->p->i_visible_bytes = p_pic->p_sys->p_image->width;
}
p_pic->i_planes = 1;
break;
case FOURCC_RV16:
case FOURCC_RV15:
......@@ -1331,7 +1358,8 @@ static int NewPicture( vout_thread_t *p_vout, picture_t *p_pic )
break;
case FOURCC_BI_BITFIELDS:
case FOURCC_RV32:
case FOURCC_RV24:
p_pic->p->p_pixels = p_pic->p_sys->p_image->data
+ p_pic->p_sys->p_image->xoffset;
......@@ -2057,6 +2085,7 @@ static int InitDisplay( vout_thread_t *p_vout )
return( 1 );
}
p_vout->p_sys->i_bytes_per_pixel = 1;
p_vout->output.pf_setpalette = SetPalette;
break;
case 15:
case 16:
......@@ -2250,3 +2279,34 @@ static IMAGE_TYPE * CreateImage( Display *p_display, EXTRA_ARGS,
return p_image;
}
#ifdef MODULE_NAME_IS_x11
/*****************************************************************************
* SetPalette: sets an 8 bpp palette
*****************************************************************************
* This function sets the palette given as an argument. It does not return
* anything, but could later send information on which colors it was unable
* to set.
*****************************************************************************/
static void SetPalette( vout_thread_t *p_vout, u16 *red, u16 *green, u16 *blue )
{
int i;
XColor p_colors[255];
/* allocate palette */
for( i = 0; i < 255; i++ )
{
/* kludge: colors are indexed reversely because color 255 seems
* to be reserved for black even if we try to set it to white */
p_colors[ i ].pixel = 255 - i;
p_colors[ i ].pad = 0;
p_colors[ i ].flags = DoRed | DoGreen | DoBlue;
p_colors[ i ].red = red[ 255 - i ];
p_colors[ i ].blue = blue[ 255 - i ];
p_colors[ i ].green = green[ 255 - i ];
}
XStoreColors( p_vout->p_sys->p_display,
p_vout->p_sys->colormap, p_colors, 255 );
}
#endif
......@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: mpeg_system.c,v 1.84 2002/03/11 07:23:09 gbazin Exp $
* $Id: mpeg_system.c,v 1.85 2002/03/17 17:00:38 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -670,7 +670,7 @@ ssize_t input_ReadPS( input_thread_t * p_input, data_packet_t ** pp_data )
/* It is common for MPEG-1 streams to pad with zeros
* (although it is forbidden by the recommendation), so
* don't bother everybody in this case. */
intf_WarnMsg( 3, "input warning: garbage at input (0x%x%x%x%x)",
intf_WarnMsg( 3, "input warning: garbage (0x%.2x%.2x%.2x%.2x)",
*p_peek, *(p_peek + 1), *(p_peek + 2), *(p_peek + 3) );
}
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.167 2002/03/16 23:03:19 sam Exp $
* $Id: video_output.c,v 1.168 2002/03/17 17:00:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -365,19 +365,9 @@ static int InitThread( vout_thread_t *p_vout )
}
#define f p_vout->chroma.p_module->p_functions->chroma.functions.chroma
p_vout->chroma.pf_init = f.pf_init;
p_vout->chroma.pf_end = f.pf_end;
#undef f
if( p_vout->chroma.pf_init( p_vout ) )
{
intf_ErrMsg( "vout error: could not initialize chroma module" );
module_Unneed( p_vout->chroma.p_module );
p_vout->pf_end( p_vout );
vlc_mutex_unlock( &p_vout->change_lock );
return( 1 );
}
if( I_OUTPUTPICTURES < VOUT_MAX_PICTURES )
{
intf_WarnMsg( 2, "vout info: indirect render, mapping "
......
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