summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Watkins <watk@google.com>2015-04-16 17:06:37 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-16 17:06:42 +0000
commitc224ec53a17994fa97ab2f29304647c9f195c51c (patch)
tree6086a1cf5720b82e7dc25b7ecd60af39d66c738d /include
parentf2326ac96366ec4d05f470cc4a0b407e7805bab7 (diff)
parent99f31604136d66ae10e20669fb6b5716f342bde0 (diff)
downloadframeworks_av-c224ec53a17994fa97ab2f29304647c9f195c51c.zip
frameworks_av-c224ec53a17994fa97ab2f29304647c9f195c51c.tar.gz
frameworks_av-c224ec53a17994fa97ab2f29304647c9f195c51c.tar.bz2
Merge "Unhide the android.media.[Media]DataSource interface."
Diffstat (limited to 'include')
-rw-r--r--include/media/IDataSource.h61
-rw-r--r--include/media/IMediaMetadataRetriever.h4
-rw-r--r--include/media/IMediaPlayer.h2
-rw-r--r--include/media/MediaMetadataRetrieverInterface.h4
-rw-r--r--include/media/MediaPlayerInterface.h5
-rw-r--r--include/media/mediametadataretriever.h4
-rw-r--r--include/media/mediaplayer.h1
-rw-r--r--include/media/stagefright/DataSource.h5
8 files changed, 83 insertions, 3 deletions
diff --git a/include/media/IDataSource.h b/include/media/IDataSource.h
new file mode 100644
index 0000000..07e46f7
--- /dev/null
+++ b/include/media/IDataSource.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_IDATASOURCE_H
+#define ANDROID_IDATASOURCE_H
+
+#include <binder/IInterface.h>
+#include <media/stagefright/foundation/ABase.h>
+#include <utils/Errors.h>
+
+namespace android {
+
+class IMemory;
+
+// A binder interface for implementing a stagefright DataSource remotely.
+class IDataSource : public IInterface {
+public:
+ DECLARE_META_INTERFACE(DataSource);
+
+ // Get the memory that readAt writes into.
+ virtual sp<IMemory> getIMemory() = 0;
+ // Read up to |size| bytes into the memory returned by getIMemory(). Returns
+ // the number of bytes read, or -1 on error. |size| must not be larger than
+ // the buffer.
+ virtual ssize_t readAt(off64_t offset, size_t size) = 0;
+ // Get the size, or -1 if the size is unknown.
+ virtual status_t getSize(off64_t* size) = 0;
+ // This should be called before deleting |this|. The other methods may
+ // return errors if they're called after calling close().
+ virtual void close() = 0;
+
+private:
+ DISALLOW_EVIL_CONSTRUCTORS(IDataSource);
+};
+
+// ----------------------------------------------------------------------------
+
+class BnDataSource : public BnInterface<IDataSource> {
+public:
+ virtual status_t onTransact(uint32_t code,
+ const Parcel& data,
+ Parcel* reply,
+ uint32_t flags = 0);
+};
+
+}; // namespace android
+
+#endif // ANDROID_IDATASOURCE_H
diff --git a/include/media/IMediaMetadataRetriever.h b/include/media/IMediaMetadataRetriever.h
index 2529800..95851fd 100644
--- a/include/media/IMediaMetadataRetriever.h
+++ b/include/media/IMediaMetadataRetriever.h
@@ -26,7 +26,8 @@
namespace android {
-struct IMediaHTTPService;
+class IDataSource;
+class IMediaHTTPService;
class IMediaMetadataRetriever: public IInterface
{
@@ -40,6 +41,7 @@ public:
const KeyedVector<String8, String8> *headers = NULL) = 0;
virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0;
+ virtual status_t setDataSource(const sp<IDataSource>& dataSource) = 0;
virtual sp<IMemory> getFrameAtTime(int64_t timeUs, int option) = 0;
virtual sp<IMemory> extractAlbumArt() = 0;
virtual const char* extractMetadata(int keyCode) = 0;
diff --git a/include/media/IMediaPlayer.h b/include/media/IMediaPlayer.h
index 4153c25..17ef489 100644
--- a/include/media/IMediaPlayer.h
+++ b/include/media/IMediaPlayer.h
@@ -31,6 +31,7 @@ namespace android {
class Parcel;
class Surface;
+class IDataSource;
class IStreamSource;
class IGraphicBufferProducer;
struct IMediaHTTPService;
@@ -49,6 +50,7 @@ public:
virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0;
virtual status_t setDataSource(const sp<IStreamSource>& source) = 0;
+ virtual status_t setDataSource(const sp<IDataSource>& source) = 0;
virtual status_t setVideoSurfaceTexture(
const sp<IGraphicBufferProducer>& bufferProducer) = 0;
virtual status_t prepareAsync() = 0;
diff --git a/include/media/MediaMetadataRetrieverInterface.h b/include/media/MediaMetadataRetrieverInterface.h
index 38dbb20..df6c7d6 100644
--- a/include/media/MediaMetadataRetrieverInterface.h
+++ b/include/media/MediaMetadataRetrieverInterface.h
@@ -25,7 +25,8 @@
namespace android {
-struct IMediaHTTPService;
+class DataSource;
+class IMediaHTTPService;
// Abstract base class
class MediaMetadataRetrieverBase : public RefBase
@@ -40,6 +41,7 @@ public:
const KeyedVector<String8, String8> *headers = NULL) = 0;
virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0;
+ virtual status_t setDataSource(const sp<DataSource>& source) = 0;
virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) = 0;
virtual MediaAlbumArt* extractAlbumArt() = 0;
virtual const char* extractMetadata(int keyCode) = 0;
diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h
index d6fe390..90211b1 100644
--- a/include/media/MediaPlayerInterface.h
+++ b/include/media/MediaPlayerInterface.h
@@ -36,6 +36,7 @@ struct sockaddr_in;
namespace android {
+class DataSource;
class Parcel;
class Surface;
class IGraphicBufferProducer;
@@ -158,6 +159,10 @@ public:
return INVALID_OPERATION;
}
+ virtual status_t setDataSource(const sp<DataSource> &source) {
+ return INVALID_OPERATION;
+ }
+
// pass the buffered IGraphicBufferProducer to the media player service
virtual status_t setVideoSurfaceTexture(
const sp<IGraphicBufferProducer>& bufferProducer) = 0;
diff --git a/include/media/mediametadataretriever.h b/include/media/mediametadataretriever.h
index 7191965..08049c4 100644
--- a/include/media/mediametadataretriever.h
+++ b/include/media/mediametadataretriever.h
@@ -25,7 +25,8 @@
namespace android {
-struct IMediaHTTPService;
+class IDataSource;
+class IMediaHTTPService;
class IMediaPlayerService;
class IMediaMetadataRetriever;
@@ -75,6 +76,7 @@ public:
const KeyedVector<String8, String8> *headers = NULL);
status_t setDataSource(int fd, int64_t offset, int64_t length);
+ status_t setDataSource(const sp<IDataSource>& dataSource);
sp<IMemory> getFrameAtTime(int64_t timeUs, int option);
sp<IMemory> extractAlbumArt();
const char* extractMetadata(int keyCode);
diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h
index 808e893..269a2d7 100644
--- a/include/media/mediaplayer.h
+++ b/include/media/mediaplayer.h
@@ -211,6 +211,7 @@ public:
status_t setDataSource(int fd, int64_t offset, int64_t length);
status_t setDataSource(const sp<IStreamSource> &source);
+ status_t setDataSource(const sp<IDataSource> &source);
status_t setVideoSurfaceTexture(
const sp<IGraphicBufferProducer>& bufferProducer);
status_t setListener(const sp<MediaPlayerListener>& listener);
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<DataSource> CreateMediaHTTP(const sp<IMediaHTTPService> &httpService);
+ static sp<DataSource> CreateFromIDataSource(const sp<IDataSource> &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: