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

Commit 4a0ff4de authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Squashed commit of the following:"

parents 74769866 1bb0ffd0
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -7,13 +7,16 @@ LOCAL_SRC_FILES:= \
	SineSource.cpp

LOCAL_SHARED_LIBRARIES := \
	libstagefright libmedia libutils libbinder libstagefright_foundation
	libstagefright libmedia libutils libbinder libstagefright_foundation \
        libskia

LOCAL_C_INCLUDES:= \
	$(JNI_H_INCLUDE) \
	frameworks/base/media/libstagefright \
	frameworks/base/media/libstagefright/include \
	$(TOP)/frameworks/base/include/media/stagefright/openmax
	$(TOP)/frameworks/base/include/media/stagefright/openmax \
        external/skia/include/core \
        external/skia/include/images \

LOCAL_CFLAGS += -Wno-multichar

+17 −0
Original line number Diff line number Diff line
@@ -49,6 +49,10 @@
#include <media/stagefright/MPEG2TSWriter.h>
#include <media/stagefright/MPEG4Writer.h>

#include <private/media/VideoFrame.h>
#include <SkBitmap.h>
#include <SkImageEncoder.h>

#include <fcntl.h>

using namespace android;
@@ -681,6 +685,19 @@ int main(int argc, char **argv) {

            if (mem != NULL) {
                printf("captureFrame(%s) => OK\n", filename);

                VideoFrame *frame = (VideoFrame *)mem->pointer();

                SkBitmap bitmap;
                bitmap.setConfig(
                        SkBitmap::kRGB_565_Config, frame->mWidth, frame->mHeight);

                bitmap.setPixels((uint8_t *)frame + sizeof(VideoFrame));

                CHECK(SkImageEncoder::EncodeFile(
                            "/sdcard/out.jpg", bitmap,
                            SkImageEncoder::kJPEG_Type,
                            SkImageEncoder::kDefaultQuality));
            } else {
                mem = retriever->extractAlbumArt();

+27 −15
Original line number Diff line number Diff line
@@ -33,35 +33,47 @@ struct ColorConverter {
    bool isValid() const;

    void convert(
            size_t width, size_t height,
            const void *srcBits, size_t srcSkip,
            void *dstBits, size_t dstSkip);
            const void *srcBits,
            size_t srcWidth, size_t srcHeight,
            size_t srcCropLeft, size_t srcCropTop,
            size_t srcCropRight, size_t srcCropBottom,
            void *dstBits,
            size_t dstWidth, size_t dstHeight,
            size_t dstCropLeft, size_t dstCropTop,
            size_t dstCropRight, size_t dstCropBottom);

private:
    struct BitmapParams {
        BitmapParams(
                void *bits,
                size_t width, size_t height,
                size_t cropLeft, size_t cropTop,
                size_t cropRight, size_t cropBottom);

        size_t cropWidth() const;
        size_t cropHeight() const;

        void *mBits;
        size_t mWidth, mHeight;
        size_t mCropLeft, mCropTop, mCropRight, mCropBottom;
    };

    OMX_COLOR_FORMATTYPE mSrcFormat, mDstFormat;
    uint8_t *mClip;

    uint8_t *initClip();

    void convertCbYCrY(
            size_t width, size_t height,
            const void *srcBits, size_t srcSkip,
            void *dstBits, size_t dstSkip);
            const BitmapParams &src, const BitmapParams &dst);

    void convertYUV420Planar(
            size_t width, size_t height,
            const void *srcBits, size_t srcSkip,
            void *dstBits, size_t dstSkip);
            const BitmapParams &src, const BitmapParams &dst);

    void convertQCOMYUV420SemiPlanar(
            size_t width, size_t height,
            const void *srcBits, size_t srcSkip,
            void *dstBits, size_t dstSkip);
            const BitmapParams &src, const BitmapParams &dst);

    void convertYUV420SemiPlanar(
            size_t width, size_t height,
            const void *srcBits, size_t srcSkip,
            void *dstBits, size_t dstSkip);
            const BitmapParams &src, const BitmapParams &dst);

    ColorConverter(const ColorConverter &);
    ColorConverter &operator=(const ColorConverter &);
+19 −0
Original line number Diff line number Diff line
@@ -32,6 +32,10 @@ enum {
    kKeyMIMEType          = 'mime',  // cstring
    kKeyWidth             = 'widt',  // int32_t
    kKeyHeight            = 'heig',  // int32_t

    // a rectangle, if absent assumed to be (0, 0, width - 1, height - 1)
    kKeyCropRect          = 'crop',

    kKeyRotation          = 'rotA',  // int32_t (angle in degrees)
    kKeyIFramesInterval   = 'ifiv',  // int32_t
    kKeyStride            = 'strd',  // int32_t
@@ -125,6 +129,7 @@ public:
        TYPE_INT64    = 'in64',
        TYPE_FLOAT    = 'floa',
        TYPE_POINTER  = 'ptr ',
        TYPE_RECT     = 'rect',
    };

    void clear();
@@ -136,12 +141,22 @@ public:
    bool setFloat(uint32_t key, float value);
    bool setPointer(uint32_t key, void *value);

    bool setRect(
            uint32_t key,
            int32_t left, int32_t top,
            int32_t right, int32_t bottom);

    bool findCString(uint32_t key, const char **value);
    bool findInt32(uint32_t key, int32_t *value);
    bool findInt64(uint32_t key, int64_t *value);
    bool findFloat(uint32_t key, float *value);
    bool findPointer(uint32_t key, void **value);

    bool findRect(
            uint32_t key,
            int32_t *left, int32_t *top,
            int32_t *right, int32_t *bottom);

    bool setData(uint32_t key, uint32_t type, const void *data, size_t size);

    bool findData(uint32_t key, uint32_t *type,
@@ -187,6 +202,10 @@ private:
        }
    };

    struct Rect {
        int32_t mLeft, mTop, mRight, mBottom;
    };

    KeyedVector<uint32_t, typed_data> mItems;

    // MetaData &operator=(const MetaData &);
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ LOCAL_SHARED_LIBRARIES := \
	libandroid_runtime    			\
	libstagefright        			\
	libstagefright_omx    			\
	libstagefright_color_conversion         \
	libstagefright_foundation               \
	libsurfaceflinger_client

Loading