Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17c933cc authored by Marco Nelissen's avatar Marco Nelissen Committed by Android Git Automerger
Browse files

am cec272df: am 724b9ea5: Merge "Replace MidiFile player with a Midi extractor"

* commit 'cec272df':
  Replace MidiFile player with a Midi extractor
parents 7e85361e cec272df
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -43,8 +43,6 @@ class IGraphicBufferProducer;
template<typename T> class SortedVector;

enum player_type {
    PV_PLAYER = 1,
    SONIVOX_PLAYER = 2,
    STAGEFRIGHT_PLAYER = 3,
    NU_PLAYER = 4,
    // Test players are available only in the 'test' and 'eng' builds.
+4 −0
Original line number Diff line number Diff line
@@ -19,12 +19,15 @@

#include <libsonivox/eas_types.h>

#include "media/stagefright/DataSource.h"

namespace android {

class MidiIoWrapper : public RefBase {
public:
    MidiIoWrapper(const char *path);
    MidiIoWrapper(int fd, off64_t offset, int64_t size);
    MidiIoWrapper(const sp<DataSource> &source);

    ~MidiIoWrapper();

@@ -37,6 +40,7 @@ private:
    int mFd;
    off64_t mBase;
    int64_t  mLength;
    sp<DataSource> mDataSource;
    EAS_FILE mEasFile;
};

+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ extern const char *MEDIA_MIMETYPE_AUDIO_AMR_WB;
extern const char *MEDIA_MIMETYPE_AUDIO_MPEG;           // layer III
extern const char *MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_I;
extern const char *MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II;
extern const char *MEDIA_MIMETYPE_AUDIO_MIDI;
extern const char *MEDIA_MIMETYPE_AUDIO_AAC;
extern const char *MEDIA_MIMETYPE_AUDIO_QCELP;
extern const char *MEDIA_MIMETYPE_AUDIO_VORBIS;
+14 −0
Original line number Diff line number Diff line
@@ -47,6 +47,16 @@ MidiIoWrapper::MidiIoWrapper(int fd, off64_t offset, int64_t size) {
    mLength = size;
}

MidiIoWrapper::MidiIoWrapper(const sp<DataSource> &source) {
    mDataSource = source;
    off64_t l;
    if (mDataSource->getSize(&l) == OK) {
        mLength = l;
    } else {
        mLength = 0;
    }
}

MidiIoWrapper::~MidiIoWrapper() {
    ALOGV("~MidiIoWrapper");
    close(mFd);
@@ -54,6 +64,10 @@ MidiIoWrapper::~MidiIoWrapper() {

int MidiIoWrapper::readAt(void *buffer, int offset, int size) {
    ALOGV("readAt(%p, %d, %d)", buffer, offset, size);

    if (mDataSource != NULL) {
        return mDataSource->readAt(offset, buffer, size);
    }
    lseek(mFd, mBase + offset, SEEK_SET);
    if (offset + size > mLength) {
        size = mLength - offset;
+0 −2
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@ LOCAL_SRC_FILES:= \
    MediaPlayerService.cpp      \
    MediaRecorderClient.cpp     \
    MetadataRetrieverClient.cpp \
    MidiFile.cpp                \
    MidiMetadataRetriever.cpp   \
    RemoteDisplay.cpp           \
    SharedLibrary.cpp           \
    StagefrightPlayer.cpp       \
Loading