Commit c8c99b21 authored by Sam Hocevar's avatar Sam Hocevar

  * Fixed a few warnings with gcc 3.0.
  * aout and vout are now allocated in banks, making it possible to have
    several of them at the same time.
  * configure now checks for MMX and MMX EXT support in the assembler.
  * Removed all MMX code from the main program and moved it to the
    existing idct modules (Closes: Debian bug #96036).

    Don't forget to make distclean before building vlc again.
parent 92df268e
......@@ -127,6 +127,7 @@ N: Andres Krapf
E: dae@via.ecp.fr
C: dae
D: FreeBSD port and tests
D: KDE interface
N: Markus Kuespert
E: ltlBeBoy@beosmail.com
......
......@@ -3,6 +3,13 @@
#===================#
HEAD
* Fixed a few warnings with gcc 3.0.
* aout and vout are now allocated in banks, making it possible to have
several of them at the same time.
* configure now checks for MMX and MMX EXT support in the assembler.
* Removed all MMX code from the main program and moved it to the
existing idct modules (Closes: Debian bug #96036).
* KDE interface.
* FreeBSD CSS decryption support.
* Fixed a segfault in TS input (psi packets with adaptation field).
* Corrected vlc-howto.sgml thanks to Arnaud Gomes-do-Vale
......
......@@ -200,11 +200,6 @@ endif
#end of optimisations
endif
# Optional MMX optimizations for x86
ifneq (,$(findstring mmx,$(ARCH)))
CFLAGS += -DHAVE_MMX
endif
#
# C compiler flags: dependancies
#
......
This diff is collapsed.
......@@ -105,10 +105,10 @@ void foo() { int meuh; ntohl(meuh); }],,
dnl Check for -rdynamic flag
CFLAGS="${CFLAGS} -rdynamic -Wall -Werror"
AC_MSG_CHECKING([if \$CC groks -rdynamic without complaining too much])
AC_MSG_CHECKING([if \$CC miserably fails with the -rdynamic flag])
AC_TRY_COMPILE([],,
LCFLAGS="${LCFLAGS} -rdynamic"
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_RESULT(no), AC_MSG_RESULT(yes))
dnl End of the bizarre compilation tests
CFLAGS="${save_CFLAGS}"
......@@ -136,18 +136,29 @@ dnl
dnl default modules
dnl
BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion"
dnl
dnl Accelerated modules
dnl
case x$host_os in
xbeos|xnto-qnx)
ACCEL_PLUGINS="yuvmmx idctmmx motionmmx"
;;
xmingw32msvc)
ACCEL_PLUGINS="idctmmx idctmmxext motionmmx motionmmxext"
MMX_PLUGINS="idctmmx motionmmx"
;;
*)
ACCEL_PLUGINS="yuvmmx idctmmx idctmmxext motionmmx motionmmxext"
MMX_PLUGINS="yuvmmx idctmmx motionmmx"
;;
esac
AC_MSG_CHECKING([if \$CC groks MMX inline assembly])
AC_TRY_COMPILE([void quux(){void *p;asm("packuswb %%mm1,%%mm2"::"r"(p));}],,
ACCEL_PLUGINS="${ACCEL_PLUGINS} ${MMX_PLUGINS}"
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_CHECKING([if \$CC groks MMX EXT (SSE) inline assembly])
AC_TRY_COMPILE([void quux(){void *p;asm("maskmovq %%mm1,%%mm2"::"r"(p));}],,
ACCEL_PLUGINS="${ACCEL_PLUGINS} idctmmxext motionmmxext"
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
dnl
dnl DVD module: check for DVD ioctls
dnl
......
vlc (0.2.73-2) unstable; urgency=low
* We now build without MMX in the main application (Closes: #96036).
-- Samuel Hocevar <sam@zoy.org> Fri, 4 May 2001 07:13:04 +0200
vlc (0.2.73-1) unstable; urgency=low
* New upstream release.
......
......@@ -2,7 +2,7 @@
* audio_output.h : audio output thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: audio_output.h,v 1.33 2001/05/01 04:18:17 sam Exp $
* $Id: audio_output.h,v 1.34 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
......@@ -21,6 +21,23 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* aout_bank_t, p_aout_bank (global variable)
*****************************************************************************
* This global variable is accessed by any function using the audio output.
*****************************************************************************/
typedef struct
{
/* Array to all the audio outputs */
struct aout_thread_s *pp_aout[ AOUT_MAX_THREADS ];
int i_count;
vlc_mutex_t lock; /* Global lock */
} aout_bank_t;
extern aout_bank_t *p_aout_bank;
/*****************************************************************************
* aout_increment_t
*****************************************************************************
......@@ -143,7 +160,8 @@ typedef struct aout_thread_s
int i_fd;
/* The current volume */
int i_vol;
int i_volume;
int i_savedvolume;
/* Format of the audio output samples */
int i_format;
/* Number of channels */
......@@ -180,6 +198,9 @@ typedef struct aout_thread_s
/*****************************************************************************
* Prototypes
*****************************************************************************/
void aout_InitBank ( void );
void aout_EndBank ( void );
aout_thread_t * aout_CreateThread ( int *pi_status );
void aout_DestroyThread ( aout_thread_t *, int * );
......
......@@ -2,7 +2,7 @@
* beos_specific.h: BeOS specific features
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: beos_specific.h,v 1.5 2001/04/12 01:52:45 sam Exp $
* $Id: beos_specific.h,v 1.6 2001/05/06 04:32:02 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
*
......@@ -29,8 +29,8 @@
extern "C" {
#endif
void system_Create ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] );
void system_Destroy( void );
void system_Init ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] );
void system_End ( void );
char * system_GetProgramPath( void );
#ifdef __cplusplus
......
......@@ -218,6 +218,9 @@
* Audio configuration
*****************************************************************************/
/* Maximum number of audio output threads */
#define AOUT_MAX_THREADS 10
/* Environment variable containing the audio output method */
#define AOUT_METHOD_VAR "vlc_aout"
......@@ -272,6 +275,9 @@
* Video configuration
*****************************************************************************/
/* Maximum number of video output threads */
#define VOUT_MAX_THREADS 10
/*
* Default settings for video output threads
*/
......
......@@ -2,7 +2,7 @@
* darwin_specific.h: Darwin specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: darwin_specific.h,v 1.1 2001/04/12 01:52:45 sam Exp $
* $Id: darwin_specific.h,v 1.2 2001/05/06 04:32:02 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -24,7 +24,7 @@
/*****************************************************************************
* Prototypes
*****************************************************************************/
void system_Create ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] );
void system_Destroy( void );
void system_Init ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] );
void system_End ( void );
char * system_GetProgramPath( void );
......@@ -3,7 +3,7 @@
* Declaration and extern access to global program object.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: main.h,v 1.17 2001/05/01 04:18:17 sam Exp $
* $Id: main.h,v 1.18 2001/05/06 04:32:02 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -50,8 +50,6 @@ typedef struct
boolean_t b_channels; /* is channel changing supported ? */
/* Unique threads */
p_vout_thread_t p_vout; /* video output thread */
p_aout_thread_t p_aout; /* audio output thread */
p_intf_thread_t p_intf; /* main interface thread */
/* Shared data - these structures are accessed directly from p_main by
......
......@@ -2,7 +2,7 @@
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.22 2001/05/01 04:18:17 sam Exp $
* $Id: modules.h,v 1.23 2001/05/06 04:32:02 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -26,7 +26,7 @@
#endif
/*****************************************************************************
* bank_t, p_bank (global variable)
* module_bank_t, p_module_bank (global variable)
*****************************************************************************
* This global variable is accessed by any function using modules.
*****************************************************************************/
......@@ -36,9 +36,9 @@ typedef struct
vlc_mutex_t lock; /* Global lock -- you can't imagine how awful it
is to design thread-safe linked lists. */
} bank_t;
} module_bank_t;
extern bank_t *p_bank;
extern module_bank_t *p_module_bank;
/*****************************************************************************
* Module #defines.
......@@ -168,12 +168,18 @@ typedef struct function_list_s
/* IDCT plugin */
struct
{
void ( * pf_init ) ( struct vdec_thread_s * );
void ( * pf_idct_init ) ( struct vdec_thread_s * );
void ( * pf_sparse_idct ) ( struct vdec_thread_s *,
dctelem_t *, int );
void ( * pf_idct ) ( struct vdec_thread_s *,
dctelem_t *, int );
void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] );
void ( * pf_vdec_init ) ( struct vdec_thread_s * );
void ( * pf_decode_mb_c ) ( struct vdec_thread_s *,
struct macroblock_s * );
void ( * pf_decode_mb_bw ) ( struct vdec_thread_s *,
struct macroblock_s * );
} idct;
/* YUV transformation plugin */
......
......@@ -4,7 +4,7 @@
* modules.
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: netutils.h,v 1.11 2001/04/27 18:07:56 henri Exp $
* $Id: netutils.h,v 1.12 2001/05/06 04:32:02 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Henri Fallon <henri@videolan.org>
......@@ -32,5 +32,5 @@
*****************************************************************************/
int network_BuildLocalAddr ( struct sockaddr_in *, int, char * );
int network_BuildRemoteAddr( struct sockaddr_in *, char * );
int network_ChannelJoin( int i_channel_id );
int network_ChannelCreate( void );
int network_ChannelJoin ( int i_channel_id );
int network_ChannelCreate ( void );
......@@ -2,7 +2,7 @@
* video_decoder.h : video decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_decoder.h,v 1.22 2001/01/13 12:57:19 sam Exp $
* $Id: video_decoder.h,v 1.23 2001/05/06 04:32:02 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -54,14 +54,14 @@ typedef struct vdec_thread_s
/* idct iformations */
dctelem_t p_pre_idct[64*64];
/* Macroblock copy functions */
void ( * pf_vdec_init ) ( struct vdec_thread_s * );
void ( * pf_decode_mb_c ) ( struct vdec_thread_s *, struct macroblock_s * );
void ( * pf_decode_mb_bw )( struct vdec_thread_s *, struct macroblock_s * );
/* Input properties */
struct vpar_thread_s * p_vpar; /* video_parser thread */
#ifndef HAVE_MMX
/* Lookup tables */
u8 pi_crop_buf[VDEC_CROPRANGE];
u8 * pi_crop;
#endif
} vdec_thread_t;
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* video_fifo.h : FIFO for the pool of video_decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_fifo.h,v 1.4 2001/02/23 14:07:25 massiot Exp $
* $Id: video_fifo.h,v 1.18 2001/05/06 04:32:02 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -127,7 +127,7 @@ static __inline__ void vpar_DecodeMacroblock( video_fifo_t * p_fifo,
vlc_mutex_unlock( &p_fifo->lock );
#else
vdec_DecodeMacroblockC( p_fifo->p_vpar->pp_vdec[0], p_mb );
p_fifo->p_vpar->pf_decode_mb_c( p_fifo->p_vpar->pp_vdec[0], p_mb );
#endif
}
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppenned video output thread.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_output.h,v 1.58 2001/05/01 04:18:17 sam Exp $
* $Id: video_output.h,v 1.59 2001/05/06 04:32:02 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -24,6 +24,23 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* vout_bank_t, p_vout_bank (global variable)
*****************************************************************************
* This global variable is accessed by any function using the video output.
*****************************************************************************/
typedef struct
{
/* Array to all the video outputs */
struct vout_thread_s *pp_vout[ VOUT_MAX_THREADS ];
int i_count;
vlc_mutex_t lock; /* Global lock */
} vout_bank_t;
extern vout_bank_t *p_vout_bank;
/*****************************************************************************
* vout_yuv_convert_t: YUV conversion function
*****************************************************************************
......@@ -256,6 +273,9 @@ typedef struct vout_thread_s
/*****************************************************************************
* Prototypes
*****************************************************************************/
void vout_InitBank ( void );
void vout_EndBank ( void );
vout_thread_t * vout_CreateThread ( int *pi_status );
void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status );
......
......@@ -2,7 +2,7 @@
* video_parser.h : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.h,v 1.8 2001/01/24 19:05:55 massiot Exp $
* $Id: video_parser.h,v 1.34 2001/05/06 04:32:02 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -136,11 +136,14 @@ typedef struct vpar_thread_s
void ( * ppf_motion_skipped[4][4] ) ( struct macroblock_s * );
/* IDCT plugin used and shortcuts to access its capabilities */
struct module_s * p_idct_module;
idct_init_t pf_init;
f_idct_t pf_sparse_idct;
f_idct_t pf_idct;
norm_scan_t pf_norm_scan;
struct module_s * p_idct_module;
void ( * pf_idct_init ) ( struct vdec_thread_s * );
void ( * pf_sparse_idct ) ( struct vdec_thread_s *, dctelem_t*, int );
void ( * pf_idct ) ( struct vdec_thread_s *, dctelem_t*, int );
void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] );
void ( * pf_vdec_init ) ( struct vdec_thread_s * );
void ( * pf_decode_mb_c ) ( struct vdec_thread_s *, struct macroblock_s * );
void ( * pf_decode_mb_bw )( struct vdec_thread_s *, struct macroblock_s * );
#ifdef STATS
/* Statistics */
......
......@@ -2,7 +2,7 @@
* vpar_headers.h : video parser : headers parsing
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_headers.h,v 1.6 2001/02/13 13:01:14 massiot Exp $
* $Id: vpar_headers.h,v 1.26 2001/05/06 04:32:02 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......
......@@ -2,7 +2,7 @@
* vpar_synchro.h : video parser blocks management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_synchro.h,v 1.8 2001/03/06 15:16:42 massiot Exp $
* $Id: vpar_synchro.h,v 1.33 2001/05/06 04:32:02 sam Exp $
*
* Author: Christophe Massiot <massiot@via.ecp.fr>
*
......
......@@ -2,7 +2,7 @@
* aout_alsa.c : Alsa functions library
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: aout_alsa.c,v 1.13 2001/04/06 09:15:47 sam Exp $
* $Id: aout_alsa.c,v 1.14 2001/05/06 04:32:02 sam Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
......@@ -36,7 +36,6 @@
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <sys/asoundlib.h>
#include <linux/asound.h>
#include "config.h"
#include "common.h" /* boolean_t, byte_t */
......
......@@ -2,7 +2,7 @@
* vout_fb.c: framebuffer video output display method
*****************************************************************************
* Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
* $Id: vout_fb.c,v 1.10 2001/03/21 13:42:33 sam Exp $
* $Id: vout_fb.c,v 1.11 2001/05/06 04:32:02 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -608,26 +608,33 @@ static void FBCloseDisplay( vout_thread_t *p_vout )
*****************************************************************************/
static void FBSwitchDisplay(int i_signal)
{
if( p_main->p_vout != NULL )
vout_thread_t *p_vout;
vlc_mutex_lock( &p_vout_bank->lock );
/* XXX: only test the first video output */
if( p_vout_bank->i_count )
{
p_vout = p_vout_bank->pp_vout[0];
switch( i_signal )
{
case SIGUSR1: /* vt has been released */
p_main->p_vout->b_active = 0;
ioctl( ((vout_sys_t *)p_main->p_vout->p_sys)->i_tty_dev,
VT_RELDISP, 1 );
p_vout->b_active = 0;
ioctl( p_vout->p_sys->i_tty_dev, VT_RELDISP, 1 );
break;
case SIGUSR2: /* vt has been acquired */
p_main->p_vout->b_active = 1;
ioctl( ((vout_sys_t *)p_main->p_vout->p_sys)->i_tty_dev,
VT_RELDISP, VT_ACTIVATE );
p_vout->b_active = 1;
ioctl( p_vout->p_sys->i_tty_dev, VT_RELDISP, VT_ACTIVATE );
/* handle blanking */
vlc_mutex_lock( &p_main->p_vout->change_lock );
p_main->p_vout->i_changes |= VOUT_SIZE_CHANGE;
vlc_mutex_unlock( &p_main->p_vout->change_lock );
vlc_mutex_lock( &p_vout->change_lock );
p_vout->i_changes |= VOUT_SIZE_CHANGE;
vlc_mutex_unlock( &p_vout->change_lock );
break;
}
}
vlc_mutex_unlock( &p_vout_bank->lock );
}
/*****************************************************************************
......
......@@ -12,20 +12,27 @@ PLUGIN_IDCTCLASSIC = idctclassic.o
PLUGIN_IDCTMMX = idctmmx.o
PLUGIN_IDCTMMXEXT = idctmmxext.o
PLUGIN_IDCTALTIVEC = idctaltivec.o
PLUGIN_IDCTCOMMON = idct_common.o
PLUGIN_IDCTCOMMON = vdec_idct.o
PLUGIN_VDECBLOCK_C = vdec_block_c.o
PLUGIN_VDECBLOCK_MMX = vdec_block_mmx.o
BUILTIN_IDCT = $(PLUGIN_IDCT:%.o=BUILTIN_IDCT_%.o) \
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCT_%.o)
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCT_%.o) \
$(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCT_%.o)
BUILTIN_IDCTCLASSIC = $(PLUGIN_IDCTCLASSIC:%.o=BUILTIN_IDCTCLASSIC_%.o) \
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTCLASSIC_%.o)
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTCLASSIC_%.o) \
$(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCTCLASSIC_%.o)
BUILTIN_IDCTMMX = $(PLUGIN_IDCTMMX:%.o=BUILTIN_IDCTMMX_%.o) \
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMX_%.o)
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMX_%.o) \
$(PLUGIN_VDECBLOCK_MMX:%.o=BUILTIN_IDCTMMX_%.o)
BUILTIN_IDCTMMXEXT = $(PLUGIN_IDCTMMXEXT:%.o=BUILTIN_IDCTMMXEXT_%.o) \
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMXEXT_%.o)
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMXEXT_%.o) \
$(PLUGIN_VDECBLOCK_MMX:%.o=BUILTIN_IDCTMMXEXT_%.o)
BUILTIN_IDCTALTIVEC = $(PLUGIN_IDCTALTIVEC:%.o=BUILTIN_IDCTALTIVEC_%.o) \
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTALTIVEC_%.o)
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTALTIVEC_%.o) \
$(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCTALTIVEC_%.o)
PLUGIN_C = $(PLUGIN_IDCT) $(PLUGIN_IDCTCLASSIC) $(PLUGIN_IDCTMMX) $(PLUGIN_IDCTMMXEXT) $(PLUGIN_IDCTCOMMON)
PLUGIN_C = $(PLUGIN_IDCT) $(PLUGIN_IDCTCLASSIC) $(PLUGIN_IDCTMMX) $(PLUGIN_IDCTMMXEXT) $(PLUGIN_IDCTCOMMON) $(PLUGIN_VDECBLOCK_C) $(PLUGIN_VDECBLOCK_MMX)
ALL_OBJ = $(PLUGIN_C) $(PLUGIN_IDCTALTIVEC) $(BUILTIN_IDCT) $(BUILTIN_IDCTCLASSIC) $(BUILTIN_IDCTMMX) $(BUILTIN_IDCTMMXEXT) $(BUILTIN_IDCTALTIVEC)
#
......
......@@ -2,7 +2,7 @@
* idct.c : IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idct.c,v 1.8 2001/04/15 04:19:57 sam Exp $
* $Id: idct.c,v 1.9 2001/05/06 04:32:02 sam Exp $
*
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
*
......@@ -44,7 +44,8 @@
#include "modules.h"
#include "idct.h"
#include "vdec_block.h"
#include "vdec_idct.h"
/*****************************************************************************
* Local and extern prototypes.
......@@ -128,10 +129,15 @@ MODULE_DEACTIVATE
static void idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT );
p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT );
p_function_list->functions.idct.pf_idct = _M( vdec_IDCT );
p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
#define F p_function_list->functions.idct
F.pf_idct_init = _M( vdec_InitIDCT );
F.pf_sparse_idct = _M( vdec_SparseIDCT );
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_vdec_init = _M( vdec_Init );
F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
#undef F
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* idctaltivec.c : Altivec IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctaltivec.c,v 1.4 2001/04/15 04:19:57 sam Exp $
* $Id: idctaltivec.c,v 1.5 2001/05/06 04:32:02 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -44,7 +44,8 @@
#include "modules.h"
#include "modules_inner.h"
#include "idct.h"
#include "vdec_block.h"
#include "vdec_idct.h"
#include "idctaltivec.h"
......@@ -129,10 +130,15 @@ MODULE_DEACTIVATE
static void idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT );
p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT );
p_function_list->functions.idct.pf_idct = _M( vdec_IDCT );
p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
#define F p_function_list->functions.idct
F.pf_idct_init = _M( vdec_InitIDCT );
F.pf_sparse_idct = _M( vdec_SparseIDCT );
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_vdec_init = _M( vdec_Init );
F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
#undef F
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* idctclassic.c : Classic IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctclassic.c,v 1.8 2001/04/15 04:19:57 sam Exp $
* $Id: idctclassic.c,v 1.9 2001/05/06 04:32:02 sam Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
*
......@@ -44,7 +44,8 @@
#include "modules.h"
#include "modules_inner.h"
#include "idct.h"
#include "vdec_block.h"
#include "vdec_idct.h"
/*****************************************************************************
* Local and extern prototypes.
......@@ -128,10 +129,15 @@ MODULE_DEACTIVATE
static void idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT );
p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT );
p_function_list->functions.idct.pf_idct = _M( vdec_IDCT );
p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
#define F p_function_list->functions.idct
F.pf_idct_init = _M( vdec_InitIDCT );
F.pf_sparse_idct = _M( vdec_SparseIDCT );
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_vdec_init = _M( vdec_Init );
F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
#undef F
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* idctmmx.c : MMX IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctmmx.c,v 1.9 2001/04/15 04:19:57 sam Exp $
* $Id: idctmmx.c,v 1.10 2001/05/06 04:32:02 sam Exp $
*
* Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
......@@ -48,7 +48,8 @@
#include "modules.h"
#include "modules_inner.h"
#include "idct.h"
#include "vdec_block.h"
#include "vdec_idct.h"
#include "attributes.h"
#include "mmx.h"
......@@ -134,10 +135,15 @@ MODULE_DEACTIVATE
static void idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT );
p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT );
p_function_list->functions.idct.pf_idct = _M( vdec_IDCT );
p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
#define F p_function_list->functions.idct
F.pf_idct_init = _M( vdec_InitIDCT );
F.pf_sparse_idct = _M( vdec_SparseIDCT );
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_vdec_init = _M( vdec_Init );
F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
#undef F
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* idctmmxext.c : MMX EXT IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctmmxext.c,v 1.6 2001/04/15 04:19:57 sam Exp $
* $Id: idctmmxext.c,v 1.7 2001/05/06 04:32:02 sam Exp $
*
* Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
......@@ -48,7 +48,8 @@
#include "modules.h"
#include "modules_inner.h"
#include "idct.h"
#include "vdec_block.h"
#include "vdec_idct.h"
#include "attributes.h"
#include "mmx.h"
......@@ -134,10 +135,15 @@ MODULE_DEACTIVATE
static void idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT );
p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT );
p_function_list->functions.idct.pf_idct = _M( vdec_IDCT );
p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
#define F p_function_list->functions.idct
F.pf_idct_init = _M( vdec_InitIDCT );
F.pf_sparse_idct = _M( vdec_SparseIDCT );
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_vdec_init = _M( vdec_Init );
F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
#undef F
}
/*****************************************************************************
......
/*****************************************************************************
* vdec_block_h: Macroblock copy functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: vdec_block.h,v 1.1 2001/05/06 04:32:02 sam Exp $
*
* Authors: Christophe Massiot <massiot@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, USA.
*****************************************************************************/
/*****************************************************************************
* Prototypes
*****************************************************************************/
void _M( vdec_Init ) ( struct vdec_thread_s *p_vdec );
void _M( vdec_DecodeMacroblockC ) ( struct vdec_thread_s *p_vdec,
struct macroblock_s * p_mb );
void _M( vdec_DecodeMacroblockBW ) ( struct vdec_thread_s *p_vdec,
struct macroblock_s * p_mb );
/*****************************************************************************
* vdec_DecodeMacroblock : decode a macroblock of a picture
*****************************************************************************/
#define DECODEBLOCKSC( OPBLOCK ) \
{ \
int i_b, i_mask; \
\
i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks); \
\
/* luminance */ \
for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 ) \
{ \
if( p_mb->i_coded_block_pattern & i_mask ) \
{ \
/* \
* Inverse DCT (ISO/IEC 13818-2 section Annex A) \
*/ \
(p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b], \
p_mb->pi_sparse_pos[i_b] ); \
\
/* \
* Adding prediction and coefficient data (ISO/IEC 13818-2 \
* section 7.6.8) \
*/ \
OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \
p_mb->p_data[i_b], p_mb->i_addb_l_stride ); \
} \
} \
\
/* chrominance */ \
for( i_b = 4; i_b < 4 + p_mb->i_chroma_nb_blocks; \
i_b++, i_mask >>= 1 ) \
{ \
if( p_mb->i_coded_block_pattern & i_mask ) \
{ \
/* \
* Inverse DCT (ISO/IEC 13818-2 section Annex A) \
*/ \
(p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b], \
p_mb->pi_sparse_pos[i_b] ); \
\
/* \
* Adding prediction and coefficient data (ISO/IEC 13818-2 \
* section 7.6.8) \
*/ \
OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \
p_mb->p_data[i_b], p_mb->i_addb_c_stride ); \
} \
} \
}
#define DECODEBLOCKSBW( OPBLOCK ) \
{ \
int i_b, i_mask; \
\
i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks); \
\
/* luminance */ \
for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 ) \
{ \
if( p_mb->i_coded_block_pattern & i_mask ) \
{ \
/* \
* Inverse DCT (ISO/IEC 13818-2 section Annex A) \
*/ \
(p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b], \
p_mb->pi_sparse_pos[i_b] ); \
\
/* \
* Adding prediction and coefficient data (ISO/IEC 13818-2 \
* section 7.6.8) \
*/ \
OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b], \
p_mb->p_data[i_b], p_mb->i_addb_l_stride ); \
} \
} \
}
/*****************************************************************************
* vdec_block_c.c: Macroblock copy functions in C
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: vdec_block_c.c,v 1.1 2001/05/06 04:32:02 sam Exp $
*
* Authors: Christophe Massiot <massiot@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, USA.
*****************************************************************************/
/* MODULE_NAME defined in Makefile together with -DBUILTIN */
#ifdef BUILTIN
# include "modules_inner.h"
#else
# define _M( foo ) foo
#endif
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "intf_msg.h"
#include "input_ext-dec.h"
#include "video.h"
#include "video_output.h"
#include "vdec_motion.h"
#include "video_decoder.h"
#include "vpar_blocks.h"
#include "vpar_headers.h"
#include "vpar_synchro.h"
#include "video_parser.h"
#include "video_fifo.h"
#include "vdec_block.h"
/*****************************************************************************
* Static variables
*****************************************************************************
* We can keep them static since they will always contain the same values.
*****************************************************************************/
static u8 pi_crop_buf[VDEC_CROPRANGE];
static u8 *pi_crop;
/*****************************************************************************
* vdec_Init: initialize video decoder thread
*****************************************************************************/
void _M( vdec_Init ) ( vdec_thread_t *p_vdec )
{
int i_dummy;
/* Init crop table */
pi_crop = pi_crop_buf + (VDEC_CROPRANGE >> 1);
for( i_dummy = -(VDEC_CROPRANGE >> 1); i_dummy < 0; i_dummy++ )
{
pi_crop[i_dummy] = 0;
}
for( ; i_dummy < 255; i_dummy ++ )
{
pi_crop[i_dummy] = i_dummy;
}
for( ; i_dummy < (VDEC_CROPRANGE >> 1) -1; i_dummy++ )
{
pi_crop[i_dummy] = 255;
}
}
/*****************************************************************************
* AddBlock : add a block
*****************************************************************************/
static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
yuv_data_t * p_data, int i_incr )
{
int i_x, i_y;
for( i_y = 0; i_y < 8; i_y++ )
{
for( i_x = 0; i_x < 8; i_x++ )
{
*p_data = pi_crop[*p_data + *p_block++];
p_data++;
}
p_data += i_incr;
}
}
/*****************************************************************************
* CopyBlock : copy a block
*****************************************************************************/
static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
yuv_data_t * p_data, int i_incr )
{
int i_x, i_y;
for( i_y = 0; i_y < 8; i_y++ )
{
for( i_x = 0; i_x < 8; i_x++ )
{
*p_data++ = pi_crop[*p_block++];
}
p_data += i_incr;
}
}
void _M( vdec_DecodeMacroblockC ) ( vdec_thread_t *p_vdec, macroblock_t * p_mb )
{
if( !(p_mb->i_mb_type & MB_INTRA) )
{
/*
* Motion Compensation (ISO/IEC 13818-2 section 7.6)
*/
if( p_mb->pf_motion == 0 )
{
intf_WarnMsg( 2, "pf_motion set to NULL" );
}
else
{
p_mb->pf_motion( p_mb );
}
DECODEBLOCKSC( AddBlock )
}
else
{
DECODEBLOCKSC( CopyBlock )
}
/*
* Decoding is finished, release the macroblock and free
* unneeded memory.
*/
vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb );
}
void _M( vdec_DecodeMacroblockBW ) ( vdec_thread_t *p_vdec,
macroblock_t * p_mb )
{
if( !(p_mb->i_mb_type & MB_INTRA) )
{
/*
* Motion Compensation (ISO/IEC 13818-2 section 7.6)
*/
if( p_mb->pf_motion == 0 )
{
intf_WarnMsg( 2, "pf_motion set to NULL" );
}
else
{
p_mb->pf_motion( p_mb );
}
DECODEBLOCKSBW( AddBlock )
}
else
{
DECODEBLOCKSBW( CopyBlock )
}
/*
* Decoding is finished, release the macroblock and free
* unneeded memory.
*/
vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb );
}
/*****************************************************************************
* vdec_block_mmx.c: Macroblock copy functions in MMX assembly
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: vdec_block_mmx.c,v 1.1 2001/05/06 04:32:02 sam Exp $
*
* Authors: Gal Hendryckx <jimmy@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, USA.
*****************************************************************************/
/* MODULE_NAME defined in Makefile together with -DBUILTIN */
#ifdef BUILTIN
# include "modules_inner.h"
#else
# define _M( foo ) foo
#endif
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "intf_msg.h"
#include "input_ext-dec.h"
#include "video.h"
#include "video_output.h"
#include "vdec_motion.h"
#include "video_decoder.h"
#include "vpar_blocks.h"
#include "vpar_headers.h"
#include "vpar_synchro.h"
#include "video_parser.h"
#include "video_fifo.h"
#include "vdec_block.h"
/*****************************************************************************
* vdec_Init: initialize video decoder thread
*****************************************************************************/
void _M( vdec_Init ) ( vdec_thread_t *p_vdec )
{
;
}
/*****************************************************************************
* AddBlock : add a block
*****************************************************************************/
static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
yuv_data_t * p_data, int i_incr )
{
asm __volatile__ (
"pxor %%mm7,%%mm7\n\t"
"movq (%0),%%mm1\n\t"
"movq %%mm1,%%mm2\n\t"
"punpckhbw %%mm7,%%mm1\n\t"
"punpcklbw %%mm7,%%mm2\n\t"
"paddw (%2),%%mm2\n\t"
"paddw 8(%2),%%mm1\n\t"
"packuswb %%mm1,%%mm2\n\t"
"movq %%mm2,(%0)\n\t"
"addl %3,%0\n\t"
"movq (%0),%%mm1\n\t"
"movq %%mm1,%%mm2\n\t"
"punpckhbw %%mm7,%%mm1\n\t"
"punpcklbw %%mm7,%%mm2\n\t"
"paddw 16(%2),%%mm2\n\t"
"paddw 24(%2),%%mm1\n\t"
"packuswb %%mm1,%%mm2\n\t"
"movq %%mm2,(%0)\n\t"
"addl %3,%0\n\t"
"movq (%0),%%mm1\n\t"
"movq %%mm1,%%mm2\n\t"
"punpckhbw %%mm7,%%mm1\n\t"
"punpcklbw %%mm7,%%mm2\n\t"
"paddw 32(%2),%%mm2\n\t"
"paddw 40(%2),%%mm1\n\t"
"packuswb %%mm1,%%mm2\n\t"
"movq %%mm2,(%0)\n\t"
"addl %3,%0\n\t"
"movq (%0),%%mm1\n\t"
"movq %%mm1,%%mm2\n\t"
"punpckhbw %%mm7,%%mm1\n\t"
"punpcklbw %%mm7,%%mm2\n\t"
"paddw 48(%2),%%mm2\n\t"
"paddw 56(%2),%%mm1\n\t"
"packuswb %%mm1,%%mm2\n\t"
"movq %%mm2,(%0)\n\t"
"addl %3,%0\n\t"
"movq (%0),%%mm1\n\t"
"movq %%mm1,%%mm2\n\t"
"punpckhbw %%mm7,%%mm1\n\t"
"punpcklbw %%mm7,%%mm2\n\t"
"paddw 64(%2),%%mm2\n\t"
"paddw 72(%2),%%mm1\n\t"
"packuswb %%mm1,%%mm2\n\t"
"movq %%mm2,(%0)\n\t"
"addl %3,%0\n\t"
"movq (%0),%%mm1\n\t"
"movq %%mm1,%%mm2\n\t"
"punpckhbw %%mm7,%%mm1\n\t"
"punpcklbw %%mm7,%%mm2\n\t"
"paddw 80(%2),%%mm2\n\t"
"paddw 88(%2),%%mm1\n\t"
"packuswb %%mm1,%%mm2\n\t"
"movq %%mm2,(%0)\n\t"
"addl %3,%0\n\t"
"movq (%0),%%mm1\n\t"
"movq %%mm1,%%mm2\n\t"
"punpckhbw %%mm7,%%mm1\n\t"
"punpcklbw %%mm7,%%mm2\n\t"
"paddw 96(%2),%%mm2\n\t"
"paddw 104(%2),%%mm1\n\t"
"packuswb %%mm1,%%mm2\n\t"
"movq %%mm2,(%0)\n\t"
"addl %3,%0\n\t"
"movq (%0),%%mm1\n\t"
"movq %%mm1,%%mm2\n\t"
"punpckhbw %%mm7,%%mm1\n\t"
"punpcklbw %%mm7,%%mm2\n\t"
"paddw 112(%2),%%mm2\n\t"
"paddw 120(%2),%%mm1\n\t"
"packuswb %%mm1,%%mm2\n\t"
"movq %%mm2,(%0)\n\t"
//"emms"
: "=r" (p_data)
: "0" (p_data), "r" (p_block), "r" (i_incr + 8) );
}
/*****************************************************************************
* CopyBlock : copy a block
*****************************************************************************/
static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
yuv_data_t * p_data, int i_incr )
{
asm __volatile__ (
"movq (%2),%%mm0\n\t"
"packuswb 8(%2),%%mm0\n\t"
"movq %%mm0,(%0)\n\t"
"addl %3,%0\n\t"
"movq 16(%2),%%mm0\n\t"
"packuswb 24(%2),%%mm0\n\t"
"movq %%mm0,(%0)\n\t"
"addl %3,%0\n\t"
"movq 32(%2),%%mm0\n\t"
"packuswb 40(%2),%%mm0\n\t"
"movq %%mm0,(%0)\n\t"
"addl %3,%0\n\t"
"movq 48(%2),%%mm0\n\t"
"packuswb 56(%2),%%mm0\n\t"
"movq %%mm0,(%0)\n\t"
"addl %3,%0\n\t"
"movq 64(%2),%%mm0\n\t"
"packuswb 72(%2),%%mm0\n\t"
"movq %%mm0,(%0)\n\t"
"addl %3,%0\n\t"
"movq 80(%2),%%mm0\n\t"
"packuswb 88(%2),%%mm0\n\t"
"movq %%mm0,(%0)\n\t"
"addl %3,%0\n\t"
"movq 96(%2),%%mm0\n\t"
"packuswb 104(%2),%%mm0\n\t"
"movq %%mm0,(%0)\n\t"
"addl %3,%0\n\t"
"movq 112(%2),%%mm0\n\t"
"packuswb 120(%2),%%mm0\n\t"
"movq %%mm0,(%0)\n\t"
//"emms"
: "=r" (p_data)
: "0" (p_data), "r" (p_block), "r" (i_incr + 8) );
}
void _M( vdec_DecodeMacroblockC ) ( vdec_thread_t *p_vdec,
macroblock_t * p_mb )
{
if( !(p_mb->i_mb_type & MB_INTRA) )
{
/*
* Motion Compensation (ISO/IEC 13818-2 section 7.6)
*/
if( p_mb->pf_motion == 0 )
{
intf_WarnMsg( 2, "pf_motion set to NULL" );
}
else
{
p_mb->pf_motion( p_mb );
}
DECODEBLOCKSC( AddBlock )
}
else
{
DECODEBLOCKSC( CopyBlock )
}
/*
* Decoding is finished, release the macroblock and free
* unneeded memory.
*/
vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb );
}
void _M( vdec_DecodeMacroblockBW ) ( vdec_thread_t *p_vdec,
macroblock_t * p_mb )
{
if( !(p_mb->i_mb_type & MB_INTRA) )
{
/*
* Motion Compensation (ISO/IEC 13818-2 section 7.6)
*/
if( p_mb->pf_motion == 0 )
{
intf_WarnMsg( 2, "pf_motion set to NULL" );
}
else
{
p_mb->pf_motion( p_mb );
}
DECODEBLOCKSBW( AddBlock )
}
else
{
DECODEBLOCKSBW( CopyBlock )
}
/*
* Decoding is finished, release the macroblock and free
* unneeded memory.
*/
vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb );
}
/*****************************************************************************
* idct_common.c : common IDCT functions
* vdec_idct.c : common IDCT functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idct_common.c,v 1.5 2001/04/15 04:19:57 sam Exp $
* $Id: vdec_idct.c,v 1.1 2001/05/06 04:32:02 sam Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
*
......@@ -47,7 +47,7 @@
#include "modules.h"
#include "idct.h"
#include "vdec_idct.h"
/*****************************************************************************
* vdec_InitIDCT : initialize datas for vdec_SparseIDCT
......
/*****************************************************************************
* idct.h : macros for the inverse discrete cosine transform
* vdec_idct.h : macros for the inverse discrete cosine transform
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idct.h,v 1.3 2001/04/15 04:19:57 sam Exp $
* $Id: vdec_idct.h,v 1.1 2001/05/06 04:32:02 sam Exp $
*
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
......
......@@ -22,13 +22,13 @@ $(PLUGIN_QT): %.o: .dep/%.dpp
$(PLUGIN_QT): %.o: %.moc
$(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/qt -I${QTDIR}/include -c -o $@ $(<:%.moc=%.cpp)
$(PLUGIN_QT:%.o=%.moc): %.moc: %.cpp
$(MOC) -i $< -o $@
grep -q Q_OBJECT $< && $(MOC) -i $< -o $@ || true
$(BUILTIN_QT): BUILTIN_%.o: .dep/%.dpp
$(BUILTIN_QT): %.o: %.moc
$(CC) $(CFLAGS) -DBUILTIN -I/usr/include/qt -I${QTDIR}/include -c -o $@ $(<:BUILTIN_%.moc=%.cpp)
$(BUILTIN_QT:%.o=%.moc): BUILTIN_%.moc: %.cpp
$(MOC) -i $< -o $@
grep -q Q_OBJECT $< && $(MOC) -i $< -o $@ || true
#
# Real targets
......
......@@ -55,9 +55,6 @@
#include "video.h"
#include "video_output.h"
#include "main.h"
/*****************************************************************************
* intf_sys_t: description and status of rc interface
*****************************************************************************/
......@@ -212,7 +209,14 @@ static void intf_Run( intf_thread_t *p_intf )
case 'f':
case 'F':
p_main->p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
vlc_mutex_lock( &p_vout_bank->lock );
/* XXX: only fullscreen the first video output */
if( p_vout_bank->i_count )
{
p_vout_bank->pp_vout[0]->i_changes
|= VOUT_FULLSCREEN_CHANGE;
}
vlc_mutex_unlock( &p_vout_bank->lock );
break;
case 'm':
......
......@@ -2,7 +2,7 @@
* ac3_bit_allocate.c: ac3 allocation tables
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: ac3_bit_allocate.c,v 1.19 2001/04/26 11:23:16 sam Exp $
* $Id: ac3_bit_allocate.c,v 1.20 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
......@@ -24,6 +24,8 @@
*****************************************************************************/
#include "defs.h"
#include <string.h> /* memcpy() */
#include "config.h"
#include "common.h"
#include "threads.h"
......
......@@ -2,7 +2,7 @@
* ac3_decoder.c: core ac3 decoder
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder.c,v 1.30 2001/04/30 21:04:20 reno Exp $
* $Id: ac3_decoder.c,v 1.31 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@zoy.org>
......@@ -25,6 +25,8 @@
#include "defs.h"
#include <string.h> /* memcpy() */
#include "config.h"
#include "common.h"
#include "threads.h"
......@@ -34,12 +36,11 @@
#include "stream_control.h"
#include "input_ext-dec.h"
#include "audio_output.h"
#include "audio_output.h"
#include "ac3_decoder.h"
#include "ac3_decoder_thread.h"
#include "ac3_internal.h"
#include <stdio.h>
......
......@@ -2,7 +2,7 @@
* ac3_decoder_thread.c: ac3 decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder_thread.c,v 1.31 2001/05/01 04:18:18 sam Exp $
* $Id: ac3_decoder_thread.c,v 1.32 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
......@@ -39,6 +39,7 @@
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* malloc(), free() */
#include <string.h> /* memset() */
#include "config.h"
#include "common.h"
......
......@@ -2,7 +2,7 @@
* ac3_downmix.c: ac3 downmix functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_downmix.c,v 1.21 2001/04/30 21:04:20 reno Exp $
* $Id: ac3_downmix.c,v 1.22 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
......@@ -24,6 +24,8 @@
*****************************************************************************/
#include "defs.h"
#include <string.h> /* memcpy() */
#include "config.h"
#include "common.h"
#include "threads.h"
......@@ -33,6 +35,7 @@
#include "stream_control.h"
#include "input_ext-dec.h"
#include "ac3_decoder.h"
#include "ac3_internal.h"
#include "ac3_downmix.h"
......
......@@ -2,7 +2,7 @@
* ac3_downmix_c.c: ac3 downmix functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: ac3_downmix_c.c,v 1.6 2001/04/30 21:04:20 reno Exp $
* $Id: ac3_downmix_c.c,v 1.7 2001/05/06 04:32:02 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
......@@ -24,6 +24,8 @@
#include "defs.h"
#include <string.h> /* memcpy() */
#include "config.h"
#include "common.h"
#include "threads.h"
......
......@@ -2,7 +2,7 @@
* ac3_imdct.c: ac3 DCT
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_imdct.c,v 1.17 2001/04/30 21:04:20 reno Exp $
* $Id: ac3_imdct.c,v 1.18 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
......@@ -25,6 +25,8 @@
#include "defs.h"
#include <string.h> /* memcpy() */
#include <math.h>
#include <stdio.h>
......
......@@ -2,7 +2,7 @@
* ac3_imdct_c.c: ac3 DCT
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_imdct_c.c,v 1.1 2001/04/30 21:04:20 reno Exp $
* $Id: ac3_imdct_c.c,v 1.2 2001/05/06 04:32:02 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
......@@ -24,6 +24,8 @@
#include "defs.h"
#include <string.h> /* memcpy() */
#include <math.h>
#include <stdio.h>
......@@ -38,6 +40,10 @@
#include "ac3_decoder.h"
#include "ac3_internal.h"
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
void fft_64p_c (complex_t *x);
void fft_128p_c (complex_t *x);
void imdct_do_512_c (imdct_t * p_imdct, float data[], float delay[]);
......
......@@ -2,7 +2,7 @@
* ac3_mantissa.c: ac3 mantissa computation
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: ac3_mantissa.c,v 1.25 2001/04/30 21:04:20 reno Exp $
* $Id: ac3_mantissa.c,v 1.26 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
......@@ -25,6 +25,8 @@
#include "defs.h"
#include <string.h> /* memcpy() */
#include "config.h"
#include "common.h"
#include "threads.h"
......
......@@ -2,7 +2,7 @@
* ac3_parse.c: ac3 parsing procedures
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: ac3_parse.c,v 1.19 2001/04/26 00:12:19 reno Exp $
* $Id: ac3_parse.c,v 1.20 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
......@@ -25,6 +25,8 @@
#include "defs.h"
#include <string.h> /* memset() */
#include "config.h"
#include "common.h"
......
......@@ -2,7 +2,7 @@
* ac3_rematrix.c: ac3 audio rematrixing
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_rematrix.c,v 1.15 2001/04/30 21:04:20 reno Exp $
* $Id: ac3_rematrix.c,v 1.16 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
......@@ -23,6 +23,8 @@
*****************************************************************************/
#include "defs.h"
#include <string.h> /* memcpy() */
#include "config.h"
#include "common.h"
#include "threads.h"
......
......@@ -2,7 +2,7 @@
* ac3_srfft.c: ac3 FFT
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_srfft.c,v 1.2 2001/04/30 21:10:25 reno Exp $
* $Id: ac3_srfft.c,v 1.3 2001/05/06 04:32:02 sam Exp $
*
* Authors: Renaud Dartus <reno@videolan.org>
* Aaron Holtzman <aholtzma@engr.uvic.ca>
......@@ -24,6 +24,8 @@
#include "defs.h"
#include <string.h> /* memcpy() */
#include <math.h>
#include <stdio.h>
......
......@@ -2,7 +2,7 @@
* ac3_iec958.c: ac3 to spdif converter
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ac3_iec958.c,v 1.2 2001/05/01 04:18:18 sam Exp $
* $Id: ac3_iec958.c,v 1.3 2001/05/06 04:32:02 sam Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
......@@ -30,6 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* memset() */
#include <fcntl.h>
#include <unistd.h>
......
......@@ -2,7 +2,7 @@
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ac3_spdif.c,v 1.2 2001/05/01 04:18:18 sam Exp $
* $Id: ac3_spdif.c,v 1.3 2001/05/06 04:32:02 sam Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
......@@ -21,15 +21,16 @@
* 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.
****************************************************************************/
*****************************************************************************/
/****************************************************************************
/*****************************************************************************
* Preamble
****************************************************************************/
*****************************************************************************/
#include "defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* memcpy() */
#include <fcntl.h>
#include <unistd.h>
......
......@@ -2,7 +2,7 @@
* aout_ext-dec.c : exported fifo management functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: aout_ext-dec.c,v 1.1 2001/05/01 04:18:18 sam Exp $
* $Id: aout_ext-dec.c,v 1.2 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
......@@ -48,30 +48,44 @@ aout_fifo_t * aout_CreateFifo( int i_type, int i_channels, long l_rate,
long l_units, long l_frame_size,
void *p_buffer )
{
#define P_AOUT p_main->p_aout
aout_thread_t *p_aout;
int i_fifo;
/* Spawn an audio output if there is none */
if( P_AOUT == NULL )
vlc_mutex_lock( &p_aout_bank->lock );
if( p_aout_bank->i_count == 0 )
{
P_AOUT = aout_CreateThread( NULL );
intf_Msg( "aout: no aout present, spawning one" );
p_aout = aout_CreateThread( NULL );
if( P_AOUT == NULL )
/* Everything failed */
if( p_aout == NULL )
{
vlc_mutex_unlock( &p_aout_bank->lock );
return NULL;
}
p_aout_bank->pp_aout[ p_aout_bank->i_count ] = p_aout;
p_aout_bank->i_count++;
}
else
{
/* Take the first audio output FIXME: take the best one */
p_aout = p_aout_bank->pp_aout[ 0 ];
}
/* Take the fifos lock */
vlc_mutex_lock( &P_AOUT->fifos_lock );
vlc_mutex_lock( &p_aout->fifos_lock );
/* Looking for a free fifo structure */
for( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
{
if( P_AOUT->fifo[i_fifo].i_type == AOUT_EMPTY_FIFO )
if( p_aout->fifo[i_fifo].i_type == AOUT_EMPTY_FIFO )
{
/* Not very clever, but at least we know which fifo it is */
P_AOUT->fifo[i_fifo].i_fifo = i_fifo;
p_aout->fifo[i_fifo].i_fifo = i_fifo;
break;
}
}
......@@ -79,97 +93,101 @@ aout_fifo_t * aout_CreateFifo( int i_type, int i_channels, long l_rate,
if( i_fifo == AOUT_MAX_FIFOS )
{
intf_ErrMsg( "aout error: no fifo available" );
vlc_mutex_unlock( &P_AOUT->fifos_lock );
vlc_mutex_unlock( &p_aout->fifos_lock );
vlc_mutex_unlock( &p_aout_bank->lock );
return( NULL );
}
/* Initialize the new fifo structure */
switch ( P_AOUT->fifo[i_fifo].i_type = i_type )
switch ( p_aout->fifo[i_fifo].i_type = i_type )
{
case AOUT_INTF_MONO_FIFO:
case AOUT_INTF_STEREO_FIFO:
P_AOUT->fifo[i_fifo].b_die = 0;
p_aout->fifo[i_fifo].b_die = 0;
P_AOUT->fifo[i_fifo].i_channels = i_channels;
P_AOUT->fifo[i_fifo].b_stereo = ( i_channels == 2 );
P_AOUT->fifo[i_fifo].l_rate = l_rate;
p_aout->fifo[i_fifo].i_channels = i_channels;
p_aout->fifo[i_fifo].b_stereo = ( i_channels == 2 );
p_aout->fifo[i_fifo].l_rate = l_rate;
P_AOUT->fifo[i_fifo].buffer = p_buffer;
p_aout->fifo[i_fifo].buffer = p_buffer;
P_AOUT->fifo[i_fifo].l_unit = 0;
InitializeIncrement( &P_AOUT->fifo[i_fifo].unit_increment,
l_rate, P_AOUT->l_rate );
P_AOUT->fifo[i_fifo].l_units = l_units;
p_aout->fifo[i_fifo].l_unit = 0;
InitializeIncrement( &p_aout->fifo[i_fifo].unit_increment,
l_rate, p_aout->l_rate );
p_aout->fifo[i_fifo].l_units = l_units;
break;
case AOUT_ADEC_MONO_FIFO:
case AOUT_ADEC_STEREO_FIFO:
P_AOUT->fifo[i_fifo].b_die = 0;
p_aout->fifo[i_fifo].b_die = 0;
P_AOUT->fifo[i_fifo].i_channels = i_channels;
P_AOUT->fifo[i_fifo].b_stereo = ( i_channels == 2 );
P_AOUT->fifo[i_fifo].l_rate = l_rate;
p_aout->fifo[i_fifo].i_channels = i_channels;
p_aout->fifo[i_fifo].b_stereo = ( i_channels == 2 );
p_aout->fifo[i_fifo].l_rate = l_rate;
P_AOUT->fifo[i_fifo].l_frame_size = l_frame_size;
p_aout->fifo[i_fifo].l_frame_size = l_frame_size;
/* Allocate the memory needed to store the audio frames. As the
* fifo is a rotative fifo, we must be able to find out whether
* the fifo is full or empty, that's why we must in fact allocate
* memory for (AOUT_FIFO_SIZE+1) audio frames. */
P_AOUT->fifo[i_fifo].buffer = malloc( sizeof(s16) *
p_aout->fifo[i_fifo].buffer = malloc( sizeof(s16) *
( AOUT_FIFO_SIZE + 1 ) * l_frame_size );
if ( P_AOUT->fifo[i_fifo].buffer == NULL )
if ( p_aout->fifo[i_fifo].buffer == NULL )
{
intf_ErrMsg( "aout error: cannot create frame buffer" );
P_AOUT->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
vlc_mutex_unlock( &P_AOUT->fifos_lock );
p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
vlc_mutex_unlock( &p_aout->fifos_lock );
vlc_mutex_unlock( &p_aout_bank->lock );
return( NULL );
}
/* Allocate the memory needed to store the dates of the frames */
P_AOUT->fifo[i_fifo].date =
p_aout->fifo[i_fifo].date =
malloc( sizeof(mtime_t) * ( AOUT_FIFO_SIZE + 1) );
if ( P_AOUT->fifo[i_fifo].date == NULL )
if ( p_aout->fifo[i_fifo].date == NULL )
{
intf_ErrMsg( "aout error: cannot create date buffer");
free( P_AOUT->fifo[i_fifo].buffer );
P_AOUT->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
vlc_mutex_unlock( &P_AOUT->fifos_lock );
free( p_aout->fifo[i_fifo].buffer );
p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
vlc_mutex_unlock( &p_aout->fifos_lock );
vlc_mutex_unlock( &p_aout_bank->lock );
return( NULL );
}
/* Set the fifo's buffer as empty (the first frame that is to be
* played is also the first frame that is not to be played) */
P_AOUT->fifo[i_fifo].l_start_frame = 0;
/* P_AOUT->fifo[i_fifo].l_next_frame = 0; */
P_AOUT->fifo[i_fifo].l_end_frame = 0;
p_aout->fifo[i_fifo].l_start_frame = 0;
/* p_aout->fifo[i_fifo].l_next_frame = 0; */
p_aout->fifo[i_fifo].l_end_frame = 0;
/* Waiting for the audio decoder to compute enough frames to work
* out the fifo's current rate (as soon as the decoder has decoded
* enough frames, the members of the fifo structure that are not
* initialized now will be calculated) */
P_AOUT->fifo[i_fifo].b_start_frame = 0;
P_AOUT->fifo[i_fifo].b_next_frame = 0;
p_aout->fifo[i_fifo].b_start_frame = 0;
p_aout->fifo[i_fifo].b_next_frame = 0;
break;
default:
intf_ErrMsg( "aout error: unknown fifo type 0x%x",
P_AOUT->fifo[i_fifo].i_type );
P_AOUT->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
vlc_mutex_unlock( &P_AOUT->fifos_lock );
p_aout->fifo[i_fifo].i_type );
p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
vlc_mutex_unlock( &p_aout->fifos_lock );
vlc_mutex_unlock( &p_aout_bank->lock );
return( NULL );
}
/* Release the fifos lock */
vlc_mutex_unlock( &P_AOUT->fifos_lock );
vlc_mutex_unlock( &p_aout->fifos_lock );
vlc_mutex_unlock( &p_aout_bank->lock );
intf_WarnMsg( 2, "aout info: fifo #%i allocated, %i channels, rate %li",
P_AOUT->fifo[i_fifo].i_fifo, P_AOUT->fifo[i_fifo].i_channels,
P_AOUT->fifo[i_fifo].l_rate );
p_aout->fifo[i_fifo].i_fifo, p_aout->fifo[i_fifo].i_channels,
p_aout->fifo[i_fifo].l_rate );
/* Return the pointer to the fifo structure */
return( &P_AOUT->fifo[i_fifo] );
#undef P_AOUT
return( &p_aout->fifo[i_fifo] );
}
/*****************************************************************************
......
......@@ -82,7 +82,7 @@ void aout_S16StereoThread( aout_thread_t * p_aout )
{
((s16 *)p_aout->buffer)[l_buffer] =
(s16)( ( p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS )
* p_aout->i_vol / 256 ) ;
* p_aout->i_volume / 256 ) ;
p_aout->s32_buffer[l_buffer] = 0;
}
......
......@@ -2,7 +2,7 @@
* aout_spdif: ac3 passthrough output
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aout_spdif.c,v 1.1 2001/04/29 02:55:36 stef Exp $
* $Id: aout_spdif.c,v 1.2 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -29,6 +29,7 @@
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <string.h> /* memset() */
#include "config.h"
#include "common.h"
......
......@@ -2,7 +2,7 @@
* aout_u8.c: 8 bit unsigned audio output functions
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: aout_u8.c,v 1.3 2001/05/01 04:18:18 sam Exp $
* $Id: aout_u8.c,v 1.4 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
......@@ -77,7 +77,7 @@ void aout_U8MonoThread( aout_thread_t * p_aout )
for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
{
((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256 ) + 128 ) * p_aout->i_vol / 256 );
((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256 ) + 128 ) * p_aout->i_volume / 256 );
p_aout->s32_buffer[l_buffer] = 0;
}
......@@ -131,7 +131,7 @@ void aout_U8StereoThread( aout_thread_t * p_aout )
for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
{
((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256) + 128 ) * p_aout->i_vol / 256 );
((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256) + 128 ) * p_aout->i_volume / 256 );
p_aout->s32_buffer[l_buffer] = 0;
}
l_bytes = p_aout->pf_getbufinfo( p_aout, l_buffer_limit );
......
......@@ -2,7 +2,7 @@
* audio_output.c : audio output thread
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: audio_output.c,v 1.59 2001/05/01 04:18:18 sam Exp $
* $Id: audio_output.c,v 1.60 2001/05/06 04:32:02 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
......@@ -64,6 +64,34 @@
*****************************************************************************/
static int aout_SpawnThread( aout_thread_t * p_aout );
/*****************************************************************************
* aout_InitBank: initialize the audio output bank.
*****************************************************************************/
void aout_InitBank ( void )
{
p_aout_bank->i_count = 0;
vlc_mutex_init( &p_aout_bank->lock );
}
/*****************************************************************************
* aout_EndBank: empty the audio output bank.
*****************************************************************************
* This function ends all unused audio outputs and empties the bank in
* case of success.
*****************************************************************************/
void aout_EndBank ( void )
{
/* Ask all remaining audio outputs to die */
while( p_aout_bank->i_count )
{
aout_DestroyThread(
p_aout_bank->pp_aout[ --p_aout_bank->i_count ], NULL );
}
vlc_mutex_destroy( &p_aout_bank->lock );
}
/*****************************************************************************
* aout_CreateThread: initialize audio thread
*****************************************************************************/
......@@ -138,7 +166,8 @@ aout_thread_t *aout_CreateThread( int *pi_status )
}
/* Initialize the volume level */
p_aout->i_vol = VOLUME_DEFAULT;
p_aout->i_volume = VOLUME_DEFAULT;
p_aout->i_savedvolume = 0;
/* FIXME: maybe it would be cleaner to change SpawnThread prototype
* see vout to handle status correctly ?? however, it is not critical since
......@@ -311,7 +340,6 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
*****************************************************************************/
void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
{
int i_fifo;
/* FIXME: pi_status is not handled correctly: check vout how to do!?? */
......
......@@ -2,7 +2,7 @@
* input_netlist.c: netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_netlist.c,v 1.35 2001/04/28 23:19:19 henri Exp $
* $Id: input_netlist.c,v 1.36 2001/05/06 04:32:02 sam Exp $
*
* Authors: Henri Fallon <henri@videolan.org>
*
......@@ -29,11 +29,18 @@
#include <stdlib.h>
#include <string.h> /* memcpy(), memset() */
#include <sys/types.h>
#ifndef WIN32
#include <sys/uio.h> /* struct iovec */
#endif
#include <unistd.h>
#ifndef WIN32
# include <sys/uio.h> /* struct iovec */
#else
struct iovec
{
void *iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};
#endif
#include "config.h"
#include "common.h"
#include "threads.h" /* mutex */
......@@ -47,17 +54,6 @@
#include "input.h"
#include "input_netlist.h"
#ifdef WIN32
struct iovec
{
void *iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};
#endif
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/*****************************************************************************
* input_NetlistInit: allocates netlist buffers and init indexes
*****************************************************************************/
......@@ -253,7 +249,7 @@ void input_NetlistMviovec( void * p_method_data, size_t i_nb_iovec,
/* Fills a table of pointers to packets associated with the io_vec's */
while (i_loop < i_nb_iovec )
while (i_loop < i_nb_iovec )
{
if( i_current >= p_netlist->i_nb_data )
i_current-=p_netlist->i_nb_data;
......@@ -304,7 +300,7 @@ struct data_packet_s * input_NetlistNewPacket( void * p_method_data,
return ( NULL );
}
p_return = (p_netlist->pp_free_data[p_netlist->i_data_start]);
p_return = p_netlist->pp_free_data[p_netlist->i_data_start];
p_netlist->i_data_start++;
p_netlist->i_data_start &= ( p_netlist->i_nb_data - 1 );
......@@ -387,7 +383,7 @@ void input_NetlistDeletePacket( void * p_method_data, data_packet_t * p_data )
p_data->p_next = NULL;
/* unlock */
vlc_mutex_unlock (&p_netlist->lock);
vlc_mutex_unlock( &p_netlist->lock );
}
/*****************************************************************************
......@@ -432,7 +428,7 @@ void input_NetlistDeletePES( void * p_method_data, pes_packet_t * p_pes )
p_netlist->pp_free_pes[p_netlist->i_pes_end] = p_pes;
/* unlock */
vlc_mutex_unlock (&p_netlist->lock);
vlc_mutex_unlock( &p_netlist->lock );
}
......@@ -450,12 +446,13 @@ void input_NetlistEnd( input_thread_t * p_input)
vlc_mutex_destroy (&p_netlist->lock);
/* free the FIFO, the buffer, and the netlist structure */
free (p_netlist->pp_free_data);
free (p_netlist->pp_free_pes);
free (p_netlist->p_pes);
free (p_netlist->p_data);
free (p_netlist->p_buffers);
free( p_netlist->pp_free_data );
free( p_netlist->pp_free_pes );
free( p_netlist->p_pes );
free( p_netlist->p_data );
free( p_netlist->p_buffers );
/* free the netlist */
free (p_netlist);
free( p_netlist );
}
......@@ -4,7 +4,7 @@
* interface, such as command line.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: interface.c,v 1.75 2001/05/01 04:18:18 sam Exp $
* $Id: interface.c,v 1.76 2001/05/06 04:32:02 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -317,7 +317,7 @@ void intf_AssignNormalKeys( intf_thread_t *p_intf)
*****************************************************************************/
int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
{
static int i_volbackup;
int i_index;
keyparm k_reply;
k_reply = intf_GetKey( p_intf, g_key);
......@@ -326,6 +326,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
case INTF_KEY_QUIT: /* quit order */
p_intf->b_die = 1;
break;
case INTF_KEY_SET_CHANNEL:
/* Change channel - return code is ignored since SelectChannel displays
* its own error messages */
......@@ -334,23 +335,62 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
/* FIXME : keyboard event is for the time being half handled by the interface
* half handled directly by the plugins. We should decide what to do. */
break;
case INTF_KEY_INC_VOLUME: /* volume + */
if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol < VOLUME_MAX) )
p_main->p_aout->i_vol += VOLUME_STEP;
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
if( p_aout_bank->pp_aout[i_index]->i_volume
< VOLUME_MAX - VOLUME_STEP )
{
p_aout_bank->pp_aout[i_index]->i_volume += VOLUME_STEP;
}
else
{
p_aout_bank->pp_aout[i_index]->i_volume = VOLUME_MAX;
}
}
vlc_mutex_unlock( &p_aout_bank->lock );
break;
case INTF_KEY_DEC_VOLUME: /* volume - */
if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol > VOLUME_STEP) )
p_main->p_aout->i_vol -= VOLUME_STEP;
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
if( p_aout_bank->pp_aout[i_index]->i_volume > VOLUME_STEP )
{
p_aout_bank->pp_aout[i_index]->i_volume -= VOLUME_STEP;
}
else
{
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
}
vlc_mutex_unlock( &p_aout_bank->lock );
break;
case INTF_KEY_TOGGLE_VOLUME: /* toggle mute */
if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol))
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
i_volbackup = p_main->p_aout->i_vol;
p_main->p_aout->i_vol = 0;
if( p_aout_bank->pp_aout[i_index]->i_savedvolume )
{
p_aout_bank->pp_aout[i_index]->i_volume =
p_aout_bank->pp_aout[i_index]->i_savedvolume;
p_aout_bank->pp_aout[i_index]->i_savedvolume = 0;
}
else
{
p_aout_bank->pp_aout[i_index]->i_savedvolume =
p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
}
else if( (p_main->p_aout != NULL) && (!p_main->p_aout->i_vol))
p_main->p_aout->i_vol = i_volbackup;
vlc_mutex_unlock( &p_aout_bank->lock );
break;
/* XXX: fix this later */
#if 0
case INTF_KEY_DEC_GAMMA: /* gamma - */
if( (p_main->p_vout != NULL) && (p_main->p_vout->f_gamma > -INTF_GAMMA_LIMIT) )
{
......@@ -367,6 +407,8 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE;
}
break;
#endif
case INTF_KEY_DUMP_STREAM:
if( p_intf->p_input != NULL )
{
......@@ -375,9 +417,11 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
}
break;
default: /* unknown key */
default: /* unknown key */
return( 1 );
}
return( 0 );
}
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.91 2001/05/01 04:18:18 sam Exp $
* $Id: main.c,v 1.92 2001/05/06 04:32:02 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -185,8 +185,10 @@ static const char *psz_shortopts = "hHvgt:T:u:a:s:c:I:A:V:";
* Global variable program_data - these are the only ones, see main.h and
* modules.h
*****************************************************************************/
main_t *p_main;
bank_t *p_bank;
main_t *p_main;
module_bank_t *p_module_bank;
aout_bank_t *p_aout_bank;
vout_bank_t *p_vout_bank;
/*****************************************************************************
* Local prototypes
......@@ -215,30 +217,21 @@ static int CPUCapabilities ( void );
*****************************************************************************/
int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
{
main_t main_data; /* root of all data - see main.h */
bank_t module_bank;
main_t main_data; /* root of all data - see main.h */
module_bank_t module_bank;
aout_bank_t aout_bank;
vout_bank_t vout_bank;
p_main = &main_data; /* set up the global variables */
p_bank = &module_bank;
p_main = &main_data; /* set up the global variables */
p_module_bank = &module_bank;
p_aout_bank = &aout_bank;
p_vout_bank = &vout_bank;
/*
* Initialize the main structure
* Test if our code is likely to run on this CPU
*/
p_main->i_cpu_capabilities = CPUCapabilities();
p_main->p_aout = NULL;
p_main->p_vout = NULL;
/*
* System specific initialization code
*/
#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
system_Create( &i_argc, ppsz_argv, ppsz_env );
#endif
/*
* Test if our code is likely to run on this CPU
*/
#if defined( __pentium__ ) || defined( __pentiumpro__ )
if( ! TestCPU( CPU_CAPABILITY_586 ) )
{
......@@ -248,13 +241,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
}
#endif
#ifdef HAVE_MMX
if( ! TestCPU( CPU_CAPABILITY_MMX ) )
{
fprintf( stderr, "error: this program needs MMX extensions,\n"
"please try a version without MMX support\n" );
return( 1 );
}
/*
* System specific initialization code
*/
#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
system_Init( &i_argc, ppsz_argv, ppsz_env );
#endif
/*
......@@ -297,9 +288,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
GetFilenames( i_argc, ppsz_argv );
/*
* Initialize module bank
* Initialize module, aout and vout banks
*/
module_InitBank();
aout_InitBank();
vout_InitBank();
/*
* Initialize shared resources and libraries
......@@ -313,60 +306,44 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
}
/*
* Run interface
* Try to run the interface
*/
p_main->p_intf = intf_Create();
if( !p_main->p_intf )
if( p_main->p_intf == NULL )
{
intf_ErrMsg( "intf error: interface initialization failed" );
module_EndBank();
intf_PlaylistDestroy( p_main->p_playlist );
intf_MsgDestroy();
return( errno );
}
/*
* Set signal handling policy for all threads
*/
InitSignalHandler();
/*
* This is the main loop
*/
p_main->p_intf->pf_run( p_main->p_intf );
/*
* Finished, destroy the interface
*/
intf_Destroy( p_main->p_intf );
/*
* Close all video devices
*/
if( p_main->p_vout != NULL )
{
vout_DestroyThread( p_main->p_vout, NULL );
}
/*
* Close all audio devices
*/
if( p_main->p_aout != NULL )
{
aout_DestroyThread( p_main->p_aout, NULL );
}
/*
* Go back into channel 0 which is the network
*/
if( p_main->b_channels )
else
{
network_ChannelJoin( COMMON_CHANNEL );
/*
* Set signal handling policy for all threads
*/
InitSignalHandler();
/*
* This is the main loop
*/
p_main->p_intf->pf_run( p_main->p_intf );
/*
* Finished, destroy the interface
*/
intf_Destroy( p_main->p_intf );
/*
* Go back into channel 0 which is the network
*/
if( p_main->b_channels )
{
network_ChannelJoin( COMMON_CHANNEL );
}
}
/*
* Free module bank
* Free module, aout and vout banks
*/
vout_EndBank();
aout_EndBank();
module_EndBank();
/*
......@@ -378,7 +355,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
* System specific cleaning code
*/
#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
system_Destroy();
system_End();
#endif
/*
......@@ -387,7 +364,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
intf_Msg( "intf: program terminated" );
intf_MsgDestroy();
return( 0 );
return 0;
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* beos_init.cpp: Initialization for BeOS specific features
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: beos_specific.cpp,v 1.10 2001/04/29 17:03:20 sam Exp $
* $Id: beos_specific.cpp,v 1.11 2001/05/06 04:32:02 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
*
......@@ -69,9 +69,9 @@ extern "C"
static void system_AppThread( void * args );
/*****************************************************************************
* system_Create: create a BApplication object and fill in program path.
* system_Init: create a BApplication object and fill in program path.
*****************************************************************************/
void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
{
/* Prepare the lock/wait before launching the BApplication thread */
vlc_mutex_init( &app_lock );
......@@ -92,9 +92,9 @@ void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
}
/*****************************************************************************
* system_Destroy: destroy the BApplication object.
* system_End: destroy the BApplication object.
*****************************************************************************/
void system_Destroy( void )
void system_End( void )
{
free( psz_program_path );
......
......@@ -2,7 +2,7 @@
* darwin_specific.c: Darwin specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: darwin_specific.c,v 1.3 2001/04/14 07:41:20 sam Exp $
* $Id: darwin_specific.c,v 1.4 2001/05/06 04:32:02 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -37,9 +37,9 @@
static char * psz_program_path;
/*****************************************************************************
* system_Create: fill in program path.
* system_Init: fill in program path.
*****************************************************************************/
void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
{
char i_dummy;
char *p_char, *p_oldchar = &i_dummy;
......@@ -64,9 +64,9 @@ void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
}
/*****************************************************************************
* system_Destroy: free the program path.
* system_End: free the program path.
*****************************************************************************/
void system_Destroy( void )
void system_End( void )
{
free( psz_program_path );
}
......
......@@ -2,7 +2,7 @@
* modules.c : Built-in and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.28 2001/05/01 04:18:18 sam Exp $
* $Id: modules.c,v 1.29 2001/05/06 04:32:02 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -85,7 +85,7 @@ static int CallSymbol ( module_t *, char * );
* This function creates a module bank structure and fills it with the
* built-in modules, as well as all the plugin modules it can find.
*****************************************************************************/
void module_InitBank( )
void module_InitBank( void )
{
#ifdef HAVE_DYNAMIC_PLUGINS
static char * path[] = { ".", "lib", PLUGIN_PATH, NULL, NULL };
......@@ -102,13 +102,19 @@ void module_InitBank( )
struct dirent * file;
#endif /* HAVE_DYNAMIC_PLUGINS */
p_bank->first = NULL;
vlc_mutex_init( &p_bank->lock );
p_module_bank->first = NULL;
vlc_mutex_init( &p_module_bank->lock );
/*
* Check all the built-in modules
*/
intf_WarnMsg( 2, "module: checking built-in modules" );
ALLOCATE_ALL_BUILTINS();
/*
* Check all the plugin modules we can find
*/
#ifdef HAVE_DYNAMIC_PLUGINS
intf_WarnMsg( 2, "module: checking plugin modules" );
......@@ -187,32 +193,32 @@ void module_InitBank( )
}
/*****************************************************************************
* module_EndBank: destroy the module bank.
* module_EndBank: empty the module bank.
*****************************************************************************
* This function unloads all unused plugin modules and removes the module
* This function unloads all unused plugin modules and empties the module
* bank in case of success.
*****************************************************************************/
void module_EndBank( )
void module_EndBank( void )
{
module_t * p_next;
while( p_bank->first != NULL )
while( p_module_bank->first != NULL )
{
if( DeleteModule( p_bank->first ) )
if( DeleteModule( p_module_bank->first ) )
{
/* Module deletion failed */
intf_ErrMsg( "module error: `%s' can't be removed. trying harder.",
p_bank->first->psz_name );
p_module_bank->first->psz_name );
/* We just free the module by hand. Niahahahahaha. */
p_next = p_bank->first->next;
free(p_bank->first);
p_bank->first = p_next;
p_next = p_module_bank->first->next;
free(p_module_bank->first);
p_module_bank->first = p_next;
}
}
/* Destroy the lock */
vlc_mutex_destroy( &p_bank->lock );
vlc_mutex_destroy( &p_module_bank->lock );
return;
}
......@@ -223,7 +229,7 @@ void module_EndBank( )
* This function resets the module bank by unloading all unused plugin
* modules.
*****************************************************************************/
void module_ResetBank( )
void module_ResetBank( void )
{
intf_ErrMsg( "FIXME: module_ResetBank unimplemented" );
return;
......@@ -235,16 +241,16 @@ void module_ResetBank( )
* This function parses the module bank and hides modules that have been
* unused for a while.
*****************************************************************************/
void module_ManageBank( )
void module_ManageBank( void )
{
#ifdef HAVE_DYNAMIC_PLUGINS
module_t * p_module;
/* We take the global lock */
vlc_mutex_lock( &p_bank->lock );
vlc_mutex_lock( &p_module_bank->lock );
/* Parse the module list to see if any modules need to be unloaded */
for( p_module = p_bank->first ;
for( p_module = p_module_bank->first ;
p_module != NULL ;
p_module = p_module->next )
{
......@@ -268,7 +274,7 @@ void module_ManageBank( )
}
/* We release the global lock */
vlc_mutex_unlock( &p_bank->lock );
vlc_mutex_unlock( &p_module_bank->lock );
#endif /* HAVE_DYNAMIC_PLUGINS */
return;
......@@ -287,10 +293,10 @@ module_t * module_Need( int i_capabilities, void *p_data )
int i_index;
/* We take the global lock */
vlc_mutex_lock( &p_bank->lock );
vlc_mutex_lock( &p_module_bank->lock );
/* Parse the module list for capabilities and probe each of them */
for( p_module = p_bank->first ;
for( p_module = p_module_bank->first ;
p_module != NULL ;
p_module = p_module->next )
{
......@@ -342,7 +348,7 @@ module_t * module_Need( int i_capabilities, void *p_data )
}
/* We can release the global lock, module refcount was incremented */
vlc_mutex_unlock( &p_bank->lock );
vlc_mutex_unlock( &p_module_bank->lock );
if( p_bestmodule != NULL )
{
......@@ -363,7 +369,7 @@ module_t * module_Need( int i_capabilities, void *p_data )
void module_Unneed( module_t * p_module )
{
/* We take the global lock */
vlc_mutex_lock( &p_bank->lock );
vlc_mutex_lock( &p_module_bank->lock );
/* Just unlock the module - we can't do anything if it fails,
* so there is no need to check the return value. */
......@@ -372,7 +378,7 @@ void module_Unneed( module_t * p_module )
intf_WarnMsg( 3, "module: unlocking module `%s'", p_module->psz_name );
/* We release the global lock */
vlc_mutex_unlock( &p_bank->lock );
vlc_mutex_unlock( &p_module_bank->lock );
return;
}
......@@ -435,7 +441,7 @@ static int AllocatePluginModule( char * psz_filename )
}
/* Check that we don't already have a module with this name */
for( p_othermodule = p_bank->first ;
for( p_othermodule = p_module_bank->first ;
p_othermodule != NULL ;
p_othermodule = p_othermodule->next )
{
......@@ -485,13 +491,13 @@ static int AllocatePluginModule( char * psz_filename )
p_module->b_builtin = 0;
/* Link module into the linked list */
if( p_bank->first != NULL )
if( p_module_bank->first != NULL )
{
p_bank->first->prev = p_module;
p_module_bank->first->prev = p_module;
}
p_module->next = p_bank->first;
p_module->next = p_module_bank->first;
p_module->prev = NULL;
p_bank->first = p_module;
p_module_bank->first = p_module;
/* Immediate message so that a slow module doesn't make the user wait */
intf_WarnMsgImm( 2, "module: plugin module `%s', %s",
......@@ -541,7 +547,7 @@ static int AllocateBuiltinModule( int ( *pf_init ) ( module_t * ),
}
/* Check that we don't already have a module with this name */
for( p_othermodule = p_bank->first ;
for( p_othermodule = p_module_bank->first ;
p_othermodule != NULL ;
p_othermodule = p_othermodule->next )
{
......@@ -587,13 +593,13 @@ static int AllocateBuiltinModule( int ( *pf_init ) ( module_t * ),
p_module->is.builtin.pf_deactivate = pf_deactivate;
/* Link module into the linked list */
if( p_bank->first != NULL )
if( p_module_bank->first != NULL )
{
p_bank->first->prev = p_module;
p_module_bank->first->prev = p_module;
}
p_module->next = p_bank->first;
p_module->next = p_module_bank->first;
p_module->prev = NULL;
p_bank->first = p_module;
p_module_bank->first = p_module;
/* Immediate message so that a slow module doesn't make the user wait */
intf_WarnMsgImm( 2, "module: builtin module `%s', %s",
......@@ -650,9 +656,9 @@ static int DeleteModule( module_t * p_module )
#endif
/* Unlink the module from the linked list. */
if( p_module == p_bank->first )
if( p_module == p_module_bank->first )
{
p_bank->first = p_module->next;
p_module_bank->first = p_module->next;
}
if( p_module->prev != NULL )
......
......@@ -2,7 +2,7 @@
* spu_decoder.c : spu decoder thread
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: spu_decoder.c,v 1.39 2001/05/01 12:22:18 sam Exp $
* $Id: spu_decoder.c,v 1.40 2001/05/06 04:32:02 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -89,24 +89,44 @@ vlc_thread_t spudec_CreateThread( vdec_config_t * p_config )
p_spudec->p_fifo = p_config->decoder_config.p_decoder_fifo;
/* XXX: The vout request and fifo opening will eventually be here */
if( p_spudec->p_vout == NULL )
/* Spawn an audio output if there is none */
vlc_mutex_lock( &p_vout_bank->lock );
if( p_vout_bank->i_count == 0 )
{
if( p_main->p_vout == NULL )
intf_Msg( "spudec: no vout present, spawning one" );
p_spudec->p_vout = vout_CreateThread( NULL );
/* Everything failed */
if( p_spudec->p_vout == NULL )
{
intf_Msg( "vpar: no vout present, spawning one" );
p_main->p_vout = vout_CreateThread( NULL );
intf_Msg( "spudec: can't open vout, aborting" );
vlc_mutex_unlock( &p_vout_bank->lock );
free( p_spudec );
return 0;
}
p_spudec->p_vout = p_main->p_vout;
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 ];
}
vlc_mutex_unlock( &p_vout_bank->lock );
/* Spawn the spu decoder thread */
if ( vlc_thread_create(&p_spudec->thread_id, "spu decoder",
(vlc_thread_func_t)RunThread, (void *)p_spudec) )
{
intf_ErrMsg( "spudec error: can't spawn spu decoder thread" );
free( p_spudec );
return( 0 );
return 0;
}
return( p_spudec->thread_id );
......
/*****************************************************************************
* vdec_idct.h : types for the inverse discrete cosine transform
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vdec_idct.h,v 1.4 2001/01/17 18:17:30 massiot Exp $
*
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
* Christophe Massiot <massiot@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, USA.
*****************************************************************************/
struct vdec_thread_s;
typedef void ( *idct_init_t ) ( struct vdec_thread_s * );
typedef void ( *f_idct_t ) ( struct vdec_thread_s *, dctelem_t*, int );
typedef void ( *norm_scan_t ) ( u8 ppi_scan[2][64] );
This diff is collapsed.
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: video_output.c,v 1.122 2001/05/01 04:18:18 sam Exp $
* $Id: video_output.c,v 1.123 2001/05/06 04:32:02 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -85,6 +85,34 @@ static int Align ( vout_thread_t *p_vout, int *pi_x,
static void SetPalette ( p_vout_thread_t p_vout, u16 *red,
u16 *green, u16 *blue, u16 *transp );
/*****************************************************************************
* vout_InitBank: initialize the video output bank.
*****************************************************************************/
void vout_InitBank ( void )
{
p_vout_bank->i_count = 0;
vlc_mutex_init( &p_vout_bank->lock );
}
/*****************************************************************************
* vout_EndBank: empty the video output bank.
*****************************************************************************
* This function ends all unused video outputs and empties the bank in
* case of success.
*****************************************************************************/
void vout_EndBank ( void )
{
/* Ask all remaining video outputs to die */
while( p_vout_bank->i_count )
{
vout_DestroyThread(
p_vout_bank->pp_vout[ --p_vout_bank->i_count ], NULL );
}
vlc_mutex_destroy( &p_vout_bank->lock );
}
/*****************************************************************************
* vout_CreateThread: creates a new video output thread
*****************************************************************************
......
......@@ -2,7 +2,7 @@
* video_fifo.c : video FIFO management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_fifo.c,v 1.30 2001/04/06 09:15:48 sam Exp $
* $Id: video_fifo.c,v 1.31 2001/05/06 04:32:02 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -43,13 +43,12 @@
#include "video_decoder.h"
#include "vdec_motion.h"
#include "../video_decoder/vdec_idct.h"
#include "vpar_blocks.h"
#include "../video_decoder/vpar_headers.h"
#include "../video_decoder/vpar_synchro.h"
#include "../video_decoder/video_parser.h"
#include "../video_decoder/video_fifo.h"
#include "vpar_headers.h"
#include "vpar_synchro.h"
#include "video_parser.h"
#include "video_fifo.h"
/*****************************************************************************
* vpar_InitFIFO : initialize the video FIFO
......
......@@ -2,7 +2,7 @@
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.c,v 1.84 2001/05/01 15:12:22 sam Exp $
* $Id: video_parser.c,v 1.85 2001/05/06 04:32:03 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -52,13 +52,12 @@
#include "video_decoder.h"
#include "vdec_motion.h"
#include "../video_decoder/vdec_idct.h"
#include "vpar_blocks.h"
#include "../video_decoder/vpar_headers.h"
#include "../video_decoder/vpar_synchro.h"
#include "../video_decoder/video_parser.h"
#include "../video_decoder/video_fifo.h"
#include "vpar_headers.h"
#include "vpar_synchro.h"
#include "video_parser.h"
#include "video_fifo.h"
/*
* Local prototypes
......@@ -175,10 +174,13 @@ vlc_thread_t vpar_CreateThread( vdec_config_t * p_config )
}
#define f p_vpar->p_idct_module->p_functions->idct.functions.idct
p_vpar->pf_init = f.pf_init;
p_vpar->pf_idct_init = f.pf_idct_init;
p_vpar->pf_sparse_idct = f.pf_sparse_idct;
p_vpar->pf_idct = f.pf_idct;
p_vpar->pf_norm_scan = f.pf_norm_scan;
p_vpar->pf_vdec_init = f.pf_vdec_init;
p_vpar->pf_decode_mb_c = f.pf_decode_mb_c;
p_vpar->pf_decode_mb_bw = f.pf_decode_mb_bw;
#undef f
/* Spawn the video parser thread */
......@@ -264,15 +266,22 @@ static int InitThread( vpar_thread_t *p_vpar )
}
#else
/* Fake a video_decoder thread */
if( (p_vpar->pp_vdec[0] = (vdec_thread_t *)malloc(sizeof( vdec_thread_t )))
== NULL || vdec_InitThread( p_vpar->pp_vdec[0] ) )
p_vpar->pp_vdec[0] = (vdec_thread_t *)malloc(sizeof( vdec_thread_t ));
if( p_vpar->pp_vdec[0] == NULL )
{
return( 1 );
}
p_vpar->pp_vdec[0]->b_die = 0;
p_vpar->pp_vdec[0]->b_error = 0;
p_vpar->pp_vdec[0]->p_vpar = p_vpar;
if( vdec_InitThread( p_vpar->pp_vdec[0] ) )
{
return( 1 );
}
# if !defined(SYS_BEOS) && !defined(WIN32)
# if VDEC_NICE
/* Re-nice ourself */
......
......@@ -2,7 +2,7 @@
* vpar_blocks.c : blocks parsing
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_blocks.c,v 1.80 2001/04/28 03:36:25 sam Exp $
* $Id: vpar_blocks.c,v 1.81 2001/05/06 04:32:03 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
......@@ -45,13 +45,12 @@
#include "video_decoder.h"
#include "vdec_motion.h"
#include "../video_decoder/vdec_idct.h"
#include "vpar_blocks.h"
#include "../video_decoder/vpar_headers.h"
#include "../video_decoder/vpar_synchro.h"
#include "../video_decoder/video_parser.h"
#include "../video_decoder/video_fifo.h"
#include "vpar_headers.h"
#include "vpar_synchro.h"
#include "video_parser.h"
#include "video_fifo.h"
/*
* Welcome to vpar_blocks.c ! Here's where the heavy processor-critical parsing
......
......@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_headers.c,v 1.85 2001/05/01 15:12:22 sam Exp $
* $Id: vpar_headers.c,v 1.86 2001/05/06 04:32:03 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -45,13 +45,12 @@
#include "video_decoder.h"
#include "vdec_motion.h"
#include "../video_decoder/vdec_idct.h"
#include "vpar_blocks.h"
#include "../video_decoder/vpar_headers.h"
#include "../video_decoder/vpar_synchro.h"
#include "../video_decoder/video_parser.h"
#include "../video_decoder/video_fifo.h"
#include "vpar_headers.h"
#include "vpar_synchro.h"
#include "video_parser.h"
#include "video_fifo.h"
#include "main.h" /* XXX REMOVE THIS */
......@@ -452,19 +451,36 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
ExtensionAndUserData( p_vpar );
/* XXX: The vout request and fifo opening will eventually be here */
if( p_vpar->p_vout == NULL )
/* Spawn an audio output if there is none */
vlc_mutex_lock( &p_vout_bank->lock );
if( p_vout_bank->i_count == 0 )
{
if( p_main->p_vout == NULL )
intf_Msg( "vpar: no vout present, spawning one" );
p_vpar->p_vout = vout_CreateThread( NULL );
/* Everything failed */
if( p_vpar->p_vout == NULL )
{
intf_Msg( "vpar: no vout present, spawning one" );
p_main->p_vout = vout_CreateThread( NULL );
intf_Msg( "vpar: can't open vout, aborting" );
vlc_mutex_unlock( &p_vout_bank->lock );
/* Spawning another one for fun */
//vout_CreateThread( NULL );
/* XXX ! XXX ! XXX ! what to do here ? */
return;
}
p_vpar->p_vout = p_main->p_vout;
p_vout_bank->pp_vout[ p_vout_bank->i_count ] = p_vpar->p_vout;
p_vout_bank->i_count++;
}
else
{
/* Take the first video output FIXME: take the best one */
p_vpar->p_vout = p_vout_bank->pp_vout[ 0 ];
}
vlc_mutex_unlock( &p_vout_bank->lock );
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* vpar_synchro.c : frame dropping routines
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_synchro.c,v 1.88 2001/04/27 19:29:11 massiot Exp $
* $Id: vpar_synchro.c,v 1.89 2001/05/06 04:32:03 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -113,12 +113,11 @@
#include "video_decoder.h"
#include "vdec_motion.h"
#include "../video_decoder/vdec_idct.h"
#include "vpar_blocks.h"
#include "../video_decoder/vpar_headers.h"
#include "../video_decoder/vpar_synchro.h"
#include "../video_decoder/video_parser.h"
#include "vpar_headers.h"
#include "vpar_synchro.h"
#include "video_parser.h"
#include "main.h"
......
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