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

Commit 22339177 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 8803

* changes:
  Squashed commit of the following:
parents a5904345 8a432776
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -119,7 +119,8 @@ int main(int argc, char **argv) {
    enc_meta->setInt32(kKeyWidth, width);
    enc_meta->setInt32(kKeyHeight, height);

    OMXDecoder *encoder = OMXDecoder::CreateEncoder(&client, enc_meta);
    OMXDecoder *encoder =
        OMXDecoder::Create(&client, enc_meta, true /* createEncoder */);

    encoder->setSource(decoder);
    // encoder->setSource(meta, new DummySource(width, height));
+10 −1
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ static int64_t getNowUs() {
int main(int argc, char **argv) {
    android::ProcessState::self()->startThreadPool();

    bool audioOnly = false;
    if (argc > 1 && !strcmp(argv[1], "--list")) {
        sp<IServiceManager> sm = defaultServiceManager();
        sp<IBinder> binder = sm->getService(String16("media.player"));
@@ -121,6 +122,10 @@ int main(int argc, char **argv) {
        }

        return 0;
    } else if (argc > 1 && !strcmp(argv[1], "--audio")) {
        audioOnly = true;
        ++argv;
        --argc;
    }

#if 0
@@ -149,7 +154,11 @@ int main(int argc, char **argv) {
        const char *mime;
        meta->findCString(kKeyMIMEType, &mime);

        if (!strncasecmp(mime, "video/", 6)) {
        if (audioOnly && !strncasecmp(mime, "audio/", 6)) {
            break;
        }

        if (!audioOnly && !strncasecmp(mime, "video/", 6)) {
            break;
        }
    }
+32 −10
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
#include <utils/List.h>
#include <utils/threads.h>

#include <OMX_Video.h>

namespace android {

class OMXMediaBuffer;
@@ -35,10 +37,8 @@ class OMXDecoder : public MediaSource,
                   public MediaBufferObserver {
public:
    static OMXDecoder *Create(
            OMXClient *client, const sp<MetaData> &data);

    static OMXDecoder *CreateEncoder(
            OMXClient *client, const sp<MetaData> &data);
            OMXClient *client, const sp<MetaData> &data,
            bool createEncoder = false);

    virtual ~OMXDecoder();

@@ -71,7 +71,19 @@ private:
        kPortStatusActive             = 0,
        kPortStatusDisabled           = 1,
        kPortStatusShutdown           = 2,
        kPortStatusFlushing = 3
        kPortStatusFlushing           = 3,
        kPortStatusFlushingToDisabled = 4,
        kPortStatusFlushingToShutdown = 5,
    };

    enum Quirks {
        kWantsRawNALFrames                   = 1,
        kDoesntReturnBuffersOnDisable        = 2,
        kDoesntFlushOnExecutingToIdle        = 4,
        kDoesntProperlyFlushAllPortsAtOnce   = 8,
        kRequiresAllocateBufferOnInputPorts  = 16,
        kRequiresAllocateBufferOnOutputPorts = 32,
        kRequiresLoadedToIdleAfterAllocation = 64
    };

    OMXClient *mClient;
@@ -79,6 +91,8 @@ private:
    IOMX::node_id mNode;
    char *mComponentName;
    bool mIsMP3;
    bool mIsAVC;
    uint32_t mQuirks;

    MediaSource *mSource;
    sp<MetaData> mOutputFormat;
@@ -116,7 +130,8 @@ private:
    bool mReachedEndOfInput;

    OMXDecoder(OMXClient *client, IOMX::node_id node,
               const char *mime, const char *codec);
               const char *mime, const char *codec,
               uint32_t quirks);

    void setPortStatus(OMX_U32 port_index, PortStatus status);
    PortStatus getPortStatus(OMX_U32 port_index) const;
@@ -125,7 +140,13 @@ private:

    void setAMRFormat();
    void setAACFormat();
    void setVideoOutputFormat(OMX_U32 width, OMX_U32 height);

    status_t setVideoPortFormatType(
            OMX_U32 portIndex,
            OMX_VIDEO_CODINGTYPE compressionFormat,
            OMX_COLOR_FORMATTYPE colorFormat);

    void setVideoOutputFormat(const char *mime, OMX_U32 width, OMX_U32 height);
    void setup();
    void dumpPortDefinition(OMX_U32 port_index);

@@ -144,6 +165,7 @@ private:

    void freeInputBuffer(IOMX::buffer_id buffer);
    void freeOutputBuffer(IOMX::buffer_id buffer);
    void freePortBuffers(OMX_U32 port_index);

    void postStart();
    void postEmptyBufferDone(IOMX::buffer_id buffer);
+58 −0
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 TI_HARDWARE_RENDERER_H_

#define TI_HARDWARE_RENDERER_H_

#include <media/stagefright/VideoRenderer.h>
#include <utils/RefBase.h>
#include <utils/Vector.h>

namespace android {

class ISurface;
class Overlay;

class TIHardwareRenderer : public VideoRenderer {
public:
    TIHardwareRenderer(
            const sp<ISurface> &surface,
            size_t displayWidth, size_t displayHeight,
            size_t decodedWidth, size_t decodedHeight);

    virtual ~TIHardwareRenderer();

    virtual void render(
            const void *data, size_t size, void *platformPrivate);

private:
    sp<ISurface> mISurface;
    size_t mDisplayWidth, mDisplayHeight;
    size_t mDecodedWidth, mDecodedHeight;
    size_t mFrameSize;
    sp<Overlay> mOverlay;
    Vector<void *> mOverlayAddresses;
    size_t mIndex;

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

}  // namespace android

#endif  // TI_HARDWARE_RENDERER_H_
+2 −0
Original line number Diff line number Diff line
@@ -59,6 +59,8 @@
#include <media/PVPlayer.h>
#include "TestPlayerStub.h"

//#undef USE_STAGEFRIGHT

#if USE_STAGEFRIGHT
#include "StagefrightPlayer.h"
#endif
Loading