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

Commit 3ccf3c1e authored by Lajos Molnar's avatar Lajos Molnar Committed by Android (Google) Code Review
Browse files

Merge "Removed libvideoeditor"

parents e7ec24c9 c8555d06
Loading
Loading
Loading
Loading

libvideoeditor/Android.mk

deleted100755 → 0
+0 −1
Original line number Diff line number Diff line
include $(call all-subdir-makefiles)

libvideoeditor/lvpp/Android.mk

deleted100755 → 0
+0 −103
Original line number Diff line number Diff line
#
# Copyright (C) 2011 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.
#

LOCAL_PATH:= $(call my-dir)

#
# libvideoeditorplayer
#

include $(CLEAR_VARS)

LOCAL_MODULE:= libvideoeditorplayer

LOCAL_SRC_FILES:=          \
    VideoEditorTools.cpp \
    VideoEditorPlayer.cpp \
    PreviewPlayer.cpp \
    VideoEditorAudioPlayer.cpp \
    VideoEditorPreviewController.cpp \
    VideoEditorSRC.cpp \
    DummyAudioSource.cpp \
    DummyVideoSource.cpp \
    VideoEditorBGAudioProcessing.cpp \
    PreviewRenderer.cpp \
    I420ColorConverter.cpp \
    NativeWindowRenderer.cpp

LOCAL_MODULE_TAGS := optional

LOCAL_STATIC_LIBRARIES := \
    libstagefright_color_conversion



LOCAL_SHARED_LIBRARIES :=     \
    libaudioresampler         \
    libaudioutils             \
    libbinder                 \
    libcutils                 \
    liblog                    \
    libEGL                    \
    libGLESv2                 \
    libgui                    \
    libmedia                  \
    libdrmframework           \
    libstagefright            \
    libstagefright_foundation \
    libstagefright_omx        \
    libsync                   \
    libui                     \
    libutils                  \
    libvideoeditor_osal       \


LOCAL_C_INCLUDES += \
    $(TOP)/system/media/audio_utils/include \
    $(TOP)/frameworks/av/media/libmediaplayerservice \
    $(TOP)/frameworks/av/media/libstagefright \
    $(TOP)/frameworks/av/media/libstagefright/include \
    $(TOP)/frameworks/av/media/libstagefright/rtsp \
    $(TOP)/frameworks/av/libvideoeditor/osal/inc \
    $(TOP)/frameworks/av/libvideoeditor/vss/common/inc \
    $(TOP)/frameworks/av/libvideoeditor/vss/mcs/inc \
    $(TOP)/frameworks/av/libvideoeditor/vss/inc \
    $(TOP)/frameworks/av/libvideoeditor/vss/stagefrightshells/inc \
    $(TOP)/frameworks/av/libvideoeditor/lvpp \
    $(TOP)/frameworks/av/services/audioflinger \
    $(TOP)/frameworks/native/include/media/editor \
    $(TOP)/frameworks/native/include/media/openmax \


LOCAL_SHARED_LIBRARIES += libdl

# All of the shared libraries we link against.
LOCAL_LDLIBS := \
    -lpthread -ldl

LOCAL_CFLAGS += -Wno-multichar \
     -DM4_ENABLE_RENDERINGMODE \
    -DUSE_STAGEFRIGHT_CODECS \
    -DUSE_STAGEFRIGHT_AUDIODEC \
    -DUSE_STAGEFRIGHT_VIDEODEC \
    -DUSE_STAGEFRIGHT_AUDIOENC \
    -DUSE_STAGEFRIGHT_VIDEOENC \
    -DUSE_STAGEFRIGHT_READERS \
    -DUSE_STAGEFRIGHT_3GPP_READER

include $(BUILD_SHARED_LIBRARY)

#include $(call all-makefiles-under,$(LOCAL_PATH))
+0 −163
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 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.
 */

// #define LOG_NDEBUG 0
#define LOG_TAG "DummyAudioSource"
#include <utils/Log.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaBufferGroup.h>
#include <media/stagefright/MetaData.h>
#include "DummyAudioSource.h"


namespace android {

//static
sp<DummyAudioSource> DummyAudioSource::Create(
        int32_t samplingRate, int32_t channelCount,
        int64_t frameDurationUs, int64_t audioDurationUs) {

    ALOGV("Create ");
    return new DummyAudioSource(samplingRate,
                                channelCount,
                                frameDurationUs,
                                audioDurationUs);

}

DummyAudioSource::DummyAudioSource(
        int32_t samplingRate, int32_t channelCount,
        int64_t frameDurationUs, int64_t audioDurationUs)
    : mSamplingRate(samplingRate),
      mChannelCount(channelCount),
      mFrameDurationUs(frameDurationUs),
      mNumberOfSamplePerFrame(0),
      mAudioDurationUs(audioDurationUs),
      mTimeStampUs(0),
      mBufferGroup(NULL) {

    mNumberOfSamplePerFrame = (int32_t)
            ((1L * mSamplingRate * mFrameDurationUs)/1000000);
    mNumberOfSamplePerFrame = mNumberOfSamplePerFrame  * mChannelCount;

    ALOGV("Constructor: E");
    ALOGV("samplingRate = %d", samplingRate);
    ALOGV("channelCount = %d", channelCount);
    ALOGV("frameDurationUs = %lld", frameDurationUs);
    ALOGV("audioDurationUs = %lld", audioDurationUs);
    ALOGV("mNumberOfSamplePerFrame = %d", mNumberOfSamplePerFrame);
    ALOGV("Constructor: X");
}

DummyAudioSource::~DummyAudioSource() {
    /* Do nothing here? */
    ALOGV("~DummyAudioSource");
}

void DummyAudioSource::setDuration(int64_t audioDurationUs) {
    ALOGV("setDuration: %lld us added to %lld us",
        audioDurationUs, mAudioDurationUs);

    Mutex::Autolock autoLock(mLock);
    mAudioDurationUs += audioDurationUs;
}

status_t DummyAudioSource::start(MetaData *params) {
    ALOGV("start: E");
    status_t err = OK;

    mTimeStampUs = 0;

    mBufferGroup = new MediaBufferGroup;
    mBufferGroup->add_buffer(
            new MediaBuffer(mNumberOfSamplePerFrame * sizeof(int16_t)));

    ALOGV("start: X");

    return err;
}

status_t DummyAudioSource::stop() {
    ALOGV("stop");

    delete mBufferGroup;
    mBufferGroup = NULL;

    return OK;
}


sp<MetaData> DummyAudioSource::getFormat() {
    ALOGV("getFormat");

    sp<MetaData> meta = new MetaData;
    meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW);
    meta->setInt32(kKeyChannelCount, mChannelCount);
    meta->setInt32(kKeySampleRate, mSamplingRate);
    meta->setInt64(kKeyDuration, mFrameDurationUs);
    meta->setCString(kKeyDecoderComponent, "DummyAudioSource");

    return meta;
}

status_t DummyAudioSource::read(
        MediaBuffer **out, const MediaSource::ReadOptions *options) {

    ALOGV("read: E");

    int64_t seekTimeUs;
    ReadOptions::SeekMode mode;

    if (options && options->getSeekTo(&seekTimeUs, &mode)) {
        CHECK(seekTimeUs >= 0);
        mTimeStampUs = seekTimeUs;
    }

    {
        Mutex::Autolock autoLock(mLock);
        if (mTimeStampUs >= mAudioDurationUs) {
            ALOGI("read: EOS reached %lld > %lld",
                mTimeStampUs, mAudioDurationUs);

            *out = NULL;
            return ERROR_END_OF_STREAM;
        }
    }

    MediaBuffer *buffer;
    status_t err = mBufferGroup->acquire_buffer(&buffer);
    if (err != OK) {
        ALOGE("Failed to acquire buffer from mBufferGroup: %d", err);
        return err;
    }

    memset((uint8_t *) buffer->data() + buffer->range_offset(),
            0, mNumberOfSamplePerFrame << 1);
    buffer->set_range(buffer->range_offset(), (mNumberOfSamplePerFrame << 1));
    buffer->meta_data()->setInt64(kKeyTime, mTimeStampUs);

    ALOGV("read: offset  = %d, size = %d, mTimeStampUs = %lld",
             buffer->range_offset(), buffer->size(), mTimeStampUs);

    mTimeStampUs = mTimeStampUs + mFrameDurationUs;
    *out = buffer;

    return OK;
}

}// namespace android
+0 −73
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 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 DUMMY_AUDIOSOURCE_H_
#define DUMMY_AUDIOSOURCE_H_

#include <media/stagefright/MediaSource.h>


namespace android {

class MetaData;
struct MediaBufferGroup;

struct DummyAudioSource : public MediaSource {

public:
    static sp<DummyAudioSource> Create(
                int32_t samplingRate, int32_t channelCount,
                int64_t frameDurationUs, int64_t audioDurationUs);

    virtual status_t start(MetaData *params = NULL);
    virtual status_t stop();
    virtual sp<MetaData> getFormat();

    virtual status_t read(
                MediaBuffer **buffer,
                const MediaSource::ReadOptions *options = NULL);

    void setDuration(int64_t audioDurationUs);

protected:
    virtual ~DummyAudioSource();

private:
    int32_t mSamplingRate;
    int32_t mChannelCount;
    int64_t mFrameDurationUs;
    int32_t mNumberOfSamplePerFrame;
    int64_t mAudioDurationUs;
    int64_t mTimeStampUs;
    Mutex mLock;

    MediaBufferGroup *mBufferGroup;

    DummyAudioSource(
            int32_t samplingRate, int32_t channelCount,
            int64_t frameDurationUs, int64_t audioDurationUs);

    // Don't call me
    DummyAudioSource(const DummyAudioSource &);
    DummyAudioSource &operator=(const DummyAudioSource &);

};

}//namespace android


#endif //DUMMY_AUDIOSOURCE_H_
+0 −172
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 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.
 */

//#define LOG_NDEBUG 0
#define LOG_TAG "DummyVideoSource"
#include <inttypes.h>
#include <stdlib.h>
#include <utils/Log.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaBufferGroup.h>
#include <media/stagefright/MetaData.h>
#include "VideoEditorTools.h"
#include "DummyVideoSource.h"


namespace android {

sp<DummyVideoSource> DummyVideoSource::Create(
        uint32_t width, uint32_t height,
        uint64_t clipDuration, const char *imageUri) {

    ALOGV("Create");
    return new DummyVideoSource(
                    width, height, clipDuration, imageUri);

}


DummyVideoSource::DummyVideoSource(
        uint32_t width, uint32_t height,
        uint64_t clipDuration, const char *imageUri) {

    ALOGV("Constructor: E");

    mFrameWidth = width;
    mFrameHeight = height;
    mImageClipDuration = clipDuration;
    mUri = imageUri;
    mImageBuffer = NULL;

    ALOGV("%s", mUri);
    ALOGV("Constructor: X");
}


DummyVideoSource::~DummyVideoSource() {
    /* Do nothing here? */
    ALOGV("~DummyVideoSource");
}



status_t DummyVideoSource::start(MetaData *params) {
    ALOGV("start: E");

    // Get the frame buffer from the rgb file, mUri,
    // and store its content into a MediaBuffer
    status_t err = LvGetImageThumbNail(
                    (const char *)mUri,
                    mFrameHeight, mFrameWidth,
                    (M4OSA_Void **) &mImageBuffer);
    if (err != OK) {
        ALOGE("LvGetImageThumbNail failed: %d", err);
        return err;
    }

    mIsFirstImageFrame = true;
    mImageSeekTime = 0;
    mImagePlayStartTime = 0;
    mFrameTimeUs = 0;

    ALOGV("start: X");
    return OK;
}


status_t DummyVideoSource::stop() {
    ALOGV("stop");
    status_t err = OK;

    if (mImageBuffer != NULL) {
        free(mImageBuffer);
        mImageBuffer = NULL;
    }

    return err;
}


sp<MetaData> DummyVideoSource::getFormat() {
    ALOGV("getFormat");

    sp<MetaData> meta = new MetaData;
    meta->setInt32(kKeyColorFormat, OMX_COLOR_FormatYUV420Planar);
    meta->setInt32(kKeyWidth, mFrameWidth);
    meta->setInt32(kKeyHeight, mFrameHeight);
    meta->setInt64(kKeyDuration, mImageClipDuration);
    meta->setCString(kKeyDecoderComponent, "DummyVideoSource");

    return meta;
}

status_t DummyVideoSource::read(
        MediaBuffer **out,
        const MediaSource::ReadOptions *options) {

    ALOGV("read: E");

    const int32_t kTimeScale = 1000;  /* time scale in ms */
    bool seeking = false;
    int64_t seekTimeUs;
    ReadOptions::SeekMode seekMode;
    if (options && options->getSeekTo(&seekTimeUs, &seekMode)) {
        seeking = true;
        mImageSeekTime = seekTimeUs;
        M4OSA_clockGetTime(&mImagePlayStartTime, kTimeScale);
    }

    if ((mImageSeekTime == mImageClipDuration) ||
        (mFrameTimeUs == (int64_t)mImageClipDuration)) {
        ALOGV("read: EOS reached");
        *out = NULL;
        return ERROR_END_OF_STREAM;
    }

    status_t err = OK;
    MediaBuffer *buffer = new MediaBuffer(
            mImageBuffer, (mFrameWidth * mFrameHeight * 1.5));

    // Set timestamp of buffer
    if (mIsFirstImageFrame) {
        M4OSA_clockGetTime(&mImagePlayStartTime, kTimeScale);
        mFrameTimeUs =  (mImageSeekTime + 1);
        ALOGV("read: jpg 1st frame timeUs = %lld, begin cut time = %" PRIu32,
            mFrameTimeUs, mImageSeekTime);

        mIsFirstImageFrame = false;
    } else {
        M4OSA_Time  currentTimeMs;
        M4OSA_clockGetTime(&currentTimeMs, kTimeScale);

        mFrameTimeUs = mImageSeekTime +
            (currentTimeMs - mImagePlayStartTime) * 1000LL;

        ALOGV("read: jpg frame timeUs = %lld", mFrameTimeUs);
    }

    buffer->meta_data()->setInt64(kKeyTime, mFrameTimeUs);
    buffer->set_range(buffer->range_offset(),
                mFrameWidth * mFrameHeight * 1.5);

    *out = buffer;
    return err;
}

}// namespace android
Loading