From 08b9e2d113213c37506a416bc95a36789bcab4ca Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Tue, 16 Dec 2014 12:46:34 -0800 Subject: 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 --- media/libmediaplayerservice/MediaPlayerFactory.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'media/libmediaplayerservice/MediaPlayerFactory.cpp') 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 #include #include +#include #include #include #include @@ -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 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; -- cgit v1.1