OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/gpu/media_foundation_video_encode_accelerator_win.h" | 5 #include "media/gpu/media_foundation_video_encode_accelerator_win.h" |
6 | 6 |
7 #pragma warning(push) | 7 #pragma warning(push) |
8 #pragma warning(disable : 4800) // Disable warning for added padding. | 8 #pragma warning(disable : 4800) // Disable warning for added padding. |
9 | 9 |
10 #include <codecapi.h> | 10 #include <codecapi.h> |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 return false; | 330 return false; |
331 } | 331 } |
332 | 332 |
333 for (const wchar_t* mfdll : kMediaFoundationVideoEncoderDLLs) { | 333 for (const wchar_t* mfdll : kMediaFoundationVideoEncoderDLLs) { |
334 if (!::GetModuleHandle(mfdll)) { | 334 if (!::GetModuleHandle(mfdll)) { |
335 DVLOG(ERROR) << mfdll << " is required for encoding"; | 335 DVLOG(ERROR) << mfdll << " is required for encoding"; |
336 return false; | 336 return false; |
337 } | 337 } |
338 } | 338 } |
339 | 339 |
340 InitializeMediaFoundation(); | 340 if (!InitializeMediaFoundation()) |
| 341 return false; |
341 | 342 |
342 uint32_t flags = MFT_ENUM_FLAG_HARDWARE | MFT_ENUM_FLAG_SORTANDFILTER; | 343 uint32_t flags = MFT_ENUM_FLAG_HARDWARE | MFT_ENUM_FLAG_SORTANDFILTER; |
343 MFT_REGISTER_TYPE_INFO input_info; | 344 MFT_REGISTER_TYPE_INFO input_info; |
344 input_info.guidMajorType = MFMediaType_Video; | 345 input_info.guidMajorType = MFMediaType_Video; |
345 input_info.guidSubtype = MFVideoFormat_NV12; | 346 input_info.guidSubtype = MFVideoFormat_NV12; |
346 MFT_REGISTER_TYPE_INFO output_info; | 347 MFT_REGISTER_TYPE_INFO output_info; |
347 output_info.guidMajorType = MFMediaType_Video; | 348 output_info.guidMajorType = MFMediaType_Video; |
348 output_info.guidSubtype = MFVideoFormat_H264; | 349 output_info.guidSubtype = MFVideoFormat_H264; |
349 | 350 |
350 base::win::ScopedCoMem<CLSID> CLSIDs; | 351 base::win::ScopedCoMem<CLSID> CLSIDs; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 void MediaFoundationVideoEncodeAccelerator::ReleaseEncoderResources() { | 696 void MediaFoundationVideoEncodeAccelerator::ReleaseEncoderResources() { |
696 encoder_.Release(); | 697 encoder_.Release(); |
697 codec_api_.Release(); | 698 codec_api_.Release(); |
698 imf_input_media_type_.Release(); | 699 imf_input_media_type_.Release(); |
699 imf_output_media_type_.Release(); | 700 imf_output_media_type_.Release(); |
700 input_sample_.Release(); | 701 input_sample_.Release(); |
701 output_sample_.Release(); | 702 output_sample_.Release(); |
702 } | 703 } |
703 | 704 |
704 } // namespace content | 705 } // namespace content |
OLD | NEW |