| 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/dxva_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #if !defined(OS_WIN) | 7 #if !defined(OS_WIN) |
| 8 #error This file should only be built on Windows. | 8 #error This file should only be built on Windows. |
| 9 #endif // !defined(OS_WIN) | 9 #endif // !defined(OS_WIN) |
| 10 | 10 |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 } | 751 } |
| 752 | 752 |
| 753 bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { | 753 bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { |
| 754 return false; | 754 return false; |
| 755 } | 755 } |
| 756 | 756 |
| 757 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { | 757 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { |
| 758 return GL_BGRA_EXT; | 758 return GL_BGRA_EXT; |
| 759 } | 759 } |
| 760 | 760 |
| 761 // static |
| 762 media::VideoDecodeAccelerator::SupportedResolution |
| 763 DXVAVideoDecodeAccelerator::GetSupportedResolution() { |
| 764 media::VideoDecodeAccelerator::SupportedResolution resolution; |
| 765 // Windows Media Foundation H.264 decoding does not support decoding videos |
| 766 // with any dimension smaller than 48 pixels: |
| 767 // http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815 |
| 768 resolution.min.SetSize(48, 48); |
| 769 // Use 1088 to account for 16x16 macroblocks. |
| 770 resolution.max.SetSize(1920, 1088); |
| 771 return resolution; |
| 772 } |
| 773 |
| 761 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { | 774 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { |
| 762 HMODULE decoder_dll = NULL; | 775 HMODULE decoder_dll = NULL; |
| 763 | 776 |
| 764 // Profile must fall within the valid range for one of the supported codecs. | 777 // Profile must fall within the valid range for one of the supported codecs. |
| 765 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { | 778 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { |
| 766 // We mimic the steps CoCreateInstance uses to instantiate the object. This | 779 // We mimic the steps CoCreateInstance uses to instantiate the object. This |
| 767 // was previously done because it failed inside the sandbox, and now is done | 780 // was previously done because it failed inside the sandbox, and now is done |
| 768 // as a more minimal approach to avoid other side-effects CCI might have (as | 781 // as a more minimal approach to avoid other side-effects CCI might have (as |
| 769 // we are still in a reduced sandbox). | 782 // we are still in a reduced sandbox). |
| 770 decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); | 783 decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 FROM_HERE, | 1637 FROM_HERE, |
| 1625 base::Bind(&DXVAVideoDecodeAccelerator::CopySurfaceComplete, | 1638 base::Bind(&DXVAVideoDecodeAccelerator::CopySurfaceComplete, |
| 1626 weak_this_factory_.GetWeakPtr(), | 1639 weak_this_factory_.GetWeakPtr(), |
| 1627 src_surface, | 1640 src_surface, |
| 1628 dest_surface, | 1641 dest_surface, |
| 1629 picture_buffer_id, | 1642 picture_buffer_id, |
| 1630 input_buffer_id)); | 1643 input_buffer_id)); |
| 1631 } | 1644 } |
| 1632 | 1645 |
| 1633 } // namespace content | 1646 } // namespace content |
| OLD | NEW |