Commit 5a64fbd7 authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/audio_output/oss.c: we spare a variable by using p_aout->b_die

    instead of our own variable.
  * ./modules/audio_filter/converter/a52tospdif.c, ./modules/codec/a52.c: added
    <unistd.h>, required for bswap.
  * ./modules/demux/mp4/libmp4.c: removed an unneccessary semicolon in a
    macro definition.
  * ./modules/audio_output/esd.c: first attempt at getting esd to work.
  * ./modules/video_output/*: split sdl.so into a video and an audio plugin,
    and removed useless subdirectories.
  * ./modules/audio_output/sdl.c: compilation fix.
parent f1d40d7e
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1331,7 +1331,7 @@ then ...@@ -1331,7 +1331,7 @@ then
fi fi
if test "x${SDL_CONFIG}" != "xno" if test "x${SDL_CONFIG}" != "xno"
then then
PLUGINS="${PLUGINS} video_output/sdl/sdl" PLUGINS="${PLUGINS} video_output/sdl audio_output/sdl"
sdl_CFLAGS="${sdl_CFLAGS} `${SDL_CONFIG} --cflags`" sdl_CFLAGS="${sdl_CFLAGS} `${SDL_CONFIG} --cflags`"
sdl_LDFLAGS="${sdl_LDFLAGS} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`" sdl_LDFLAGS="${sdl_LDFLAGS} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
CPPFLAGS="${save_CPPFLAGS} ${sdl_CFLAGS}" CPPFLAGS="${save_CPPFLAGS} ${sdl_CFLAGS}"
...@@ -1396,7 +1396,7 @@ AC_ARG_ENABLE(fb, ...@@ -1396,7 +1396,7 @@ AC_ARG_ENABLE(fb,
if test "x${enable_fb}" != "xno" if test "x${enable_fb}" != "xno"
then then
AC_CHECK_HEADERS(linux/fb.h, [ AC_CHECK_HEADERS(linux/fb.h, [
PLUGINS="${PLUGINS} video_output/fb/fb" PLUGINS="${PLUGINS} video_output/fb"
]) ])
fi fi
...@@ -1417,7 +1417,7 @@ AC_ARG_ENABLE(ggi, ...@@ -1417,7 +1417,7 @@ AC_ARG_ENABLE(ggi,
[ --enable-ggi GGI support (default disabled)]) [ --enable-ggi GGI support (default disabled)])
if test "x${enable_ggi}" = "xyes" if test "x${enable_ggi}" = "xyes"
then then
PLUGINS="${PLUGINS} video_output/ggi/ggi" PLUGINS="${PLUGINS} video_output/ggi"
ggi_LDFLAGS="${ggi_LDFLAGS} -lggi" ggi_LDFLAGS="${ggi_LDFLAGS} -lggi"
AC_ARG_WITH(ggi, AC_ARG_WITH(ggi,
[ --with-ggi=PATH path to libggi], [ --with-ggi=PATH path to libggi],
...@@ -1435,7 +1435,7 @@ AC_ARG_ENABLE(glide, ...@@ -1435,7 +1435,7 @@ AC_ARG_ENABLE(glide,
[ --enable-glide Glide (3dfx) support (default disabled)]) [ --enable-glide Glide (3dfx) support (default disabled)])
if test "x${enable_glide}" = "xyes" if test "x${enable_glide}" = "xyes"
then then
PLUGINS="${PLUGINS} video_output/glide/glide" PLUGINS="${PLUGINS} video_output/glide"
glide_LDFLAGS="${glide_LDFLAGS} -lglide2x -lm" glide_LDFLAGS="${glide_LDFLAGS} -lglide2x -lm"
glide_CFLAGS="${glide_CFLAGS} -I/usr/include/glide" glide_CFLAGS="${glide_CFLAGS} -I/usr/include/glide"
AC_ARG_WITH(glide, AC_ARG_WITH(glide,
...@@ -1457,7 +1457,7 @@ then ...@@ -1457,7 +1457,7 @@ then
AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false") AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
if test "x${have_aa}" = "xtrue" if test "x${have_aa}" = "xtrue"
then then
PLUGINS="${PLUGINS} video_output/aa/aa" PLUGINS="${PLUGINS} video_output/aa"
aa_LDFLAGS="${aa_LDFLAGS} -laa" aa_LDFLAGS="${aa_LDFLAGS} -laa"
fi fi
fi fi
......
...@@ -214,3 +214,11 @@ the Boston strangler is to the woman home alone. ...@@ -214,3 +214,11 @@ the Boston strangler is to the woman home alone.
-- #videolan -- #videolan
% %
<zBen_home> mais truc[tres_grand] sur la pile ca me parait idiot :)
<tooney> zBen_home - ou mais c'est truc[tout_petit] donc ca va
<zBen_home> ah vi alors ca va
<zBen_home> parceque meuh donnait un example avec un entier assez costaud
<tooney> c'est parce qu'il etait pas content
-- #videolan
%
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* a52tospdif.c : encapsulates A/52 frames into S/PDIF packets * a52tospdif.c : encapsulates A/52 frames into S/PDIF packets
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: a52tospdif.c,v 1.3 2002/08/12 22:48:18 massiot Exp $ * $Id: a52tospdif.c,v 1.4 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -30,6 +30,11 @@ ...@@ -30,6 +30,11 @@
#include <string.h> #include <string.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "audio_output.h" #include "audio_output.h"
#include "aout_internal.h" #include "aout_internal.h"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* float32tos16.c : converter from float32 to signed 16 bits integer * float32tos16.c : converter from float32 to signed 16 bits integer
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: float32tos16.c,v 1.3 2002/08/12 22:48:18 massiot Exp $ * $Id: float32tos16.c,v 1.4 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -87,7 +87,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -87,7 +87,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
float * p_in = (float *)p_in_buf->p_buffer; float * p_in = (float *)p_in_buf->p_buffer;
s16 * p_out = (s16 *)p_out_buf->p_buffer; s16 * p_out = (s16 *)p_out_buf->p_buffer;
for ( i = 0; i < p_in_buf->i_nb_samples * p_filter->input.i_channels; i++ ) for ( i = p_in_buf->i_nb_samples * p_filter->input.i_channels ; i-- ; )
{ {
#if 0 #if 0
/* Slow version */ /* Slow version */
......
...@@ -3,4 +3,5 @@ arts_SOURCES = arts.c ...@@ -3,4 +3,5 @@ arts_SOURCES = arts.c
esd_SOURCES = esd.c esd_SOURCES = esd.c
file_SOURCES = file.c file_SOURCES = file.c
oss_SOURCES = oss.c oss_SOURCES = oss.c
sdl_SOURCES = sdl.c
waveout_SOURCES = waveout.c waveout_SOURCES = waveout.c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* esd.c : EsounD module * esd.c : EsounD module
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: esd.c,v 1.1 2002/08/07 21:36:55 massiot Exp $ * $Id: esd.c,v 1.2 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -32,9 +32,12 @@ ...@@ -32,9 +32,12 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/aout.h> #include <vlc/aout.h>
#include "aout_internal.h"
#include <esd.h> #include <esd.h>
#define DEFAULT_FRAME_SIZE 2048*2
/***************************************************************************** /*****************************************************************************
* aout_sys_t: esd audio output method descriptor * aout_sys_t: esd audio output method descriptor
***************************************************************************** *****************************************************************************
...@@ -45,6 +48,7 @@ struct aout_sys_t ...@@ -45,6 +48,7 @@ struct aout_sys_t
{ {
esd_format_t esd_format; esd_format_t esd_format;
int i_fd; int i_fd;
vlc_bool_t b_initialized;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -53,9 +57,9 @@ struct aout_sys_t ...@@ -53,9 +57,9 @@ struct aout_sys_t
static int Open ( vlc_object_t * ); static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * ); static void Close ( vlc_object_t * );
static int SetFormat ( aout_thread_t * ); static int SetFormat ( aout_instance_t * );
static int GetBufInfo ( aout_thread_t *, int ); static void Play ( aout_instance_t *, aout_buffer_t * );
static void Play ( aout_thread_t *, byte_t *, int ); static int ESDThread ( aout_instance_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -72,123 +76,181 @@ vlc_module_end(); ...@@ -72,123 +76,181 @@ vlc_module_end();
*****************************************************************************/ *****************************************************************************/
static int Open( vlc_object_t *p_this ) static int Open( vlc_object_t *p_this )
{ {
aout_thread_t *p_aout = (aout_thread_t *)p_this; aout_instance_t *p_aout = (aout_instance_t *)p_this;
struct aout_sys_t * p_sys;
/* mpg123 does it this way */
int i_bits = ESD_BITS16;
int i_mode = ESD_STREAM;
int i_func = ESD_PLAY;
/* Allocate structure */ /* Allocate structure */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->p_sys == NULL ) if( p_sys == NULL )
{ {
msg_Err( p_aout, "out of memory" ); msg_Err( p_aout, "out of memory" );
return( 1 ); return -1;
} }
/* Initialize some variables */ p_aout->output.p_sys = p_sys;
p_aout->i_rate = esd_audio_rate; /* We use actual esd rate value, not
* initial value */
i_bits = ESD_BITS16;
i_mode = ESD_STREAM;
i_func = ESD_PLAY;
p_aout->p_sys->esd_format = (i_bits | i_mode | i_func) & (~ESD_MASK_CHAN);
if( p_aout->i_channels == 1 ) /* Create ESD thread and wait for its readiness. */
p_sys->b_initialized = VLC_FALSE;
if( vlc_thread_create( p_aout, "aout", ESDThread, VLC_FALSE ) )
{ {
p_aout->p_sys->esd_format |= ESD_MONO; msg_Err( p_aout, "cannot create ESD thread (%s)", strerror(errno) );
free( p_sys );
return -1;
} }
else
p_aout->output.pf_setformat = SetFormat;
p_aout->output.pf_play = Play;
return( 0 );
}
/*****************************************************************************
* SetFormat: set the output format
*****************************************************************************/
static int SetFormat( aout_instance_t *p_aout )
{
struct aout_sys_t * p_sys = p_aout->output.p_sys;
p_sys->b_initialized = VLC_FALSE;
/* Initialize some variables */
p_sys->esd_format = ESD_BITS16 | ESD_STREAM | ESD_PLAY;
p_sys->esd_format &= ~ESD_MASK_CHAN;
switch( p_aout->output.output.i_channels )
{ {
p_aout->p_sys->esd_format |= ESD_STEREO; case 1:
p_sys->esd_format |= ESD_MONO;
break;
case 2:
p_sys->esd_format |= ESD_STEREO;
break;
default:
return -1;
} }
/* open a socket for playing a stream /* open a socket for playing a stream
* and try to open /dev/dsp if there's no EsounD */ * and try to open /dev/dsp if there's no EsounD */
if ( (p_aout->p_sys->i_fd p_sys->i_fd = esd_play_stream_fallback( p_sys->esd_format,
= esd_play_stream_fallback(p_aout->p_sys->esd_format, p_aout->output.output.i_rate, NULL, "vlc" );
p_aout->i_rate, NULL, "vlc")) < 0 ) if( p_sys->i_fd < 0 )
{ {
msg_Err( p_aout, "cannot open esound socket (format 0x%08x at %ld Hz)", msg_Err( p_aout, "cannot open esound socket (format 0x%08x at %ld Hz)",
p_aout->p_sys->esd_format, p_aout->i_rate ); p_sys->esd_format, p_aout->output.output.i_rate );
return( -1 ); return -1;
} }
p_aout->pf_setformat = SetFormat; p_aout->output.output.i_format = AOUT_FMT_S16_NE;
p_aout->pf_getbufinfo = GetBufInfo; p_aout->output.i_nb_samples = DEFAULT_FRAME_SIZE;
p_aout->pf_play = Play;
return( 0 ); p_sys->b_initialized = VLC_TRUE;
return 0;
} }
/***************************************************************************** /*****************************************************************************
* SetFormat: set the output format * Play: queue a buffer for playing by ESDThread
*****************************************************************************/ *****************************************************************************/
static int SetFormat( aout_thread_t *p_aout ) static void Play( aout_instance_t *p_aout, aout_buffer_t * p_buffer )
{ {
int i_fd; aout_FifoPush( p_aout, &p_aout->output.fifo, p_buffer );
i_fd = esd_open_sound(NULL);
p_aout->i_latency = esd_get_latency(i_fd);
msg_Dbg( p_aout, "aout_esd_latency: %d", p_aout->i_latency );
return( 0 );
} }
/***************************************************************************** /*****************************************************************************
* GetBufInfo: buffer status query * Close: close the Esound socket
*****************************************************************************/ *****************************************************************************/
static int GetBufInfo( aout_thread_t *p_aout, int i_buffer_limit ) static void Close( vlc_object_t *p_this )
{ {
/* arbitrary value that should be changed */ aout_instance_t *p_aout = (aout_instance_t *)p_this;
return( i_buffer_limit ); struct aout_sys_t * p_sys = p_aout->output.p_sys;
p_aout->b_die = 1;
vlc_thread_join( p_aout );
close( p_sys->i_fd );
free( p_sys );
} }
/***************************************************************************** /*****************************************************************************
* Play: play a sound samples buffer * ESDThread: asynchronous thread used to DMA the data to the device
*****************************************************************************
* This function writes a buffer of i_length bytes in the socket
*****************************************************************************/ *****************************************************************************/
static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) static int ESDThread( aout_instance_t * p_aout )
{ {
int i_amount; struct aout_sys_t * p_sys = p_aout->output.p_sys;
if (p_aout->p_sys->esd_format & ESD_STEREO) while ( !p_aout->b_die )
{ {
if (p_aout->p_sys->esd_format & ESD_BITS16) aout_buffer_t * p_buffer;
mtime_t next_date = 0;
int i_tmp, i_size;
byte_t * p_bytes;
if( !p_sys->b_initialized )
{ {
i_amount = (44100 * (ESD_BUF_SIZE + 64)) / p_aout->i_rate; msleep( THREAD_SLEEP );
continue;
} }
else
if ( p_aout->output.output.i_format != AOUT_FMT_SPDIF )
{ {
i_amount = (44100 * (ESD_BUF_SIZE + 128)) / p_aout->i_rate; /* Get the presentation date of the next write() operation. It
* is equal to the current date + esd latency */
/* FIXME: wtf ? it works better with a - here */
next_date = -(mtime_t)esd_get_latency(esd_open_sound(NULL))
* 1000000
/ aout_FormatToByterate( &p_aout->output.output,
p_aout->output.output.i_rate );
next_date += mdate();
} }
p_buffer = aout_OutputNextBuffer( p_aout, next_date );
if ( p_buffer != NULL )
{
p_bytes = p_buffer->p_buffer;
i_size = aout_FormatToSize( &p_aout->output.output,
p_buffer->i_nb_samples );
} }
else else
{ {
if (p_aout->p_sys->esd_format & ESD_BITS16) i_size = aout_FormatToSize( &p_aout->output.output,
DEFAULT_FRAME_SIZE );
p_bytes = alloca( i_size );
memset( p_bytes, 0, i_size );
}
i_tmp = write( p_sys->i_fd, p_bytes, i_size );
if( i_tmp < 0 )
{ {
i_amount = (2 * 44100 * (ESD_BUF_SIZE + 128)) / p_aout->i_rate; msg_Err( p_aout, "write failed (%s)", strerror(errno) );
} }
else
if ( p_buffer != NULL )
{ {
i_amount = (2 * 44100 * (ESD_BUF_SIZE + 256)) / p_aout->i_rate; aout_BufferFree( p_buffer );
} }
} }
write( p_aout->p_sys->i_fd, buffer, i_size ); return 0;
} }
#if 0
/***************************************************************************** /*****************************************************************************
* Close: close the Esound socket * Play: play a sound samples buffer
*****************************************************************************
* This function writes a buffer of i_length bytes in the socket
*****************************************************************************/ *****************************************************************************/
static void Close( vlc_object_t *p_this ) static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{ {
aout_thread_t *p_aout = (aout_thread_t *)p_this; int i_amount;
int m1 = p_aout->output.p_sys->esd_format & ESD_STEREO ? 1 : 2;
int m2 = p_aout->output.p_sys->esd_format & ESD_BITS16 ? 64 : 128;
i_amount = (m1 * 44100 * (ESD_BUF_SIZE + m1 * m2)) / p_aout->i_rate;
close( p_aout->p_sys->i_fd ); write( p_aout->output.p_sys->i_fd, buffer, i_size );
} }
#endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* oss.c : OSS /dev/dsp module for vlc * oss.c : OSS /dev/dsp module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2002 VideoLAN * Copyright (C) 2000-2002 VideoLAN
* $Id: oss.c,v 1.7 2002/08/12 09:34:15 sam Exp $ * $Id: oss.c,v 1.8 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
struct aout_sys_t struct aout_sys_t
{ {
int i_fd; int i_fd;
volatile vlc_bool_t b_die;
volatile vlc_bool_t b_initialized; volatile vlc_bool_t b_initialized;
}; };
...@@ -120,8 +119,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -120,8 +119,7 @@ static int Open( vlc_object_t *p_this )
/* Open the sound device */ /* Open the sound device */
if( (p_sys->i_fd = open( psz_device, O_WRONLY )) < 0 ) if( (p_sys->i_fd = open( psz_device, O_WRONLY )) < 0 )
{ {
msg_Err( p_aout, "cannot open audio device (%s)", msg_Err( p_aout, "cannot open audio device (%s)", psz_device );
psz_device );
free( psz_device ); free( psz_device );
free( p_sys ); free( p_sys );
return -1; return -1;
...@@ -129,7 +127,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -129,7 +127,6 @@ static int Open( vlc_object_t *p_this )
free( psz_device ); free( psz_device );
/* Create OSS thread and wait for its readiness. */ /* Create OSS thread and wait for its readiness. */
p_sys->b_die = 0;
p_sys->b_initialized = VLC_FALSE; p_sys->b_initialized = VLC_FALSE;
if( vlc_thread_create( p_aout, "aout", OSSThread, VLC_FALSE ) ) if( vlc_thread_create( p_aout, "aout", OSSThread, VLC_FALSE ) )
{ {
...@@ -255,7 +252,7 @@ static void Close( vlc_object_t * p_this ) ...@@ -255,7 +252,7 @@ static void Close( vlc_object_t * p_this )
aout_instance_t *p_aout = (aout_instance_t *)p_this; aout_instance_t *p_aout = (aout_instance_t *)p_this;
struct aout_sys_t * p_sys = p_aout->output.p_sys; struct aout_sys_t * p_sys = p_aout->output.p_sys;
p_sys->b_die = 1; p_aout->b_die = 1;
vlc_thread_join( p_aout ); vlc_thread_join( p_aout );
close( p_sys->i_fd ); close( p_sys->i_fd );
...@@ -291,7 +288,7 @@ static int OSSThread( aout_instance_t * p_aout ) ...@@ -291,7 +288,7 @@ static int OSSThread( aout_instance_t * p_aout )
{ {
struct aout_sys_t * p_sys = p_aout->output.p_sys; struct aout_sys_t * p_sys = p_aout->output.p_sys;
while ( !p_sys->b_die ) while ( !p_aout->b_die )
{ {
aout_buffer_t * p_buffer; aout_buffer_t * p_buffer;
mtime_t next_date = 0; mtime_t next_date = 0;
......
/***************************************************************************** /*****************************************************************************
* aout_sdl.c : audio sdl functions library * sdl.c : SDL audio output plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 2000-2002 VideoLAN
* $Id: aout.c,v 1.4 2002/08/12 22:12:51 massiot Exp $ * $Id: sdl.c,v 1.1 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -38,47 +38,63 @@ ...@@ -38,47 +38,63 @@
#include SDL_INCLUDE_FILE #include SDL_INCLUDE_FILE
#define FRAME_SIZE 2048 #define FRAME_SIZE 2048*2
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static int SetFormat ( aout_instance_t * ); static int SetFormat ( aout_instance_t * );
static void Play ( aout_instance_t *, aout_buffer_t * ); static void Play ( aout_instance_t *, aout_buffer_t * );
static void SDLCallback ( void *, Uint8 *, int ); static void SDLCallback ( void *, Uint8 *, int );
/***************************************************************************** /*****************************************************************************
* OpenAudio: open the audio device * Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("Simple DirectMedia Layer audio module") );
set_capability( "audio output", 40 );
set_callbacks( Open, Close );
vlc_module_end();
/*****************************************************************************
* Open: open the audio device
*****************************************************************************/ *****************************************************************************/
int E_(OpenAudio) ( aout_instance_t *p_aout ) static int Open ( vlc_object_t *p_this )
{ {
if( SDL_WasInit( SDL_INIT_AUDIO ) != 0 ) aout_instance_t *p_aout = (aout_instance_t *)p_this;
Uint32 i_flags = SDL_INIT_AUDIO;
if( SDL_WasInit( i_flags ) )
{ {
return( 1 ); return 1;
} }
p_aout->output.pf_setformat = SetFormat; p_aout->output.pf_setformat = SetFormat;
p_aout->output.pf_play = Play; p_aout->output.pf_play = Play;
/* Initialize library */
if( SDL_Init( SDL_INIT_AUDIO
#ifndef WIN32 #ifndef WIN32
/* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/ /* Win32 SDL implementation doesn't support SDL_INIT_EVENTTHREAD yet*/
| SDL_INIT_EVENTTHREAD i_flags |= SDL_INIT_EVENTTHREAD;
#endif #endif
#ifdef DEBUG #ifdef DEBUG
/* In debug mode you may want vlc to dump a core instead of staying /* In debug mode you may want vlc to dump a core instead of staying
* stuck */ * stuck */
| SDL_INIT_NOPARACHUTE i_flags |= SDL_INIT_NOPARACHUTE;
#endif #endif
) < 0 )
/* Initialize library */
if( SDL_Init( i_flags ) < 0 )
{ {
msg_Err( p_aout, "cannot initialize SDL (%s)", SDL_GetError() ); msg_Err( p_aout, "cannot initialize SDL (%s)", SDL_GetError() );
return( 1 ); return 1;
} }
return( 0 ); return 0;
} }
/***************************************************************************** /*****************************************************************************
...@@ -103,7 +119,7 @@ static int SetFormat( aout_instance_t *p_aout ) ...@@ -103,7 +119,7 @@ static int SetFormat( aout_instance_t *p_aout )
} }
p_aout->output.output.i_format = AOUT_FMT_S16_NE; p_aout->output.output.i_format = AOUT_FMT_S16_NE;
p_aout->output.i_nb_samples = DEFAULT_FRAME_SIZE; p_aout->output.i_nb_samples = FRAME_SIZE;
SDL_PauseAudio( 0 ); SDL_PauseAudio( 0 );
...@@ -123,14 +139,12 @@ static void Play( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) ...@@ -123,14 +139,12 @@ static void Play( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
} }
/***************************************************************************** /*****************************************************************************
* CloseAudio: close the audio device * Close: close the audio device
*****************************************************************************/ *****************************************************************************/
void E_(CloseAudio) ( aout_instance_t *p_aout ) static void Close ( vlc_object_t *p_this )
{ {
SDL_PauseAudio( 1 ); SDL_PauseAudio( 1 );
SDL_CloseAudio(); SDL_CloseAudio();
SDL_QuitSubSystem( SDL_INIT_AUDIO ); SDL_QuitSubSystem( SDL_INIT_AUDIO );
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (http://liba52.sf.net/). * (http://liba52.sf.net/).
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: a52.c,v 1.2 2002/08/11 22:46:34 massiot Exp $ * $Id: a52.c,v 1.3 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
# include <inttypes.h> /* int16_t .. */ # include <inttypes.h> /* int16_t .. */
#endif #endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef USE_A52DEC_TREE /* liba52 header file */ #ifdef USE_A52DEC_TREE /* liba52 header file */
# include "include/a52.h" # include "include/a52.h"
#else #else
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libmp4.c : LibMP4 library for mp4 module for vlc * libmp4.c : LibMP4 library for mp4 module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: libmp4.c,v 1.3 2002/08/11 08:30:01 gbazin Exp $ * $Id: libmp4.c,v 1.4 2002/08/13 11:59:36 sam Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
+ ( p_box->i_type == FOURCC_uuid ? 16 : 0 ) ) + ( p_box->i_type == FOURCC_uuid ? 16 : 0 ) )
#define MP4_BOX_DESCEND( p_box ) \ #define MP4_BOX_DESCEND( p_box ) \
MP4_SeekStream( p_stream, p_box->i_pos + MP4_BOX_HEADERSIZE( p_box ) ); MP4_SeekStream( p_stream, p_box->i_pos + MP4_BOX_HEADERSIZE( p_box ) )
#define MP4_GET1BYTE( dst ) \ #define MP4_GET1BYTE( dst ) \
dst = *p_peek; p_peek++; i_read-- dst = *p_peek; p_peek++; i_read--
......
aa_SOURCES = aa.c
fb_SOURCES = fb.c
ggi_SOURCES = ggi.c
glide_SOURCES = glide.c
sdl_SOURCES = sdl.c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_aa.c: Aa video output display method for testing purposes * vout_aa.c: Aa video output display method for testing purposes
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: aa.c,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: aa.c,v 1.1 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* fb.c : framebuffer plugin for vlc * fb.c : framebuffer plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: fb.c,v 1.2 2002/08/08 22:28:22 sam Exp $ * $Id: fb.c,v 1.1 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ggi.c : GGI plugin for vlc * ggi.c : GGI plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: ggi.c,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: ggi.c,v 1.1 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* glide.c : 3dfx Glide plugin for vlc * glide.c : 3dfx Glide plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: glide.c,v 1.2 2002/08/08 22:28:22 sam Exp $ * $Id: glide.c,v 1.1 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
......
/***************************************************************************** /*****************************************************************************
* vout_sdl.c: SDL video output display method * sdl.c: SDL video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: vout.c,v 1.1 2002/08/04 17:23:44 sam Exp $ * $Id: sdl.c,v 1.1 2002/08/13 11:59:36 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org> * Pierre Baillet <oct@zoy.org>
...@@ -85,6 +85,8 @@ struct picture_sys_t ...@@ -85,6 +85,8 @@ struct picture_sys_t
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static int Init ( vout_thread_t * ); static int Init ( vout_thread_t * );
static void End ( vout_thread_t * ); static void End ( vout_thread_t * );
static int Manage ( vout_thread_t * ); static int Manage ( vout_thread_t * );
...@@ -95,6 +97,15 @@ static void CloseDisplay ( vout_thread_t * ); ...@@ -95,6 +97,15 @@ static void CloseDisplay ( vout_thread_t * );
static int NewPicture ( vout_thread_t *, picture_t * ); static int NewPicture ( vout_thread_t *, picture_t * );
static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * ); static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("Simple DirectMedia Layer video module") );
set_capability( "video output", 40 );
set_callbacks( Open, Close );
vlc_module_end();
/***************************************************************************** /*****************************************************************************
* OpenVideo: allocate SDL video thread output method * OpenVideo: allocate SDL video thread output method
***************************************************************************** *****************************************************************************
...@@ -102,7 +113,7 @@ static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * ); ...@@ -102,7 +113,7 @@ static void SetPalette ( vout_thread_t *, u16 *, u16 *, u16 * );
* vout properties to choose the correct mode, and change them according to the * vout properties to choose the correct mode, and change them according to the
* mode actually used. * mode actually used.
*****************************************************************************/ *****************************************************************************/
int E_(OpenVideo) ( vlc_object_t *p_this ) static int Open ( vlc_object_t *p_this )
{ {
vout_thread_t * p_vout = (vout_thread_t *)p_this; vout_thread_t * p_vout = (vout_thread_t *)p_this;
...@@ -276,7 +287,7 @@ static void End( vout_thread_t *p_vout ) ...@@ -276,7 +287,7 @@ static void End( vout_thread_t *p_vout )
***************************************************************************** *****************************************************************************
* Terminate an output method created by vout_SDLCreate * Terminate an output method created by vout_SDLCreate
*****************************************************************************/ *****************************************************************************/
void E_(CloseVideo) ( vlc_object_t *p_this ) static void Close ( vlc_object_t *p_this )
{ {
vout_thread_t * p_vout = (vout_thread_t *)p_this; vout_thread_t * p_vout = (vout_thread_t *)p_this;
......
sdl_SOURCES = sdl.c vout.c aout.c
/*****************************************************************************
* sdl.c : SDL plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: sdl.c,v 1.1 2002/08/04 17:23:44 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org>
* Arnaud de Bossoreille de Ribou <bozo@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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <vlc/vlc.h>
/*****************************************************************************
* External prototypes
*****************************************************************************/
int E_(OpenVideo) ( vlc_object_t * );
void E_(CloseVideo) ( vlc_object_t * );
int E_(OpenAudio) ( vlc_object_t * );
void E_(CloseAudio) ( vlc_object_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("Simple DirectMedia Layer module") );
add_submodule();
set_capability( "video output", 40 );
set_callbacks( E_(OpenVideo), E_(CloseVideo) );
add_submodule();
set_capability( "audio output", 40 );
set_callbacks( E_(OpenAudio), E_(CloseAudio) );
vlc_module_end();
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