summaryrefslogtreecommitdiffstats
path: root/media/libmedia/IMediaPlayer.cpp
diff options
context:
space:
mode:
authorChris Watkins <watk@google.com>2015-03-20 13:06:33 -0700
committerChris Watkins <watk@google.com>2015-04-15 17:12:22 -0700
commit99f31604136d66ae10e20669fb6b5716f342bde0 (patch)
tree20e64f4f26533b37b087ce8656b1040b8189e24f /media/libmedia/IMediaPlayer.cpp
parent2f33dbc6ca08d45efea2df775c158e2a11e07ab6 (diff)
downloadframeworks_av-99f31604136d66ae10e20669fb6b5716f342bde0.zip
frameworks_av-99f31604136d66ae10e20669fb6b5716f342bde0.tar.gz
frameworks_av-99f31604136d66ae10e20669fb6b5716f342bde0.tar.bz2
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
Diffstat (limited to 'media/libmedia/IMediaPlayer.cpp')
-rw-r--r--media/libmedia/IMediaPlayer.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp
index ce3009a..0091078 100644
--- a/media/libmedia/IMediaPlayer.cpp
+++ b/media/libmedia/IMediaPlayer.cpp
@@ -21,6 +21,7 @@
#include <binder/Parcel.h>
+#include <media/IDataSource.h>
#include <media/IMediaHTTPService.h>
#include <media/IMediaPlayer.h>
#include <media/IStreamSource.h>
@@ -35,6 +36,7 @@ enum {
SET_DATA_SOURCE_URL,
SET_DATA_SOURCE_FD,
SET_DATA_SOURCE_STREAM,
+ SET_DATA_SOURCE_CALLBACK,
PREPARE_ASYNC,
START,
STOP,
@@ -121,6 +123,14 @@ public:
return reply.readInt32();
}
+ status_t setDataSource(const sp<IDataSource> &source) {
+ Parcel data, reply;
+ data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor());
+ data.writeStrongBinder(IInterface::asBinder(source));
+ remote()->transact(SET_DATA_SOURCE_CALLBACK, data, &reply);
+ return reply.readInt32();
+ }
+
// pass the buffered IGraphicBufferProducer to the media player service
status_t setVideoSurfaceTexture(const sp<IGraphicBufferProducer>& bufferProducer)
{
@@ -406,6 +416,13 @@ status_t BnMediaPlayer::onTransact(
reply->writeInt32(setDataSource(source));
return NO_ERROR;
}
+ case SET_DATA_SOURCE_CALLBACK: {
+ CHECK_INTERFACE(IMediaPlayer, data, reply);
+ sp<IDataSource> source =
+ interface_cast<IDataSource>(data.readStrongBinder());
+ reply->writeInt32(setDataSource(source));
+ return NO_ERROR;
+ }
case SET_VIDEO_SURFACETEXTURE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
sp<IGraphicBufferProducer> bufferProducer =