| 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/omx_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/omx_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 // This is to initialize the OMX data structures to default values. | 136 // This is to initialize the OMX data structures to default values. |
| 137 template <typename T> | 137 template <typename T> |
| 138 static void InitParam(const OmxVideoDecodeAccelerator& dec, T* param) { | 138 static void InitParam(const OmxVideoDecodeAccelerator& dec, T* param) { |
| 139 memset(param, 0, sizeof(T)); | 139 memset(param, 0, sizeof(T)); |
| 140 param->nVersion.nVersion = 0x00000101; | 140 param->nVersion.nVersion = 0x00000101; |
| 141 param->nSize = sizeof(T); | 141 param->nSize = sizeof(T); |
| 142 } | 142 } |
| 143 | 143 |
| 144 bool OmxVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile) { | 144 bool OmxVideoDecodeAccelerator::Initialize( |
| 145 media::VideoCodecProfile profile, |
| 146 const gfx::Size& frame_size, |
| 147 const std::vector<uint8_t>& extra_data) { |
| 145 DCHECK_EQ(message_loop_, MessageLoop::current()); | 148 DCHECK_EQ(message_loop_, MessageLoop::current()); |
| 146 | 149 |
| 147 RETURN_ON_FAILURE((profile >= media::H264PROFILE_MIN && | 150 RETURN_ON_FAILURE((profile >= media::H264PROFILE_MIN && |
| 148 profile <= media::H264PROFILE_MAX), | 151 profile <= media::H264PROFILE_MAX), |
| 149 "Only h264 supported", INVALID_ARGUMENT, false); | 152 "Only h264 supported", INVALID_ARGUMENT, false); |
| 150 profile_ = MapH264ProfileToOMXAVCProfile(profile); | 153 profile_ = MapH264ProfileToOMXAVCProfile(profile); |
| 151 RETURN_ON_FAILURE(profile_ != OMX_VIDEO_AVCProfileMax, | 154 RETURN_ON_FAILURE(profile_ != OMX_VIDEO_AVCProfileMax, |
| 152 "Unexpected profile", INVALID_ARGUMENT, false); | 155 "Unexpected profile", INVALID_ARGUMENT, false); |
| 153 | 156 |
| 154 if (!CreateComponent()) // Does its own RETURN_ON_FAILURE dances. | 157 if (!CreateComponent()) // Does its own RETURN_ON_FAILURE dances. |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 | 1051 |
| 1049 bool OmxVideoDecodeAccelerator::SendCommandToPort( | 1052 bool OmxVideoDecodeAccelerator::SendCommandToPort( |
| 1050 OMX_COMMANDTYPE cmd, int port_index) { | 1053 OMX_COMMANDTYPE cmd, int port_index) { |
| 1051 DCHECK_EQ(message_loop_, MessageLoop::current()); | 1054 DCHECK_EQ(message_loop_, MessageLoop::current()); |
| 1052 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, | 1055 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, |
| 1053 cmd, port_index, 0); | 1056 cmd, port_index, 0); |
| 1054 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd, | 1057 RETURN_ON_OMX_FAILURE(result, "SendCommand() failed" << cmd, |
| 1055 PLATFORM_FAILURE, false); | 1058 PLATFORM_FAILURE, false); |
| 1056 return true; | 1059 return true; |
| 1057 } | 1060 } |
| OLD | NEW |