3 ** Copyright 2008, The Android Open Source Project
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
9 ** http://www.apache.org/licenses/LICENSE-2.0
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
18 #ifndef ANDROID_MIDIFILE_H
19 #define ANDROID_MIDIFILE_H
21 #include <media/MediaPlayerInterface.h>
22 #include <media/AudioTrack.h>
23 #include <libsonivox/eas.h>
27 class MidiFile : public MediaPlayerInterface {
32 virtual status_t initCheck();
34 virtual status_t setDataSource(
35 const char* path, const KeyedVector<String8, String8> *headers);
37 virtual status_t setDataSource(int fd, int64_t offset, int64_t length);
38 virtual status_t setVideoSurface(const sp<ISurface>& surface) { return UNKNOWN_ERROR; }
39 virtual status_t prepare();
40 virtual status_t prepareAsync();
41 virtual status_t start();
42 virtual status_t stop();
43 virtual status_t seekTo(int msec);
44 virtual status_t pause();
45 virtual bool isPlaying();
46 virtual status_t getCurrentPosition(int* msec);
47 virtual status_t getDuration(int* msec);
48 virtual status_t release();
49 virtual status_t reset();
50 virtual status_t setLooping(int loop);
51 virtual player_type playerType() { return SONIVOX_PLAYER; }
52 virtual status_t invoke(const Parcel& request, Parcel *reply) {
53 return INVALID_OPERATION;
57 status_t createOutputTrack();
58 status_t reset_nosync();
59 static int renderThread(void*);
61 void updateState(){ EAS_State(mEasData, mEasHandle, &mState); }
65 EAS_DATA_HANDLE mEasData;
66 EAS_HANDLE mEasHandle;
67 EAS_PCM* mAudioBuffer;
71 EAS_FILE mFileLocator;
76 volatile bool mRender;
80 }; // namespace android
82 #endif // ANDROID_MIDIFILE_H