? a.patch ? example/yaf/yafyuv/yaf-yuv Index: lib/decoder/decoderPlugin.cpp =================================================================== RCS file: /home/kde/kdemultimedia/mpeglib/lib/decoder/decoderPlugin.cpp,v retrieving revision 1.4 diff -u -r1.4 decoderPlugin.cpp --- lib/decoder/decoderPlugin.cpp 2000/08/29 16:10:32 1.4 +++ lib/decoder/decoderPlugin.cpp 2000/08/30 19:49:52 @@ -419,13 +419,13 @@ break; case _COMMAND_SEEK: { if (streamState==_STREAM_STATE_FIRST_INIT) { - command->print("ignore command in _STREAM_STATE_FIRST_INIT"); + command->print("ignore command seek in _STREAM_STATE_FIRST_INIT"); } else { intArg=command->getIntArg(); cout << "_COMMAND_SEEK:"<name=name; bytePos=0; fillgrade=0; setUrl(name); lLock=false; abs_thread_mutex_init(&writeInMut); - abs_thread_mutex_init(&resizeMut); } BufferInputStream::~BufferInputStream() { delete ringBuffer; abs_thread_mutex_destroy(&writeInMut); - abs_thread_mutex_destroy(&resizeMut); } -int BufferInputStream::open(const char* name) { +int BufferInputStream::open(const char*) { leof=false; setBlocking(true); - setUrl(name); return true; } void BufferInputStream::close() { leof=true; setBlocking(false); - setUrl(NULL); } int BufferInputStream::eof() { @@ -81,7 +76,6 @@ int n=size; int canCopy=n; char* readPtr; - lockResizeBuffer(); // here we read even if leof is true // we make sure that we empty the whole buffer! while((eof()==false) && (n > 0)) { @@ -104,7 +98,6 @@ fillgrade-=canCopy; unlockBuffer(); } - unlockResizeBuffer(); return i; } @@ -199,7 +192,7 @@ } -int BufferInputStream::getFreeWrite() { +int BufferInputStream::getFreeSpace() { return ringBuffer->getFreeWrite(); } @@ -237,12 +230,10 @@ // remote read extension -int BufferInputStream::readRemote(char* &ptr,int size) { +int BufferInputStream::readRemote(char** ptr,int size) { int n=0; char* readPtr; - lockResizeBuffer(); while((eof()==false)) { - n=size; ringBuffer->getReadArea(readPtr,n); if (n < size){ @@ -254,7 +245,7 @@ } break; } - ptr=readPtr; + *ptr=readPtr; return n; } @@ -268,7 +259,6 @@ fillgrade-=bytes; unlockBuffer(); getTimeStamp(bytePos); - unlockResizeBuffer(); } @@ -286,23 +276,9 @@ abs_thread_mutex_unlock(&writeInMut); } -void BufferInputStream::lockResizeBuffer() { - abs_thread_mutex_lock(&resizeMut); -} - - -void BufferInputStream::unlockResizeBuffer() { - abs_thread_mutex_unlock(&resizeMut); -} int BufferInputStream::getSize() { return ringBuffer->getSize(); } -void BufferInputStream::resizeBuffer(int changeSize) { - lockResizeBuffer(); - lockBuffer(); - ringBuffer->resizeBuffer(changeSize); - unlockBuffer(); - unlockResizeBuffer(); -} + Index: lib/input/bufferInputStream.h =================================================================== RCS file: /home/kde/kdemultimedia/mpeglib/lib/input/bufferInputStream.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 bufferInputStream.h --- lib/input/bufferInputStream.h 2000/07/04 19:22:13 1.1.1.1 +++ lib/input/bufferInputStream.h 2000/08/30 19:49:52 @@ -24,14 +24,11 @@ SimpleRingBuffer* ringBuffer; int leof; - const char* name; long bytePos; int fillgrade; int lLock; abs_thread_mutex_t writeInMut; - abs_thread_mutex_t resizeMut; - public: BufferInputStream(int size,int minlinSize,const char* name); ~BufferInputStream(); @@ -62,7 +59,7 @@ int getFillgrade(); int getSize(); int getFreeRead(); - int getFreeWrite(); + int getFreeSpace(); void clear(); @@ -70,7 +67,7 @@ // Note you _need_ to call always both methods // readRemote and forwardReadPtr even if bytes==0!!! // (we hold a resizeLock during this operation) - int readRemote(char* &ptr,int size); + int readRemote(char** ptr,int size); void forwardReadPtr(int bytes); void setCanWaitForData(int lBlock); @@ -86,10 +83,6 @@ private: void lockBuffer(); void unlockBuffer(); - - void lockResizeBuffer(); - void unlockResizeBuffer(); - }; #endif Index: lib/input/fileInputStream.cpp =================================================================== RCS file: /home/kde/kdemultimedia/mpeglib/lib/input/fileInputStream.cpp,v retrieving revision 1.2 diff -u -r1.2 fileInputStream.cpp --- lib/input/fileInputStream.cpp 2000/08/29 16:10:32 1.2 +++ lib/input/fileInputStream.cpp 2000/08/30 19:49:53 @@ -18,12 +18,14 @@ FileInputStream::FileInputStream() { file=NULL; lopen=false; - name=NULL; + fileLen=0; + abs_thread_mutex_init(&fileMut); } FileInputStream::~FileInputStream() { close(); + abs_thread_mutex_destroy(&fileMut); } @@ -37,7 +39,9 @@ setUrl(dest); if (strlen(dest) == 1) { if (strncmp(dest,"-",1)==0) { + lockFile(); file=::fdopen(0,"r"); + unlockFile(); } } // load out of current dir if no full path is given @@ -53,30 +57,35 @@ } } cout << "open:"<> 6) == 0x01) { Index: lib/mpgplayer/mpegStreamPlayer.cpp =================================================================== RCS file: /home/kde/kdemultimedia/mpeglib/lib/mpgplayer/mpegStreamPlayer.cpp,v retrieving revision 1.3 diff -u -r1.3 mpegStreamPlayer.cpp --- lib/mpgplayer/mpegStreamPlayer.cpp 2000/08/06 18:55:20 1.3 +++ lib/mpgplayer/mpegStreamPlayer.cpp 2000/08/30 19:49:55 @@ -44,9 +44,10 @@ here we set the plugins in autoPlay mode. because we handle all commands over the loopback buffer. */ + /* audioDecoder->config("-y","on",NULL); videoDecoder->config("-y","on",NULL); - + */ audioInput=new BufferInputStream(1024*_BUFFER_CHUNK_SIZE, 1024*200,"audioInput"); Index: lib/output/artsOutputStream.cpp =================================================================== RCS file: /home/kde/kdemultimedia/mpeglib/lib/output/artsOutputStream.cpp,v retrieving revision 1.4 diff -u -r1.4 artsOutputStream.cpp --- lib/output/artsOutputStream.cpp 2000/08/29 16:10:32 1.4 +++ lib/output/artsOutputStream.cpp 2000/08/30 19:49:55 @@ -33,7 +33,7 @@ // from /dev/dsp + connected nodes // or arts need a video interface cout << "buffer"<isOpen()==false) { - audioTime->sleepWrite(size); - } // we call this for stream state handling OutputStream::audioPlay(startStamp,endStamp,buffer,size); @@ -106,13 +107,17 @@ // here we simulate our own blocking audio device - write=stream->write(buffer,size,startStamp); + if (stream->isOpen()==false) { + audioTime->sleepWrite(size); + } else { + write=stream->write(buffer,size,startStamp); + } return write; } -int ArtsOutputStream::read(char* &buffer,int bytes) { +int ArtsOutputStream::read(char** buffer,int bytes) { int back=stream->readRemote(buffer,bytes); return back; } Index: lib/output/artsOutputStream.h =================================================================== RCS file: /home/kde/kdemultimedia/mpeglib/lib/output/artsOutputStream.h,v retrieving revision 1.2 diff -u -r1.2 artsOutputStream.h --- lib/output/artsOutputStream.h 2000/07/17 15:40:07 1.2 +++ lib/output/artsOutputStream.h 2000/08/30 19:49:56 @@ -104,7 +104,7 @@ // Remote read extension - int read(char* &buffer,int bytes); + int read(char** buffer,int bytes); void forwardReadPtr(int bytes); // buffer control Index: lib/output/audioData.cpp =================================================================== RCS file: /home/kde/kdemultimedia/mpeglib/lib/output/audioData.cpp,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 audioData.cpp --- lib/output/audioData.cpp 2000/07/04 19:22:14 1.1.1.1 +++ lib/output/audioData.cpp 2000/08/30 19:49:56 @@ -30,6 +30,7 @@ delete audioTime; delete start; delete end; + delete writeStamp; } Index: lib/output/audioDataArray.cpp =================================================================== RCS file: /home/kde/kdemultimedia/mpeglib/lib/output/audioDataArray.cpp,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 audioDataArray.cpp --- lib/output/audioDataArray.cpp 2000/07/04 19:22:15 1.1.1.1 +++ lib/output/audioDataArray.cpp 2000/08/30 19:49:56 @@ -24,6 +24,8 @@ readPos=0; writePos=0; pcmSum=0; + abs_thread_mutex_init(&writeInMut); + abs_thread_mutex_init(&changeMut); audioDataArray=new AudioData*[entries]; @@ -35,18 +37,19 @@ abs_thread_mutex_init(&writeInMut); abs_thread_mutex_init(&changeMut); - - } AudioDataArray::~AudioDataArray() { + int i; for(i=0;i= maxSize) { + cout << "size:"<read(getBuffer(),size); if (back!=size) { + perror("fillbuffer"); return false; } if(mpegHeaderInfo->getProtection()==false) { Index: lib/splay/mpeglayer3.cc =================================================================== RCS file: /home/kde/kdemultimedia/mpeglib/lib/splay/mpeglayer3.cc,v retrieving revision 1.3 diff -u -r1.3 mpeglayer3.cc --- lib/splay/mpeglayer3.cc 2000/08/16 16:35:07 1.3 +++ lib/splay/mpeglayer3.cc 2000/08/30 19:50:00 @@ -241,6 +241,11 @@ gi->part2_3_length =getbits(12); gi->big_values =getbits(9); + if(gi->big_values > 288) { + fprintf(stderr,"big_values too large!\n"); + gi->big_values = 288; + } + gi->global_gain =getbits(8); gi->scalefac_compress =getbits(4); gi->window_switching_flag=getbit(); @@ -300,6 +305,11 @@ gi->part2_3_length =getbits(12); gi->big_values =getbits(9); + if(gi->big_values > 288) { + fprintf(stderr,"big_values too large!\n"); + gi->big_values = 288; + } + gi->global_gain =getbits(8); gi->scalefac_compress =getbits(9); gi->window_switching_flag=getbit(); @@ -773,10 +783,10 @@ if(h->treelen) { while(igetFreeWrite() < rawdataoffset*2) { + int freeWrite=bufferInputStream->getFreeSpace(); + + while(freeWrite < rawdataoffset*2) { + freeWrite=bufferInputStream->getFreeSpace(); dosleep(10000); } Index: lib/splay/splayPlugin.cpp =================================================================== RCS file: /home/kde/kdemultimedia/mpeglib/lib/splay/splayPlugin.cpp,v retrieving revision 1.4 diff -u -r1.4 splayPlugin.cpp --- lib/splay/splayPlugin.cpp 2000/08/29 16:10:32 1.4 +++ lib/splay/splayPlugin.cpp 2000/08/30 19:50:00 @@ -82,7 +82,7 @@ cout << "_STREAM_STATE_FIRST_INIT"<firstInitialize(currentHeader)==false) { } else { - + cout << "splay has init"<setdownfrequency(downSampleFlag); server->setforcetomono(monoFlag);