Index: cc/video_layer_impl.cc |
diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc |
index 8a624bfa678eb242bc4553b27aad42be5596ef39..120d9f347233147df13360e9302dd8862f3e8618 100644 |
--- a/cc/video_layer_impl.cc |
+++ b/cc/video_layer_impl.cc |
@@ -15,6 +15,7 @@ |
#include "cc/texture_draw_quad.h" |
#include "cc/video_frame_provider_client_impl.h" |
#include "cc/yuv_video_draw_quad.h" |
+#include "cc/yuva_video_draw_quad.h" |
#include "gpu/GLES2/gl2extchromium.h" |
#include "media/filters/skcanvas_video_renderer.h" |
#include "third_party/khronos/GLES2/gl2.h" |
@@ -86,6 +87,7 @@ static GLenum convertVFCFormatToGLenum(const media::VideoFrame& frame) |
switch (frame.format()) { |
case media::VideoFrame::YV12: |
case media::VideoFrame::YV16: |
+ case media::VideoFrame::YV12A: |
return GL_LUMINANCE; |
case media::VideoFrame::NATIVE_TEXTURE: |
return frame.texture_target(); |
@@ -113,6 +115,8 @@ size_t VideoLayerImpl::numPlanes() const |
case media::VideoFrame::YV12: |
case media::VideoFrame::YV16: |
return 3; |
+ case media::VideoFrame::YV12A: |
+ return 4; |
case media::VideoFrame::INVALID: |
case media::VideoFrame::EMPTY: |
case media::VideoFrame::I420: |
@@ -172,6 +176,7 @@ void VideoLayerImpl::willDrawInternal(ResourceProvider* resourceProvider) |
// starts shaping up. |
m_convertYUV = resourceProvider->defaultResourceType() == ResourceProvider::Bitmap && |
(m_frame->format() == media::VideoFrame::YV12 || |
+ m_frame->format() == media::VideoFrame::YV12A || |
m_frame->format() == media::VideoFrame::YV16); |
if (m_convertYUV) |
@@ -217,14 +222,27 @@ void VideoLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad |
switch (m_format) { |
case GL_LUMINANCE: { |
- // YUV software decoder. |
- const FramePlane& yPlane = m_framePlanes[media::VideoFrame::kYPlane]; |
- const FramePlane& uPlane = m_framePlanes[media::VideoFrame::kUPlane]; |
- const FramePlane& vPlane = m_framePlanes[media::VideoFrame::kVPlane]; |
- gfx::SizeF texScale(texWidthScale, texHeightScale); |
- scoped_ptr<YUVVideoDrawQuad> yuvVideoQuad = YUVVideoDrawQuad::Create(); |
- yuvVideoQuad->SetNew(sharedQuadState, quadRect, opaqueRect, texScale, yPlane, uPlane, vPlane); |
- quadSink.append(yuvVideoQuad.PassAs<DrawQuad>(), appendQuadsData); |
+ if(m_frame->HasAlpha()) { |
jzern
2013/02/13 19:56:14
add a space after the if
|
+ // YUVA software decoder. |
+ const FramePlane& yPlane = m_framePlanes[media::VideoFrame::kYPlane]; |
+ const FramePlane& uPlane = m_framePlanes[media::VideoFrame::kUPlane]; |
+ const FramePlane& vPlane = m_framePlanes[media::VideoFrame::kVPlane]; |
+ const FramePlane& aPlane = m_framePlanes[media::VideoFrame::kAPlane]; |
+ gfx::SizeF texScale(texWidthScale, texHeightScale); |
+ scoped_ptr<YUVAVideoDrawQuad> yuvaVideoQuad = YUVAVideoDrawQuad::Create(); |
+ yuvaVideoQuad->SetNew(sharedQuadState, quadRect, opaqueRect, texScale, yPlane, uPlane, vPlane, aPlane); |
+ quadSink.append(yuvaVideoQuad.PassAs<DrawQuad>(), appendQuadsData); |
+ } else { |
+ // YUV software decoder. |
+ const FramePlane& yPlane = m_framePlanes[media::VideoFrame::kYPlane]; |
+ const FramePlane& uPlane = m_framePlanes[media::VideoFrame::kUPlane]; |
+ const FramePlane& vPlane = m_framePlanes[media::VideoFrame::kVPlane]; |
+ gfx::SizeF texScale(texWidthScale, texHeightScale); |
+ scoped_ptr<YUVVideoDrawQuad> yuvVideoQuad = YUVVideoDrawQuad::Create(); |
+ yuvVideoQuad->SetNew(sharedQuadState, quadRect, opaqueRect, texScale, yPlane, uPlane, vPlane); |
+ quadSink.append(yuvVideoQuad.PassAs<DrawQuad>(), appendQuadsData); |
+ } |
+ |
break; |
} |
case GL_RGBA: { |
@@ -301,7 +319,8 @@ static gfx::Size videoFrameDimension(media::VideoFrame* frame, int plane) { |
gfx::Size dimensions = frame->coded_size(); |
switch (frame->format()) { |
case media::VideoFrame::YV12: |
- if (plane != media::VideoFrame::kYPlane) { |
+ case media::VideoFrame::YV12A: |
+ if (plane != media::VideoFrame::kYPlane && plane != media::VideoFrame::kAPlane) { |
dimensions.set_width(dimensions.width() / 2); |
dimensions.set_height(dimensions.height() / 2); |
} |