summaryrefslogtreecommitdiffstats
path: root/libstagefrighthw
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-11-04 14:05:31 -0700
committerAndreas Huber <andih@google.com>2010-11-04 14:05:31 -0700
commit3a5f8cd7970f0e9b34e2637596a7f36f990dad77 (patch)
tree0da672b22473a19836cbe1e8bb133b2242a83fb6 /libstagefrighthw
parentf893585c3f13c2ad3f02cf758e940a8a79b5c595 (diff)
downloaddevice_samsung_crespo-3a5f8cd7970f0e9b34e2637596a7f36f990dad77.zip
device_samsung_crespo-3a5f8cd7970f0e9b34e2637596a7f36f990dad77.tar.gz
device_samsung_crespo-3a5f8cd7970f0e9b34e2637596a7f36f990dad77.tar.bz2
Support for rotated display of video content.
Change-Id: If2662682811ffb339775b1101189338285d93fcc related-to-bug: 3166122
Diffstat (limited to 'libstagefrighthw')
-rw-r--r--libstagefrighthw/SecHardwareRenderer.cpp15
-rw-r--r--libstagefrighthw/SecHardwareRenderer.h1
-rw-r--r--libstagefrighthw/stagefright_overlay_output.cpp6
3 files changed, 18 insertions, 4 deletions
diff --git a/libstagefrighthw/SecHardwareRenderer.cpp b/libstagefrighthw/SecHardwareRenderer.cpp
index d975462..f534b10 100644
--- a/libstagefrighthw/SecHardwareRenderer.cpp
+++ b/libstagefrighthw/SecHardwareRenderer.cpp
@@ -43,6 +43,7 @@ SecHardwareRenderer::SecHardwareRenderer(
size_t displayWidth, size_t displayHeight,
size_t decodedWidth, size_t decodedHeight,
OMX_COLOR_FORMATTYPE colorFormat,
+ int32_t rotationDegrees,
bool fromHardwareDecoder)
: mISurface(surface),
mDisplayWidth(displayWidth),
@@ -67,18 +68,28 @@ SecHardwareRenderer::SecHardwareRenderer(
return;
}
+ uint32_t orientation;
+ switch (rotationDegrees) {
+ case 0: orientation = ISurface::BufferHeap::ROT_0; break;
+ case 90: orientation = ISurface::BufferHeap::ROT_90; break;
+ case 180: orientation = ISurface::BufferHeap::ROT_180; break;
+ case 270: orientation = ISurface::BufferHeap::ROT_270; break;
+ default: orientation = ISurface::BufferHeap::ROT_0; break;
+ }
+
sp<OverlayRef> ref;
#if defined (USE_ZERO_COPY)
if (fromHardwareDecoder) {
ref = mISurface->createOverlay(
mDecodedWidth, mDecodedHeight,
- HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP, 0);
+ HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP, orientation);
mCustomFormat = true;
} else
#else
ref = mISurface->createOverlay(
- mDecodedWidth, mDecodedHeight, HAL_PIXEL_FORMAT_YCbCr_420_P, 0);
+ mDecodedWidth, mDecodedHeight, HAL_PIXEL_FORMAT_YCbCr_420_P,
+ orientation);
#endif
if (ref.get() == NULL) {
diff --git a/libstagefrighthw/SecHardwareRenderer.h b/libstagefrighthw/SecHardwareRenderer.h
index 42f93b2..3fad243 100644
--- a/libstagefrighthw/SecHardwareRenderer.h
+++ b/libstagefrighthw/SecHardwareRenderer.h
@@ -39,6 +39,7 @@ public:
size_t displayWidth, size_t displayHeight,
size_t decodedWidth, size_t decodedHeight,
OMX_COLOR_FORMATTYPE colorFormat,
+ int32_t rotationDegrees,
bool fromHardwareDecoder);
virtual ~SecHardwareRenderer();
diff --git a/libstagefrighthw/stagefright_overlay_output.cpp b/libstagefrighthw/stagefright_overlay_output.cpp
index 3ac46a6..fce1d7e 100644
--- a/libstagefrighthw/stagefright_overlay_output.cpp
+++ b/libstagefrighthw/stagefright_overlay_output.cpp
@@ -22,12 +22,13 @@ using android::sp;
using android::ISurface;
using android::VideoRenderer;
-VideoRenderer *createRenderer(
+VideoRenderer *createRendererWithRotation(
const sp<ISurface> &surface,
const char *componentName,
OMX_COLOR_FORMATTYPE colorFormat,
size_t displayWidth, size_t displayHeight,
- size_t decodedWidth, size_t decodedHeight) {
+ size_t decodedWidth, size_t decodedHeight,
+ int32_t rotationDegrees) {
using android::SecHardwareRenderer;
bool fromHardwareDecoder = !strncmp(componentName, "OMX.SEC.", 8);
@@ -37,6 +38,7 @@ VideoRenderer *createRenderer(
surface, displayWidth, displayHeight,
decodedWidth, decodedHeight,
colorFormat,
+ rotationDegrees,
fromHardwareDecoder);
if (renderer->initCheck() != android::OK) {