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/input/bufferInputStream.h | 88 +++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 mpeglib/lib/input/bufferInputStream.h (limited to 'mpeglib/lib/input/bufferInputStream.h') diff --git a/mpeglib/lib/input/bufferInputStream.h b/mpeglib/lib/input/bufferInputStream.h new file mode 100644 index 00000000..3bd3e691 --- /dev/null +++ b/mpeglib/lib/input/bufferInputStream.h @@ -0,0 +1,88 @@ +/* + reads input data + Copyright (C) 1999 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 + + */ + +#ifndef __BUFFERINPUTSTREAM_H +#define __BUFFERINPUTSTREAM_H + +#include "../util/abstract/abs_thread.h" + +#include "inputStream.h" + + +class SimpleRingBuffer; + +class BufferInputStream : public InputStream { + + SimpleRingBuffer* ringBuffer; + int leof; + long bytePos; + int fillgrade; + int lLock; + abs_thread_mutex_t writeInMut; + + public: + BufferInputStream(int size,int minlinSize,const char* name); + ~BufferInputStream(); + + int open(const char* name); + void close(); + + int isOpen(); + + + int eof(); + void setBlocking(int lblock); + int read(char* ptr,int size); + + // reads from a buffer + int write(char* ptr,int len,TimeStamp* stamp); + + // this method directy read from another inputstream (faster); + int write(InputStream* ptr,int len,TimeStamp* stamp); + + int seek(long bytePos); + + + long getByteLength(); + long getBytePosition(); + + void setBytePosition(long bytePos); + int getFillgrade(); + int getSize(); + int getFreeRead(); + int getFreeSpace(); + + void clear(); + + // remote read extension + // 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); + void forwardReadPtr(int bytes); + void setCanWaitForData(int lBlock); + + + // this method is only safe to call by the writer in the buffer + // a reader never should call this (segfault possible) + void resizeBuffer(int changeSize); + + // for pause/play over loopback + int getHold(); + void setHold(int lLock); + + private: + void lockBuffer(); + void unlockBuffer(); + +}; +#endif -- cgit v1.2.1