18253f44c3d0d8a7003dd2e6f728f9e3d63927727Steven Moreland/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef MIDI_IO_WRAPPER_H_
18#define MIDI_IO_WRAPPER_H_
19
20#include <libsonivox/eas_types.h>
21
22#include "media/stagefright/DataSource.h"
23
24namespace android {
25
26class MidiIoWrapper : public RefBase {
27public:
28    MidiIoWrapper(const char *path);
29    MidiIoWrapper(int fd, off64_t offset, int64_t size);
30    MidiIoWrapper(const sp<DataSource> &source);
31
32    ~MidiIoWrapper();
33
34    int readAt(void *buffer, int offset, int size);
35    int size();
36
37    EAS_FILE_LOCATOR getLocator();
38
39private:
40    int mFd;
41    off64_t mBase;
42    int64_t  mLength;
43    sp<DataSource> mDataSource;
44    EAS_FILE mEasFile;
45};
46
47
48}  // namespace android
49
50#endif // MIDI_IO_WRAPPER_H_
51