summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-05-11 14:50:16 -0700
committerJames Dong <jdong@google.com>2012-05-11 14:53:22 -0700
commit3a2633008be4a92fbca6e76c057f86e220558197 (patch)
tree64aa2de3dd08bae08930da1e10e66bbe565688d3 /media
parent240d8a84dec9f9482257a8037457a1d63193b7ff (diff)
downloadframeworks_av-3a2633008be4a92fbca6e76c057f86e220558197.zip
frameworks_av-3a2633008be4a92fbca6e76c057f86e220558197.tar.gz
frameworks_av-3a2633008be4a92fbca6e76c057f86e220558197.tar.bz2
Remove unused VideoSourceDownSampler class
Change-Id: I2faf5962ff4cc366c688ef5bb27f53596f08fe0a related-to-bug: 6484217
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/Android.mk1
-rw-r--r--media/libstagefright/VideoSourceDownSampler.cpp142
2 files changed, 0 insertions, 143 deletions
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 78a68fd..8ad1cb9 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -14,7 +14,6 @@ LOCAL_SRC_FILES:= \
AwesomePlayer.cpp \
CameraSource.cpp \
CameraSourceTimeLapse.cpp \
- VideoSourceDownSampler.cpp \
DataSource.cpp \
DRMExtractor.cpp \
ESDS.cpp \
diff --git a/media/libstagefright/VideoSourceDownSampler.cpp b/media/libstagefright/VideoSourceDownSampler.cpp
deleted file mode 100644
index 90a42c9..0000000
--- a/media/libstagefright/VideoSourceDownSampler.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2010 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 "VideoSourceDownSampler"
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/VideoSourceDownSampler.h>
-#include <media/stagefright/MediaBuffer.h>
-#include <media/stagefright/MetaData.h>
-#include <media/stagefright/YUVImage.h>
-#include <media/stagefright/YUVCanvas.h>
-#include "OMX_Video.h"
-
-namespace android {
-
-VideoSourceDownSampler::VideoSourceDownSampler(const sp<MediaSource> &videoSource,
- int32_t width, int32_t height) {
- ALOGV("Construct VideoSourceDownSampler");
- CHECK(width > 0);
- CHECK(height > 0);
-
- mRealVideoSource = videoSource;
- mWidth = width;
- mHeight = height;
-
- mMeta = new MetaData(*(mRealVideoSource->getFormat()));
- CHECK(mMeta->findInt32(kKeyWidth, &mRealSourceWidth));
- CHECK(mMeta->findInt32(kKeyHeight, &mRealSourceHeight));
-
- if ((mWidth != mRealSourceWidth) || (mHeight != mRealSourceHeight)) {
- // Change meta data for width and height.
- CHECK(mWidth <= mRealSourceWidth);
- CHECK(mHeight <= mRealSourceHeight);
-
- mNeedDownSampling = true;
- computeDownSamplingParameters();
- mMeta->setInt32(kKeyWidth, mWidth);
- mMeta->setInt32(kKeyHeight, mHeight);
- } else {
- mNeedDownSampling = false;
- }
-}
-
-VideoSourceDownSampler::~VideoSourceDownSampler() {
-}
-
-void VideoSourceDownSampler::computeDownSamplingParameters() {
- mDownSampleSkipX = mRealSourceWidth / mWidth;
- mDownSampleSkipY = mRealSourceHeight / mHeight;
-
- mDownSampleOffsetX = mRealSourceWidth - mDownSampleSkipX * mWidth;
- mDownSampleOffsetY = mRealSourceHeight - mDownSampleSkipY * mHeight;
-}
-
-void VideoSourceDownSampler::downSampleYUVImage(
- const MediaBuffer &sourceBuffer, MediaBuffer **buffer) const {
- // find the YUV format
- int32_t srcFormat;
- CHECK(mMeta->findInt32(kKeyColorFormat, &srcFormat));
- YUVImage::YUVFormat yuvFormat;
- if (srcFormat == OMX_COLOR_FormatYUV420SemiPlanar) {
- yuvFormat = YUVImage::YUV420SemiPlanar;
- } else if (srcFormat == OMX_COLOR_FormatYUV420Planar) {
- yuvFormat = YUVImage::YUV420Planar;
- }
-
- // allocate mediaBuffer for down sampled image and setup a canvas.
- *buffer = new MediaBuffer(YUVImage::bufferSize(yuvFormat, mWidth, mHeight));
- YUVImage yuvDownSampledImage(yuvFormat,
- mWidth, mHeight,
- (uint8_t *)(*buffer)->data());
- YUVCanvas yuvCanvasDownSample(yuvDownSampledImage);
-
- YUVImage yuvImageSource(yuvFormat,
- mRealSourceWidth, mRealSourceHeight,
- (uint8_t *)sourceBuffer.data());
- yuvCanvasDownSample.downsample(mDownSampleOffsetX, mDownSampleOffsetY,
- mDownSampleSkipX, mDownSampleSkipY,
- yuvImageSource);
-}
-
-status_t VideoSourceDownSampler::start(MetaData *params) {
- ALOGV("start");
- return mRealVideoSource->start();
-}
-
-status_t VideoSourceDownSampler::stop() {
- ALOGV("stop");
- return mRealVideoSource->stop();
-}
-
-sp<MetaData> VideoSourceDownSampler::getFormat() {
- ALOGV("getFormat");
- return mMeta;
-}
-
-status_t VideoSourceDownSampler::read(
- MediaBuffer **buffer, const ReadOptions *options) {
- ALOGV("read");
- MediaBuffer *realBuffer;
- status_t err = mRealVideoSource->read(&realBuffer, options);
-
- if (mNeedDownSampling) {
- downSampleYUVImage(*realBuffer, buffer);
-
- int64_t frameTime;
- realBuffer->meta_data()->findInt64(kKeyTime, &frameTime);
- (*buffer)->meta_data()->setInt64(kKeyTime, frameTime);
-
- // We just want this buffer to be deleted when the encoder releases it.
- // So don't add a reference to it and set the observer to NULL.
- (*buffer)->setObserver(NULL);
-
- // The original buffer is no longer required. Release it.
- realBuffer->release();
- } else {
- *buffer = realBuffer;
- }
-
- return err;
-}
-
-status_t VideoSourceDownSampler::pause() {
- ALOGV("pause");
- return mRealVideoSource->pause();
-}
-
-} // namespace android