summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorwonsik@google.com <wonsik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-04 06:31:21 +0000
committerwonsik@google.com <wonsik@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-04 06:31:21 +0000
commiteadbaaf32f299ba14e6b792e4851322c287d4a4a (patch)
treec1e83b3cd17fc73e153da0d49fbc96f9b4723755 /cc
parent88ac5c023116aa501b9fd9eeac102f4f0b8f4419 (diff)
downloadchromium_src-eadbaaf32f299ba14e6b792e4851322c287d4a4a.zip
chromium_src-eadbaaf32f299ba14e6b792e4851322c287d4a4a.tar.gz
chromium_src-eadbaaf32f299ba14e6b792e4851322c287d4a4a.tar.bz2
Implement "hole" video frame.
In order to support out-of-band compositing of protected video content in Chrome, it is necessary to have a transparent hole in Chrome's HTML rendering so that video playing "beneath" the HTML elements can be seen through. To accomplish the scenario stated above, define a "hole" video frame which would clear the region where video would have been composited. In CC, this is done by sending a transparent black SolidColorDrawQuad with blending disabled. Review URL: https://chromiumcodereview.appspot.com/12255032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185841 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/video_layer_impl.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc
index 8a624bfa..502ccc2 100644
--- a/cc/video_layer_impl.cc
+++ b/cc/video_layer_impl.cc
@@ -20,6 +20,10 @@
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
+#if defined(GOOGLE_TV)
+#include "cc/solid_color_draw_quad.h"
+#endif
+
namespace cc {
// static
@@ -89,6 +93,10 @@ static GLenum convertVFCFormatToGLenum(const media::VideoFrame& frame)
return GL_LUMINANCE;
case media::VideoFrame::NATIVE_TEXTURE:
return frame.texture_target();
+#if defined(GOOGLE_TV)
+ case media::VideoFrame::HOLE:
+ return GL_INVALID_VALUE;
+#endif
case media::VideoFrame::INVALID:
case media::VideoFrame::RGB32:
case media::VideoFrame::EMPTY:
@@ -108,6 +116,10 @@ size_t VideoLayerImpl::numPlanes() const
return 1;
switch (m_frame->format()) {
+#if defined(GOOGLE_TV)
+ case media::VideoFrame::HOLE:
+ return 0;
+#endif
case media::VideoFrame::RGB32:
return 1;
case media::VideoFrame::YV12:
@@ -152,6 +164,11 @@ void VideoLayerImpl::willDrawInternal(ResourceProvider* resourceProvider)
if (!m_frame)
return;
+#if defined(GOOGLE_TV)
+ if (m_frame->format() == media::VideoFrame::HOLE)
+ return;
+#endif
+
m_format = convertVFCFormatToGLenum(*m_frame);
// If these fail, we'll have to add draw logic that handles offset bitmap/
@@ -215,6 +232,27 @@ void VideoLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
const float texHeightScale =
static_cast<float>(visibleRect.height()) / codedSize.height();
+#if defined(GOOGLE_TV)
+ // This block and other blocks wrapped around #if defined(GOOGLE_TV) is not
+ // maintained by the general compositor team. Please contact the following
+ // people instead:
+ //
+ // wonsik@chromium.org
+ // ycheo@chromium.org
+
+ if (m_frame->format() == media::VideoFrame::HOLE) {
+ scoped_ptr<SolidColorDrawQuad> solidColorDrawQuad =
+ SolidColorDrawQuad::Create();
+ // Create a solid color quad with transparent black and force no
+ // blending.
+ solidColorDrawQuad->SetAll(
+ sharedQuadState, quadRect, quadRect, quadRect, false,
+ SK_ColorTRANSPARENT);
+ quadSink.append(solidColorDrawQuad.PassAs<DrawQuad>(), appendQuadsData);
+ return;
+ }
+#endif
+
switch (m_format) {
case GL_LUMINANCE: {
// YUV software decoder.