diff options
author | Andreas Huber <andih@google.com> | 2009-11-16 15:43:38 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2009-11-16 15:43:38 -0800 |
commit | 30ab66297501757d745b9ae10da61adcd891f497 (patch) | |
tree | e287230832c3cf3437df7ac07c282975e95044e7 /media/libstagefright/CameraSource.cpp | |
parent | 057eacf4578ac6b90ee18c524670e01445bf2732 (diff) | |
download | frameworks_av-30ab66297501757d745b9ae10da61adcd891f497.zip frameworks_av-30ab66297501757d745b9ae10da61adcd891f497.tar.gz frameworks_av-30ab66297501757d745b9ae10da61adcd891f497.tar.bz2 |
Squashed commit of the following:
commit 333057b355f8c260c549553b9a0634755c838b6a
Author: Andreas Huber <andih@google.com>
Date: Fri Nov 13 15:35:48 2009 -0800
Some more tweaks to AVC encoding on sholes.
commit 9981d0ee52ec5b8b0182aae733d1571e3ebb8390
Author: Andreas Huber <andih@google.com>
Date: Thu Nov 12 16:36:57 2009 -0800
Support for avc encoding, including sholes specific tweaks to pick the right colorspace for the camera to not require transcoding.
commit 5ba0ebbbd4efca51f3ae1f60e2ca31e7d2cf136d
Author: Andreas Huber <andih@google.com>
Date: Wed Nov 11 09:50:03 2009 -0800
Enable actual (camera) video-only recording using h.263 or mpeg4 encoding.
commit 3fd59c3526a37fe7c696f4a978925d1831c09313
Author: Andreas Huber <andih@google.com>
Date: Tue Nov 10 14:57:48 2009 -0800
Allow switching between the PV recorder implementation and one supported by stagefright.
This is controlled through the property "media.stagefright.enable-record".
Diffstat (limited to 'media/libstagefright/CameraSource.cpp')
-rw-r--r-- | media/libstagefright/CameraSource.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index e9d8557..bd862e0 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -19,6 +19,7 @@ #include <OMX_Component.h> #include <binder/IServiceManager.h> +#include <cutils/properties.h> // for property_get #include <media/stagefright/CameraSource.h> #include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> @@ -123,6 +124,17 @@ CameraSource *CameraSource::Create() { return new CameraSource(camera); } +// static +CameraSource *CameraSource::CreateFromICamera(const sp<ICamera> &icamera) { + sp<Camera> camera = Camera::create(icamera); + + if (camera.get() == NULL) { + return NULL; + } + + return new CameraSource(camera); +} + CameraSource::CameraSource(const sp<Camera> &camera) : mCamera(camera), mWidth(0), @@ -130,6 +142,13 @@ CameraSource::CameraSource(const sp<Camera> &camera) mFirstFrameTimeUs(0), mNumFrames(0), mStarted(false) { + char value[PROPERTY_VALUE_MAX]; + if (property_get("ro.hardware", value, NULL) && !strcmp(value, "sholes")) { + // The hardware encoder(s) do not support yuv420, but only YCbYCr, + // fortunately the camera also supports this, so we needn't transcode. + mCamera->setParameters(String8("preview-format=yuv422i-yuyv")); + } + String8 s = mCamera->getParameters(); printf("params: \"%s\"\n", s.string()); @@ -143,13 +162,18 @@ CameraSource::~CameraSource() { } } +void CameraSource::setPreviewSurface(const sp<ISurface> &surface) { + mPreviewSurface = surface; +} + status_t CameraSource::start(MetaData *) { CHECK(!mStarted); mCamera->setListener(new CameraSourceListener(this)); - sp<ISurface> dummy = new DummySurface; - status_t err = mCamera->setPreviewDisplay(dummy); + status_t err = + mCamera->setPreviewDisplay( + mPreviewSurface != NULL ? mPreviewSurface : new DummySurface); CHECK_EQ(err, OK); mCamera->setPreviewCallbackFlags( |