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

Commit 72b0e784 authored by Andreas Huber's avatar Andreas Huber Committed by Android Git Automerger
Browse files

am bbd6cb46: Merge change Ib1b7bce4 into eclair-mr2

Merge commit 'bbd6cb463b405fc90912dee470fe6c7b8c6b1f54' into eclair-mr2-plus-aosp

* commit 'bbd6cb463b405fc90912dee470fe6c7b8c6b1f54':
  Squashed commit of the following:
parents aadb854e bfa6b2d7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -19,13 +19,13 @@
#include <binder/ProcessState.h>
#include <media/stagefright/AudioPlayer.h>
#include <media/stagefright/CameraSource.h>
#include <media/stagefright/FileSource.h>
#include <media/stagefright/MediaBufferGroup.h>
#include <media/stagefright/MediaDebug.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/MediaExtractor.h>
#include <media/stagefright/MPEG4Writer.h>
#include <media/stagefright/MmapSource.h>
#include <media/stagefright/OMXClient.h>
#include <media/stagefright/OMXCodec.h>
#include <media/MediaPlayerInterface.h>
@@ -105,7 +105,7 @@ sp<MediaSource> createSource(const char *filename) {
    sp<MediaSource> source;

    sp<MediaExtractor> extractor =
        MediaExtractor::Create(new MmapSource(filename));
        MediaExtractor::Create(new FileSource(filename));

    size_t num_tracks = extractor->countTracks();

+5 −6
Original line number Diff line number Diff line
@@ -24,15 +24,14 @@
#include <binder/ProcessState.h>
#include <media/IMediaPlayerService.h>
#include <media/stagefright/CachingDataSource.h>
#include <media/stagefright/FileSource.h>
#include <media/stagefright/HTTPDataSource.h>
#include <media/stagefright/JPEGSource.h>
#include <media/stagefright/MediaDebug.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaPlayerImpl.h>
#include <media/stagefright/MediaExtractor.h>
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/MmapSource.h>
#include <media/stagefright/OMXClient.h>
#include <media/stagefright/OMXCodec.h>

@@ -52,9 +51,6 @@ static int64_t getNowUs() {
static void playSource(OMXClient *client, const sp<MediaSource> &source) {
    sp<MetaData> meta = source->getFormat();

    int64_t durationUs;
    CHECK(meta->findInt64(kKeyDuration, &durationUs));

    const char *mime;
    CHECK(meta->findCString(kKeyMIMEType, &mime));

@@ -74,6 +70,9 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
    rawSource->start();

    if (gReproduceBug >= 3 && gReproduceBug <= 5) {
        int64_t durationUs;
        CHECK(meta->findInt64(kKeyDuration, &durationUs));

        status_t err;
        MediaBuffer *buffer;
        MediaSource::ReadOptions options;
@@ -368,7 +367,7 @@ int main(int argc, char **argv) {
            dataSource = new HTTPDataSource(filename);
            dataSource = new CachingDataSource(dataSource, 64 * 1024, 10);
        } else {
            dataSource = new MmapSource(filename);
            dataSource = new FileSource(filename);
        }

        bool isJPEG = false;
+1 −1
Original line number Diff line number Diff line
@@ -133,9 +133,9 @@ public:
        return INVALID_OPERATION;
    };

protected:
    virtual void        sendEvent(int msg, int ext1=0, int ext2=0) { if (mNotify) mNotify(mCookie, msg, ext1, ext2); }

protected:
    void*               mCookie;
    notify_callback_f   mNotify;
};
+11 −0
Original line number Diff line number Diff line
@@ -30,12 +30,20 @@ class AudioTrack;

class AudioPlayer : public TimeSource {
public:
    enum {
        REACHED_EOS,
        SEEK_COMPLETE
    };

    AudioPlayer(const sp<MediaPlayerBase::AudioSink> &audioSink);
    virtual ~AudioPlayer();

    // Caller retains ownership of "source".
    void setSource(const sp<MediaSource> &source);

    void setListenerCallback(
            void (*notify)(void *cookie, int what), void *cookie);

    // Return time in us.
    virtual int64_t getRealTimeUs();

@@ -76,6 +84,9 @@ private:

    bool mStarted;

    void (*mListenerCallback)(void *cookie, int what);
    void *mListenerCookie;

    sp<MediaPlayerBase::AudioSink> mAudioSink;

    static void AudioCallback(int event, void *user, void *info);
+0 −53
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef MMAP_SOURCE_H_

#define MMAP_SOURCE_H_

#include <media/stagefright/DataSource.h>
#include <media/stagefright/MediaErrors.h>

namespace android {

class MmapSource : public DataSource {
public:
    MmapSource(const char *filename);

    // Assumes ownership of "fd".
    MmapSource(int fd, int64_t offset, int64_t length);

    virtual status_t initCheck() const;

    virtual ssize_t readAt(off_t offset, void *data, size_t size);
    virtual status_t getSize(off_t *size);

protected:
    virtual ~MmapSource();

private:
    int mFd;
    void *mBase;
    size_t mSize;

    MmapSource(const MmapSource &);
    MmapSource &operator=(const MmapSource &);
};

}  // namespace android

#endif  // MMAP_SOURCE_H_
Loading