diff options
author | Marco Nelissen <marcone@google.com> | 2014-12-16 12:46:34 -0800 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2014-12-16 14:06:57 -0800 |
commit | 08b9e2d113213c37506a416bc95a36789bcab4ca (patch) | |
tree | f417e27066b7ba7c59eb12606d28f1c7081e998e /media/libmediaplayerservice/MediaPlayerFactory.cpp | |
parent | d3671c844e2592ce3a29d6d3c4fc344343783f46 (diff) | |
download | frameworks_av-08b9e2d113213c37506a416bc95a36789bcab4ca.zip frameworks_av-08b9e2d113213c37506a416bc95a36789bcab4ca.tar.gz frameworks_av-08b9e2d113213c37506a416bc95a36789bcab4ca.tar.bz2 |
Use callbacks for Midi I/O
Instead of having the Sonivox engine directly open the file and
use stdio to read from it, use caller-provided callbacks.
Change-Id: I4d775c8458c48c591a15794c4517e006dcf034e1
Diffstat (limited to 'media/libmediaplayerservice/MediaPlayerFactory.cpp')
-rw-r--r-- | media/libmediaplayerservice/MediaPlayerFactory.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerFactory.cpp b/media/libmediaplayerservice/MediaPlayerFactory.cpp index aeefb4c..c689470 100644 --- a/media/libmediaplayerservice/MediaPlayerFactory.cpp +++ b/media/libmediaplayerservice/MediaPlayerFactory.cpp @@ -15,11 +15,13 @@ ** limitations under the License. */ +//#define LOG_NDEBUG 0 #define LOG_TAG "MediaPlayerFactory" #include <utils/Log.h> #include <cutils/properties.h> #include <media/IMediaPlayer.h> +#include <media/MidiIoWrapper.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/FileSource.h> #include <media/stagefright/foundation/ADebug.h> @@ -308,7 +310,6 @@ class SonivoxPlayerFactory : public MediaPlayerFactory::IFactory { } } } - return 0.0; } @@ -324,14 +325,10 @@ class SonivoxPlayerFactory : public MediaPlayerFactory::IFactory { // Some kind of MIDI? EAS_DATA_HANDLE easdata; + sp<MidiIoWrapper> wrapper = new MidiIoWrapper(fd, offset, length); if (EAS_Init(&easdata) == EAS_SUCCESS) { - EAS_FILE locator; - locator.path = NULL; - locator.fd = fd; - locator.offset = offset; - locator.length = length; EAS_HANDLE eashandle; - if (EAS_OpenFile(easdata, &locator, &eashandle) == EAS_SUCCESS) { + if (EAS_OpenFile(easdata, wrapper->getLocator(), &eashandle) == EAS_SUCCESS) { EAS_CloseFile(easdata, eashandle); EAS_Shutdown(easdata); return kOurScore; |