From 99f31604136d66ae10e20669fb6b5716f342bde0 Mon Sep 17 00:00:00 2001 From: Chris Watkins Date: Fri, 20 Mar 2015 13:06:33 -0700 Subject: Unhide the android.media.[Media]DataSource interface. This allows apps to implement MediaDataSource, which is modeled on stagefright's DataSource, to supply media data to the framework. This was already implemented for MediaExtractor, but it was renamed from DataSource. MediaExtractor, MediaPlayer and MediaMetadataRetriever each have a new overload: #setDataSource(android.media.MediaDataSource) Only NuPlayer supports this new data source. The change introduces: * IDataSource: The binder interface for DataSource. * JMediaDataSource: The native counterpart to the java interface. It implements IDataSource. * CallbackDataSource: A stagefright DataSource that wraps an IDataSource. Change-Id: Ib3c944b49cc8a792c8eb9c85e5015c07f298ebc1 --- include/media/stagefright/DataSource.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/media/stagefright/DataSource.h') diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h index 3630263..997fe95 100644 --- a/include/media/stagefright/DataSource.h +++ b/include/media/stagefright/DataSource.h @@ -32,6 +32,7 @@ namespace android { struct AMessage; struct AString; +struct IDataSource; struct IMediaHTTPService; class String8; struct HTTPBase; @@ -53,11 +54,15 @@ public: HTTPBase *httpSource = NULL); static sp CreateMediaHTTP(const sp &httpService); + static sp CreateFromIDataSource(const sp &source); DataSource() {} virtual status_t initCheck() const = 0; + // Returns the number of bytes read, or -1 on failure. It's not an error if + // this returns zero; it just means the given offset is equal to, or + // beyond, the end of the source. virtual ssize_t readAt(off64_t offset, void *data, size_t size) = 0; // Convenience methods: -- cgit v1.1