Commit 3cbfc06d authored by Sam Hocevar's avatar Sam Hocevar

. nouveaux plugins - ne fonctionnent pas encore tous

parent 1b79957c
Tue Jun 20 14:17:56 CEST 2000
0.1.99d :
* fixed RPM build
* .deb is now more lintian-friendly
Sun Jun 18 18:54:48 CEST 2000
0.1.99c :
* fixed Makefile.in for debug version
* caught Delete Window event in Gnome and X11 modes
* fixed manpage
* GGI output now works
* fixed a segfault on exit for the Gnome plugin
* fixed compile problems for BeOS
* sound support almost works under BeOS
* fixed a warning in ac3_exponent.c
* automatic support for .rpm and .deb building
* fixed Makefile.in for debug version
* caught Delete Window event in Gnome and X11 modes
* fixed manpage
* GGI output now works
* fixed a segfault on exit for the Gnome plugin
* fixed compile problems for BeOS
* sound support almost works under BeOS
* fixed a warning in ac3_exponent.c
* automatic support for .rpm and .deb building
Sat Jun 17 03:35:02 CEST 2000
0.1.99b :
* fixed a bug preventing to quit when run with no arguments
* new VLAN changing code
* created the ChangeLog file :)
* fixed a bug preventing to quit when run with no arguments
* new VLAN changing code
* created the ChangeLog file :)
INSTALL file for vlc, the VideoLAN Client
Building VideoLAN
=================
A typical way to configure the vlc is :
./configure --prefix=/usr --enable-ppro --enable-mmx --enable-gnome
See `./configure --help' for more information.
Then, run `make', and `make install' to install it.
To build a Debian package, you may use :
dpkg-buildpackage -rfakeroot -us -uc
To build RedHat packages, use :
rpm -ba vlc.spec
Installing and running VideoLAN
===============================
You can install the vlc and its plugins by typing :
make install
But you don't need to do it if you don't want ; vlc can be launched
from the current directory as well :
./vlc
......@@ -13,10 +13,7 @@
DEBUG=0
SYS=@SYS@
ARCH=@ARCH@
AOUT=@AOUT@
VOUT=@VOUT@
INTF=@VOUT@
PLUGINS=@PLUGINS@
SNAPSHOTDIR=vlc-@VLC_VERSION@
INSTALL=@INSTALL@
prefix=@prefix@
......@@ -249,12 +246,44 @@ endif
#
# Plugins
#
intf_plugin = $(INTF:%=plugins/intf/intf_%.so)
aout_plugin = $(AOUT:%=plugins/aout/aout_%.so)
vout_plugin = $(VOUT:%=plugins/vout/vout_%.so)
PLUGINS := $(PLUGINS:%=lib/%.so)
PLUGIN_OBJ = $(intf_plugin) $(aout_plugin) $(vout_plugin)
PLUGIN_BEOS = plugins/beos/aout_beos.o \
plugins/beos/intf_beos.o \
plugins/beos/vout_beos.o
PLUGIN_DSP = plugins/dsp/aout_dsp.o
PLUGIN_DUMMY = plugins/dummy/aout_dummy.o \
plugins/dummy/intf_dummy.o \
plugins/dummy/vout_dummy.o
PLUGIN_ESD = plugins/esd/aout_esd.o
PLUGIN_FB = plugins/fb/intf_fb.o \
plugins/fb/vout_fb.o
PLUGIN_GGI = plugins/ggi/intf_ggi.o \
plugins/ggi/vout_ggi.o
PLUGIN_GLIDE = plugins/glide/intf_glide.o \
plugins/glide/vout_glide.o
PLUGIN_GNOME = plugins/gnome/intf_gnome.o \
plugins/gnome/intf_gnome_callbacks.o \
plugins/gnome/intf_gnome_interface.o \
plugins/gnome/intf_gnome_support.o \
plugins/gnome/vout_gnome.o
PLUGIN_MGA = plugins/mga/intf_mga.o \
plugins/fb/vout_mga.o
PLUGIN_X11 = plugins/x11/intf_x11.o \
plugins/x11/vout_x11.o
PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
$(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
$(PLUGIN_MGA) $(PLUGIN_X11)
#
# Other lists of files
#
......@@ -280,7 +309,7 @@ clean:
rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
distclean: clean
rm -f */*/*.o plugins/*/*.so **/*~ *.log
rm -f src/*/*.o plugins/*/*.o lib/*.so **/*~ *.log
rm -f Makefile include/defs.h include/config.h
rm -f config.status config.cache config.log
rm -f vlc gmon.out core build-stamp
......@@ -290,9 +319,9 @@ install:
$(INSTALL) vlc $(prefix)/bin
mkdir -p $(prefix)/lib/videolan/vlc
mkdir -p $(prefix)/share/videolan/vlc
$(INSTALL) $(PLUGIN_OBJ) $(prefix)/lib/videolan/vlc
$(INSTALL) share/*.psf $(prefix)/share/videolan/vlc
$(INSTALL) share/*.png $(prefix)/share/videolan/vlc
$(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
$(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan/vlc
$(INSTALL) -m 644 share/*.png $(prefix)/share/videolan/vlc
show:
@echo "Command line for C objects:"
......@@ -316,12 +345,6 @@ snapshot:
mv /tmp/${SNAPSHOTDIR}.tar.gz ..
@echo "Sources are in ../${SNAPSHOTDIR}.tar.gz"
deb:
dpkg-buildpackage -rfakeroot -us -uc
rpm:
rpm -ba vlc.spec
FORCE:
#
......@@ -336,7 +359,7 @@ else
$(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
endif
plugins: $(PLUGIN_OBJ)
plugins: $(PLUGINS)
#
# Generic rules (see below)
......@@ -359,57 +382,56 @@ $(ASM_OBJ): %.o: %.S
#$(PLUGIN_OBJ): %.so: Makefile.dep
#$(PLUGIN_OBJ): %.so: .dep/%.d
# audio plugins
plugins/aout/aout_dummy.so plugins/aout/aout_dsp.so: %.so: %.c
ifeq ($(SYS),beos)
$(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
else
$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
endif
#$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
lib/beos.so: $(PLUGIN_BEOS)
ld -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
$(PLUGIN_BEOS): %.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
plugins/aout/aout_esd.so: %.so: %.c
lib/esd.so: $(PLUGIN_ESD)
ifneq (,$(findstring bsd,$(SYS)))
$(CC) $(CCFLAGS) $(CFLAGS) -lesd -shared -o $@ $<
ld -shared -lesd -o $@ $^
else
$(CC) $(CCFLAGS) $(CFLAGS) -laudiofile -lesd -shared -o $@ $<
ld -shared -laudiofile -lesd -o $@ $^
endif
$(PLUGIN_ESD): %.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
plugins/aout/aout_beos.so: %.so: %.cpp
$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
# video plugins
plugins/intf/intf_dummy.so plugins/vout/vout_dummy.so \
plugins/intf/intf_fb.so plugins/vout/vout_fb.so: %.so: %.c
ifeq ($(SYS),beos)
$(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
else
$(CC) $(CCFLAGS) $(CFLAGS) -shared -o $@ $<
endif
plugins/intf/intf_x11.so plugins/vout/vout_x11.so: %.so: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
plugins/intf/intf_mga.so plugins/vout/vout_mga.so: %.so: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
lib/dummy.so: $(PLUGIN_DUMMY)
ld -shared -o $@ $^
$(PLUGIN_DUMMY): %.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
plugins/intf/intf_gnome.so: %.so: %.c
$(CC) $(CCFLAGS) $(CFLAGS) $(LCFLAGS) `gnome-config --libs --cflags gnomeui` -shared -o $@ $< plugins/intf/intf_gnome_callbacks.c plugins/intf/intf_gnome_interface.c plugins/intf/intf_gnome_support.c
lib/fb.so: $(PLUGIN_FB)
ld -shared -o $@ $^
$(PLUGIN_FB): %.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
plugins/vout/vout_gnome.so: %.so: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXext -shared -o $@ $<
lib/x11.so: $(PLUGIN_X11)
ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
$(PLUGIN_X11): %.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
plugins/intf/intf_glide.so plugins/vout/vout_glide.so: %.so: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -lglide2x -shared -o $@ $<
lib/mga.so: $(PLUGIN_MGA)
ld -shared -L/usr/X11R6/lib -lX11 -lXext -o $@ $^
$(PLUGIN_MGA): %.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
plugins/intf/intf_ggi.so plugins/vout/vout_ggi.so: %.so: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -lggi -shared -o $@ $<
lib/gnome.so: $(PLUGIN_GNOME)
ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
$(PLUGIN_GNOME): %.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui`-c -o $@ $<
plugins/intf/intf_beos.so: %.so: %.cpp
$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
lib/glide.so: $(PLUGIN_GLIDE)
ld -shared -lglide2x -o $@ $^
$(PLUGIN_GLIDE): %.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -I/usr/include/glide -c -o $@ $<
plugins/vout/vout_beos.so: %.so: %.cpp
$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
lib/ggi.so: $(PLUGIN_GGI)
ld -shared -lggi -o $@ $^
$(PLUGIN_GGI): %.o: %.c
$(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
################################################################################
# Note on generic rules and dependancies
......
README for vlc, the VideoLAN Client
README for vlc, the VideoLAN Client
... Introduction
Introduction
============
[ nothing appropriate yet ]
Building, Installing and Running VideoLAN
=========================================
... Building VideoLAN
See the INSTALL file for this.
A typical way to configure the vlc is :
./configure --prefix=/usr --enable-ppro --enable-mmx --enable-gnome
Troubleshooting
===============
See `./configure --help' for more information.
A mailing-list has been set up for support and discussion about the
vlc. Its address is :
Then, run `make'.
<vlc@videolan.org>
To subscribe, send a mail to <listar@videolan.org> with the following
words in the mail body :
... Running VideoLAN
subscribe vlc
[ nothing appropriate yet ]
To unsubscribe, do the same with the words :
unsubscribe vlc
... Troubleshooting
When reporting bugs, try to be as precise as possible (which OS, which
distribution, what plugins you were trying, and so on).
[ nothing appropriate yet ]
... Resources
Resources
=========
[ nothing appropriate yet ]
... The team
The team
========
The following teachers were involved in the VideoLAN project :
......@@ -52,6 +56,7 @@ The following students were members of the VideoLAN team :
Antoine Brenner <brenner@via.ecp.fr>
Rgis Duchesne <regis@via.ecp.fr>
Alexandre Francois <francois@via.ecp.fr>
Christian Gross <gross@via.ecp.fr>
Hugo Haas <hugo@via.ecp.fr>
Mikael Journo <mj32@cornell.edu>
Michel Lespinasse <walken@wrs.com>
......@@ -61,7 +66,6 @@ The following students were members of the VideoLAN team :
Olivier Baxa <oli@via.ecp.fr>
Patrice Bazerque <patrice.bazerque@via.ecp.fr>
Etienne Bernard <eb@via.ecp.fr>
Arnaud Bienvenu <arnaud.bienvenu@via.ecp.fr>
Rgis Clment <clement@via.ecp.fr>
Alexandre Duret <alex@via.ecp.fr>
......
This diff is collapsed.
......@@ -4,7 +4,7 @@ AC_CONFIG_HEADER(include/defs.h)
AC_CANONICAL_HOST
VLC_VERSION=0.1.99c
VLC_VERSION=0.1.99d
AC_SUBST(VLC_VERSION)
VLC_CODENAME=Onatopp
AC_SUBST(VLC_CODENAME)
......@@ -58,34 +58,30 @@ AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_ARG_ENABLE(dummy,
[ --enable-vout-dummy dummy video support (default enabled)])
if test x$enable_vout_dummy != xno; then VOUT=${VOUT}"dummy "; fi
AC_ARG_ENABLE(x11,
[ --enable-x11 X11 video support (default enabled)])
if test x$enable_x11 != xno; then VOUT=${VOUT}"x11 "; fi
AC_ARG_ENABLE(fb,
[ --enable-fb Linux framebuffer video support (default disabled)],
[if test x$enable_fb = xyes; then VOUT=${VOUT}"fb "; fi])
AC_ARG_ENABLE(gnome,
[ --enable-gnome Gnome video support (default disabled)],
[if test x$enable_gnome = xyes; then VOUT=${VOUT}"gnome "; fi])
AC_ARG_ENABLE(glide,
[ --enable-glide Glide (3dfx) video support (default disabled)],
[if test x$enable_glide = xyes; then VOUT=${VOUT}"glide "; fi])
AC_ARG_ENABLE(ggi,
[ --enable-ggi GGI video support (default disabled)],
[if test x$enable_ggi = xyes; then VOUT=${VOUT}"ggi "; fi])
AC_ARG_ENABLE(dummy,
[ --enable-aout-dummy dummy audio support (default enabled)])
if test x$enable_aout_dummy != xno; then AOUT=${AOUT}"dummy "; fi
AC_ARG_ENABLE(dsp,
[ --enable-dsp Linux /dev/dsp support (default enabled)])
if test x$enable_dsp != xno; then AOUT=${AOUT}"dsp "; fi
if test x$enable_dsp != xno; then PLUGINS=${PLUGINS}"dsp "; fi
AC_ARG_ENABLE(dummy,
[ --enable-dummy dummy audio and video support (default enabled)])
if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi
AC_ARG_ENABLE(esd,
[ --enable-esd Esound library support (default disabled)],
[if test x$enable_gnome = xyes; then AOUT=${AOUT}"esd "; fi])
[if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"esd "; fi])
AC_ARG_ENABLE(fb,
[ --enable-fb Linux framebuffer support (default disabled)],
[if test x$enable_fb = xyes; then PLUGINS=${PLUGINS}"fb "; fi])
AC_ARG_ENABLE(ggi,
[ --enable-ggi GGI support (default disabled)],
[if test x$enable_ggi = xyes; then PLUGINS=${PLUGINS}"ggi "; fi])
AC_ARG_ENABLE(glide,
[ --enable-glide Glide (3dfx) support (default disabled)],
[if test x$enable_glide = xyes; then PLUGINS=${PLUGINS}"glide "; fi])
AC_ARG_ENABLE(gnome,
[ --enable-gnome Gnome support (default disabled)],
[if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; fi])
AC_ARG_ENABLE(x11,
[ --enable-x11 X11 support (default enabled)])
if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi
ARCH=${host_cpu}
AC_ARG_ENABLE(ppro,
......@@ -99,14 +95,12 @@ SYS=${host_os}
# special cases
if test x$host_os = xbeos; then
VOUT="dummy beos"
AOUT="dummy beos"
PLUGINS="dummy beos"
fi
AC_SUBST(SYS)
AC_SUBST(ARCH)
AC_SUBST(VOUT)
AC_SUBST(AOUT)
AC_SUBST(PLUGINS)
AC_OUTPUT([Makefile include/config.h])
......@@ -116,6 +110,5 @@ vlc configuration
vlc version : ${VLC_VERSION}
system : ${SYS}
architecture : ${ARCH}
vout : ${VOUT}
aout : ${AOUT}
plugins : ${PLUGINS}
"
vlc (0.1.99d) unstable; urgency=low
* .deb is now more lintian-friendly
-- Samuel Hocevar <sam@via.ecp.fr> Tue, 20 Jun 2000 14:17:33 +0200
vlc (0.1.99c) unstable; urgency=low
* Caught Delete Window event in Gnome and X11 modes
......
......@@ -26,7 +26,7 @@ typedef int plugin_id_t;
typedef void* plugin_id_t;
#endif
int RequestPlugin ( plugin_id_t * p_plugin, char * psz_mask, char * psz_name );
int RequestPlugin ( plugin_id_t * p_plugin, char * psz_name );
void TrashPlugin ( plugin_id_t p_plugin );
void * GetPluginFunction ( plugin_id_t plugin, char *name );
/*****************************************************************************
* aout_beos.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
* Authors:
* Samuel Hocevar <sam@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 "defs.h"
#include <stdio.h>
#include <stdlib.h> /* malloc(), free() */
#include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */
#include <kernel/OS.h>
#include <View.h>
#include <Application.h>
#include <Message.h>
#include <Locker.h>
#include <media/MediaDefs.h>
#include <game/PushGameSound.h>
#include <malloc.h>
#include <string.h>
extern "C"
{
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "audio_output.h"
#include "intf_msg.h"
#include "main.h"
}
/*****************************************************************************
* aout_sys_t: esd audio output method descriptor
*****************************************************************************
* This structure is part of the audio output thread descriptor.
* It describes some esd specific variables.
*****************************************************************************/
typedef struct aout_sys_s
{
BPushGameSound * p_sound;
gs_audio_format * p_format;
void * p_buffer;
long i_buffer_size;
long i_buffer_pos;
} aout_sys_t;
extern "C"
{
/*****************************************************************************
* aout_SysOpen: opens a BPushGameSound
*****************************************************************************/
int aout_SysOpen( aout_thread_t *p_aout )
{
/* Allocate structure */
p_aout->p_sys = (aout_sys_t*) malloc( sizeof( aout_sys_t ) );
if( p_aout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Allocate gs_audio_format */
p_aout->p_sys->p_format = (gs_audio_format *) malloc( sizeof( gs_audio_format ) );
if( p_aout->p_sys->p_format == NULL )
{
free( p_aout->p_sys );
intf_ErrMsg("error: cannot allocate memory for gs_audio_format\n" );
return( 1 );
}
/* Initialize some variables */
p_aout->i_format = AOUT_DEFAULT_FORMAT;
p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR,
AOUT_STEREO_DEFAULT );
p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
p_aout->p_sys->p_format->frame_rate = 44100.0;
p_aout->p_sys->p_format->channel_count = p_aout->i_channels;
p_aout->p_sys->p_format->format = gs_audio_format::B_GS_S16;
p_aout->p_sys->p_format->byte_order = B_MEDIA_LITTLE_ENDIAN;
p_aout->p_sys->p_format->buffer_size = 8192;
/* Allocate BPushGameSound */
p_aout->p_sys->p_sound = new BPushGameSound( 8192,
p_aout->p_sys->p_format,
2, NULL );
if( p_aout->p_sys->p_sound == NULL )
{
free( p_aout->p_sys->p_format );
free( p_aout->p_sys );
intf_ErrMsg("error: cannot allocate memory for BPushGameSound\n" );
return( 1 );
}
if( p_aout->p_sys->p_sound->InitCheck() != B_OK )
{
free( p_aout->p_sys->p_format );
free( p_aout->p_sys );
intf_ErrMsg("error: cannot allocate memory for BPushGameSound\n" );
return( 1 );
}
p_aout->p_sys->p_sound->StartPlaying( );
p_aout->p_sys->p_sound->LockForCyclic( &p_aout->p_sys->p_buffer,
(size_t *)&p_aout->p_sys->i_buffer_size );
return( 0 );
}
/*****************************************************************************
* aout_SysReset: resets the dsp
*****************************************************************************/
int aout_SysReset( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysSetFormat: sets the dsp output format
*****************************************************************************/
int aout_SysSetFormat( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysSetChannels: sets the dsp's stereo or mono mode
*****************************************************************************/
int aout_SysSetChannels( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysSetRate: sets the dsp's audio output rate
*****************************************************************************/
int aout_SysSetRate( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysGetBufInfo: buffer status query
*****************************************************************************/
long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{
long i_hard_pos = 4 * p_aout->p_sys->p_sound->CurrentPosition();
/*fprintf( stderr, "read 0x%.6lx - write 0x%.6lx = ",
i_hard_pos, p_aout->p_sys->i_buffer_pos );*/
if( i_hard_pos < p_aout->p_sys->i_buffer_pos )
{
i_hard_pos += p_aout->p_sys->i_buffer_size;
}
/*fprintf( stderr, "0x%.6lx\n", i_hard_pos - p_aout->p_sys->i_buffer_pos ); */
return( (p_aout->p_sys->i_buffer_size - (i_hard_pos - p_aout->p_sys->i_buffer_pos)) );
}
/*****************************************************************************
* aout_SysPlaySamples: plays a sound samples buffer
*****************************************************************************
* This function writes a buffer of i_length bytes in the dsp
*****************************************************************************/
void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{
long i_newbuf_pos;
//fprintf( stderr, "writing %i\n", i_size );
if( (i_newbuf_pos = p_aout->p_sys->i_buffer_pos + i_size)
> p_aout->p_sys->i_buffer_size )
{
memcpy( (void *)((int)p_aout->p_sys->p_buffer
+ p_aout->p_sys->i_buffer_pos),
buffer,
p_aout->p_sys->i_buffer_size - p_aout->p_sys->i_buffer_pos );
memcpy( (void *)((int)p_aout->p_sys->p_buffer),
buffer,
i_size - ( p_aout->p_sys->i_buffer_size
- p_aout->p_sys->i_buffer_pos ) );
p_aout->p_sys->i_buffer_pos = i_newbuf_pos - p_aout->p_sys->i_buffer_size;
}
else
{
memcpy( (void *)((int)p_aout->p_sys->p_buffer + p_aout->p_sys->i_buffer_pos),
buffer, i_size );
p_aout->p_sys->i_buffer_pos = i_newbuf_pos;
}
}
/*****************************************************************************
* aout_SysClose: closes the dsp audio device
*****************************************************************************/
void aout_SysClose( aout_thread_t *p_aout )
{
p_aout->p_sys->p_sound->UnlockCyclic();
p_aout->p_sys->p_sound->StopPlaying( );
delete p_aout->p_sys->p_sound;
free( p_aout->p_sys->p_format );
free( p_aout->p_sys );
}
} /* extern "C" */
/*****************************************************************************
* intf_beos.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
* Authors:
* Jean-Marc Dressler
*
* 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 "defs.h"
#include <stdio.h>
#include <stdlib.h> /* malloc(), free() */
#include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */
#include <kernel/OS.h>
#include <View.h>
#include <Application.h>
#include <Message.h>
#include <Locker.h>
#include <DirectWindow.h>
#include <malloc.h>
#include <string.h>
extern "C"
{
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "intf_msg.h"
#include "interface.h"
#include "main.h"
}
#include "beos_window.h"
/*****************************************************************************
* intf_sys_t: description and status of FB interface
*****************************************************************************/
typedef struct intf_sys_s
{
InterfaceWindow * p_window;
char i_key;
} intf_sys_t;
/*****************************************************************************
* InterfaceWindow
*****************************************************************************/
InterfaceWindow::InterfaceWindow( BRect frame, const char *name , intf_thread_t *p_intf )
: BWindow(frame, name, B_TITLED_WINDOW, B_NOT_RESIZABLE|B_NOT_ZOOMABLE)
{
p_interface = p_intf;
SetName( "interface" );
BView * p_view;
p_view = new BView( Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW );
AddChild( p_view );
Show();
}
InterfaceWindow::~InterfaceWindow()
{
}
/*****************************************************************************
* InterfaceWindow::MessageReceived
*****************************************************************************/
void InterfaceWindow::MessageReceived( BMessage * p_message )
{
char * psz_key;
switch( p_message->what )
{
case B_KEY_DOWN:
p_message->FindString( "bytes", (const char **)&psz_key );
p_interface->p_sys->i_key = psz_key[0];
break;
default:
BWindow::MessageReceived( p_message );
break;
}
}
/*****************************************************************************
* InterfaceWindow::QuitRequested
*****************************************************************************/
bool InterfaceWindow::QuitRequested()
{
return( false );
}
extern "C"
{
/*****************************************************************************
* intf_SysCreate: initialize dummy interface
*****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf )
{
/* Allocate instance and initialize some members */
p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM));
return( 1 );
}
p_intf->p_sys->i_key = -1;
/* Create the interface window */
p_intf->p_sys->p_window =
new InterfaceWindow( BRect( 100, 100, 200, 200 ), "Interface :)", p_intf );
if( p_intf->p_sys->p_window == 0 )
{
free( p_intf->p_sys );
intf_ErrMsg( "error: cannot allocate memory for InterfaceWindow\n" );
return( 1 );
}
/* Spawn video output thread */
if( p_main->b_video )
{
p_intf->p_vout = vout_CreateThread( NULL, 0, 0, 0, NULL, 0, NULL );
if( p_intf->p_vout == NULL ) /* error */
{
intf_ErrMsg("intf error: can't create output thread\n" );
return( 1 );
}
}
return( 0 );
}
/*****************************************************************************
* intf_SysDestroy: destroy dummy interface
*****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf )
{
/* Close input thread, if any (blocking) */
if( p_intf->p_input )
{
input_DestroyThread( p_intf->p_input, NULL );
}
/* Close video output thread, if any (blocking) */
if( p_intf->p_vout )
{
vout_DestroyThread( p_intf->p_vout, NULL );
}
/* Destroy the interface window */
p_intf->p_sys->p_window->Lock();
p_intf->p_sys->p_window->Quit();
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_SysManage: event loop
*****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf )
{
if( p_intf->p_sys->i_key != -1 )
{
intf_ProcessKey( p_intf, p_intf->p_sys->i_key );
p_intf->p_sys->i_key = -1;
}
}
} /* extern "C" */
This diff is collapsed.
/*****************************************************************************
* aout_dsp.c : dsp functions library
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
* Authors:
*
* 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.
*****************************************************************************/
/* TODO:
*
* - an aout_sysGetFormats() function
* - dsp inline/static
* - make this library portable (see mpg123)
* - macroify aout_sysPlaySamples &/| aout_sysGetBufInfo ?
*
*/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <errno.h> /* ENOMEM */
#include <fcntl.h> /* open(), O_WRONLY */
#include <sys/ioctl.h> /* ioctl() */
#include <string.h> /* strerror() */
#include <unistd.h> /* write(), close() */
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* calloc(), malloc(), free() */
#ifdef SYS_BSD
#include <machine/soundcard.h> /* SNDCTL_DSP_RESET, SNDCTL_DSP_SETFMT,
SNDCTL_DSP_STEREO, SNDCTL_DSP_SPEED, SNDCTL_DSP_GETOSPACE */
#else
#include <sys/soundcard.h> /* SNDCTL_DSP_RESET, SNDCTL_DSP_SETFMT,
SNDCTL_DSP_STEREO, SNDCTL_DSP_SPEED, SNDCTL_DSP_GETOSPACE */
#endif
#include "config.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "audio_output.h" /* aout_thread_t */
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
#include "main.h"
/*****************************************************************************
* vout_dsp_t: dsp audio output method descriptor
*****************************************************************************
* This structure is part of the audio output thread descriptor.
* It describes the dsp specific properties of an audio device.
*****************************************************************************/
typedef struct aout_sys_s
{
audio_buf_info audio_buf;
} aout_sys_t;
/*****************************************************************************
* aout_SysOpen: opens the audio device (the digital sound processor)
*****************************************************************************
* - This function opens the dsp as an usual non-blocking write-only file, and
* modifies the p_aout->p_sys->i_fd with the file's descriptor.
*****************************************************************************/
int aout_SysOpen( aout_thread_t *p_aout )
{
/* Allocate structure */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Initialize some variables */
p_aout->i_format = AOUT_DEFAULT_FORMAT;
p_aout->psz_device = main_GetPszVariable( AOUT_DSP_VAR, AOUT_DSP_DEFAULT );
p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
/* Open the sound device */
if ( (p_aout->i_fd = open( p_aout->psz_device, O_WRONLY )) < 0 )
{
intf_ErrMsg( "aout error: can't open audio device (%s)\n", p_aout->psz_device );
return( -1 );
}
return( 0 );
}
/*****************************************************************************
* aout_SysReset: resets the dsp
*****************************************************************************/
int aout_SysReset( aout_thread_t *p_aout )
{
if ( ioctl( p_aout->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 )
{
intf_ErrMsg( "aout error: can't reset audio device (%s)\n", p_aout->psz_device );
return( -1 );
}
return( 0 );
}
/*****************************************************************************
* aout_SysSetFormat: sets the dsp output format
*****************************************************************************
* This functions tries to initialize the dsp output format with the value
* contained in the dsp structure, and if this value could not be set, the
* default value returned by ioctl is set.
*****************************************************************************/
int aout_SysSetFormat( aout_thread_t *p_aout )
{
int i_format;
i_format = p_aout->i_format;
if ( ioctl( p_aout->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
{
intf_ErrMsg( "aout error: can't set audio output format (%i)\n", p_aout->i_format );
return( -1 );
}
if ( i_format != p_aout->i_format )
{
intf_DbgMsg( "aout debug: audio output format not supported (%i)\n", p_aout->i_format );
p_aout->i_format = i_format;
}
return( 0 );
}
/*****************************************************************************
* aout_SysSetChannels: sets the dsp's stereo or mono mode
*****************************************************************************
* This function acts just like the previous one...
*****************************************************************************/
int aout_SysSetChannels( aout_thread_t *p_aout )
{
boolean_t b_stereo = p_aout->b_stereo;
if ( ioctl( p_aout->i_fd, SNDCTL_DSP_STEREO, &b_stereo ) < 0 )
{
intf_ErrMsg( "aout error: can't set number of audio channels (%i)\n", p_aout->i_channels );
return( -1 );
}
if ( b_stereo != p_aout->b_stereo )
{
intf_DbgMsg( "aout debug: number of audio channels not supported (%i)\n", p_aout->i_channels );
p_aout->b_stereo = b_stereo;
p_aout->i_channels = 1 + b_stereo;
}
return( 0 );
}
/*****************************************************************************
* aout_SysSetRate: sets the dsp's audio output rate
*****************************************************************************
* This function tries to initialize the dsp with the rate contained in the
* dsp structure, but if the dsp doesn't support this value, the function uses
* the value returned by ioctl...
*****************************************************************************/
int aout_SysSetRate( aout_thread_t *p_aout )
{
long l_rate;
l_rate = p_aout->l_rate;
if ( ioctl( p_aout->i_fd, SNDCTL_DSP_SPEED, &l_rate ) < 0 )
{
intf_ErrMsg( "aout error: can't set audio output rate (%li)\n", p_aout->l_rate );
return( -1 );
}
if ( l_rate != p_aout->l_rate )
{
intf_DbgMsg( "aout debug: audio output rate not supported (%li)\n", p_aout->l_rate );
p_aout->l_rate = l_rate;
}
return( 0 );
}
/*****************************************************************************
* aout_SysGetBufInfo: buffer status query
*****************************************************************************
* This function fills in the audio_buf_info structure :
* - int fragments : number of available fragments (partially usend ones not
* counted)
* - int fragstotal : total number of fragments allocated
* - int fragsize : size of a fragment in bytes
* - int bytes : available space in bytes (includes partially used fragments)
* Note! 'bytes' could be more than fragments*fragsize
*****************************************************************************/
long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{
ioctl( p_aout->i_fd, SNDCTL_DSP_GETOSPACE, &p_aout->p_sys->audio_buf );
/* returns the allocated space in bytes */
return ( (p_aout->p_sys->audio_buf.fragstotal
* p_aout->p_sys->audio_buf.fragsize)
- p_aout->p_sys->audio_buf.bytes );
}
/*****************************************************************************
* aout_SysPlaySamples: plays a sound samples buffer
*****************************************************************************
* This function writes a buffer of i_length bytes in the dsp
*****************************************************************************/
void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{
if( p_aout->b_active )
{
write( p_aout->i_fd, buffer, i_size );
}
}
/*****************************************************************************
* aout_SysClose: closes the dsp audio device
*****************************************************************************/
void aout_SysClose( aout_thread_t *p_aout )
{
close( p_aout->i_fd );
}
/*****************************************************************************
* aout_dummy.c : dummy audio output plugin
*****************************************************************************
* Copyright (C) 2000 VideoLAN
*
* Authors:
*
* 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 "defs.h"
#include "config.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "audio_output.h" /* aout_thread_t */
#include "main.h"
/*****************************************************************************
* vout_dummy_t: dummy video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the dummy specific properties of an output thread.
*****************************************************************************/
typedef struct aout_sys_s
{
} aout_sys_t;
/*****************************************************************************
* aout_SysOpen: opens a dummy audio device
*****************************************************************************/
int aout_SysOpen( aout_thread_t *p_aout )
{
/* Initialize some variables */
p_aout->i_format = AOUT_DEFAULT_FORMAT;
p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
return( 0 );
}
/*****************************************************************************
* aout_SysReset: fake reset
*****************************************************************************/
int aout_SysReset( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysSetFormat: pretends to set the dsp output format
*****************************************************************************/
int aout_SysSetFormat( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysSetChannels: pretends to set stereo or mono mode
*****************************************************************************/
int aout_SysSetChannels( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysSetRate: pretends to set audio output rate
*****************************************************************************/
int aout_SysSetRate( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysGetBufInfo: returns available bytes in buffer
*****************************************************************************/
long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{
return( 2 * l_buffer_limit ); /* value big enough to sleep */
}
/*****************************************************************************
* aout_SysPlaySamples: pretends to play a sound
*****************************************************************************/
void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{
;
}
/*****************************************************************************
* aout_SysClose: closes the dummy audio device
*****************************************************************************/
void aout_SysClose( aout_thread_t *p_aout )
{
;
}
/*****************************************************************************
* intf_dummy.c: dummy interface plugin
*****************************************************************************
* Copyright (C) 2000 VideoLAN
*
* Authors:
*
* 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 "defs.h"
#include <stdlib.h> /* malloc(), free() */
#include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* "input.h" */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "intf_msg.h"
#include "interface.h"
#include "main.h"
/*****************************************************************************
* intf_sys_t: description and status of FB interface
*****************************************************************************/
typedef struct intf_sys_s
{
} intf_sys_t;
/*****************************************************************************
* intf_SysCreate: initialize dummy interface
*****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf )
{
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
return( 1 );
};
/* Spawn video output thread */
if( p_main->b_video )
{
p_intf->p_vout = vout_CreateThread( NULL, 0, 0, 0, NULL, 0, NULL );
if( p_intf->p_vout == NULL ) /* error */
{
intf_ErrMsg("intf error: can't create output thread\n" );
return( 1 );
}
}
return( 0 );
}
/*****************************************************************************
* intf_SysDestroy: destroy dummy interface
*****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf )
{
/* Close input thread, if any (blocking) */
if( p_intf->p_input )
{
input_DestroyThread( p_intf->p_input, NULL );
}
/* Close video output thread, if any (blocking) */
if( p_intf->p_vout )
{
vout_DestroyThread( p_intf->p_vout, NULL );
}
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_SysManage: event loop
*****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf )
{
;
}
/*****************************************************************************
* vout_dummy.c: Dummy video output display method for testing purposes
*****************************************************************************
* Copyright (C) 2000 VideoLAN
*
* Authors:
*
* 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 "defs.h"
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "video.h"
#include "video_output.h"
#include "intf_msg.h"
#define WIDTH 128
#define HEIGHT 64
#define BITS_PER_PLANE 16
#define BYTES_PER_PIXEL 2
/*****************************************************************************
* vout_sys_t: dummy video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the dummy specific properties of an output thread.
*****************************************************************************/
typedef struct vout_sys_s
{
/* Dummy video memory */
byte_t * p_video; /* base adress */
size_t i_page_size; /* page size */
} vout_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int DummyOpenDisplay ( vout_thread_t *p_vout );
static void DummyCloseDisplay ( vout_thread_t *p_vout );
/*****************************************************************************
* vout_SysCreate: allocates dummy video thread output method
*****************************************************************************
* This function allocates and initializes a dummy vout method.
*****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Open and initialize device */
if( DummyOpenDisplay( p_vout ) )
{
intf_ErrMsg("vout error: can't open display\n");
free( p_vout->p_sys );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* vout_SysInit: initialize dummy video thread output method
*****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout )
{
return( 0 );
}
/*****************************************************************************
* vout_SysEnd: terminate dummy video thread output method
*****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout )
{
;
}
/*****************************************************************************
* vout_SysDestroy: destroy dummy video thread output method
*****************************************************************************
* Terminate an output method created by DummyCreateOutputMethod
*****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout )
{
DummyCloseDisplay( p_vout );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_SysManage: handle dummy events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error.
*****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
return( 0 );
}
/*****************************************************************************
* vout_SysDisplay: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to dummy image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout )
{
;
}
/* following functions are local */
/*****************************************************************************
* DummyOpenDisplay: open and initialize dummy device
*****************************************************************************
* XXX?? The framebuffer mode is only provided as a fast and efficient way to
* display video, providing the card is configured and the mode ok. It is
* not portable, and is not supposed to work with many cards. Use at your
* own risk !
*****************************************************************************/
static int DummyOpenDisplay( vout_thread_t *p_vout )
{
p_vout->i_width = WIDTH;
p_vout->i_height = HEIGHT;
p_vout->i_screen_depth = BITS_PER_PLANE;
p_vout->i_bytes_per_pixel = BYTES_PER_PIXEL;
p_vout->i_bytes_per_line = WIDTH * BYTES_PER_PIXEL;
p_vout->p_sys->i_page_size = WIDTH * HEIGHT * BYTES_PER_PIXEL;
/* Map two framebuffers a the very beginning of the fb */
p_vout->p_sys->p_video = malloc( p_vout->p_sys->i_page_size * 2 );
if( (int)p_vout->p_sys->p_video == -1 )
{
intf_ErrMsg("vout error: can't map video memory (%s)\n", strerror(errno) );
return( 1 );
}
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
return( 0 );
}
/*****************************************************************************
* DummyCloseDisplay: close and reset dummy device
*****************************************************************************
* Returns all resources allocated by DummyOpenDisplay and restore the original
* state of the device.
*****************************************************************************/
static void DummyCloseDisplay( vout_thread_t *p_vout )
{
free( p_vout->p_sys->p_video );
}
/*****************************************************************************
* aout_esd.c : Esound functions library
*****************************************************************************
* Copyright (C) 2000 VideoLAN
*
* Authors:
*
* 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.
*****************************************************************************/
/* TODO:
*
* - use the libesd function to get latency when it's not buggy anymore
*
*/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <errno.h> /* ENOMEM */
#include <fcntl.h> /* open(), O_WRONLY */
#include <string.h> /* strerror() */
#include <unistd.h> /* write(), close() */
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <esd.h>
#include "config.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "audio_output.h" /* aout_thread_t */
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
#include "main.h"
/*****************************************************************************
* aout_sys_t: esd audio output method descriptor
*****************************************************************************
* This structure is part of the audio output thread descriptor.
* It describes some esd specific variables.
*****************************************************************************/
typedef struct aout_sys_s
{
esd_format_t esd_format;
} aout_sys_t;
/*****************************************************************************
* aout_SysOpen: opens an esd socket
*****************************************************************************/
int aout_SysOpen( aout_thread_t *p_aout )
{
/* mpg123 does it this way */
int i_bits = ESD_BITS16;
int i_mode = ESD_STREAM;
int i_func = ESD_PLAY;
/* Allocate structure */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Initialize some variables */
p_aout->i_format = AOUT_DEFAULT_FORMAT;
p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
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 )
p_aout->p_sys->esd_format |= ESD_MONO;
else
p_aout->p_sys->esd_format |= ESD_STEREO;
/* open a socket for playing a stream
* and try to open /dev/dsp if there's no EsounD */
if ( (p_aout->i_fd
= esd_play_stream_fallback(p_aout->p_sys->esd_format,
p_aout->l_rate, NULL, "vlc")) < 0 )
{
intf_ErrMsg( "aout error: can't open esound socket"
" (format 0x%08x at %ld Hz)\n",
p_aout->p_sys->esd_format, p_aout->l_rate );
return( -1 );
}
return( 0 );
}
/*****************************************************************************
* aout_SysReset: resets the dsp
*****************************************************************************/
int aout_SysReset( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysSetFormat: sets the dsp output format
*****************************************************************************/
int aout_SysSetFormat( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysSetChannels: sets the dsp's stereo or mono mode
*****************************************************************************/
int aout_SysSetChannels( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysSetRate: sets the dsp's audio output rate
*****************************************************************************/
int aout_SysSetRate( aout_thread_t *p_aout )
{
return( 0 );
}
/*****************************************************************************
* aout_SysGetBufInfo: buffer status query
*****************************************************************************/
long aout_SysGetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
{
/* arbitrary value that should be changed */
return( l_buffer_limit );
}
/*****************************************************************************
* aout_SysPlaySamples: plays a sound samples buffer
*****************************************************************************
* This function writes a buffer of i_length bytes in the dsp
*****************************************************************************/
void aout_SysPlaySamples( aout_thread_t *p_aout, byte_t *buffer, int i_size )
{
int amount;
if (p_aout->p_sys->esd_format & ESD_STEREO)
{
if (p_aout->p_sys->esd_format & ESD_BITS16)
amount = (44100 * (ESD_BUF_SIZE + 64)) / p_aout->l_rate;
else
amount = (44100 * (ESD_BUF_SIZE + 128)) / p_aout->l_rate;
}
else
{
if (p_aout->p_sys->esd_format & ESD_BITS16)
amount = (2 * 44100 * (ESD_BUF_SIZE + 128)) / p_aout->l_rate;
else
amount = (2 * 44100 * (ESD_BUF_SIZE + 256)) / p_aout->l_rate;
}
intf_DbgMsg( "aout: latency is %i\n", amount );
write( p_aout->i_fd, buffer, i_size );
}
/*****************************************************************************
* aout_SysClose: closes the dsp audio device
*****************************************************************************/
void aout_SysClose( aout_thread_t *p_aout )
{
close( p_aout->i_fd );
}
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* intf_ggi.c: GGI interface plugin
* Since GII doesnt seem to work well for keyboard events, the GGI display is
* used, and therefore the GII interface can't be spawned without a video output
* thread. It also needs a kludge to get the visual from the video output GGI
* driver.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
* Authors:
*
* 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 "defs.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <ggi/ggi.h>
#include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* for input.h */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "interface.h"
#include "intf_msg.h"
#include "main.h"
/*****************************************************************************
* intf_sys_t: description and status of GGI interface
*****************************************************************************/
typedef struct intf_sys_s
{
/* GGI system information */
ggi_visual_t p_display; /* display */
} intf_sys_t;
/*****************************************************************************
* External prototypes
*****************************************************************************/
/* vout_SysGetVisual: get back visual from video output thread - in video_ggi.c
* This function is used to get back the display pointer once the video output
* thread has been spawned. */
ggi_visual_t vout_SysGetVisual( vout_thread_t *p_vout );
/*****************************************************************************
* intf_SysCreate: initialize and create GII interface
*****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf )
{
/* Check that b_video is set */
if( !p_main->b_video )
{
intf_ErrMsg("error: GGI interface require a video output thread\n");
return( 1 );
}
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Spawn video output thread */
p_intf->p_vout = vout_CreateThread( main_GetPszVariable( VOUT_DISPLAY_VAR,
NULL), 0,
main_GetIntVariable( VOUT_WIDTH_VAR,
VOUT_WIDTH_DEFAULT ),
main_GetIntVariable( VOUT_HEIGHT_VAR,
VOUT_HEIGHT_DEFAULT ),
NULL, 0,
(void *)&p_intf->p_sys->p_display );
fprintf(stderr, "display is %i\n", p_intf->p_sys->p_display);
if( p_intf->p_vout == NULL ) /* error */
{
intf_ErrMsg("error: can't create video output thread\n" );
free( p_intf->p_sys );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* intf_SysDestroy: destroy interface
*****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf )
{
/* Close input thread, if any (blocking) */
if( p_intf->p_input )
{
input_DestroyThread( p_intf->p_input, NULL );
}
/* Close video output thread, if any (blocking) */
if( p_intf->p_vout )
{
vout_DestroyThread( p_intf->p_vout, NULL );
}
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_SysManage: event loop
*****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf )
{
int i_key; /* unicode key */
/* For all events in queue */
while( ggiKbhit( p_intf->p_sys->p_display ) )
{
i_key = ggiGetc( p_intf->p_sys->p_display );
if( intf_ProcessKey( p_intf, i_key ) )
{
intf_DbgMsg("unhandled key '%c' (%i)\n", (char) i_key, i_key );
}
}
}
This diff is collapsed.
/*****************************************************************************
* intf_glide.c: 3dfx interface plugin
*****************************************************************************
* Copyright (C) 2000 VideoLAN
*
* Authors:
*
* 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 "defs.h"
#include <stdlib.h> /* malloc(), free() */
#include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* for input.h */
#include <linutil.h> /* Glide kbhit() and getch() */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "plugins.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "intf_msg.h"
#include "interface.h"
#include "main.h"
/*****************************************************************************
* intf_sys_t: description and status of 3dfx interface
*****************************************************************************/
typedef struct intf_sys_s
{
} intf_sys_t;
/*****************************************************************************
* intf_SysCreate: initialize 3dfx interface
*****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf )
{
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
return( 1 );
};
/* Spawn video output thread */
if( p_main->b_video )
{
p_intf->p_vout = vout_CreateThread( NULL, 0, 0, 0, NULL, 0, NULL );
if( p_intf->p_vout == NULL ) /* error */
{
intf_ErrMsg("intf error: can't create output thread\n" );
return( 1 );
}
}
return( 0 );
}
/*****************************************************************************
* intf_SysDestroy: destroy 3dfx interface
*****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf )
{
/* Close input thread, if any (blocking) */
if( p_intf->p_input )
{
input_DestroyThread( p_intf->p_input, NULL );
}
/* Close video output thread, if any (blocking) */
if( p_intf->p_vout )
{
vout_DestroyThread( p_intf->p_vout, NULL );
}
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_SysManage: event loop
*****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf )
{
unsigned int buf;
/* very Linux specific - see tlib.c in Glide for other versions */
while( kbhit() )
{
if( intf_ProcessKey(p_intf, (int)buf = getch()) )
{
intf_ErrMsg( "unhandled key '%c' (%i)\n", (char) buf, buf );
}
}
}
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* intf_gnome.h: Gnome interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
*
* Authors:
*
* 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
* Boston, MA 02111-1307, USA.
*****************************************************************************/
/*****************************************************************************
* intf_sys_t: description and status of Gnome interface
*****************************************************************************/
typedef struct intf_sys_s
{
/* X11 generic properties */
Display * p_display; /* X11 display pointer */
int i_screen; /* X11 screen */
Atom wm_protocols;
Atom wm_delete_window;
/* Main window properties */
Window window; /* main window */
GC gc; /* graphic context for main window */
int i_width; /* width of main window */
int i_height; /* height of main window */
Colormap colormap; /* colormap used (8bpp only) */
/* Screen saver properties */
int i_ss_count; /* enabling/disabling count */
int i_ss_timeout; /* timeout */
int i_ss_interval; /* interval between changes */
int i_ss_blanking; /* blanking mode */
int i_ss_exposure; /* exposure mode */
/* Mouse pointer properties */
boolean_t b_mouse; /* is the mouse pointer displayed ? */
/* Gnome part properties */
gnome_thread_t * p_gnome;
} intf_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int GnomeCreateWindow ( intf_thread_t *p_intf );
static void GnomeDestroyWindow ( intf_thread_t *p_intf );
static void GnomeManageInterface ( intf_thread_t *p_intf );
static gint GnomeManageMain ( gpointer p_data );
static void GnomeManageWindow ( intf_thread_t *p_intf );
static void GnomeEnableScreenSaver ( intf_thread_t *p_intf );
static void GnomeDisableScreenSaver ( intf_thread_t *p_intf );
static void GnomeTogglePointer ( intf_thread_t *p_intf );
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_intf_window (void);
GtkWidget* create_intf_about (void);
GtkWidget* create_intf_popup (void);
GtkWidget* create_intf_playlist (void);
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <gnome.h>
#include "intf_gnome_support.h"
/* This is an internally used function to create pixmaps. */
static GtkWidget* create_dummy_pixmap (GtkWidget *widget,
gboolean gnome_pixmap);
GtkWidget*
lookup_widget (GtkWidget *widget,
const gchar *widget_name)
{
GtkWidget *parent, *found_widget;
for (;;)
{
if (GTK_IS_MENU (widget))
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
else
parent = widget->parent;
if (parent == NULL)
break;
widget = parent;
}
found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
widget_name);
if (!found_widget)
g_warning ("Widget not found: %s", widget_name);
return found_widget;
}
/* This is a dummy pixmap we use when a pixmap can't be found. */
static char *dummy_pixmap_xpm[] = {
/* columns rows colors chars-per-pixel */
"1 1 1 1",
" c None",
/* pixels */
" ",
" "
};
/* This is an internally used function to create pixmaps. */
static GtkWidget*
create_dummy_pixmap (GtkWidget *widget,
gboolean gnome_pixmap)
{
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
GtkWidget *pixmap;
if (gnome_pixmap)
{
return gnome_pixmap_new_from_xpm_d (dummy_pixmap_xpm);
}
colormap = gtk_widget_get_colormap (widget);
gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask,
NULL, dummy_pixmap_xpm);
if (gdkpixmap == NULL)
g_error ("Couldn't create replacement pixmap.");
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
return pixmap;
}
/* This is an internally used function to create pixmaps. */
GtkWidget*
create_pixmap (GtkWidget *widget,
const gchar *filename,
gboolean gnome_pixmap)
{
GtkWidget *pixmap;
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
gchar *pathname;
pathname = gnome_pixmap_file (filename);
if (!pathname)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return create_dummy_pixmap (widget, gnome_pixmap);
}
if (gnome_pixmap)
{
pixmap = gnome_pixmap_new_from_file (pathname);
g_free (pathname);
return pixmap;
}
colormap = gtk_widget_get_colormap (widget);
gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask,
NULL, pathname);
if (gdkpixmap == NULL)
{
g_warning (_("Couldn't create pixmap from file: %s"), pathname);
g_free (pathname);
return create_dummy_pixmap (widget, gnome_pixmap);
}
g_free (pathname);
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
return pixmap;
}
/* This is an internally used function to create imlib images. */
GdkImlibImage*
create_image (const gchar *filename)
{
GdkImlibImage *image;
gchar *pathname;
pathname = gnome_pixmap_file (filename);
if (!pathname)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return NULL;
}
image = gdk_imlib_load_image (pathname);
g_free (pathname);
return image;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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