June 7 2016 1:44 PM, "Alexander von Gluck IV" <kallisti5@xxxxxxxxxxx> wrote:
June 7 2016 9:14 AM, b.vitruvio@xxxxxxxxx wrote:
hrev50355 adds 1 changeset to branch 'master'
old head: 0b20cac7c345bf5101ad2991ed959653f8cc4a0a
new head: 3faf39eb5d6f2e738712b4ec2525fef36aadc8f1
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=3faf39eb5d6f+%5E0b20cac7c345
----------------------------------------------------------------------------
3faf39eb5d6f: BAdapterIO: Add initial seeking support
diff --git a/src/kits/media/AdapterIO.cpp b/src/kits/media/AdapterIO.cpp
index 4f9b235..64c0a9b 100644
--- a/src/kits/media/AdapterIO.cpp
+++ b/src/kits/media/AdapterIO.cpp
@@ -11,6 +11,146 @@
#include <stdio.h>
+class RelativePositionIO : public BPositionIO
+{
+public:
+ RelativePositionIO(BPositionIO* buffer)
+ :
+ BPositionIO(),
+ fStartOffset(0),
+ fTotalSize(0),
+ fBuffer(buffer)
+ {}
+
+ virtual ~RelativePositionIO()
+ {
+ delete fBuffer;
+ }
+
+ void SetTotalSize(size_t size)
+ {
+ fTotalSize = size;
+ }
+
+ size_t TotalSize() const
+ {
+ return fTotalSize;
+ }
+
+ status_t ResetStartOffset(off_t offset)
+ {
+ status_t ret = fBuffer->SetSize(0);
+ if (ret == B_OK)
+ fStartOffset = offset;
+
+ return ret;
+ }
+
+ status_t EvaluatePosition(off_t position)
+ {
+ if (position < 0)
+ return B_ERROR;
+
+ if (position < fStartOffset)
+ return B_RESOURCE_UNAVAILABLE;
I may be completely off my rocker... but does this follow our style
guidelines?
http://cgit.haiku-os.org/haiku/diff/src/kits/media/AdapterIO.cpp?id=3faf39eb5d6f2e738712b4ec2525fef3
aadc8f1