Commit 2d90188b authored by Sam Hocevar's avatar Sam Hocevar

  * Initialize SDL before opening the SDL audio output.
  * Prevent two SDL video outputs or audio outputs to be spawned at the
    same time to avoid ugly crashes.
  * The SDL plugin now says whether we are using software or hardware YUV
    in its window title.
  * We now stop at the first ':' when looking for a module name, to easily
    pass information to the modules. Possible example: --vout sdl:software,
    implementation of such an option is left as an exercise.
  * Merged filter_bob and filter_bob422 into filter_bob. Use --filter bob
    to deinterlace 422 into 420 as well.
  * Factorized code common to most filters and the video output, optimized
    a few filters by aligning data and reading 64 bits at a time.
  * Two new absolutely useless, CPU-eating, resource-wasting, but fun
    filters: enjoy `transform', which performs flips and 90� rotations, and
    `distort', which performs animated image effects (currently only a naive
    sine wave is implemented). Usage examples:
       --filter transform:hflip
       --filter transform:vflip
       --filter transform:90
       --filter transform:180
       --filter transform:270
       --filter distort:wave
parent 8acfd9b4
...@@ -65,8 +65,9 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \ ...@@ -65,8 +65,9 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
esd/esd \ esd/esd \
fb/fb \ fb/fb \
filter/filter_bob \ filter/filter_bob \
filter/filter_bob422 \ filter/filter_transform \
filter/filter_invert \ filter/filter_invert \
filter/filter_distort \
filter/filter_wall \ filter/filter_wall \
ggi/ggi \ ggi/ggi \
glide/glide \ glide/glide \
......
...@@ -77,6 +77,7 @@ LIB_DVD_PLUGIN = @LIB_DVD_PLUGIN@ ...@@ -77,6 +77,7 @@ LIB_DVD_PLUGIN = @LIB_DVD_PLUGIN@
LIB_DVDREAD = @LIB_DVDREAD@ LIB_DVDREAD = @LIB_DVDREAD@
LIB_DVDREAD_PLUGIN = @LIB_DVDREAD_PLUGIN@ LIB_DVDREAD_PLUGIN = @LIB_DVDREAD_PLUGIN@
LIB_ESD = @LIB_ESD@ LIB_ESD = @LIB_ESD@
LIB_FILTER_DISTORT = @LIB_FILTER_DISTORT@
LIB_GGI = @LIB_GGI@ LIB_GGI = @LIB_GGI@
LIB_GLIDE = @LIB_GLIDE@ LIB_GLIDE = @LIB_GLIDE@
LIB_GNOME = @LIB_GNOME@ LIB_GNOME = @LIB_GNOME@
......
This diff is collapsed.
...@@ -144,7 +144,9 @@ AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)], ...@@ -144,7 +144,9 @@ AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
AC_FUNC_MMAP AC_FUNC_MMAP
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl") AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl")
AC_CHECK_LIB(m,cos,LIB_IMDCT="${LIB_IMDCT} -lm") AC_CHECK_LIB(m,cos,
LIB_IMDCT="${LIB_IMDCT} -lm"
LIB_FILTER_DISTORT="${LIB_FILTER_DISTORT} -lm")
AC_CHECK_LIB(m,pow, AC_CHECK_LIB(m,pow,
LIB_IMDCT="${LIB_IMDCT} -lm" LIB_IMDCT="${LIB_IMDCT} -lm"
LIB_IMDCT3DN="${LIB_IMDCT3DN} -lm" LIB_IMDCT3DN="${LIB_IMDCT3DN} -lm"
...@@ -310,7 +312,7 @@ dnl ...@@ -310,7 +312,7 @@ dnl
dnl default modules dnl default modules
dnl dnl
BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy 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 chroma_yv12_rgb8 filter_bob filter_invert filter_wall filter_bob422" PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert filter_wall filter_transform filter_distort"
dnl dnl
dnl Accelerated modules dnl Accelerated modules
...@@ -411,7 +413,7 @@ dnl ...@@ -411,7 +413,7 @@ dnl
case ${target_os} in case ${target_os} in
linux*) linux*)
SYS=linux SYS=linux
;; ;;
bsdi*) bsdi*)
SYS=bsdi SYS=bsdi
;; ;;
...@@ -1269,6 +1271,7 @@ AC_SUBST(LIB_DVD_PLUGIN) ...@@ -1269,6 +1271,7 @@ AC_SUBST(LIB_DVD_PLUGIN)
AC_SUBST(LIB_DVDREAD) AC_SUBST(LIB_DVDREAD)
AC_SUBST(LIB_DVDREAD_PLUGIN) AC_SUBST(LIB_DVDREAD_PLUGIN)
AC_SUBST(LIB_ESD) AC_SUBST(LIB_ESD)
AC_SUBST(LIB_FILTER_DISTORT)
AC_SUBST(LIB_GGI) AC_SUBST(LIB_GGI)
AC_SUBST(LIB_GLIDE) AC_SUBST(LIB_GLIDE)
AC_SUBST(LIB_GNOME) AC_SUBST(LIB_GNOME)
......
vlc (0.2.92-1) unstable; urgency=low vlc (0.2.92-UNSTABLE) unstable; urgency=low
* New upstream release. * Development branch.
-- Christophe Massiot <massiot@via.ecp.fr> Fri, 7 Dec 2001 20:18:56 +0100 -- Christophe Massiot <massiot@via.ecp.fr> Fri, 7 Dec 2001 20:18:56 +0100
......
...@@ -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: common.h,v 1.59 2001/12/16 16:18:36 sam Exp $ * $Id: common.h,v 1.60 2001/12/19 03:50:22 sam 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>
...@@ -547,6 +547,7 @@ typedef struct module_symbols_s ...@@ -547,6 +547,7 @@ typedef struct module_symbols_s
struct picture_s * ( * vout_CreatePicture ) struct picture_s * ( * vout_CreatePicture )
( struct vout_thread_s *, ( struct vout_thread_s *,
boolean_t, boolean_t, boolean_t ); boolean_t, boolean_t, boolean_t );
void ( * vout_AllocatePicture )( struct picture_s *, int, int, int );
void ( * vout_DisplayPicture ) ( struct vout_thread_s *, void ( * vout_DisplayPicture ) ( struct vout_thread_s *,
struct picture_s * ); struct picture_s * );
void ( * vout_DestroyPicture ) ( struct vout_thread_s *, void ( * vout_DestroyPicture ) ( struct vout_thread_s *,
......
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
(p_symbols)->vout_DestroySubPicture = vout_DestroySubPicture; \ (p_symbols)->vout_DestroySubPicture = vout_DestroySubPicture; \
(p_symbols)->vout_DisplaySubPicture = vout_DisplaySubPicture; \ (p_symbols)->vout_DisplaySubPicture = vout_DisplaySubPicture; \
(p_symbols)->vout_CreatePicture = vout_CreatePicture; \ (p_symbols)->vout_CreatePicture = vout_CreatePicture; \
(p_symbols)->vout_AllocatePicture = vout_AllocatePicture; \
(p_symbols)->vout_DisplayPicture = vout_DisplayPicture; \ (p_symbols)->vout_DisplayPicture = vout_DisplayPicture; \
(p_symbols)->vout_DestroyPicture = vout_DestroyPicture; \ (p_symbols)->vout_DestroyPicture = vout_DestroyPicture; \
(p_symbols)->vout_DatePicture = vout_DatePicture; \ (p_symbols)->vout_DatePicture = vout_DatePicture; \
...@@ -203,6 +204,7 @@ ...@@ -203,6 +204,7 @@
# define vout_DestroySubPicture p_symbols->vout_DestroySubPicture # define vout_DestroySubPicture p_symbols->vout_DestroySubPicture
# define vout_DisplaySubPicture p_symbols->vout_DisplaySubPicture # define vout_DisplaySubPicture p_symbols->vout_DisplaySubPicture
# define vout_CreatePicture p_symbols->vout_CreatePicture # define vout_CreatePicture p_symbols->vout_CreatePicture
# define vout_AllocatePicture p_symbols->vout_AllocatePicture
# define vout_DisplayPicture p_symbols->vout_DisplayPicture # define vout_DisplayPicture p_symbols->vout_DisplayPicture
# define vout_DestroyPicture p_symbols->vout_DestroyPicture # define vout_DestroyPicture p_symbols->vout_DestroyPicture
# define vout_DatePicture p_symbols->vout_DatePicture # define vout_DatePicture p_symbols->vout_DatePicture
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously oppenned video output thread. * thread, and destroy a previously oppenned video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video_output.h,v 1.66 2001/12/16 16:18:36 sam Exp $ * $Id: video_output.h,v 1.67 2001/12/19 03:50:22 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -195,6 +195,7 @@ void vout_FreeFifo ( vout_fifo_t * ); ...@@ -195,6 +195,7 @@ 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 ); boolean_t, boolean_t, boolean_t );
void vout_AllocatePicture( picture_t *, int, int, int );
void vout_DestroyPicture ( vout_thread_t *, picture_t * ); void vout_DestroyPicture ( vout_thread_t *, picture_t * );
void vout_DisplayPicture ( vout_thread_t *, picture_t * ); void vout_DisplayPicture ( vout_thread_t *, picture_t * );
void vout_DatePicture ( vout_thread_t *, picture_t *, mtime_t ); void vout_DatePicture ( vout_thread_t *, picture_t *, mtime_t );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_alsa.c : Alsa functions library * aout_alsa.c : Alsa functions library
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: aout_alsa.c,v 1.22 2001/12/07 18:33:07 sam Exp $ * $Id: aout_alsa.c,v 1.23 2001/12/19 03:50:22 sam Exp $
* *
* Authors: Henri Fallon <henri@videolan.org> - Original Author * Authors: Henri Fallon <henri@videolan.org> - Original Author
* Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API * Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API
...@@ -86,11 +86,9 @@ static int aout_Probe( probedata_t *p_data ) ...@@ -86,11 +86,9 @@ static int aout_Probe( probedata_t *p_data )
int i_open_return, i_close_return; int i_open_return, i_close_return;
aout_sys_t local_sys; aout_sys_t local_sys;
printf("aout_probe\n");
/* Open device */ /* Open device */
i_open_return = snd_pcm_open( &(local_sys.p_alsa_handle), "default", i_open_return = snd_pcm_open( &(local_sys.p_alsa_handle), "default",
SND_PCM_STREAM_PLAYBACK, 0 ); SND_PCM_STREAM_PLAYBACK, 0 );
printf("grmbl\n");
if( i_open_return ) if( i_open_return )
{ {
intf_WarnMsg( 2, "aout info: could not probe ALSA device (%s)", intf_WarnMsg( 2, "aout info: could not probe ALSA device (%s)",
......
...@@ -8,17 +8,19 @@ ...@@ -8,17 +8,19 @@
# #
PLUGIN_BOB = bob.o PLUGIN_BOB = bob.o
PLUGIN_BOB422 = bob422.o PLUGIN_TRANSFORM = transform.o
PLUGIN_INVERT = invert.o PLUGIN_INVERT = invert.o
PLUGIN_DISTORT = distort.o
PLUGIN_WALL = wall.o PLUGIN_WALL = wall.o
BUILTIN_BOB = $(PLUGIN_BOB:%.o=BUILTIN_%.o) BUILTIN_BOB = $(PLUGIN_BOB:%.o=BUILTIN_%.o)
BUILTIN_BOB422 = $(PLUGIN_BOB422:%.o=BUILTIN_%.o) BUILTIN_TRANSFORM = $(PLUGIN_TRANSFORM:%.o=BUILTIN_%.o)
BUILTIN_INVERT = $(PLUGIN_INVERT:%.o=BUILTIN_%.o) BUILTIN_INVERT = $(PLUGIN_INVERT:%.o=BUILTIN_%.o)
BUILTIN_DISTORT = $(PLUGIN_DISTORT:%.o=BUILTIN_%.o)
BUILTIN_WALL = $(PLUGIN_WALL:%.o=BUILTIN_%.o) BUILTIN_WALL = $(PLUGIN_WALL:%.o=BUILTIN_%.o)
PLUGIN_C = $(PLUGIN_BOB) $(PLUGIN_BOB422) $(PLUGIN_INVERT) $(PLUGIN_WALL) PLUGIN_C = $(PLUGIN_BOB) $(PLUGIN_TRANSFORM) $(PLUGIN_INVERT) $(PLUGIN_DISTORT) $(PLUGIN_WALL)
BUILTIN_C = $(BUILTIN_BOB) $(BUILTIN_BOB422) $(BUILTIN_INVERT) $(BUILTIN_WALL) BUILTIN_C = $(BUILTIN_BOB) $(BUILTIN_TRANSFORM) $(BUILTIN_INVERT) $(BUILTIN_DISTORT) $(BUILTIN_WALL)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C) ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
# #
...@@ -38,10 +40,10 @@ include ../../Makefile.modules ...@@ -38,10 +40,10 @@ include ../../Makefile.modules
ar r $@ $^ ar r $@ $^
$(RANLIB) $@ $(RANLIB) $@
../filter_bob422.so: $(PLUGIN_BOB422) ../filter_transform.so: $(PLUGIN_TRANSFORM)
$(CC) -o $@ $^ $(PLCFLAGS) $(CC) -o $@ $^ $(PLCFLAGS)
../filter_bob422.a: $(BUILTIN_BOB422) ../filter_transform.a: $(BUILTIN_TRANSFORM)
ar r $@ $^ ar r $@ $^
$(RANLIB) $@ $(RANLIB) $@
...@@ -52,6 +54,13 @@ include ../../Makefile.modules ...@@ -52,6 +54,13 @@ include ../../Makefile.modules
ar r $@ $^ ar r $@ $^
$(RANLIB) $@ $(RANLIB) $@
../filter_distort.so: $(PLUGIN_DISTORT)
$(CC) -o $@ $^ $(PLCFLAGS) $(LIB_FILTER_DISTORT)
../filter_distort.a: $(BUILTIN_DISTORT)
ar r $@ $^
$(RANLIB) $@
../filter_wall.so: $(PLUGIN_WALL) ../filter_wall.so: $(PLUGIN_WALL)
$(CC) -o $@ $^ $(PLCFLAGS) $(CC) -o $@ $^ $(PLCFLAGS)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* bob.c : BOB deinterlacer plugin for vlc * bob.c : BOB deinterlacer plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: bob.c,v 1.2 2001/12/16 18:00:18 sam Exp $ * $Id: bob.c,v 1.3 2001/12/19 03:50:22 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "filter_common.h"
#include "modules.h" #include "modules.h"
#include "modules_export.h" #include "modules_export.h"
#define BOB_MAX_DIRECTBUFFERS 8
/***************************************************************************** /*****************************************************************************
* Capabilities defined in the other files. * Capabilities defined in the other files.
*****************************************************************************/ *****************************************************************************/
...@@ -96,8 +96,6 @@ static void vout_Destroy ( struct vout_thread_s * ); ...@@ -96,8 +96,6 @@ static void vout_Destroy ( struct vout_thread_s * );
static int vout_Manage ( struct vout_thread_s * ); static int vout_Manage ( struct vout_thread_s * );
static void vout_Display ( struct vout_thread_s *, struct picture_s * ); static void vout_Display ( struct vout_thread_s *, struct picture_s * );
static int BobNewPicture( struct vout_thread_s *, struct picture_s * );
/***************************************************************************** /*****************************************************************************
* Functions exported as capabilities. They are declared as static so that * Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much. * we don't pollute the namespace too much.
...@@ -162,6 +160,7 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -162,6 +160,7 @@ static int vout_Init( vout_thread_t *p_vout )
switch( p_vout->render.i_chroma ) switch( p_vout->render.i_chroma )
{ {
case YUV_420_PICTURE: case YUV_420_PICTURE:
case YUV_422_PICTURE:
p_vout->output.i_chroma = p_vout->render.i_chroma; p_vout->output.i_chroma = p_vout->render.i_chroma;
p_vout->output.i_width = p_vout->render.i_width; p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->render.i_height; p_vout->output.i_height = p_vout->render.i_height;
...@@ -178,11 +177,26 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -178,11 +177,26 @@ static int vout_Init( vout_thread_t *p_vout )
main_PutPszVariable( VOUT_FILTER_VAR, "" ); main_PutPszVariable( VOUT_FILTER_VAR, "" );
intf_WarnMsg( 1, "filter: spawning the real video output" ); intf_WarnMsg( 1, "filter: spawning the real video output" );
p_vout->p_sys->p_vout = switch( p_vout->render.i_chroma )
vout_CreateThread( NULL, {
case YUV_420_PICTURE:
p_vout->p_sys->p_vout =
vout_CreateThread( NULL,
p_vout->output.i_width, p_vout->output.i_height / 2, p_vout->output.i_width, p_vout->output.i_height / 2,
p_vout->output.i_chroma, p_vout->output.i_aspect ); p_vout->output.i_chroma, p_vout->output.i_aspect );
break;
case YUV_422_PICTURE:
p_vout->p_sys->p_vout =
vout_CreateThread( NULL,
p_vout->output.i_width, p_vout->output.i_height,
YUV_420_PICTURE, p_vout->output.i_aspect );
break;
default:
break;
}
/* Everything failed */ /* Everything failed */
if( p_vout->p_sys->p_vout == NULL ) if( p_vout->p_sys->p_vout == NULL )
...@@ -194,39 +208,7 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -194,39 +208,7 @@ static int vout_Init( vout_thread_t *p_vout )
main_PutPszVariable( VOUT_FILTER_VAR, psz_filter ); main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
/* Try to initialize BOB_MAX_DIRECTBUFFERS direct buffers */ ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
while( I_OUTPUTPICTURES < BOB_MAX_DIRECTBUFFERS )
{
p_pic = NULL;
/* Find an empty picture slot */
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
{
if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
{
p_pic = p_vout->p_picture + i_index;
break;
}
}
/* Allocate the picture */
if( BobNewPicture( p_vout, p_pic ) )
{
break;
}
p_pic->i_status = DESTROYED_PICTURE;
p_pic->i_type = DIRECT_PICTURE;
p_pic->i_left_margin =
p_pic->i_right_margin =
p_pic->i_top_margin =
p_pic->i_bottom_margin = 0;
PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
I_OUTPUTPICTURES++;
}
return( 0 ); return( 0 );
} }
...@@ -275,7 +257,7 @@ static int vout_Manage( vout_thread_t *p_vout ) ...@@ -275,7 +257,7 @@ static int vout_Manage( vout_thread_t *p_vout )
* This function send the currently rendered image to BOB image, waits until * This function send the currently rendered image to BOB image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame. * it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/ *****************************************************************************/
static void vout_Display( vout_thread_t *p_vout, picture_t *p_inpic ) static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
{ {
picture_t *p_outpic; picture_t *p_outpic;
int i_index, i_field; int i_index, i_field;
...@@ -299,23 +281,62 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_inpic ) ...@@ -299,23 +281,62 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_inpic )
mdate() + (mtime_t)(50000 + i_field * 20000) ); mdate() + (mtime_t)(50000 + i_field * 20000) );
/* Copy image and skip lines */ /* Copy image and skip lines */
for( i_index = 0 ; i_index < p_inpic->i_planes ; i_index++ ) for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ )
{ {
pixel_data_t *p_in, *p_end, *p_out; pixel_data_t *p_in, *p_out_end, *p_out;
int i_increment;
p_in = p_inpic->planes[ i_index ].p_data p_in = p_pic->planes[ i_index ].p_data
+ i_field * p_inpic->planes[ i_index ].i_line_bytes; + i_field * p_pic->planes[ i_index ].i_line_bytes;
p_out = p_outpic->planes[ i_index ].p_data; p_out = p_outpic->planes[ i_index ].p_data;
p_end = p_out + p_outpic->planes[ i_index ].i_bytes; p_out_end = p_out + p_outpic->planes[ i_index ].i_bytes;
for( ; p_out < p_end ; ) switch( p_vout->render.i_chroma )
{ {
p_main->fast_memcpy( p_out, p_in, case YUV_420_PICTURE:
p_inpic->planes[ i_index ].i_line_bytes );
for( ; p_out < p_out_end ; )
p_out += p_inpic->planes[ i_index ].i_line_bytes; {
p_in += 2 * p_inpic->planes[ i_index ].i_line_bytes; p_main->fast_memcpy( p_out, p_in,
p_pic->planes[ i_index ].i_line_bytes );
p_out += p_pic->planes[ i_index ].i_line_bytes;
p_in += 2 * p_pic->planes[ i_index ].i_line_bytes;
}
break;
case YUV_422_PICTURE:
i_increment = 2 * p_pic->planes[ i_index ].i_line_bytes;
if( i_index == Y_PLANE )
{
for( ; p_out < p_out_end ; )
{
p_main->fast_memcpy( p_out, p_in,
p_pic->planes[ i_index ].i_line_bytes );
p_out += p_pic->planes[ i_index ].i_line_bytes;
p_main->fast_memcpy( p_out, p_in,
p_pic->planes[ i_index ].i_line_bytes );
p_out += p_pic->planes[ i_index ].i_line_bytes;
p_in += i_increment;
}
}
else
{
for( ; p_out < p_out_end ; )
{
p_main->fast_memcpy( p_out, p_in,
p_pic->planes[ i_index ].i_line_bytes );
p_out += p_pic->planes[ i_index ].i_line_bytes;
p_in += i_increment;
}
}
break;
default:
break;
} }
} }
...@@ -323,65 +344,3 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_inpic ) ...@@ -323,65 +344,3 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_inpic )
} }
} }
/*****************************************************************************
* BobNewPicture: allocate a picture
*****************************************************************************
* Returns 0 on success, -1 otherwise
*****************************************************************************/
static int BobNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
int i_luma_bytes, i_chroma_bytes;
int i_width = p_vout->output.i_width;
int i_height = p_vout->output.i_height;
switch( p_vout->output.i_chroma )
{
/* We know this chroma, allocate a buffer which will be used
* directly by the decoder */
case YUV_420_PICTURE:
/* 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_height * ( i_width / 2 );
/* Allocate the memory buffer */
i_luma_bytes = p_pic->i_size * sizeof(pixel_data_t);
i_chroma_bytes = p_pic->i_chroma_size * sizeof(pixel_data_t);
/* 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 / 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 / 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;
return( 0 );
break;
/* Unknown chroma, do nothing */
default:
return( 0 );
break;
}
}
/*****************************************************************************
* filter_common.h: Common filter functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: filter_common.h,v 1.1 2001/12/19 03:50:22 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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, USA.
*****************************************************************************/
#define ALLOCATE_DIRECTBUFFERS( i_max ) \
/* Try to initialize i_max direct buffers */ \
while( I_OUTPUTPICTURES < ( i_max ) ) \
{ \
p_pic = NULL; \
\
/* Find an empty picture slot */ \
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ ) \
{ \
if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE ) \
{ \
p_pic = p_vout->p_picture + i_index; \
break; \
} \
} \
\
if( p_pic == NULL ) \
{ \
break; \
} \
\
/* Allocate the picture */ \
vout_AllocatePicture( p_pic, \
p_vout->output.i_width, \
p_vout->output.i_height, \
p_vout->output.i_chroma ); \
\
if( !p_pic->i_planes ) \
{ \
break; \
} \
\
p_pic->i_status = DESTROYED_PICTURE; \
p_pic->i_type = DIRECT_PICTURE; \
\
p_pic->i_left_margin = \
p_pic->i_right_margin = \
p_pic->i_top_margin = \
p_pic->i_bottom_margin = 0; \
\
PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic; \
\
I_OUTPUTPICTURES++; \
} \
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* invert.c : Invert video plugin for vlc * invert.c : Invert video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: invert.c,v 1.1 2001/12/16 16:18:36 sam Exp $ * $Id: invert.c,v 1.2 2001/12/19 03:50:22 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "filter_common.h"
#include "modules.h" #include "modules.h"
#include "modules_export.h" #include "modules_export.h"
#define INVERT_MAX_DIRECTBUFFERS 8
/***************************************************************************** /*****************************************************************************
* Capabilities defined in the other files. * Capabilities defined in the other files.
*****************************************************************************/ *****************************************************************************/
...@@ -96,8 +96,6 @@ static void vout_Destroy ( struct vout_thread_s * ); ...@@ -96,8 +96,6 @@ static void vout_Destroy ( struct vout_thread_s * );
static int vout_Manage ( struct vout_thread_s * ); static int vout_Manage ( struct vout_thread_s * );
static void vout_Display ( struct vout_thread_s *, struct picture_s * ); static void vout_Display ( struct vout_thread_s *, struct picture_s * );
static int InvertNewPicture( struct vout_thread_s *, struct picture_s * );
/***************************************************************************** /*****************************************************************************
* Functions exported as capabilities. They are declared as static so that * Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much. * we don't pollute the namespace too much.
...@@ -157,6 +155,21 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -157,6 +155,21 @@ static int vout_Init( vout_thread_t *p_vout )
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
/* Initialize the output structure */
switch( p_vout->render.i_chroma )
{
case YUV_420_PICTURE:
p_vout->output.i_chroma = p_vout->render.i_chroma;
p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
break;
default:
return( 0 ); /* unknown chroma */
break;
}
/* Try to open the real video output */ /* Try to open the real video output */
psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" ); psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
main_PutPszVariable( VOUT_FILTER_VAR, "" ); main_PutPszVariable( VOUT_FILTER_VAR, "" );
...@@ -178,54 +191,7 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -178,54 +191,7 @@ static int vout_Init( vout_thread_t *p_vout )
main_PutPszVariable( VOUT_FILTER_VAR, psz_filter ); main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
/* Initialize the output structure */ ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
switch( p_vout->render.i_chroma )
{
case YUV_420_PICTURE:
p_vout->output.i_chroma = p_vout->render.i_chroma;
p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
break;
default:
p_vout->output.i_chroma = EMPTY_PICTURE; /* unknown chroma */
break;
}
/* Try to initialize INVERT_MAX_DIRECTBUFFERS direct buffers */
while( I_OUTPUTPICTURES < INVERT_MAX_DIRECTBUFFERS )
{
p_pic = NULL;
/* Find an empty picture slot */
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
{
if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
{
p_pic = p_vout->p_picture + i_index;
break;
}
}
/* Allocate the picture */
if( InvertNewPicture( p_vout, p_pic ) )
{
break;
}
p_pic->i_status = DESTROYED_PICTURE;
p_pic->i_type = DIRECT_PICTURE;
p_pic->i_left_margin =
p_pic->i_right_margin =
p_pic->i_top_margin =
p_pic->i_bottom_margin = 0;
PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
I_OUTPUTPICTURES++;
}
return( 0 ); return( 0 );
} }
...@@ -296,13 +262,31 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -296,13 +262,31 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ ) for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ )
{ {
pixel_data_t *p_in = p_pic->planes[ i_index ].p_data; pixel_data_t *p_in, *p_in_end, *p_out;
pixel_data_t *p_end = p_in + p_pic->planes[ i_index ].i_bytes;
p_in = p_pic->planes[ i_index ].p_data;
p_in_end = p_in + p_pic->planes[ i_index ].i_bytes - 64;
pixel_data_t *p_out = p_outpic->planes[ i_index ].p_data; p_out = p_outpic->planes[ i_index ].p_data;
for( ; p_in < p_end ; ) for( ; p_in < p_in_end ; )
{ {
/* Do 64 pixels at a time */
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
*((u64*)p_out)++ = ~( *((u64*)p_in)++ );
}
p_in_end += 64;
for( ; p_in < p_in_end ; )
{
/* Do 1 pixel at a time */
*p_out++ = ~( *p_in++ ); *p_out++ = ~( *p_in++ );
} }
} }
...@@ -312,60 +296,3 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -312,60 +296,3 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic ); vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
} }
/*****************************************************************************
* InvertNewPicture: allocate a picture
*****************************************************************************
* Returns 0 on success, -1 otherwise
*****************************************************************************/
static int InvertNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
int i_luma_bytes, i_chroma_bytes;
int i_width = p_vout->output.i_width;
int i_height = p_vout->output.i_height;
switch( p_vout->output.i_chroma )
{
/* We know this chroma, allocate a buffer which will be used
* directly by the decoder */
case YUV_420_PICTURE:
/* 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_height * ( i_width / 2 );
/* Allocate the memory buffer */
i_luma_bytes = p_pic->i_size * sizeof(pixel_data_t);
i_chroma_bytes = p_pic->i_chroma_size * sizeof(pixel_data_t);
/* 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 / 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 / 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;
return( 0 );
break;
/* Unknown chroma, do nothing */
default:
return( 0 );
break;
}
}
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wall.c : Wall video plugin for vlc * wall.c : Wall video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: wall.c,v 1.1 2001/12/17 03:38:21 sam Exp $ * $Id: wall.c,v 1.2 2001/12/19 03:50:22 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "filter_common.h"
#include "modules.h" #include "modules.h"
#include "modules_export.h" #include "modules_export.h"
#define WALL_MAX_DIRECTBUFFERS 8
/***************************************************************************** /*****************************************************************************
* Capabilities defined in the other files. * Capabilities defined in the other files.
*****************************************************************************/ *****************************************************************************/
...@@ -97,8 +97,6 @@ static void vout_Destroy ( struct vout_thread_s * ); ...@@ -97,8 +97,6 @@ static void vout_Destroy ( struct vout_thread_s * );
static int vout_Manage ( struct vout_thread_s * ); static int vout_Manage ( struct vout_thread_s * );
static void vout_Display ( struct vout_thread_s *, struct picture_s * ); static void vout_Display ( struct vout_thread_s *, struct picture_s * );
static int WallNewPicture ( struct vout_thread_s *, struct picture_s * );
/***************************************************************************** /*****************************************************************************
* Functions exported as capabilities. They are declared as static so that * Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much. * we don't pollute the namespace too much.
...@@ -158,6 +156,21 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -158,6 +156,21 @@ static int vout_Init( vout_thread_t *p_vout )
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
/* Initialize the output structure */
switch( p_vout->render.i_chroma )
{
case YUV_420_PICTURE:
p_vout->output.i_chroma = p_vout->render.i_chroma;
p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
break;
default:
return( 0 ); /* unknown chroma */
break;
}
/* Try to open the real video output */ /* Try to open the real video output */
psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" ); psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
main_PutPszVariable( VOUT_FILTER_VAR, "" ); main_PutPszVariable( VOUT_FILTER_VAR, "" );
...@@ -193,54 +206,7 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -193,54 +206,7 @@ static int vout_Init( vout_thread_t *p_vout )
main_PutPszVariable( VOUT_FILTER_VAR, psz_filter ); main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
/* Initialize the output structure */ ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
switch( p_vout->render.i_chroma )
{
case YUV_420_PICTURE:
p_vout->output.i_chroma = p_vout->render.i_chroma;
p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
break;
default:
p_vout->output.i_chroma = EMPTY_PICTURE; /* unknown chroma */
break;
}
/* Try to initialize WALL_MAX_DIRECTBUFFERS direct buffers */
while( I_OUTPUTPICTURES < WALL_MAX_DIRECTBUFFERS )
{
p_pic = NULL;
/* Find an empty picture slot */
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
{
if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
{
p_pic = p_vout->p_picture + i_index;
break;
}
}
/* Allocate the picture */
if( WallNewPicture( p_vout, p_pic ) )
{
break;
}
p_pic->i_status = DESTROYED_PICTURE;
p_pic->i_type = DIRECT_PICTURE;
p_pic->i_left_margin =
p_pic->i_right_margin =
p_pic->i_top_margin =
p_pic->i_bottom_margin = 0;
PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
I_OUTPUTPICTURES++;
}
return( 0 ); return( 0 );
} }
...@@ -345,60 +311,3 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -345,60 +311,3 @@ static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
vout_DisplayPicture( p_vout->p_sys->p_vout_bottom, p_outpic_bottom ); vout_DisplayPicture( p_vout->p_sys->p_vout_bottom, p_outpic_bottom );
} }
/*****************************************************************************
* WallNewPicture: allocate a picture
*****************************************************************************
* Returns 0 on success, -1 otherwise
*****************************************************************************/
static int WallNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
int i_luma_bytes, i_chroma_bytes;
int i_width = p_vout->output.i_width;
int i_height = p_vout->output.i_height;
switch( p_vout->output.i_chroma )
{
/* We know this chroma, allocate a buffer which will be used
* directly by the decoder */
case YUV_420_PICTURE:
/* 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_height * ( i_width / 2 );
/* Allocate the memory buffer */
i_luma_bytes = p_pic->i_size * sizeof(pixel_data_t);
i_chroma_bytes = p_pic->i_chroma_size * sizeof(pixel_data_t);
/* 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 / 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 / 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;
return( 0 );
break;
/* Unknown chroma, do nothing */
default:
return( 0 );
break;
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management * input_ps.c: PS demux and packet management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: input_ps.c,v 1.4 2001/12/12 13:48:09 massiot Exp $ * $Id: input_ps.c,v 1.5 2001/12/19 03:50:22 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr> * Cyril Deguet <asmax@via.ecp.fr>
...@@ -214,6 +214,7 @@ static void PSInit( input_thread_t * p_input ) ...@@ -214,6 +214,7 @@ static void PSInit( input_thread_t * p_input )
data_packet_t * pp_packets[INPUT_READ_ONCE]; data_packet_t * pp_packets[INPUT_READ_ONCE];
i_result = PSRead( p_input, pp_packets ); i_result = PSRead( p_input, pp_packets );
if( i_result == 1 ) if( i_result == 1 )
{ {
/* EOF */ /* EOF */
...@@ -222,7 +223,7 @@ static void PSInit( input_thread_t * p_input ) ...@@ -222,7 +223,7 @@ static void PSInit( input_thread_t * p_input )
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
break; break;
} }
if( i_result == -1 ) else if( i_result == -1 )
{ {
p_input->b_error = 1; p_input->b_error = 1;
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_sdl.c : audio sdl functions library * aout_sdl.c : audio sdl functions library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: aout_sdl.c,v 1.20 2001/12/07 18:33:08 sam Exp $ * $Id: aout_sdl.c,v 1.21 2001/12/19 03:50:22 sam Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -107,7 +107,14 @@ static int aout_Probe( probedata_t *p_data ) ...@@ -107,7 +107,14 @@ static int aout_Probe( probedata_t *p_data )
{ {
#if 0 #if 0
SDL_AudioSpec desired, obtained; SDL_AudioSpec desired, obtained;
#endif
if( SDL_WasInit( SDL_INIT_AUDIO ) != 0 )
{
return( 0 );
}
#if 0
/* Start AudioSDL */ /* Start AudioSDL */
if( SDL_Init(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE) != 0 ) if( SDL_Init(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE) != 0 )
{ {
...@@ -154,7 +161,7 @@ static int aout_Open( aout_thread_t *p_aout ) ...@@ -154,7 +161,7 @@ static int aout_Open( aout_thread_t *p_aout )
SDL_AudioSpec desired; SDL_AudioSpec desired;
int i_channels = p_aout->b_stereo ? 2 : 1; int i_channels = p_aout->b_stereo ? 2 : 1;
/* Allocate structure */ /* Allocate structure */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->p_sys == NULL ) if( p_aout->p_sys == NULL )
...@@ -163,6 +170,24 @@ static int aout_Open( aout_thread_t *p_aout ) ...@@ -163,6 +170,24 @@ static int aout_Open( aout_thread_t *p_aout )
return( 1 ); return( 1 );
} }
/* Initialize library */
if( SDL_Init( SDL_INIT_AUDIO
#ifndef WIN32
/* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/
| SDL_INIT_EVENTTHREAD
#endif
#ifdef DEBUG
/* In debug mode you may want vlc to dump a core instead of staying
* stuck */
| SDL_INIT_NOPARACHUTE
#endif
) < 0 )
{
intf_ErrMsg( "aout error: can't initialize SDL (%s)", SDL_GetError() );
free( p_aout->p_sys );
return( 1 );
}
p_aout->p_sys->i_audio_end = 0; p_aout->p_sys->i_audio_end = 0;
p_aout->p_sys->audio_buf = malloc( OVERFLOWLIMIT ); p_aout->p_sys->audio_buf = malloc( OVERFLOWLIMIT );
...@@ -192,6 +217,8 @@ static int aout_Open( aout_thread_t *p_aout ) ...@@ -192,6 +217,8 @@ static int aout_Open( aout_thread_t *p_aout )
if( SDL_OpenAudio( &desired, NULL ) < 0 ) if( SDL_OpenAudio( &desired, NULL ) < 0 )
{ {
intf_ErrMsg( "aout error: SDL_OpenAudio failed (%s)", SDL_GetError() ); intf_ErrMsg( "aout error: SDL_OpenAudio failed (%s)", SDL_GetError() );
SDL_QuitSubSystem( SDL_INIT_AUDIO );
free( p_aout->p_sys );
return( -1 ); return( -1 );
} }
...@@ -295,6 +322,8 @@ static void aout_Close( aout_thread_t *p_aout ) ...@@ -295,6 +322,8 @@ static void aout_Close( aout_thread_t *p_aout )
SDL_CloseAudio(); SDL_CloseAudio();
SDL_QuitSubSystem( SDL_INIT_AUDIO );
free( p_aout->p_sys ); /* Close the Output. */ free( p_aout->p_sys ); /* Close the Output. */
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_sdl.c: SDL video output display method * vout_sdl.c: SDL video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: vout_sdl.c,v 1.70 2001/12/16 16:18:36 sam Exp $ * $Id: vout_sdl.c,v 1.71 2001/12/19 03:50:22 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org> * Pierre Baillet <oct@zoy.org>
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
typedef struct vout_sys_s typedef struct vout_sys_s
{ {
SDL_Surface * p_display; /* display device */ SDL_Surface * p_display; /* display device */
SDL_Overlay * p_overlay; /* An overlay we keep to grab the XVideo port */
int i_width; int i_width;
int i_height; int i_height;
...@@ -129,6 +130,11 @@ void _M( vout_getfunctions )( function_list_t * p_function_list ) ...@@ -129,6 +130,11 @@ void _M( vout_getfunctions )( function_list_t * p_function_list )
*****************************************************************************/ *****************************************************************************/
static int vout_Probe( probedata_t *p_data ) static int vout_Probe( probedata_t *p_data )
{ {
if( SDL_WasInit( SDL_INIT_VIDEO ) != 0 )
{
return( 0 );
}
if( TestMethod( VOUT_METHOD_VAR, "sdl" ) ) if( TestMethod( VOUT_METHOD_VAR, "sdl" ) )
{ {
return( 999 ); return( 999 );
...@@ -190,15 +196,21 @@ static int vout_Create( vout_thread_t *p_vout ) ...@@ -190,15 +196,21 @@ static int vout_Create( vout_thread_t *p_vout )
* VOUT_ASPECT_FACTOR / p_vout->render.i_aspect; * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
} }
if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 300 ) if( p_vout->p_sys->i_width <= 300 && p_vout->p_sys->i_height <= 200 )
{
p_vout->p_sys->i_width <<= 1;
p_vout->p_sys->i_height <<= 1;
}
else 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_width += p_vout->p_sys->i_width >> 1;
p_vout->p_sys->i_height *= 2; p_vout->p_sys->i_height += p_vout->p_sys->i_height >> 1;
} }
if( SDLOpenDisplay( p_vout ) ) if( SDLOpenDisplay( p_vout ) )
{ {
intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() ); intf_ErrMsg( "vout error: can't set up SDL (%s)", SDL_GetError() );
SDL_QuitSubSystem( SDL_INIT_VIDEO );
free( p_vout->p_sys ); free( p_vout->p_sys );
return( 1 ); return( 1 );
} }
...@@ -247,8 +259,8 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -247,8 +259,8 @@ static int vout_Init( vout_thread_t *p_vout )
} }
} }
/* Allocate the picture */ /* Allocate the picture if we found one */
if( SDLNewPicture( p_vout, p_pic ) ) if( p_pic == NULL || SDLNewPicture( p_vout, p_pic ) )
{ {
break; break;
} }
...@@ -506,8 +518,29 @@ static int SDLOpenDisplay( vout_thread_t *p_vout ) ...@@ -506,8 +518,29 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
SDL_LockSurface( p_vout->p_sys->p_display ); SDL_LockSurface( p_vout->p_sys->p_display );
SDL_WM_SetCaption( VOUT_TITLE " (SDL output)", p_vout->p_sys->p_overlay =
VOUT_TITLE " (SDL output)" ); SDL_CreateYUVOverlay( 32, 32, SDL_YV12_OVERLAY,
p_vout->p_sys->p_display );
if( p_vout->p_sys->p_overlay == NULL )
{
intf_ErrMsg( "vout error: cannot set overlay" );
SDL_UnlockSurface( p_vout->p_sys->p_display );
SDL_FreeSurface( p_vout->p_sys->p_display );
return( 1 );
}
if( p_vout->p_sys->p_overlay->hw_overlay )
{
SDL_WM_SetCaption( VOUT_TITLE " (hardware SDL output)",
VOUT_TITLE " (hardware SDL output)" );
}
else
{
SDL_WM_SetCaption( VOUT_TITLE " (software SDL output)",
VOUT_TITLE " (software SDL output)" );
}
SDL_EventState( SDL_KEYUP, SDL_IGNORE ); /* ignore keys up */ SDL_EventState( SDL_KEYUP, SDL_IGNORE ); /* ignore keys up */
return( 0 ); return( 0 );
...@@ -521,6 +554,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout ) ...@@ -521,6 +554,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
*****************************************************************************/ *****************************************************************************/
static void SDLCloseDisplay( vout_thread_t *p_vout ) static void SDLCloseDisplay( vout_thread_t *p_vout )
{ {
SDL_FreeYUVOverlay( p_vout->p_sys->p_overlay );
SDL_UnlockSurface ( p_vout->p_sys->p_display ); SDL_UnlockSurface ( p_vout->p_sys->p_display );
SDL_FreeSurface( p_vout->p_sys->p_display ); SDL_FreeSurface( p_vout->p_sys->p_display );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_common.c: Functions common to the X11 and XVideo plugins * vout_common.c: Functions common to the X11 and XVideo plugins
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: vout_common.c,v 1.4 2001/12/16 16:18:36 sam Exp $ * $Id: vout_common.c,v 1.5 2001/12/19 03:50:22 sam 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>
...@@ -470,10 +470,16 @@ int _M( XCommonCreateWindow ) ( vout_thread_t *p_vout ) ...@@ -470,10 +470,16 @@ int _M( XCommonCreateWindow ) ( vout_thread_t *p_vout )
* VOUT_ASPECT_FACTOR / p_vout->render.i_aspect; * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
} }
if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 300 ) if( p_vout->p_sys->i_width <= 300 && p_vout->p_sys->i_height <= 200 )
{ {
p_vout->p_sys->i_width *= 2; p_vout->p_sys->i_width <<= 1;
p_vout->p_sys->i_height *= 2; p_vout->p_sys->i_height <<= 1;
}
else if( p_vout->p_sys->i_width <= 400
&& p_vout->p_sys->i_height <= 300 )
{
p_vout->p_sys->i_width += p_vout->p_sys->i_width >> 1;
p_vout->p_sys->i_height += p_vout->p_sys->i_height >> 1;
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Functions are prototyped in tests.h. * Functions are prototyped in tests.h.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: tests.c,v 1.9 2001/12/07 18:33:08 sam Exp $ * $Id: tests.c,v 1.10 2001/12/19 03:50:22 sam Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* *
...@@ -46,7 +46,21 @@ int TestProgram( char * psz_program ) ...@@ -46,7 +46,21 @@ int TestProgram( char * psz_program )
*****************************************************************************/ *****************************************************************************/
int TestMethod( char * psz_var, char * psz_method ) int TestMethod( char * psz_var, char * psz_method )
{ {
return( !strcmp( psz_method, main_GetPszVariable( psz_var, "" ) ) ); int i_len = strlen( psz_method );
int i_index = 0;
char *psz_requested = main_GetPszVariable( psz_var, "" );
while( psz_requested[i_index] && psz_requested[i_index] != ':' )
{
i_index++;
}
if( i_index != i_len )
{
return 0;
}
return !strncmp( psz_method, psz_requested, i_len );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -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.4 2001/12/16 16:18:36 sam Exp $ * $Id: vout_pictures.c,v 1.5 2001/12/19 03:50:22 sam 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>
...@@ -40,11 +40,6 @@ ...@@ -40,11 +40,6 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static void NewPicture ( vout_thread_t *, picture_t * );
/***************************************************************************** /*****************************************************************************
* vout_DisplayPicture: display a picture * vout_DisplayPicture: display a picture
***************************************************************************** *****************************************************************************
...@@ -185,12 +180,16 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, ...@@ -185,12 +180,16 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout,
*/ */
if( p_free_picture != NULL ) if( p_free_picture != NULL )
{ {
NewPicture( p_vout, p_free_picture ); vout_AllocatePicture( p_free_picture,
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma );
if( p_free_picture->i_planes ) if( p_free_picture->i_planes )
{ {
/* Copy picture information, set some default values */ /* Copy picture information, set some default values */
p_free_picture->i_status = RESERVED_PICTURE; p_free_picture->i_status = RESERVED_PICTURE;
p_free_picture->i_type = MEMORY_PICTURE;
p_free_picture->i_refcount = 0; p_free_picture->i_refcount = 0;
p_free_picture->b_progressive = b_progressive; p_free_picture->b_progressive = b_progressive;
...@@ -447,51 +446,46 @@ void vout_PlacePicture( vout_thread_t *p_vout, int i_width, int i_height, ...@@ -447,51 +446,46 @@ void vout_PlacePicture( vout_thread_t *p_vout, int i_width, int i_height,
*pi_y = ( i_height - *pi_height ) / 2; *pi_y = ( i_height - *pi_height ) / 2;
} }
/* Following functions are local */
/***************************************************************************** /*****************************************************************************
* NewPicture: allocate a new picture in the heap. * vout_AllocatePicture: allocate a new picture in the heap.
***************************************************************************** *****************************************************************************
* This function allocates a fake direct buffer in memory, which can be * This function allocates a fake direct buffer in memory, which can be
* used exactly like a video buffer. The video output thread then manages * used exactly like a video buffer. The video output thread then manages
* how it gets displayed. * how it gets displayed.
*****************************************************************************/ *****************************************************************************/
static void NewPicture( vout_thread_t *p_vout, picture_t *p_picture ) void vout_AllocatePicture( picture_t *p_picture,
int i_width, int i_height, int i_chroma )
{ {
int i_data_size = 0; int i_data_size = 0;
p_picture->i_size = p_vout->render.i_width p_picture->i_size = i_width * i_height;
* p_vout->render.i_height;
/* Calculate coordinates */ /* Calculate coordinates */
switch( p_vout->render.i_chroma ) switch( i_chroma )
{ {
case YUV_420_PICTURE: /* YUV 420: 1,1/4,1/4 samples per pixel */ case YUV_420_PICTURE: /* YUV 420: 1,1/4,1/4 samples per pixel */
p_picture->i_chroma_size = p_picture->i_size / 4; p_picture->i_chroma_size = p_picture->i_size / 4;
p_picture->i_chroma_width = p_vout->render.i_width / 2; p_picture->i_chroma_width = i_width / 2;
break; break;
case YUV_422_PICTURE: /* YUV 422: 1,1/2,1/2 samples per pixel */ case YUV_422_PICTURE: /* YUV 422: 1,1/2,1/2 samples per pixel */
p_picture->i_chroma_size = p_picture->i_size / 2; p_picture->i_chroma_size = p_picture->i_size / 2;
p_picture->i_chroma_width = p_vout->render.i_width / 2; p_picture->i_chroma_width = i_width / 2;
break; break;
case YUV_444_PICTURE: /* YUV 444: 1,1,1 samples per pixel */ case YUV_444_PICTURE: /* YUV 444: 1,1,1 samples per pixel */
p_picture->i_chroma_size = p_picture->i_size; p_picture->i_chroma_size = p_picture->i_size;
p_picture->i_chroma_width = p_vout->render.i_width; p_picture->i_chroma_width = i_width;
break; break;
default: default:
intf_ErrMsg( "vout error: unknown chroma type %d", intf_ErrMsg( "vout error: unknown chroma type %d", i_chroma );
p_vout->render.i_chroma );
p_picture->i_planes = 0; p_picture->i_planes = 0;
return; return;
} }
p_picture->i_type = MEMORY_PICTURE;
/* Allocate memory */ /* Allocate memory */
switch( p_vout->render.i_chroma ) switch( i_chroma )
{ {
case YUV_420_PICTURE: /* YUV 420: 1,1/4,1/4 samples per pixel */ case YUV_420_PICTURE: /* YUV 420: 1,1/4,1/4 samples per pixel */
case YUV_422_PICTURE: /* YUV 422: 1,1/2,1/2 samples per pixel */ case YUV_422_PICTURE: /* YUV 422: 1,1/2,1/2 samples per pixel */
...@@ -503,7 +497,7 @@ static void NewPicture( vout_thread_t *p_vout, picture_t *p_picture ) ...@@ -503,7 +497,7 @@ static void NewPicture( vout_thread_t *p_vout, picture_t *p_picture )
p_picture->planes[ Y_PLANE ].i_bytes = p_picture->planes[ Y_PLANE ].i_bytes =
p_picture->i_size * sizeof(pixel_data_t); p_picture->i_size * sizeof(pixel_data_t);
p_picture->planes[ Y_PLANE ].i_line_bytes = p_picture->planes[ Y_PLANE ].i_line_bytes =
p_vout->render.i_width * sizeof(pixel_data_t); i_width * sizeof(pixel_data_t);
p_picture->planes[ Y_PLANE ].p_data = p_picture->planes[ Y_PLANE ].p_data =
memalign( 16, i_data_size * sizeof(pixel_data_t) * 4 ); memalign( 16, i_data_size * sizeof(pixel_data_t) * 4 );
/* The U plane */ /* The U plane */
......
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