From f76ca8f6aaa56146b388239c034bd53f19b9abf2 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Wed, 24 Oct 2012 13:43:32 -0700 Subject: Make ThrottledSource more usable Add reconnectAtOffset(), DrmInitialization() and getDrmInfo(). Also rearrange the code a bit so all the methods that just call through to the wrapped DataSource are in the header. Change-Id: If25b674df317b0f6da5d36241c694e32abb0a01c --- media/libstagefright/include/ThrottledSource.h | 36 ++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'media/libstagefright/include') diff --git a/media/libstagefright/include/ThrottledSource.h b/media/libstagefright/include/ThrottledSource.h index 7fe7c06..673268b 100644 --- a/media/libstagefright/include/ThrottledSource.h +++ b/media/libstagefright/include/ThrottledSource.h @@ -28,18 +28,44 @@ struct ThrottledSource : public DataSource { const sp &source, int32_t bandwidthLimitBytesPerSecond); - virtual status_t initCheck() const; - + // implementation of readAt() that sleeps to achieve the desired max throughput virtual ssize_t readAt(off64_t offset, void *data, size_t size); - virtual status_t getSize(off64_t *size); - virtual uint32_t flags(); + // returns an empty string to prevent callers from using the Uri to construct a new datasource + virtual String8 getUri() { + return String8(); + } + + // following methods all call through to the wrapped DataSource's methods + + status_t initCheck() const { + return mSource->initCheck(); + } + + virtual status_t getSize(off64_t *size) { + return mSource->getSize(size); + } + + virtual uint32_t flags() { + return mSource->flags(); + } + + virtual status_t reconnectAtOffset(off64_t offset) { + return mSource->reconnectAtOffset(offset); + } + + virtual sp DrmInitialization(const char *mime = NULL) { + return mSource->DrmInitialization(mime); + } + + virtual void getDrmInfo(sp &handle, DrmManagerClient **client) { + mSource->getDrmInfo(handle, client); + }; virtual String8 getMIMEType() const { return mSource->getMIMEType(); } - private: Mutex mLock; -- cgit v1.1