From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- mpeglib/lib/util/audio/audioIO_SDL.cpp | 164 +++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 mpeglib/lib/util/audio/audioIO_SDL.cpp (limited to 'mpeglib/lib/util/audio/audioIO_SDL.cpp') diff --git a/mpeglib/lib/util/audio/audioIO_SDL.cpp b/mpeglib/lib/util/audio/audioIO_SDL.cpp new file mode 100644 index 00000000..782fa388 --- /dev/null +++ b/mpeglib/lib/util/audio/audioIO_SDL.cpp @@ -0,0 +1,164 @@ +/* + audio wrapper for SDL + Copyright (C) 2000 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file COPYRIGHT in this package + + */ +#include "../../input/bufferInputStream.h" +#include +#include +#if defined WIN32 +#include +#include +#else +#include +#include +#endif + +//static SDL_AudioSpec actual; +static BufferInputStream* audioRing; +static TimeStamp* dummy; +static int lOpen=false; + + + +int audioConstruct() { + cout << "audioConstruct ********* SDL"<open("audioSDL"); + dummy=new TimeStamp(); + lOpen=false; + return true; +} + + +void audioDestruct() { + delete audioRing; + delete dummy; +} + + + + +int audioOpen() { + return true; +} + + +void audioClose() { + lOpen=false; + SDL_CloseAudio(); +} + + +void audioCallback(void *, Uint8 *stream, int len) { + char* startPtr; + TimeStamp* start; + int bytePos; + + int read=audioRing->readRemote(&startPtr,len); + SDL_MixAudio(stream, (Uint8*) startPtr, read, SDL_MIX_MAXVOLUME); + + audioRing->forwardReadPtr(read); + // dequeue time stamps + bytePos=audioRing->getBytePosition(); + start=audioRing->getTimeStamp(bytePos); + +} + + + +void audioInit(int sampleSize,int frequency, int stereo, int sign, int big) { + if( sign == 0 ) + { + fprintf(stderr, + "%s, %d: expecting signed audio data, " + "initialized unsigned (ignored)\n", + __FILE__, __LINE__ ); + } + if( big != 0 ) + { + fprintf(stderr, + "%s, %d: expecting little endian audio data, " + "initialized big endian (ignored)\n", + __FILE__, __LINE__ ); + } + + cout << "SDL audioInit: " + << " sampleSize:"< return"<write(buffer,count,dummy); + + + return count; +} + + +int getAudioFd() { + return false; +} + + +int getAudioBufferSize() { + int buf=1024*65; + return buf; +} -- cgit v1.2.1