Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: webkit/media/crypto/ppapi/fake_cdm_video_decoder.cc

Issue 12212079: Update Cdm Wrapper and ClearKeyCdm to work with CDM interface version 4. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/media/crypto/ppapi/fake_cdm_video_decoder.h" 5 #include "webkit/media/crypto/ppapi/fake_cdm_video_decoder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "webkit/media/crypto/ppapi/cdm/content_decryption_module.h" 8 #include "webkit/media/crypto/ppapi/cdm/content_decryption_module.h"
9 9
10 namespace webkit_media { 10 namespace webkit_media {
11 11
12 FakeCdmVideoDecoder::FakeCdmVideoDecoder(cdm::Allocator* allocator) 12 FakeCdmVideoDecoder::FakeCdmVideoDecoder(cdm::Host* host)
13 : is_initialized_(false), 13 : is_initialized_(false),
14 allocator_(allocator) { 14 host_(host) {
15 } 15 }
16 16
17 FakeCdmVideoDecoder::~FakeCdmVideoDecoder() { 17 FakeCdmVideoDecoder::~FakeCdmVideoDecoder() {
18 Deinitialize(); 18 Deinitialize();
19 } 19 }
20 20
21 bool FakeCdmVideoDecoder::Initialize(const cdm::VideoDecoderConfig& config) { 21 bool FakeCdmVideoDecoder::Initialize(const cdm::VideoDecoderConfig& config) {
22 DVLOG(1) << "Initialize()"; 22 DVLOG(1) << "Initialize()";
23 23
24 video_size_ = config.coded_size; 24 video_size_ = config.coded_size;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 int y_stride = (width + kAlignment - 1) / kAlignment * kAlignment + kPadding; 60 int y_stride = (width + kAlignment - 1) / kAlignment * kAlignment + kPadding;
61 int uv_stride = 61 int uv_stride =
62 (width / 2 + kAlignment - 1) / kAlignment * kAlignment + kPadding; 62 (width / 2 + kAlignment - 1) / kAlignment * kAlignment + kPadding;
63 int y_rows = height; 63 int y_rows = height;
64 int uv_rows = height / 2; 64 int uv_rows = height / 2;
65 int y_offset = 0; 65 int y_offset = 0;
66 int v_offset = y_stride * y_rows + kPlanePadding; 66 int v_offset = y_stride * y_rows + kPlanePadding;
67 int u_offset = v_offset + uv_stride * uv_rows + kPlanePadding; 67 int u_offset = v_offset + uv_stride * uv_rows + kPlanePadding;
68 int frame_size = u_offset + uv_stride * uv_rows + kPlanePadding; 68 int frame_size = u_offset + uv_stride * uv_rows + kPlanePadding;
69 69
70 decoded_frame->SetFrameBuffer(allocator_->Allocate(frame_size)); 70 decoded_frame->SetFrameBuffer(host_->Allocate(frame_size));
71 decoded_frame->FrameBuffer()->SetSize(frame_size); 71 decoded_frame->FrameBuffer()->SetSize(frame_size);
72 72
73 decoded_frame->SetFormat(cdm::kYv12); 73 decoded_frame->SetFormat(cdm::kYv12);
74 decoded_frame->SetSize(video_size_); 74 decoded_frame->SetSize(video_size_);
75 decoded_frame->SetPlaneOffset(cdm::VideoFrame::kYPlane, y_offset); 75 decoded_frame->SetPlaneOffset(cdm::VideoFrame::kYPlane, y_offset);
76 decoded_frame->SetPlaneOffset(cdm::VideoFrame::kVPlane, v_offset); 76 decoded_frame->SetPlaneOffset(cdm::VideoFrame::kVPlane, v_offset);
77 decoded_frame->SetPlaneOffset(cdm::VideoFrame::kUPlane, u_offset); 77 decoded_frame->SetPlaneOffset(cdm::VideoFrame::kUPlane, u_offset);
78 decoded_frame->SetStride(cdm::VideoFrame::kYPlane, y_stride); 78 decoded_frame->SetStride(cdm::VideoFrame::kYPlane, y_stride);
79 decoded_frame->SetStride(cdm::VideoFrame::kVPlane, uv_stride); 79 decoded_frame->SetStride(cdm::VideoFrame::kVPlane, uv_stride);
80 decoded_frame->SetStride(cdm::VideoFrame::kUPlane, uv_stride); 80 decoded_frame->SetStride(cdm::VideoFrame::kUPlane, uv_stride);
81 decoded_frame->SetTimestamp(timestamp); 81 decoded_frame->SetTimestamp(timestamp);
82 82
83 static unsigned char color = 0; 83 static unsigned char color = 0;
84 color += 10; 84 color += 10;
85 85
86 memset(reinterpret_cast<void*>(decoded_frame->FrameBuffer()->Data()), 86 memset(reinterpret_cast<void*>(decoded_frame->FrameBuffer()->Data()),
87 color, frame_size); 87 color, frame_size);
88 88
89 return cdm::kSuccess; 89 return cdm::kSuccess;
90 } 90 }
91 91
92 } // namespace webkit_media 92 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/crypto/ppapi/fake_cdm_video_decoder.h ('k') | webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698