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

Side by Side Diff: content/common/gpu/media/mac_video_decode_accelerator.mm

Issue 10408003: Plumb extra_data() to VideoDecodeAccelerator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rev interface versino Created 8 years, 7 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 "content/common/gpu/media/mac_video_decode_accelerator.h" 5 #include "content/common/gpu/media/mac_video_decode_accelerator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #import "base/mac/foundation_util.h" 9 #import "base/mac/foundation_util.h"
10 #import "base/memory/ref_counted_memory.h" 10 #import "base/memory/ref_counted_memory.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 nalu_len_field_size_(0), 88 nalu_len_field_size_(0),
89 frame_width_(0), 89 frame_width_(0),
90 frame_height_(0), 90 frame_height_(0),
91 did_request_pictures_(false) { 91 did_request_pictures_(false) {
92 } 92 }
93 93
94 void MacVideoDecodeAccelerator::SetGLContext(void* gl_context) { 94 void MacVideoDecodeAccelerator::SetGLContext(void* gl_context) {
95 cgl_context_ = static_cast<CGLContextObj>(gl_context); 95 cgl_context_ = static_cast<CGLContextObj>(gl_context);
96 } 96 }
97 97
98 bool MacVideoDecodeAccelerator::SetConfigInfo( 98 bool MacVideoDecodeAccelerator::Initialize(
99 uint32_t frame_width, 99 media::VideoCodecProfile profile,
100 uint32_t frame_height, 100 const gfx::Size& frame_size,
101 const std::vector<uint8_t>& avc_data) { 101 const std::vector<uint8_t>& extra_data) {
102 frame_width_ = frame_width; 102 if (extra_data.size() < 5)
103 frame_height_ = frame_height; 103 return false;
104 nalu_len_field_size_ = (avc_data[4] & 0x03) + 1; 104
105 frame_width_ = frame_size.width();
106 frame_height_ = frame_size.height();
107 nalu_len_field_size_ = (extra_data[4] & 0x03) + 1;
105 108
106 DCHECK(!vda_.get()); 109 DCHECK(!vda_.get());
107 vda_ = new gfx::VideoDecodeAccelerationSupport(); 110 vda_ = new gfx::VideoDecodeAccelerationSupport();
108 gfx::VideoDecodeAccelerationSupport::Status status = vda_->Create( 111 gfx::VideoDecodeAccelerationSupport::Status status = vda_->Create(
109 frame_width_, frame_height_, 112 frame_width_, frame_height_,
110 kCVPixelFormatType_422YpCbCr8, &avc_data.front(), avc_data.size()); 113 kCVPixelFormatType_422YpCbCr8, &extra_data.front(), extra_data.size());
111 if (status != gfx::VideoDecodeAccelerationSupport::VDA_SUCCESS) 114 if (status != gfx::VideoDecodeAccelerationSupport::VDA_SUCCESS)
112 return false; 115 return false;
113 return true;
114 }
115 116
116 bool MacVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile) {
117 if (client_) 117 if (client_)
118 client_->NotifyInitializeDone(); 118 client_->NotifyInitializeDone();
119 return true; 119 return true;
120 } 120 }
121 121
122 void MacVideoDecodeAccelerator::Decode( 122 void MacVideoDecodeAccelerator::Decode(
123 const media::BitstreamBuffer& bitstream_buffer) { 123 const media::BitstreamBuffer& bitstream_buffer) {
124 base::SharedMemory memory(bitstream_buffer.handle(), true); 124 base::SharedMemory memory(bitstream_buffer.handle(), true);
125 if (!memory.Map(bitstream_buffer.size())) { 125 if (!memory.Map(bitstream_buffer.size())) {
126 CHECK(false); 126 CHECK(false);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 263 }
264 264
265 MacVideoDecodeAccelerator::PendingPictureInfo::~PendingPictureInfo() { 265 MacVideoDecodeAccelerator::PendingPictureInfo::~PendingPictureInfo() {
266 } 266 }
267 267
268 MacVideoDecodeAccelerator::DecodedImageInfo::DecodedImageInfo() { 268 MacVideoDecodeAccelerator::DecodedImageInfo::DecodedImageInfo() {
269 } 269 }
270 270
271 MacVideoDecodeAccelerator::DecodedImageInfo::~DecodedImageInfo() { 271 MacVideoDecodeAccelerator::DecodedImageInfo::~DecodedImageInfo() {
272 } 272 }
OLDNEW
« no previous file with comments | « content/common/gpu/media/mac_video_decode_accelerator.h ('k') | content/common/gpu/media/omx_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698