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
diff --git a/media/libstagefright/ThrottledSource.cpp b/media/libstagefright/ThrottledSource.cpp
index 348a9d3..7496752 100644
--- a/media/libstagefright/ThrottledSource.cpp
+++ b/media/libstagefright/ThrottledSource.cpp
@@ -31,10 +31,6 @@
     CHECK(mBandwidthLimitBytesPerSecond > 0);
 }
 
-status_t ThrottledSource::initCheck() const {
-    return mSource->initCheck();
-}
-
 ssize_t ThrottledSource::readAt(off64_t offset, void *data, size_t size) {
     Mutex::Autolock autoLock(mLock);
 
@@ -62,17 +58,9 @@
     if (whenUs > nowUs) {
         usleep(whenUs - nowUs);
     }
-
     return n;
 }
 
-status_t ThrottledSource::getSize(off64_t *size) {
-    return mSource->getSize(size);
-}
-
-uint32_t ThrottledSource::flags() {
-    return mSource->flags();
-}
 
 }  // namespace android
 
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 @@
             const sp<DataSource> &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<DecryptHandle> DrmInitialization(const char *mime = NULL) {
+        return mSource->DrmInitialization(mime);
+    }
+
+    virtual void getDrmInfo(sp<DecryptHandle> &handle, DrmManagerClient **client) {
+        mSource->getDrmInfo(handle, client);
+    };
 
     virtual String8 getMIMEType() const {
         return mSource->getMIMEType();
     }
 
-
 private:
     Mutex mLock;