OLD | NEW |
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 GL_UNSIGNED_SHORT_8_8_APPLE, | 86 GL_UNSIGNED_SHORT_8_8_APPLE, |
87 io_surface, | 87 io_surface, |
88 0) != kCGLNoError) { | 88 0) != kCGLNoError) { |
89 DVLOG(1) << "Failed to bind image to texture."; | 89 DVLOG(1) << "Failed to bind image to texture."; |
90 return false; | 90 return false; |
91 } | 91 } |
92 return glGetError() == GL_NO_ERROR; | 92 return glGetError() == GL_NO_ERROR; |
93 } | 93 } |
94 | 94 |
95 MacVideoDecodeAccelerator::MacVideoDecodeAccelerator( | 95 MacVideoDecodeAccelerator::MacVideoDecodeAccelerator( |
96 media::VideoDecodeAccelerator::Client* client) | 96 CGLContextObj cgl_context, media::VideoDecodeAccelerator::Client* client) |
97 : client_(client), | 97 : client_(client), |
98 cgl_context_(NULL), | 98 cgl_context_(cgl_context), |
99 did_build_config_record_(false) { | 99 did_build_config_record_(false) { |
100 } | 100 } |
101 | 101 |
102 void MacVideoDecodeAccelerator::SetCGLContext(CGLContextObj cgl_context) { | |
103 DCHECK(CalledOnValidThread()); | |
104 cgl_context_ = cgl_context; | |
105 } | |
106 | |
107 bool MacVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile) { | 102 bool MacVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile) { |
108 DCHECK(CalledOnValidThread()); | 103 DCHECK(CalledOnValidThread()); |
109 | 104 |
110 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); | 105 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); |
111 if (!io_surface_support) | 106 if (!io_surface_support) |
112 return false; | 107 return false; |
113 | 108 |
114 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 109 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
115 &MacVideoDecodeAccelerator::NotifyInitializeDone, base::AsWeakPtr(this))); | 110 &MacVideoDecodeAccelerator::NotifyInitializeDone, base::AsWeakPtr(this))); |
116 return true; | 111 return true; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 } | 368 } |
374 | 369 |
375 MacVideoDecodeAccelerator::UsedPictureInfo::~UsedPictureInfo() { | 370 MacVideoDecodeAccelerator::UsedPictureInfo::~UsedPictureInfo() { |
376 } | 371 } |
377 | 372 |
378 MacVideoDecodeAccelerator::DecodedImageInfo::DecodedImageInfo() { | 373 MacVideoDecodeAccelerator::DecodedImageInfo::DecodedImageInfo() { |
379 } | 374 } |
380 | 375 |
381 MacVideoDecodeAccelerator::DecodedImageInfo::~DecodedImageInfo() { | 376 MacVideoDecodeAccelerator::DecodedImageInfo::~DecodedImageInfo() { |
382 } | 377 } |
OLD | NEW |