diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 00:17:16 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 00:17:16 +0000 |
commit | f402ba034d0a796bbb57655a3a0781922b6a8b16 (patch) | |
tree | 6291aabe2e9580fd61fcf4ea8cf56fb6411454f3 | |
parent | c8c552d18c353fcea4ae92d815abd6549f4bb0f0 (diff) | |
download | chromium_src-f402ba034d0a796bbb57655a3a0781922b6a8b16.zip chromium_src-f402ba034d0a796bbb57655a3a0781922b6a8b16.tar.gz chromium_src-f402ba034d0a796bbb57655a3a0781922b6a8b16.tar.bz2 |
Cull unnecessary media::VideoFrame::Formats from the enum.
This removes the easy ones: RGB555, RGB565, RGB24, RGBA, NV12, and ASCII.
BUG=108306
TEST=videotestmatrix is still as happy as it was.
Review URL: http://codereview.chromium.org/10024072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131682 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | media/base/video_frame.cc | 32 | ||||
-rw-r--r-- | media/base/video_frame.h | 20 | ||||
-rw-r--r-- | media/base/video_frame_unittest.cc | 10 | ||||
-rw-r--r-- | media/media.gyp | 2 | ||||
-rw-r--r-- | media/tools/shader_bench/cpu_color_painter.cc | 6 | ||||
-rw-r--r-- | media/tools/shader_bench/gpu_color_painter_exp.cc | 132 | ||||
-rw-r--r-- | media/tools/shader_bench/gpu_color_painter_exp.h | 36 | ||||
-rw-r--r-- | media/tools/shader_bench/shader_bench.cc | 4 | ||||
-rw-r--r-- | remoting/base/codec_test.cc | 3 | ||||
-rw-r--r-- | remoting/base/encoder_row_based.cc | 3 | ||||
-rw-r--r-- | remoting/base/util.cc | 21 | ||||
-rw-r--r-- | remoting/base/util.h | 3 | ||||
-rw-r--r-- | remoting/host/capturer_fake_ascii.cc | 86 | ||||
-rw-r--r-- | remoting/host/capturer_fake_ascii.h | 61 | ||||
-rw-r--r-- | remoting/remoting.gyp | 2 | ||||
-rw-r--r-- | webkit/media/webvideoframe_impl.cc | 12 |
16 files changed, 21 insertions, 412 deletions
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc index 833d2a8..f8cdcf9 100644 --- a/media/base/video_frame.cc +++ b/media/base/video_frame.cc @@ -22,27 +22,15 @@ scoped_refptr<VideoFrame> VideoFrame::CreateFrame( scoped_refptr<VideoFrame> frame(new VideoFrame( format, width, height, timestamp, duration)); switch (format) { - case VideoFrame::RGB555: - case VideoFrame::RGB565: - frame->AllocateRGB(2u); - break; - case VideoFrame::RGB24: - frame->AllocateRGB(3u); - break; case VideoFrame::RGB32: - case VideoFrame::RGBA: frame->AllocateRGB(4u); break; case VideoFrame::YV12: case VideoFrame::YV16: frame->AllocateYUV(); break; - case VideoFrame::ASCII: - frame->AllocateRGB(1u); - break; default: - NOTREACHED(); - return NULL; + LOG(FATAL) << "Unsupported frame format: " << format; } return frame; } @@ -175,11 +163,7 @@ VideoFrame::~VideoFrame() { bool VideoFrame::IsValidPlane(size_t plane) const { switch (format_) { - case RGB555: - case RGB565: - case RGB24: case RGB32: - case RGBA: return plane == kRGBPlane; case YV12: @@ -207,18 +191,8 @@ int VideoFrame::stride(size_t plane) const { int VideoFrame::row_bytes(size_t plane) const { DCHECK(IsValidPlane(plane)); switch (format_) { - // 16bpp. - case RGB555: - case RGB565: - return width_ * 2; - - // 24bpp. - case RGB24: - return width_ * 3; - // 32bpp. case RGB32: - case RGBA: return width_ * 4; // Planar, 8bpp. @@ -240,11 +214,7 @@ int VideoFrame::row_bytes(size_t plane) const { int VideoFrame::rows(size_t plane) const { DCHECK(IsValidPlane(plane)); switch (format_) { - case RGB555: - case RGB565: - case RGB24: case RGB32: - case RGBA: case YV16: return height_; diff --git a/media/base/video_frame.h b/media/base/video_frame.h index 1346009..42b627a 100644 --- a/media/base/video_frame.h +++ b/media/base/video_frame.h @@ -28,19 +28,13 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { // http://www.fourcc.org/yuv.php // Keep in sync with WebKit::WebVideoFrame! enum Format { - INVALID, // Invalid format value. Used for error reporting. - RGB555, // 16bpp RGB packed 5:5:5 - RGB565, // 16bpp RGB packed 5:6:5 - RGB24, // 24bpp RGB packed 8:8:8 - RGB32, // 32bpp RGB packed with extra byte 8:8:8 - RGBA, // 32bpp RGBA packed 8:8:8:8 - YV12, // 12bpp YVU planar 1x1 Y, 2x2 VU samples - YV16, // 16bpp YVU planar 1x1 Y, 2x1 VU samples - NV12, // 12bpp YVU planar 1x1 Y, 2x2 UV interleaving samples - EMPTY, // An empty frame. - ASCII, // A frame with ASCII content. For testing only. - I420, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. - NATIVE_TEXTURE, // Native texture. Pixel-format agnostic. + INVALID = 0, // Invalid format value. Used for error reporting. + RGB32 = 4, // 32bpp RGB packed with extra byte 8:8:8 + YV12 = 6, // 12bpp YVU planar 1x1 Y, 2x2 VU samples + YV16 = 7, // 16bpp YVU planar 1x1 Y, 2x1 VU samples + EMPTY = 9, // An empty frame. + I420 = 11, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. + NATIVE_TEXTURE = 12, // Native texture. Pixel-format agnostic. }; // Creates a new frame in system memory with given parameters. Buffers for diff --git a/media/base/video_frame_unittest.cc b/media/base/video_frame_unittest.cc index 9548797..3357ed2 100644 --- a/media/base/video_frame_unittest.cc +++ b/media/base/video_frame_unittest.cc @@ -47,7 +47,7 @@ void ExpectFrameColor(media::VideoFrame* yv12_frame, uint32 expect_rgb_color) { yv12_frame->stride(VideoFrame::kVPlane)); scoped_refptr<media::VideoFrame> rgb_frame; - rgb_frame = media::VideoFrame::CreateFrame(VideoFrame::RGBA, + rgb_frame = media::VideoFrame::CreateFrame(VideoFrame::RGB32, yv12_frame->width(), yv12_frame->height(), yv12_frame->GetTimestamp(), @@ -202,16 +202,8 @@ TEST(VideoFrame, CheckFrameExtents) { // and the expected hash of all planes if filled with kFillByte (defined in // ExpectFrameExtents). ExpectFrameExtents( - VideoFrame::RGB555, 1, 2, "31f7739efc76b5d9cb51361ba82533fa"); - ExpectFrameExtents( - VideoFrame::RGB565, 1, 2, "31f7739efc76b5d9cb51361ba82533fa"); - ExpectFrameExtents( - VideoFrame::RGB24, 1, 3, "84361ae9d4b6d4641a11474b3a7a2260"); - ExpectFrameExtents( VideoFrame::RGB32, 1, 4, "de6d3d567e282f6a38d478f04fc81fb0"); ExpectFrameExtents( - VideoFrame::RGBA, 1, 4, "de6d3d567e282f6a38d478f04fc81fb0"); - ExpectFrameExtents( VideoFrame::YV12, 3, 1, "71113bdfd4c0de6cf62f48fb74f7a0b1"); ExpectFrameExtents( VideoFrame::YV16, 3, 1, "9bb99ac3ff350644ebff4d28dc01b461"); diff --git a/media/media.gyp b/media/media.gyp index 35b38ca..3bd7cc4 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -830,8 +830,6 @@ 'tools/shader_bench/cpu_color_painter.h', 'tools/shader_bench/gpu_color_painter.cc', 'tools/shader_bench/gpu_color_painter.h', - 'tools/shader_bench/gpu_color_painter_exp.cc', - 'tools/shader_bench/gpu_color_painter_exp.h', 'tools/shader_bench/gpu_painter.cc', 'tools/shader_bench/gpu_painter.h', 'tools/shader_bench/painter.cc', diff --git a/media/tools/shader_bench/cpu_color_painter.cc b/media/tools/shader_bench/cpu_color_painter.cc index e8b7562..d2dbc4c 100644 --- a/media/tools/shader_bench/cpu_color_painter.cc +++ b/media/tools/shader_bench/cpu_color_painter.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -64,9 +64,9 @@ void CPUColorPainter::Initialize(int width, int height) { } void CPUColorPainter::Paint(scoped_refptr<media::VideoFrame> video_frame) { - // Convert to RGBA frame. + // Convert to RGB32 frame. scoped_refptr<media::VideoFrame> rgba_frame = - media::VideoFrame::CreateFrame(media::VideoFrame::RGBA, + media::VideoFrame::CreateFrame(media::VideoFrame::RGB32, video_frame->width(), video_frame->height(), base::TimeDelta(), diff --git a/media/tools/shader_bench/gpu_color_painter_exp.cc b/media/tools/shader_bench/gpu_color_painter_exp.cc deleted file mode 100644 index 860c1bf..0000000 --- a/media/tools/shader_bench/gpu_color_painter_exp.cc +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "media/tools/shader_bench/gpu_color_painter_exp.h" - -enum { kNumYUVPlanes = 3 }; - -// Matrix used for the YUV to RGB conversion. -static const float kYUV2RGB[9] = { - 1.f, 0.f, 1.403f, - 1.f, -.344f, -.714f, - 1.f, 1.772f, 0.f, -}; - -static const float kYUV2RGB_TRANS[9] = { - 1.f, 1.f, 1.f, - 0.f, -.344f, 1.772f, - 1.403f, -.714f, 0.f, -}; - -const float attributeSelector[4] = { - 1.f, 10.f, 100.f, 1000.f, -}; - -// Pass-through vertex shader. -static const char kVertexShader[] = - "precision highp float;\n" - "precision highp int;\n" - "varying vec2 interp_tc;\n" - "\n" - "attribute vec4 in_pos;\n" - "attribute vec2 in_tc;\n" - "\n" - "void main() {\n" - " interp_tc = in_tc;\n" - " gl_Position = in_pos;\n" - "}\n"; - -// YUV to RGB pixel shader. Loads a pixel from each plane and pass through the -// matrix. -static const char kFragmentShader[] = - "precision mediump float;\n" - "precision mediump int;\n" - "varying vec2 interp_tc;\n" - "\n" - "uniform sampler2D y_tex;\n" - "uniform sampler2D u_tex;\n" - "uniform sampler2D v_tex;\n" - "uniform mat3 yuv2rgb;\n" - "uniform vec4 attrib_vector; \n" - "uniform int texture_width; \n" - "\n" - "void main() {\n" - " float x_pos = interp_tc.x * float(texture_width); \n" - " float y_index = floor(mod(x_pos, 4.0)); \n" - " float y_denom = pow(10.0, y_index); \n" - " vec4 attrib_y = mod(floor(attrib_vector / y_denom), 10.0); \n" - " float uv_index = floor(mod(floor(x_pos / 4.0), 4.0)); \n" - " float uv_denom = pow(10.0, uv_index); \n" - " vec4 attrib_uv = mod(floor(attrib_vector / uv_denom), 10.0); \n" - " vec4 texel_y = texture2D(y_tex, interp_tc); \n" - " vec4 texel_u = texture2D(u_tex, interp_tc); \n" - " vec4 texel_v = texture2D(v_tex, interp_tc); \n" - " float y = dot(attrib_y, texel_y); \n" - " float u = dot(attrib_uv, texel_u) - 0.5; \n" - " float v = dot(attrib_uv, texel_v) - 0.5; \n" - " vec3 rgb = yuv2rgb * vec3(y, u, v);\n" - " gl_FragColor = vec4(rgb, 1);\n" - "}\n"; - -GPUColorRGBALumHackPainter::GPUColorRGBALumHackPainter() - : program_id_(-1) { -} - -GPUColorRGBALumHackPainter::~GPUColorRGBALumHackPainter() { - if (program_id_) { - glDeleteProgram(program_id_); - glDeleteTextures(kNumYUVPlanes, textures_); - } -} - -void GPUColorRGBALumHackPainter::Initialize(int width, int height) { - glGenTextures(3, textures_); - for (unsigned int i = 0; i < kNumYUVPlanes; ++i) { - unsigned int texture_width = (i == media::VideoFrame::kYPlane) ? - width : width / 2; - unsigned int texture_height = (i == media::VideoFrame::kYPlane) ? - height : height / 2; - glActiveTexture(GL_TEXTURE0 + i); - glBindTexture(GL_TEXTURE_2D, textures_[i]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture_width / 4, texture_height, - 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - } - - GLuint program = CreateShaderProgram(kVertexShader, kFragmentShader); - - // Bind parameters. - glUniform1i(glGetUniformLocation(program, "y_tex"), 0); - glUniform1i(glGetUniformLocation(program, "u_tex"), 1); - glUniform1i(glGetUniformLocation(program, "v_tex"), 2); - glUniform1i(glGetUniformLocation(program, "texture_width"), width); - int yuv2rgb_location = glGetUniformLocation(program, "yuv2rgb"); - if (gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) - glUniformMatrix3fv(yuv2rgb_location, 1, GL_TRUE, kYUV2RGB); - else - glUniformMatrix3fv(yuv2rgb_location, 1, GL_FALSE, kYUV2RGB_TRANS); - int attrib_location = glGetUniformLocation(program, "attrib_vector"); - glUniform4fv(attrib_location, 1, attributeSelector); - - program_id_ = program; -} - -void GPUColorRGBALumHackPainter::Paint( - scoped_refptr<media::VideoFrame> video_frame) { - for (unsigned int i = 0; i < kNumYUVPlanes; ++i) { - unsigned int width = (i == media::VideoFrame::kYPlane) ? - video_frame->width() : video_frame->width() / 2; - unsigned int height = (i == media::VideoFrame::kYPlane) ? - video_frame->height() : video_frame->height() / 2; - glBindTexture(GL_TEXTURE_2D, textures_[i]); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width / 4, height, - GL_RGBA, GL_UNSIGNED_BYTE, video_frame->data(i)); - } - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - surface()->SwapBuffers(); -} diff --git a/media/tools/shader_bench/gpu_color_painter_exp.h b/media/tools/shader_bench/gpu_color_painter_exp.h deleted file mode 100644 index 19b3c7e..0000000 --- a/media/tools/shader_bench/gpu_color_painter_exp.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MEDIA_TOOLS_SHADER_BENCH_GPU_COLOR_PAINTER_EXP_H_ -#define MEDIA_TOOLS_SHADER_BENCH_GPU_COLOR_PAINTER_EXP_H_ - -#include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" -#include "media/base/video_frame.h" -#include "media/tools/shader_bench/gpu_painter.h" -#include "ui/gfx/gl/gl_context.h" - -// Does color space conversion using RGBA textures acting as -// luminance textures (experimental shader hack) for YUV->RGBA -// conversion; renders using GPU. -class GPUColorRGBALumHackPainter : public GPUPainter { - public: - GPUColorRGBALumHackPainter(); - virtual ~GPUColorRGBALumHackPainter(); - - // Painter interface. - virtual void Initialize(int width, int height) OVERRIDE; - virtual void Paint(scoped_refptr<media::VideoFrame> video_frame) OVERRIDE; - - private: - // Shader program id. - GLuint program_id_; - - // IDs of 3 RGBA textures, pretending to be luminance textures. - GLuint textures_[3]; - - DISALLOW_COPY_AND_ASSIGN(GPUColorRGBALumHackPainter); -}; - -#endif // MEDIA_TOOLS_SHADER_BENCH_GPU_COLOR_PAINTER_EXP_H_ diff --git a/media/tools/shader_bench/shader_bench.cc b/media/tools/shader_bench/shader_bench.cc index 37eae1b..83a2bb1 100644 --- a/media/tools/shader_bench/shader_bench.cc +++ b/media/tools/shader_bench/shader_bench.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,7 +16,6 @@ #include "media/base/video_frame.h" #include "media/tools/shader_bench/cpu_color_painter.h" #include "media/tools/shader_bench/gpu_color_painter.h" -#include "media/tools/shader_bench/gpu_color_painter_exp.h" #include "media/tools/shader_bench/painter.h" #include "media/tools/shader_bench/window.h" #include "ui/gfx/gl/gl_bindings.h" @@ -149,7 +148,6 @@ int main(int argc, char** argv) { } painters[] = { { "CPU CSC + GPU Render", new CPUColorPainter() }, { "GPU CSC/Render", new GPUColorWithLuminancePainter() }, - { "GPU CSC/Render (experimental)", new GPUColorRGBALumHackPainter() }, }; // Run GPU painter tests. diff --git a/remoting/base/codec_test.cc b/remoting/base/codec_test.cc index 5fd58ed..381fdf4 100644 --- a/remoting/base/codec_test.cc +++ b/remoting/base/codec_test.cc @@ -303,7 +303,8 @@ static void TestEncodeDecodeRects(Encoder* encoder, // Generate random data for the updated region. srand(0); for (int i = 0; i < count; ++i) { - const int bytes_per_pixel = GetBytesPerPixel(data->pixel_format()); + CHECK_EQ(data->pixel_format(), media::VideoFrame::RGB32); + const int bytes_per_pixel = 4; // Because of RGB32 on previous line. const int row_size = bytes_per_pixel * rects[i].width(); uint8* memory = data->data_planes().data[0] + data->data_planes().strides[0] * rects[i].top() + diff --git a/remoting/base/encoder_row_based.cc b/remoting/base/encoder_row_based.cc index c84b38a..41d9e9e 100644 --- a/remoting/base/encoder_row_based.cc +++ b/remoting/base/encoder_row_based.cc @@ -80,8 +80,9 @@ void EncoderRowBased::Encode( void EncoderRowBased::EncodeRect(const SkIRect& rect, bool last) { CHECK(capture_data_->data_planes().data[0]); + CHECK_EQ(capture_data_->pixel_format(), media::VideoFrame::RGB32); const int strides = capture_data_->data_planes().strides[0]; - const int bytes_per_pixel = GetBytesPerPixel(capture_data_->pixel_format()); + const int bytes_per_pixel = 4; const int row_size = bytes_per_pixel * rect.width(); compressor_->Reset(); diff --git a/remoting/base/util.cc b/remoting/base/util.cc index 26886ca..b126f15 100644 --- a/remoting/base/util.cc +++ b/remoting/base/util.cc @@ -17,6 +17,8 @@ using media::VideoFrame; namespace remoting { +enum { kBytesPerPixelRGB32 = 4 }; + // Do not write LOG messages in this routine since it is called from within // our LOG message handler. Bad things will happen. std::string GetTimestampString() { @@ -28,24 +30,9 @@ std::string GetTimestampString() { tex.hour, tex.minute, tex.second); } -int GetBytesPerPixel(VideoFrame::Format format) { - // Note: The order is important here for performance. This is sorted from the - // most common to the less common (PIXEL_FORMAT_ASCII is mostly used - // just for testing). - switch (format) { - case VideoFrame::RGB24: return 3; - case VideoFrame::RGB565: return 2; - case VideoFrame::RGB32: return 4; - case VideoFrame::ASCII: return 1; - default: - NOTREACHED() << "Pixel format not supported"; - return 0; - } -} - // Helper methods to calculate plane offset given the coordinates. static int CalculateRGBOffset(int x, int y, int stride) { - return stride * y + GetBytesPerPixel(media::VideoFrame::RGB32) * x; + return stride * y + kBytesPerPixelRGB32 * x; } static int CalculateYOffset(int x, int y, int stride) { @@ -274,7 +261,7 @@ void CopyRGB32Rect(const uint8* source_buffer, source_stride, dest_buffer + dest_offset, dest_stride, - GetBytesPerPixel(media::VideoFrame::RGB32), + kBytesPerPixelRGB32, SkIRect::MakeWH(dest_rect.width(), dest_rect.height())); } diff --git a/remoting/base/util.h b/remoting/base/util.h index c4621cc..07b501b 100644 --- a/remoting/base/util.h +++ b/remoting/base/util.h @@ -15,9 +15,6 @@ namespace remoting { // Return a string that contains the current date formatted as 'MMDD/HHMMSS:'. std::string GetTimestampString(); -// TODO(sergeyu): Move these methods to media. -int GetBytesPerPixel(media::VideoFrame::Format format); - // Convert and scale YUV to RGB32 on a specific rectangle. The source and // destination buffers are assumed to contain only |source_buffer_rect| and // |dest_buffer_rect| areas correspondingly. The scaling factor is determined diff --git a/remoting/host/capturer_fake_ascii.cc b/remoting/host/capturer_fake_ascii.cc deleted file mode 100644 index e0f5845..0000000 --- a/remoting/host/capturer_fake_ascii.cc +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "remoting/host/capturer_fake_ascii.h" - -namespace remoting { - -static const int kWidth = 32; -static const int kHeight = 20; -static const int kBytesPerPixel = 1; - -CapturerFakeAscii::CapturerFakeAscii() - : current_buffer_(0), - pixel_format_(media::VideoFrame::ASCII) { -} - -CapturerFakeAscii::~CapturerFakeAscii() { -} - -void CapturerFakeAscii::ScreenConfigurationChanged() { - width_ = kWidth; - height_ = kHeight; - bytes_per_row_ = width_ * kBytesPerPixel; - pixel_format_ = media::VideoFrame::ASCII; - - // Create memory for the buffers. - int buffer_size = height_ * bytes_per_row_; - for (int i = 0; i < kNumBuffers; i++) { - buffers_[i].reset(new uint8[buffer_size]); - } -} - -media::VideoFrame::Format CapturerFakeAscii::pixel_format() const { - return pixel_format_; -} - -void CapturerFakeAscii::ClearInvalidRegion() { - helper_.ClearInvalidRegion(); -} - -void CapturerFakeAscii::InvalidateRegion(const SkRegion& invalid_region) { - helper_.InvalidateRegion(invalid_region); -} - -void CapturerFakeAscii::InvalidateScreen(const SkISize& size) { - helper_.InvalidateScreen(size); -} - -void CapturerFakeAscii::InvalidateFullScreen() { - helper_.InvalidateFullScreen(); -} - -void CapturerFakeAscii::CaptureInvalidRegion( - const CaptureCompletedCallback& callback) { - GenerateImage(); - DataPlanes planes; - planes.data[0] = buffers_[current_buffer_].get(); - current_buffer_ = (current_buffer_ + 1) % kNumBuffers; - planes.strides[0] = bytes_per_row_; - scoped_refptr<CaptureData> capture_data(new CaptureData( - planes, SkISize::Make(width_, height_), pixel_format_)); - - helper_.set_size_most_recent(capture_data->size()); - - callback.Run(capture_data); -} - -const SkISize& CapturerFakeAscii::size_most_recent() const { - return helper_.size_most_recent(); -} - -void CapturerFakeAscii::GenerateImage() { - for (int y = 0; y < height_; ++y) { - uint8* row = buffers_[current_buffer_].get() + bytes_per_row_ * y; - for (int x = 0; x < bytes_per_row_; ++x) { - if (y == 0 || x == 0 || x == (width_ - 1) || y == (height_ - 1)) { - row[x] = '*'; - } else { - row[x] = ' '; - } - } - } -} - -} // namespace remoting diff --git a/remoting/host/capturer_fake_ascii.h b/remoting/host/capturer_fake_ascii.h deleted file mode 100644 index 5559197..0000000 --- a/remoting/host/capturer_fake_ascii.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef REMOTING_HOST_CAPTURER_FAKE_ASCII_H_ -#define REMOTING_HOST_CAPTURER_FAKE_ASCII_H_ - -#include "base/memory/scoped_ptr.h" -#include "remoting/host/capturer.h" -#include "remoting/host/capturer_helper.h" - -namespace remoting { - -// A CapturerFakeAscii always outputs an image of 64x48 ASCII characters. -// This image is artificially generated for testing purpose. -// -// CapturerFakeAscii is doubled buffered as required by Capturer. See -// remoting/host/capturer.h. -class CapturerFakeAscii : public Capturer { - public: - CapturerFakeAscii(); - virtual ~CapturerFakeAscii(); - - // Capturer interface. - virtual void ScreenConfigurationChanged() OVERRIDE; - virtual media::VideoFrame::Format pixel_format() const OVERRIDE; - virtual void ClearInvalidRegion() OVERRIDE; - virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE; - virtual void InvalidateScreen(const SkISize& size) OVERRIDE; - virtual void InvalidateFullScreen() OVERRIDE; - virtual void CaptureInvalidRegion( - const CaptureCompletedCallback& callback) OVERRIDE; - virtual const SkISize& size_most_recent() const OVERRIDE; - - private: - // Generates an image in the front buffer. - void GenerateImage(); - - // The screen dimensions. - int width_; - int height_; - int bytes_per_row_; - - CapturerHelper helper_; - - // We have two buffers for the screen images as required by Capturer. - static const int kNumBuffers = 2; - scoped_array<uint8> buffers_[kNumBuffers]; - - // The current buffer with valid data for reading. - int current_buffer_; - - // Format of pixels returned in buffer. - media::VideoFrame::Format pixel_format_; - - DISALLOW_COPY_AND_ASSIGN(CapturerFakeAscii); -}; - -} // namespace remoting - -#endif // REMOTING_HOST_CAPTURER_FAKE_ASCII_H_ diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index bb2d586..2fe3b4e 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -971,8 +971,6 @@ '../media/media.gyp:media', ], 'sources': [ - 'host/capturer_fake_ascii.cc', - 'host/capturer_fake_ascii.h', 'host/continue_window.h', 'host/continue_window_mac.mm', 'host/continue_window_linux.cc', diff --git a/webkit/media/webvideoframe_impl.cc b/webkit/media/webvideoframe_impl.cc index 58cfa62..d6e178c 100644 --- a/webkit/media/webvideoframe_impl.cc +++ b/webkit/media/webvideoframe_impl.cc @@ -33,16 +33,10 @@ WebVideoFrameImpl::~WebVideoFrameImpl() {} int(media::VideoFrame::chromium_name), \ mismatching_enums) COMPILE_ASSERT_MATCHING_ENUM(FormatInvalid, INVALID); -COMPILE_ASSERT_MATCHING_ENUM(FormatRGB555, RGB555); -COMPILE_ASSERT_MATCHING_ENUM(FormatRGB565, RGB565); -COMPILE_ASSERT_MATCHING_ENUM(FormatRGB24, RGB24); COMPILE_ASSERT_MATCHING_ENUM(FormatRGB32, RGB32); -COMPILE_ASSERT_MATCHING_ENUM(FormatRGBA, RGBA); COMPILE_ASSERT_MATCHING_ENUM(FormatYV12, YV12); COMPILE_ASSERT_MATCHING_ENUM(FormatYV16, YV16); -COMPILE_ASSERT_MATCHING_ENUM(FormatNV12, NV12); COMPILE_ASSERT_MATCHING_ENUM(FormatEmpty, EMPTY); -COMPILE_ASSERT_MATCHING_ENUM(FormatASCII, ASCII); COMPILE_ASSERT_MATCHING_ENUM(FormatI420, I420); COMPILE_ASSERT_MATCHING_ENUM(FormatNativeTexture, NATIVE_TEXTURE); @@ -68,19 +62,13 @@ unsigned WebVideoFrameImpl::planes() const { if (!video_frame_.get()) return 0; switch (video_frame_->format()) { - case media::VideoFrame::RGB555: - case media::VideoFrame::RGB565: - case media::VideoFrame::RGB24: case media::VideoFrame::RGB32: - case media::VideoFrame::RGBA: return 1; case media::VideoFrame::YV12: case media::VideoFrame::YV16: return 3; case media::VideoFrame::INVALID: - case media::VideoFrame::NV12: case media::VideoFrame::EMPTY: - case media::VideoFrame::ASCII: case media::VideoFrame::I420: break; case media::VideoFrame::NATIVE_TEXTURE: |