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

Commit 3dbeca17 authored by Leon Scroggins's avatar Leon Scroggins Committed by Android (Google) Code Review
Browse files

Merge "Remove SkOmxPixelRef to fix build."

parents f8bc9e3b 7a3878cd
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
        omx_jpeg_decoder.cpp \
        jpeg_decoder_bench.cpp \
        SkOmxPixelRef.cpp \
        StreamSource.cpp

LOCAL_SHARED_LIBRARIES := \
+0 −46
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.
 */

#include <media/stagefright/foundation/ADebug.h>
#include <SkBitmap.h>

#include "SkOmxPixelRef.h"

using namespace android;

SkOmxPixelRef::SkOmxPixelRef(SkColorTable* ctable, MediaBuffer* buffer,
        sp<MediaSource> decoder)  {
    mBuffer = buffer;
    mDecoder = decoder;
    mSize = buffer->size();
    mCTable = ctable;
    SkSafeRef(mCTable);
}

SkOmxPixelRef::~SkOmxPixelRef() {
    mBuffer->release();
    CHECK_EQ(mDecoder->stop(), (status_t)OK);
    SkSafeUnref(mCTable);
}

void* SkOmxPixelRef::onLockPixels(SkColorTable** ct) {
    *ct = mCTable;
    return mBuffer->data();
}

void SkOmxPixelRef::onUnlockPixels() {
    // nothing to do
}
+0 −52
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 SKOMXPIXELREF_DEFINED
#define SKOMXPIXELREF_DEFINED

#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/OMXClient.h>
#include <media/stagefright/OMXCodec.h>
#include <SkPixelRef.h>

namespace android {

class SkOmxPixelRef : public SkPixelRef {
public:
    SkOmxPixelRef(SkColorTable* ctable, MediaBuffer* buffer,
            sp<MediaSource> decoder);
    virtual ~SkOmxPixelRef();

     //! Return the allocation size for the pixels
    size_t getSize() const { return mSize; }

    SK_DECLARE_UNFLATTENABLE_OBJECT()
protected:
    // overrides from SkPixelRef
    virtual void* onLockPixels(SkColorTable**);
    virtual void onUnlockPixels();

private:
    MediaBuffer* mBuffer;
    sp<MediaSource> mDecoder;
    size_t          mSize;
    SkColorTable*   mCTable;

    typedef SkPixelRef INHERITED;
};

} // namespace android
#endif // SKOMXPIXELREF_DEFINED
+0 −16
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@
#include <SkMallocPixelRef.h>

#include "omx_jpeg_decoder.h"
#include "SkOmxPixelRef.h"
#include "StreamSource.h"

using namespace android;
@@ -158,10 +157,6 @@ bool OmxJpegImageDecoder::decodeSource(sp<MediaSource> decoder,
    printf("Duration in decoder->read(): %.1f (msecs). \n",
                duration / 1E3 );

    /* Mark the code for now, since we attend to copy buffer to SkBitmap.
    // Install pixelRef to Bitmap.
    installPixelRef(buffer, decoder, bm);*/

    // Copy pixels from buffer to bm.
    // May need to check buffer->rawBytes() == bm->rawBytes().
    CHECK_EQ(buffer->size(), bm->getSize());
@@ -172,17 +167,6 @@ bool OmxJpegImageDecoder::decodeSource(sp<MediaSource> decoder,
    return true;
}

void OmxJpegImageDecoder::installPixelRef(MediaBuffer *buffer, sp<MediaSource> decoder,
        SkBitmap* bm) {

    // set bm's pixelref based on the data in buffer.
    SkAutoLockPixels alp(*bm);
    SkPixelRef* pr = new SkOmxPixelRef(NULL, buffer, decoder);
    bm->setPixelRef(pr)->unref();
    bm->lockPixels();
    return;
}

void OmxJpegImageDecoder::configBitmapSize(SkBitmap* bm, SkBitmap::Config pref,
        int width, int height) {
    bm->setConfig(getColorSpaceConfig(pref), width, height, 0, kOpaque_SkAlphaType);
+0 −2
Original line number Diff line number Diff line
@@ -49,8 +49,6 @@ private:
    sp<MediaSource> getDecoder(OMXClient* client, const sp<MediaSource>& source);
    bool decodeSource(sp<MediaSource> decoder, const sp<MediaSource>& source,
            SkBitmap* bm);
    void installPixelRef(MediaBuffer* buffer, sp<MediaSource> decoder,
            SkBitmap* bm);
    void configBitmapSize(SkBitmap* bm, SkBitmap::Config pref, int width,
            int height);
    SkBitmap::Config getColorSpaceConfig(SkBitmap::Config pref);