get the legacy.media_addon compiling, even though it wont work

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@129 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2002-07-12 12:33:57 +00:00
parent 9ca7451251
commit 79de8cf953
5 changed files with 28 additions and 30 deletions

View File

@ -1,10 +1,12 @@
SubDir OBOS_TOP src add-ons media media-add-ons legacy ; SubDir OBOS_TOP src add-ons media media-add-ons legacy ;
#Addon legacy.media_addon : media : UsePrivateHeaders media ;
# LegacyAudioConsumer.cpp
# LegacyAudioDevice.cpp
# LegacyAudioProducer.cpp
# LegacyMediaAddOn.cpp
#;
#LinkSharedOSLibs legacy.media_addon : media ; Addon legacy.media_addon : media :
LegacyAudioConsumer.cpp
LegacyAudioDevice.cpp
LegacyAudioProducer.cpp
LegacyMediaAddOn.cpp
;
LinkSharedOSLibs legacy.media_addon : media ;

View File

@ -14,12 +14,8 @@
#include <support/Autolock.h> #include <support/Autolock.h>
#include <support/Debug.h> #include <support/Debug.h>
#include "driver/audio.h"
#include "driver/sound.h"
#include "LegacyAudioConsumer.h"
#include "driver_io.h" #include "driver_io.h"
#include "LegacyAudioConsumer.h"
LegacyAudioConsumer::LegacyAudioConsumer( BMediaAddOn *addon, const char *name, int32 internal_id ) LegacyAudioConsumer::LegacyAudioConsumer( BMediaAddOn *addon, const char *name, int32 internal_id )
@ -53,7 +49,7 @@ LegacyAudioConsumer::LegacyAudioConsumer( BMediaAddOn *addon, const char *name,
return; return;
} }
DRIVER_GET_PLAYBACK_PREFERRED_BUF_SIZE( &mBuffer_size, 0 ); mBuffer_size = 4096;
io_buf1 = malloc( 2 * ( sizeof( audio_buffer_header ) + mBuffer_size ) ); io_buf1 = malloc( 2 * ( sizeof( audio_buffer_header ) + mBuffer_size ) );
@ -413,7 +409,7 @@ LegacyAudioConsumer::RunThread()
} }
//send buffer //send buffer
DRIVER_UNSAFE_WRITE( io_buf, 0 ); DRIVER_WRITE_BUFFER( io_buf, 0 );
//wait for IO //wait for IO
if ( acquire_sem( mBuffer_waitIO ) == B_BAD_SEM_ID ) { if ( acquire_sem( mBuffer_waitIO ) == B_BAD_SEM_ID ) {

View File

@ -2,7 +2,7 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include "driver/sound.h" #include "driver_io.h"
#include "LegacyAudioDevice.h" #include "LegacyAudioDevice.h"
@ -34,8 +34,9 @@ LegacyAudioDevice::LegacyAudioDevice( const char *name, int32 id )
input_flavor.out_formats = &input_format; input_flavor.out_formats = &input_format;
//get driver capture buffer size //get driver capture buffer size
ioctl( fd, SOUND_GET_CAPTURE_PREFERRED_BUF_SIZE, &buffer_size, 0 ); //ioctl( fd, SOUND_GET_CAPTURE_PREFERRED_BUF_SIZE, &buffer_size, 0 );
ioctl( fd, SOUND_SET_CAPTURE_PREFERRED_BUF_SIZE, buffer_size, 0 ); //ioctl( fd, SOUND_SET_CAPTURE_PREFERRED_BUF_SIZE, buffer_size, 0 );
buffer_size = 4096;
input_format.type = B_MEDIA_RAW_AUDIO; input_format.type = B_MEDIA_RAW_AUDIO;
input_format.u.raw_audio.frame_rate = 44100.0; input_format.u.raw_audio.frame_rate = 44100.0;
@ -68,8 +69,9 @@ LegacyAudioDevice::LegacyAudioDevice( const char *name, int32 id )
output_flavor.out_formats = NULL; output_flavor.out_formats = NULL;
//get driver playback buffer size //get driver playback buffer size
ioctl( fd, SOUND_GET_PLAYBACK_PREFERRED_BUF_SIZE, &buffer_size, 0 ); //ioctl( fd, SOUND_GET_PLAYBACK_PREFERRED_BUF_SIZE, &buffer_size, 0 );
ioctl( fd, SOUND_SET_PLAYBACK_PREFERRED_BUF_SIZE, buffer_size, 0 ); //ioctl( fd, SOUND_SET_PLAYBACK_PREFERRED_BUF_SIZE, buffer_size, 0 );
buffer_size = 4096;
output_format.type = B_MEDIA_RAW_AUDIO; output_format.type = B_MEDIA_RAW_AUDIO;
output_format.u.raw_audio.frame_rate = 44100.0; output_format.u.raw_audio.frame_rate = 44100.0;
@ -131,12 +133,14 @@ LegacyAudioDevice::Input_Thread()
{ {
while ( 1 ) { while ( 1 ) {
/* send IO request */ /* send IO request */
ioctl( fd, SOUND_UNSAFE_READ, buffer, sizeof( buffer ) ); // XXX this is wrong, the buffer needs a header
//ioctl( fd, SOUND_READ_BUFFER, buffer, sizeof( buffer ) );
/* Wait for IO completion: /* Wait for IO completion:
The only acceptable response is B_OK. Everything else means The only acceptable response is B_OK. Everything else means
the thread should quit. */ the thread should quit. */
_ if ( acquire_sem( in_sem ) != B_OK ) { if ( acquire_sem( in_sem ) != B_OK ) {
break; break;
} }

View File

@ -14,7 +14,7 @@
#include <support/Autolock.h> #include <support/Autolock.h>
#include <support/Debug.h> #include <support/Debug.h>
#include "driver/sound.h" #include "driver_io.h"
//#include "LegacyAudioProducer.h" //#include "LegacyAudioProducer.h"

View File

@ -3,19 +3,15 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <Drivers.h>
#include "driver/sound.h" #include "OldSoundDriver.h"
#define DRIVER_GET_PARAMS(x...) ioctl( fd, SOUND_GET_PARAMS, x ) #define DRIVER_GET_PARAMS(x...) ioctl( fd, SOUND_GET_PARAMS, x )
#define DRIVER_SET_PARAMS(x...) ioctl( fd, SOUND_SET_PARAMS, x ) #define DRIVER_SET_PARAMS(x...) ioctl( fd, SOUND_SET_PARAMS, x )
#define DRIVER_SET_PLAYBACK_COMPLETION_SEM(x...) ioctl( fd, SOUND_SET_PLAYBACK_COMPLETION_SEM, x ) #define DRIVER_SET_PLAYBACK_COMPLETION_SEM(x...) ioctl( fd, SOUND_SET_PLAYBACK_COMPLETION_SEM, x )
#define DRIVER_SET_CAPTURE_COMPLETION_SEM(x...) ioctl( fd, SOUND_SET_CAPTURE_COMPLETION_SEM, x ) #define DRIVER_SET_CAPTURE_COMPLETION_SEM(x...) ioctl( fd, SOUND_SET_CAPTURE_COMPLETION_SEM, x )
#define DRIVER_UNSAFE_WRITE(x...) ioctl( fd, SOUND_UNSAFE_WRITE, x ) #define DRIVER_WRITE_BUFFER(x...) ioctl( fd, SOUND_WRITE_BUFFER, x )
#define DRIVER_UNSAFE_READ(x...) ioctl( fd, SOUND_UNSAFE_READ, x ) #define DRIVER_READ_BUFFER(x...) ioctl( fd, SOUND_READ_BUFFER, x )
#define DRIVER_LOCK_FOR_DMA(x...) ioctl( fd, SOUND_LOCK_FOR_DMA, x ) #define DRIVER_LOCK_FOR_DMA(x...) ioctl( fd, SOUND_LOCK_FOR_DMA, x )
#define DRIVER_SET_CAPTURE_PREFERRED_BUF_SIZE(x...) ioctl( fd, SOUND_SET_CAPTURE_PREFERRED_BUF_SIZE, x )
#define DRIVER_SET_PLAYBACK_PREFERRED_BUF_SIZE(x...) ioctl( fd, SOUND_SET_PLAYBACK_PREFERRED_BUF_SIZE, x )
#define DRIVER_GET_CAPTURE_PREFERRED_BUF_SIZE(x...) ioctl( fd, SOUND_GET_CAPTURE_PREFERRED_BUF_SIZE, x )
#define DRIVER_GET_PLAYBACK_PREFERRED_BUF_SIZE(x...) ioctl( fd, SOUND_GET_PLAYBACK_PREFERRED_BUF_SIZE, x )
#endif #endif