Commit 14047fa1 authored by Sam Hocevar's avatar Sam Hocevar

  * Filter plugins. Not very polished (please don't look at how the dates are
    calculated!), but worth a try. Use the following flags:
     "--filter invert" for inverse video
     "--filter bob" for BOB deinterlacing
  * Fixed a potential segfault if the subtitle stream was encountered
    before the video stream.
  * Misc vout4 fixes.
parent 97cba428
......@@ -26,6 +26,7 @@ PLUGINS_DIR := ac3_adec \
dvdread \
esd \
fb \
filter \
ggi \
glide \
gtk \
......@@ -54,7 +55,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
alsa/alsa \
arts/arts \
beos/beos \
chroma/yuv2rgb8 \
chroma/chroma_yv12_rgb8 \
directx/directx \
dsp/dsp \
dummy/dummy \
......@@ -63,6 +64,8 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
dvdread/dvdread \
esd/esd \
fb/fb \
filter/filter_bob \
filter/filter_invert \
ggi/ggi \
glide/glide \
gtk/gnome \
......@@ -320,7 +323,6 @@ snapshot-common:
-type d -name CVS -o -name '.*' -o -name '*.[o]' | \
while read i ; do rm -Rf $$i ; done
# Copy gettext stuff
mkdir tmp/vlc/po
cp po/*.po tmp/vlc/po
for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
# Copy misc files
......
......@@ -95,7 +95,6 @@ LIB_RC = @LIB_RC@
LIB_SDL = @LIB_SDL@
LIB_X11 = @LIB_X11@
LIB_XVIDEO = @LIB_XVIDEO@
LIB_YUV = @LIB_YUV@
#
# CFLAGS for special cases
......
This diff is collapsed.
......@@ -146,7 +146,6 @@ AC_TYPE_SIGNAL
AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl")
AC_CHECK_LIB(m,cos,LIB_IMDCT="${LIB_IMDCT} -lm")
AC_CHECK_LIB(m,pow,
LIB_YUV="${LIB_YUV} -lm"
LIB_IMDCT="${LIB_IMDCT} -lm"
LIB_IMDCT3DN="${LIB_IMDCT3DN} -lm"
LIB_IMDCTSSE="${LIB_IMDCTSSE} -lm"
......@@ -310,9 +309,8 @@ ARCH=${target_cpu}
dnl
dnl default modules
dnl
#BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy yuv2rgb8 idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
PLUGINS="${PLUGINS} ac3_spdif spudec"
PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert"
dnl
dnl Accelerated modules
......@@ -1280,7 +1278,6 @@ AC_SUBST(LIB_RC)
AC_SUBST(LIB_SDL)
AC_SUBST(LIB_X11)
AC_SUBST(LIB_XVIDEO)
AC_SUBST(LIB_YUV)
AC_SUBST(CFLAGS_VLC)
AC_SUBST(CFLAGS_ALTIVEC)
......@@ -1345,7 +1342,7 @@ which modules get compiled as plugins.
"
if test x${HAVE_VLC} = x1
then
echo "To build vlc and its plugins, type \`make vlc'."
echo "To build vlc and its plugins, type \`make vlc plugins'."
fi
if test x${HAVE_LIBDVDCSS} = x1
then
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.58 2001/12/13 12:47:17 sam Exp $
* $Id: common.h,v 1.59 2001/12/16 16:18:36 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -542,26 +542,30 @@ typedef struct module_symbols_s
void ( * aout_DestroyFifo ) ( struct aout_fifo_s * );
struct vout_thread_s * (* vout_CreateThread) ( int *, int, int, int, int );
struct subpicture_s * (* vout_CreateSubPicture) ( struct vout_thread_s *,
int, int );
struct picture_s * ( * vout_CreatePicture ) ( struct vout_thread_s * );
void ( * vout_DestroyThread ) ( struct vout_thread_s *, int * );
void ( * vout_DestroySubPicture ) ( struct vout_thread_s *,
struct subpicture_s * );
void ( * vout_DisplaySubPicture ) ( struct vout_thread_s *,
struct subpicture_s * );
struct picture_s * ( * vout_CreatePicture )
( struct vout_thread_s *,
boolean_t, boolean_t, boolean_t );
void ( * vout_DisplayPicture ) ( struct vout_thread_s *,
struct picture_s * );
void ( * vout_DestroyPicture ) ( struct vout_thread_s *,
struct picture_s * );
void ( * vout_LinkPicture ) ( struct vout_thread_s *,
struct picture_s * );
void ( * vout_UnlinkPicture ) ( struct vout_thread_s *,
void ( * vout_UnlinkPicture ) ( struct vout_thread_s *,
struct picture_s * );
void ( * vout_DatePicture ) ( struct vout_thread_s *p_vout,
struct picture_s *p_pic, mtime_t );
void ( * vout_DatePicture ) ( struct vout_thread_s *,
struct picture_s *, mtime_t );
void ( * vout_PlacePicture ) ( struct vout_thread_s *, int, int,
int *, int *, int *, int * );
struct subpicture_s * (* vout_CreateSubPicture)
( struct vout_thread_s *, int, int );
void ( * vout_DestroySubPicture ) ( struct vout_thread_s *,
struct subpicture_s * );
void ( * vout_DisplaySubPicture ) ( struct vout_thread_s *,
struct subpicture_s * );
u32 ( * UnalignedShowBits ) ( struct bit_stream_s *, unsigned int );
void ( * UnalignedRemoveBits ) ( struct bit_stream_s * );
......
......@@ -325,6 +325,10 @@
#define VOUT_METHOD_VAR "vlc_vout"
#define VOUT_METHOD_DEFAULT "x11"
/* Environment variable containing the display method */
#define VOUT_FILTER_VAR "vlc_filter"
#define VOUT_FILTER_DEFAULT "x11"
/* Environment variable containing the motion compensation method */
#define MOTION_METHOD_VAR "vlc_motion"
......@@ -346,6 +350,9 @@
#define VOUT_DEPTH_VAR "vlc_depth"
#define VOUT_DEPTH_DEFAULT 15
/* Multiplier value for aspect ratio calculation */
#define VOUT_ASPECT_FACTOR (2*2*2*2*2*2*2*3*3*3*5*5*5)
/* Maximum width of a scaled source picture - this should be relatively high,
* since higher stream values will result in no display at all. */
#define VOUT_MAX_WIDTH 4096
......@@ -414,6 +421,12 @@
/* Better be in advance when awakening than late... */
#define VOUT_MWAIT_TOLERANCE ((int)(0.020*CLOCK_FREQ))
/* Time to sleep when waiting for a buffer (from vout or the video fifo).
* It should be approximately the time needed to perform a complete picture
* loop. Since it only happens when the video heap is full, it does not need
* to be too low, even if it blocks the decoder. */
#define VOUT_OUTMEM_SLEEP ((int)(0.020*CLOCK_FREQ))
/* The default video output window title */
#define VOUT_TITLE "VideoLAN Client @VLC_VERSION@"
......@@ -430,12 +443,6 @@
#define VPAR_IDLE_SLEEP ((int)(0.010*CLOCK_FREQ))
/* Time to sleep when waiting for a buffer (from vout or the video fifo).
* It should be approximately the time needed to perform a complete picture
* loop. Since it only happens when the video heap is full, it does not need
* to be too low, even if it blocks the decoder. */
#define VPAR_OUTMEM_SLEEP ((int)(0.020*CLOCK_FREQ))
/* Optimization level, from 0 to 2 - 1 is generally a good compromise. Remember
* that raising this level dramatically lengthens the compilation time. */
#ifdef RELEASE
......
......@@ -87,6 +87,7 @@
(p_symbols)->aout_CreateFifo = aout_CreateFifo; \
(p_symbols)->aout_DestroyFifo = aout_DestroyFifo; \
(p_symbols)->vout_CreateThread = vout_CreateThread; \
(p_symbols)->vout_DestroyThread = vout_DestroyThread; \
(p_symbols)->vout_CreateSubPicture = vout_CreateSubPicture; \
(p_symbols)->vout_DestroySubPicture = vout_DestroySubPicture; \
(p_symbols)->vout_DisplaySubPicture = vout_DisplaySubPicture; \
......@@ -197,6 +198,7 @@
# define aout_DestroyFifo p_symbols->aout_DestroyFifo
# define vout_CreateThread p_symbols->vout_CreateThread
# define vout_DestroyThread p_symbols->vout_DestroyThread
# define vout_CreateSubPicture p_symbols->vout_CreateSubPicture
# define vout_DestroySubPicture p_symbols->vout_DestroySubPicture
# define vout_DisplaySubPicture p_symbols->vout_DisplaySubPicture
......
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video.h,v 1.34 2001/12/13 12:47:17 sam Exp $
* $Id: video.h,v 1.35 2001/12/16 16:18:36 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -39,6 +39,7 @@ typedef struct plane_s
{
pixel_data_t *p_data;
int i_bytes;
int i_line_bytes;
} plane_t;
/*****************************************************************************
......@@ -82,7 +83,7 @@ typedef struct picture_s
/* Picture dynamic properties - those properties can be changed by the
* decoder */
boolean_t b_progressive_frame; /* is it a progressive frame ? */
boolean_t b_progressive; /* is it a progressive frame ? */
boolean_t b_repeat_first_field; /* RFF bit */
boolean_t b_top_field_first; /* which field is first */
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppenned video output thread.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_output.h,v 1.65 2001/12/13 12:47:17 sam Exp $
* $Id: video_output.h,v 1.66 2001/12/16 16:18:36 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -193,7 +193,8 @@ vout_fifo_t * vout_CreateFifo ( void );
void vout_DestroyFifo ( vout_fifo_t * );
void vout_FreeFifo ( vout_fifo_t * );
picture_t * vout_CreatePicture ( vout_thread_t * );
picture_t * vout_CreatePicture ( vout_thread_t *,
boolean_t, boolean_t, boolean_t );
void vout_DestroyPicture ( vout_thread_t *, picture_t * );
void vout_DisplayPicture ( vout_thread_t *, picture_t * );
void vout_DatePicture ( vout_thread_t *, picture_t *, mtime_t );
......
......@@ -2,7 +2,7 @@
* ac3_adec.c: ac3 decoder module main file
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ac3_adec.c,v 1.7 2001/12/10 04:53:10 sam Exp $
* $Id: ac3_adec.c,v 1.8 2001/12/16 16:18:36 sam Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
......@@ -81,13 +81,13 @@ void _M( adec_getfunctions )( function_list_t * p_function_list )
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for ac3 decoder module" )
ADD_WINDOW( "Configuration for AC3 decoder module" )
ADD_COMMENT( "Nothing to configure" )
MODULE_CONFIG_STOP
MODULE_INIT_START
p_module->i_capabilities = MODULE_CAPABILITY_DEC;
p_module->psz_longname = "Ac3 sofware decoder";
p_module->psz_longname = "AC3 sofware decoder";
MODULE_INIT_STOP
MODULE_ACTIVATE_START
......
......@@ -7,12 +7,12 @@
# Objects
#
PLUGIN_YUV2RGB8 = yuv2rgb8.o #common.o
PLUGIN_YV12_RGB8 = yv12_rgb8.o
BUILTIN_YUV2RGB8 = $(PLUGIN_YUV2RGB8:%.o=BUILTIN_%.o)
BUILTIN_YV12_RGB8 = $(PLUGIN_YV12_RGB8:%.o=BUILTIN_%.o)
PLUGIN_C = $(PLUGIN_YUV2RGB8)
BUILTIN_C = $(BUILTIN_YUV2RGB8)
PLUGIN_C = $(PLUGIN_YV12_RGB8)
BUILTIN_C = $(BUILTIN_YV12_RGB8)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
#
......@@ -25,10 +25,10 @@ include ../../Makefile.modules
# Real targets
#
../yuv2rgb8.so: $(PLUGIN_YUV2RGB8)
../chroma_yv12_rgb8.so: $(PLUGIN_YV12_RGB8)
$(CC) -o $@ $^ $(PLCFLAGS)
../yuv2rgb8.a: $(BUILTIN_YUV2RGB8)
../chroma_yv12_rgb8.a: $(BUILTIN_YV12_RGB8)
ar r $@ $^
$(RANLIB) $@
/*****************************************************************************
* chroma_common.h: YUV transformation functions
* Provides functions to perform the YUV conversion. The functions provided here
* are a complete and portable C implementation, and may be replaced in certain
* case by optimized functions.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: chroma_common.h,v 1.1 2001/12/16 16:18:36 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*****************************************************************************/
/*****************************************************************************
* Constants
*****************************************************************************/
/* Margins and offsets in conversion tables - Margins are used in case a RGB
* RGB conversion would give a value outside the 0-255 range. Offsets have been
* calculated to avoid using the same cache line for 2 tables. conversion tables
* are 2*MARGIN + 256 long and stores pixels.*/
#define RED_MARGIN 178
#define GREEN_MARGIN 135
#define BLUE_MARGIN 224
#define RED_OFFSET 1501 /* 1323 to 1935 */
#define GREEN_OFFSET 135 /* 0 to 526 */
#define BLUE_OFFSET 818 /* 594 to 1298 */
#define RGB_TABLE_SIZE 1935 /* total table size */
#define GRAY_MARGIN 384
#define GRAY_TABLE_SIZE 1024 /* total table size */
#define PALETTE_TABLE_SIZE 2176 /* YUV -> 8bpp palette lookup table */
/* macros used for YUV pixel conversions */
#define SHIFT 20
#define U_GREEN_COEF ((int)(-0.391 * (1<<SHIFT) / 1.164))
#define U_BLUE_COEF ((int)(2.018 * (1<<SHIFT) / 1.164))
#define V_RED_COEF ((int)(1.596 * (1<<SHIFT) / 1.164))
#define V_GREEN_COEF ((int)(-0.813 * (1<<SHIFT) / 1.164))
/*****************************************************************************
* Extern prototypes
*****************************************************************************/
void _M( SetOffset )( int i_width, int i_height, int i_pic_width,
int i_pic_height, boolean_t *pb_h_scaling,
int *pi_v_scaling, int *p_offset, boolean_t b_double );
This diff is collapsed.
This diff is collapsed.
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_dummy.c,v 1.11 2001/12/13 12:47:17 sam Exp $
* $Id: vout_dummy.c,v 1.12 2001/12/16 16:18:36 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -255,7 +255,7 @@ static int DummyNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
/* Precalculate some values */
p_pic->i_size = i_width * i_height;
p_pic->i_chroma_width = i_width / 2;
p_pic->i_chroma_size = i_width * i_height / 2;
p_pic->i_chroma_size = i_width * ( i_height / 2 );
/* Allocate the memory buffer */
i_luma_bytes = p_pic->i_size * sizeof(pixel_data_t);
......@@ -264,14 +264,17 @@ static int DummyNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
/* Y buffer */
p_pic->planes[ Y_PLANE ].p_data = malloc( i_luma_bytes + 2 * i_chroma_bytes );
p_pic->planes[ Y_PLANE ].i_bytes = i_luma_bytes;
p_pic->planes[ Y_PLANE ].i_line_bytes = i_width * sizeof(pixel_data_t);
/* U buffer */
p_pic->planes[ U_PLANE ].p_data = p_pic->planes[ Y_PLANE ].p_data + i_height * i_width;
p_pic->planes[ U_PLANE ].i_bytes = i_chroma_bytes;
p_pic->planes[ U_PLANE ].i_bytes = i_chroma_bytes / 2;
p_pic->planes[ U_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof(pixel_data_t);
/* V buffer */
p_pic->planes[ V_PLANE ].p_data = p_pic->planes[ U_PLANE ].p_data + i_height * p_pic->i_chroma_width;
p_pic->planes[ V_PLANE ].i_bytes = i_chroma_bytes;
p_pic->planes[ V_PLANE ].i_bytes = i_chroma_bytes / 2;
p_pic->planes[ V_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof(pixel_data_t);
/* We allocated 3 planes */
p_pic->i_planes = 3;
......
###############################################################################
# vlc (VideoLAN Client) image filter modules makefile
# (c)2001 VideoLAN
###############################################################################
#
# Objects
#
PLUGIN_BOB = bob.o
PLUGIN_INVERT = invert.o
BUILTIN_BOB = $(PLUGIN_BOB:%.o=BUILTIN_%.o)
BUILTIN_INVERT = $(PLUGIN_INVERT:%.o=BUILTIN_%.o)
PLUGIN_C = $(PLUGIN_BOB) $(PLUGIN_INVERT)
BUILTIN_C = $(BUILTIN_BOB) $(BUILTIN_INVERT)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
#
# Virtual targets
#
include ../../Makefile.modules
#
# Real targets
#
../filter_bob.so: $(PLUGIN_BOB)
$(CC) -o $@ $^ $(PLCFLAGS)
../filter_bob.a: $(BUILTIN_BOB)
ar r $@ $^
$(RANLIB) $@
../filter_invert.so: $(PLUGIN_INVERT)
$(CC) -o $@ $^ $(PLCFLAGS)
../filter_invert.a: $(BUILTIN_INVERT)
ar r $@ $^
$(RANLIB) $@
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: vpar_headers.c,v 1.6 2001/12/13 12:47:17 sam Exp $
* $Id: vpar_headers.c,v 1.7 2001/12/16 16:18:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -303,14 +303,14 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
};
#undef RESERVED
int i_height_save, i_width_save;
int i_height_save, i_width_save, i_aspect;
i_height_save = p_vpar->sequence.i_height;
i_width_save = p_vpar->sequence.i_width;
p_vpar->sequence.i_width = GetBits( &p_vpar->bit_stream, 12 );
p_vpar->sequence.i_height = GetBits( &p_vpar->bit_stream, 12 );
p_vpar->sequence.i_aspect = GetBits( &p_vpar->bit_stream, 4 );
i_aspect = GetBits( &p_vpar->bit_stream, 4 );
p_vpar->sequence.i_frame_rate =
i_frame_rate_table[ GetBits( &p_vpar->bit_stream, 4 ) ];
......@@ -383,39 +383,25 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
/* It's an MPEG-1 stream. Put adequate parameters. */
int i_xyratio;
static int pi_mpeg1ratio[15] = {
10000,
10000,
6735,
7031,
7615,
8055,
8437,
8935,
9157,
9815,
10255,
10695,
10950,
11575,
12015
10000, 10000, 6735, 7031, 7615, 8055, 8437, 8935,
9157, 9815, 10255, 10695, 10950, 11575, 12015
};
if( p_vpar->sequence.i_aspect > 1 )
if( i_aspect > 1 )
{
i_xyratio = p_vpar->sequence.i_height *
pi_mpeg1ratio[p_vpar->sequence.i_aspect] /
p_vpar->sequence.i_width;
pi_mpeg1ratio[i_aspect] / p_vpar->sequence.i_width;
if( 7450 < i_xyratio && i_xyratio < 7550 )
{
p_vpar->sequence.i_aspect = 2;
i_aspect = 2;
}
else if( 5575 < i_xyratio && i_xyratio < 5675 )
{
p_vpar->sequence.i_aspect = 3;
i_aspect = 3;
}
else if( 4475 < i_xyratio && i_xyratio < 4575 )
{
p_vpar->sequence.i_aspect = 4;
i_aspect = 4;
}
}
......@@ -424,6 +410,28 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
p_vpar->sequence.i_chroma_format = CHROMA_420;
}
/* Store calculated aspect ratio */
switch( i_aspect )
{
case AR_3_4_PICTURE:
p_vpar->sequence.i_aspect = VOUT_ASPECT_FACTOR * 4 / 3;
break;
case AR_16_9_PICTURE:
p_vpar->sequence.i_aspect = VOUT_ASPECT_FACTOR * 16 / 9;
break;
case AR_221_1_PICTURE:
p_vpar->sequence.i_aspect = VOUT_ASPECT_FACTOR * 221 / 100;
break;
case AR_SQUARE_PICTURE:
default:
p_vpar->sequence.i_aspect = VOUT_ASPECT_FACTOR
* p_vpar->sequence.i_width / p_vpar->sequence.i_height;
break;
}
/* Update sizes */
p_vpar->sequence.i_mb_width = (p_vpar->sequence.i_width + 15) / 16;
p_vpar->sequence.i_mb_height = (p_vpar->sequence.b_progressive) ?
......@@ -774,14 +782,18 @@ static void PictureHeader( vpar_thread_t * p_vpar )
if( !p_vpar->picture.i_current_structure )
{
/* This is a new frame. Get a structure from the video_output. */
while( ( P_picture = vout_CreatePicture( p_vpar->p_vout ) ) == NULL )
while( ( P_picture = vout_CreatePicture( p_vpar->p_vout,
p_vpar->picture.b_progressive,
p_vpar->picture.b_top_field_first,
p_vpar->picture.b_repeat_first_field ) )
== NULL )
{
intf_DbgMsg("vpar debug: vout_CreatePicture failed, delaying");
if( p_vpar->p_fifo->b_die || p_vpar->p_fifo->b_error )
{
return;
}
msleep( VPAR_OUTMEM_SLEEP );
msleep( VOUT_OUTMEM_SLEEP );
}
/* Initialize values. */
......
......@@ -2,7 +2,7 @@
* vout_sdl.c: SDL video output display method
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vout_sdl.c,v 1.69 2001/12/13 12:47:17 sam Exp $
* $Id: vout_sdl.c,v 1.70 2001/12/16 16:18:36 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org>
......@@ -176,8 +176,25 @@ static int vout_Create( vout_thread_t *p_vout )
p_vout->p_sys->b_cursor_autohidden = 0;
p_vout->p_sys->i_lastmoved = mdate();
p_vout->p_sys->i_width = p_vout->render.i_width;
p_vout->p_sys->i_height = p_vout->render.i_height;
if( p_vout->render.i_height * p_vout->render.i_aspect
>= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
{
p_vout->p_sys->i_width = p_vout->render.i_height
* p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
p_vout->p_sys->i_height = p_vout->render.i_height;
}
else
{
p_vout->p_sys->i_width = p_vout->render.i_width;
p_vout->p_sys->i_height = p_vout->render.i_width
* VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
}
if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 300 )
{
p_vout->p_sys->i_width *= 2;
p_vout->p_sys->i_height *= 2;
}
if( SDLOpenDisplay( p_vout ) )
{
......@@ -549,12 +566,17 @@ static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
p_pic->i_chroma_size = i_height * ( i_width / 2 );
/* FIXME: try to get the right i_bytes value from p_overlay */
p_pic->planes[ Y_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[0];
p_pic->planes[ Y_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[ 0 ];
p_pic->planes[ Y_PLANE ].i_bytes = p_pic->i_size * sizeof( u8 );
p_pic->planes[ U_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[2];
p_pic->planes[ Y_PLANE ].i_line_bytes = i_width * sizeof( u8 );
p_pic->planes[ U_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[ 2 ];
p_pic->planes[ U_PLANE ].i_bytes = p_pic->i_size * sizeof( u8 ) / 4;
p_pic->planes[ V_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[1];
p_pic->planes[ U_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof( u8 );
p_pic->planes[ V_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[ 1 ];
p_pic->planes[ V_PLANE ].i_bytes = p_pic->i_size * sizeof( u8 ) / 4;
p_pic->planes[ V_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof( u8 );
p_pic->i_planes = 3;
......
......@@ -2,7 +2,7 @@
* spu_decoder.c : spu decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: spu_decoder.c,v 1.2 2001/12/10 04:53:11 sam Exp $
* $Id: spu_decoder.c,v 1.3 2001/12/16 16:18:36 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -187,34 +187,29 @@ static int spudec_Run( decoder_config_t * p_config )
*****************************************************************************/
static int spudec_Init( spudec_thread_t *p_spudec )
{
int i_retry = 0;
/* Spawn a video output if there is none */
vlc_mutex_lock( &p_vout_bank->lock );
if( p_vout_bank->i_count == 0 )
while( p_vout_bank->i_count == 0 )
{
intf_WarnMsg( 1, "spudec: no vout present, spawning one" );
p_spudec->p_vout = vout_CreateThread( NULL, 0, 0, 0, 0 );
vlc_mutex_unlock( &p_vout_bank->lock );
/* Everything failed */
if( p_spudec->p_vout == NULL )
if( i_retry++ > 10 )
{
intf_Msg( "spudec: can't open vout, aborting" );
vlc_mutex_unlock( &p_vout_bank->lock );
intf_WarnMsg( 1, "spudec: waited too long for vout, aborting" );
free( p_spudec );
return( -1 );
}
p_vout_bank->pp_vout[ p_vout_bank->i_count ] = p_spudec->p_vout;
p_vout_bank->i_count++;
}
else
{
/* Take the first video output FIXME: take the best one */
p_spudec->p_vout = p_vout_bank->pp_vout[ 0 ];
msleep( VOUT_OUTMEM_SLEEP );
vlc_mutex_lock( &p_vout_bank->lock );
}
/* Take the first video output FIXME: take the best one */
p_spudec->p_vout = p_vout_bank->pp_vout[ 0 ];
vlc_mutex_unlock( &p_vout_bank->lock );
p_spudec->p_config->pf_init_bit_stream(
&p_spudec->bit_stream,
......
......@@ -2,7 +2,7 @@
* vout_common.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vout_common.c,v 1.3 2001/12/13 12:47:17 sam Exp $
* $Id: vout_common.c,v 1.4 2001/12/16 16:18:36 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -456,8 +456,25 @@ int _M( XCommonCreateWindow ) ( vout_thread_t *p_vout )
else
{
/* Set main window's size */
p_vout->p_sys->i_width = p_vout->render.i_width;
p_vout->p_sys->i_height = p_vout->render.i_height;
if( p_vout->render.i_height * p_vout->render.i_aspect
>= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
{
p_vout->p_sys->i_width = p_vout->render.i_height
* p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
p_vout->p_sys->i_height = p_vout->render.i_height;
}
else
{
p_vout->p_sys->i_width = p_vout->render.i_width;
p_vout->p_sys->i_height = p_vout->render.i_width
* VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
}
if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 300 )
{
p_vout->p_sys->i_width *= 2;
p_vout->p_sys->i_height *= 2;
}
}
/* Prepare window manager hints and properties */
......
......@@ -2,7 +2,7 @@
* vout_xvideo.c: Xvideo video output display method
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vout_xvideo.c,v 1.38 2001/12/13 12:47:17 sam Exp $
* $Id: vout_xvideo.c,v 1.39 2001/12/16 16:18:36 sam Exp $
*
* Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -463,12 +463,20 @@ static int XVideoNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
/* FIXME: try to get the right i_bytes value from p_xvimage */
p_pic->planes[Y_PLANE].p_data = p_pic->p_sys->p_xvimage->data;
p_pic->planes[Y_PLANE].i_bytes = p_pic->i_size * sizeof(u8);
p_pic->planes[Y_PLANE].i_line_bytes = i_width * sizeof(u8);
p_pic->planes[U_PLANE].p_data = (u8*)p_pic->p_sys->p_xvimage->data
+ p_pic->i_size * 5 / 4;
p_pic->planes[U_PLANE].i_bytes = p_pic->i_size * sizeof(u8) / 4;
p_pic->planes[U_PLANE].i_line_bytes = p_pic->i_chroma_width
* sizeof(u8);
p_pic->planes[V_PLANE].p_data = (u8*)p_pic->p_sys->p_xvimage->data
+ p_pic->i_size;
p_pic->planes[V_PLANE].i_bytes = p_pic->i_size * sizeof(u8) / 4;
p_pic->planes[V_PLANE].i_line_bytes = p_pic->i_chroma_width
* sizeof(u8);
p_pic->i_planes = 3;
return 0;
......
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: main.c,v 1.137 2001/12/12 15:20:16 sam Exp $
* $Id: main.c,v 1.138 2001/12/16 16:18:36 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -124,6 +124,7 @@
#define OPT_OVERLAY 166
#define OPT_XVADAPTOR 167
#define OPT_SMP 168
#define OPT_FILTER 169
#define OPT_CHANNELS 170
#define OPT_SERVER 171
......@@ -206,6 +207,7 @@ static const struct option longopts[] =
{ "overlay", 0, 0, OPT_OVERLAY },
{ "xvadaptor", 1, 0, OPT_XVADAPTOR },
{ "smp", 1, 0, OPT_SMP },
{ "filter", 1, 0, OPT_FILTER },
/* DVD options */
{ "dvdtitle", 1, 0, 't' },
......@@ -805,6 +807,9 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
case OPT_SMP: /* --smp */
main_PutIntVariable( VDEC_SMP_VAR, atoi(optarg) );
break;
case OPT_FILTER: /* --filter */
main_PutPszVariable( VOUT_FILTER_VAR, optarg );
break;
/* DVD options */
case 't': /* --dvdtitle */
......@@ -960,6 +965,7 @@ static void Usage( int i_fashion )
"\n --yuv <module> \tYUV method"
"\n --synchro <type> \tforce synchro algorithm"
"\n --smp <number of threads> \tuse several processors"
"\n --filter <module> \tvideo filter module"
"\n"
"\n -t, --dvdtitle <num> \tchoose DVD title"
"\n -T, --dvdchapter <num> \tchoose DVD chapter"
......@@ -1026,7 +1032,8 @@ static void Usage( int i_fashion )
"\n " IDCT_METHOD_VAR "=<method name> \tIDCT method"
"\n " YUV_METHOD_VAR "=<method name> \tYUV method"
"\n " VPAR_SYNCHRO_VAR "={I|I+|IP|IP+|IPB} \tsynchro algorithm"
"\n " VDEC_SMP_VAR "=<number of threads> \tuse several processors" );
"\n " VDEC_SMP_VAR "=<number of threads> \tuse several processors"
"\n " VOUT_FILTER_VAR "=<method name> \tvideo filter method" );
/* DVD parameters */
intf_MsgImm( "\nDVD parameters:"
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.147 2001/12/13 12:47:17 sam Exp $
* $Id: video_output.c,v 1.148 2001/12/16 16:18:36 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -264,6 +264,7 @@ static int InitThread( vout_thread_t *p_vout )
{
intf_ErrMsg( "vout error: plugin was unable to allocate at least "
"one direct buffer" );
p_vout->pf_end( p_vout );
vlc_mutex_unlock( &p_vout->change_lock );
return( 1 );
}
......@@ -291,12 +292,17 @@ static int InitThread( vout_thread_t *p_vout )
for( ; i_index < VOUT_MAX_PICTURES; i_index++ )
{
PP_RENDERPICTURE[ I_RENDERPICTURES ]
= &p_vout->p_picture[ i_index ];
PP_RENDERPICTURE[ I_RENDERPICTURES ] = &p_vout->p_picture[ i_index ];
I_RENDERPICTURES++;
}
intf_WarnMsg( 1, "vout info: got %i direct buffer(s)", I_OUTPUTPICTURES );
intf_WarnMsg( 1, "vout info: picture in %ix%i chroma %i aspect ratio %i",
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
intf_WarnMsg( 1, "vout info: picture out %ix%i chroma %i aspect ratio %i",
p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_chroma, p_vout->output.i_aspect );
/* Mark thread as running and return */
p_vout->b_active = 1;
......
......@@ -2,7 +2,7 @@
* vout_pictures.c : picture management functions
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: vout_pictures.c,v 1.3 2001/12/13 20:47:46 sam Exp $
* $Id: vout_pictures.c,v 1.4 2001/12/16 16:18:36 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -121,7 +121,10 @@ void vout_DatePicture( vout_thread_t *p_vout,
* 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 )
picture_t *vout_CreatePicture( vout_thread_t *p_vout,
boolean_t b_progressive,
boolean_t b_top_field_first,
boolean_t b_repeat_first_field )
{
int i_picture; /* picture index */
picture_t * p_picture;
......@@ -131,7 +134,7 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout )
vlc_mutex_lock( &p_vout->picture_lock );
/*
* Look for an empty place. XXX: we start at 1 because the first
* Look for an empty place. We start at 1 because the first
* directbuffer is reserved for memcpy()ed pictures.
*/
for( i_picture = 0;
......@@ -156,6 +159,12 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout )
* immediately - this is the best possible case, since no
* memory allocation needs to be done */
p_picture->i_status = RESERVED_PICTURE;
p_picture->i_refcount = 0;
p_picture->b_progressive = b_progressive;
p_picture->b_repeat_first_field = b_repeat_first_field;
p_picture->b_top_field_first = b_top_field_first;
p_vout->i_heap_size++;
vlc_mutex_unlock( &p_vout->picture_lock );
......@@ -182,8 +191,14 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout )
{
/* Copy picture information, set some default values */
p_free_picture->i_status = RESERVED_PICTURE;
p_free_picture->i_matrix_coefficients = 1;
p_free_picture->i_refcount = 0;
p_free_picture->b_progressive = b_progressive;
p_free_picture->b_repeat_first_field = b_repeat_first_field;
p_free_picture->b_top_field_first = b_top_field_first;
p_free_picture->i_matrix_coefficients = 1;
p_vout->i_heap_size++;
}
else
......@@ -319,6 +334,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
* displaying it if there are subtitles. */
if( p_subpic != NULL )
{
//printf("memcpy (refcount != 0)\n");
/* We have subtitles. First copy the picture to
* the spare direct buffer, then render the
* subtitles. */
......@@ -338,12 +354,14 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
/* No subtitles, picture is in a directbuffer so
* we can display it directly even if it is still
* in use. */
//printf("direct (refcount == 0)\n");
return p_picture;
}
/* Picture is in a direct buffer but isn't used by the
* decoder. We can safely render subtitles on it and
* display it. */
//printf("direct (refcount == 0)\n");
vout_RenderSubPictures( p_vout, p_picture, p_subpic );
return p_picture;
......@@ -356,6 +374,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
/* Picture is not in a direct buffer, but is exactly the
* same size as the direct buffers. A memcpy() is enough,
* then render the subtitles. */
//printf("memcpy (not a direct buffer)\n");
for( i_index = 0; i_index < p_picture->i_planes; i_index++ )
{
p_main->fast_memcpy( PP_OUTPUTPICTURE[0]->planes[ i_index ].p_data,
......@@ -375,6 +394,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
/* This usually means software YUV, or hardware YUV with a
* different chroma. */
//printf("render (not a direct buffer)\n");
/* XXX: render to direct buffer */
vout_RenderSubPictures( p_vout, p_picture, p_subpic );
......@@ -391,8 +411,6 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
void vout_PlacePicture( vout_thread_t *p_vout, int i_width, int i_height,
int *pi_x, int *pi_y, int *pi_width, int *pi_height )
{
int i_ratio;
if( p_vout->b_scale )
{
*pi_width = i_width;
......@@ -404,46 +422,25 @@ void vout_PlacePicture( vout_thread_t *p_vout, int i_width, int i_height,
*pi_height = MIN( i_height, p_vout->render.i_height );
}
switch( p_vout->render.i_aspect )
{
case AR_3_4_PICTURE:
i_ratio = 900 * 4 / 3;
break;
case AR_16_9_PICTURE:
i_ratio = 900 * 16 / 9;
break;
case AR_221_1_PICTURE:
i_ratio = 900 * 221 / 100;
break;
case AR_SQUARE_PICTURE:
default:
i_ratio = 900 * p_vout->render.i_width
/ p_vout->render.i_height;
break;
}
if( 900 * *pi_width / *pi_height < i_ratio )
if( VOUT_ASPECT_FACTOR * *pi_width / *pi_height < p_vout->render.i_aspect )
{
*pi_width = *pi_height * i_ratio / 900;
*pi_width = *pi_height * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
}
else
{
*pi_height = *pi_width * 900 / i_ratio;
*pi_height = *pi_width * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
}
if( *pi_width > i_width )
{
*pi_width = i_width;
*pi_height = 900 * *pi_width / i_ratio;
*pi_height = VOUT_ASPECT_FACTOR * *pi_width / p_vout->render.i_aspect;
}
if( *pi_height > i_height )
{
*pi_height = i_height;
*pi_width = *pi_height * i_ratio / 900;
*pi_width = *pi_height * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
}
*pi_x = ( i_width - *pi_width ) / 2;
......@@ -505,16 +502,22 @@ static void NewPicture( vout_thread_t *p_vout, picture_t *p_picture )
/* The Y plane */
p_picture->planes[ Y_PLANE ].i_bytes =
p_picture->i_size * sizeof(pixel_data_t);
p_picture->planes[ Y_PLANE ].i_line_bytes =
p_vout->render.i_width * sizeof(pixel_data_t);
p_picture->planes[ Y_PLANE ].p_data =
memalign( 16, i_data_size * sizeof(pixel_data_t) * 4 );
/* The U plane */
p_picture->planes[ U_PLANE ].i_bytes =
p_picture->i_chroma_size * sizeof(pixel_data_t);
p_picture->planes[ U_PLANE ].i_line_bytes =
p_picture->i_chroma_width * sizeof(pixel_data_t);
p_picture->planes[ U_PLANE ].p_data =
p_picture->planes[ Y_PLANE ].p_data + p_picture->i_size;
/* The V plane */
p_picture->planes[ V_PLANE ].i_bytes =
p_picture->i_chroma_size * sizeof(pixel_data_t);
p_picture->planes[ V_PLANE ].i_line_bytes =
p_picture->i_chroma_width * sizeof(pixel_data_t);
p_picture->planes[ V_PLANE ].p_data =
p_picture->planes[ U_PLANE ].p_data + p_picture->i_chroma_size;
......
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