diff options
author | Chris Watkins <watk@google.com> | 2015-03-20 13:06:33 -0700 |
---|---|---|
committer | Chris Watkins <watk@google.com> | 2015-04-15 17:12:22 -0700 |
commit | 99f31604136d66ae10e20669fb6b5716f342bde0 (patch) | |
tree | 20e64f4f26533b37b087ce8656b1040b8189e24f /media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp | |
parent | 2f33dbc6ca08d45efea2df775c158e2a11e07ab6 (diff) | |
download | frameworks_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/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp index 1fa9cef..bb1255f 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp @@ -135,6 +135,25 @@ status_t NuPlayerDriver::setDataSource(const sp<IStreamSource> &source) { return mAsyncResult; } +status_t NuPlayerDriver::setDataSource(const sp<DataSource> &source) { + ALOGV("setDataSource(%p) callback source", this); + Mutex::Autolock autoLock(mLock); + + if (mState != STATE_IDLE) { + return INVALID_OPERATION; + } + + mState = STATE_SET_DATASOURCE_PENDING; + + mPlayer->setDataSourceAsync(source); + + while (mState == STATE_SET_DATASOURCE_PENDING) { + mCondition.wait(mLock); + } + + return mAsyncResult; +} + status_t NuPlayerDriver::setVideoSurfaceTexture( const sp<IGraphicBufferProducer> &bufferProducer) { ALOGV("setVideoSurfaceTexture(%p)", this); |