| 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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 753 } |
| 754 | 754 |
| 755 bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { | 755 bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { |
| 756 return false; | 756 return false; |
| 757 } | 757 } |
| 758 | 758 |
| 759 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { | 759 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { |
| 760 return GL_BGRA_EXT; | 760 return GL_BGRA_EXT; |
| 761 } | 761 } |
| 762 | 762 |
| 763 // static |
| 764 media::VideoDecodeAccelerator::SupportedResolution |
| 765 DXVAVideoDecodeAccelerator::GetSupportedResolution() { |
| 766 media::VideoDecodeAccelerator::SupportedResolution resolution; |
| 767 // Windows Media Foundation H.264 decoding does not support decoding videos |
| 768 // with any dimension smaller than 48 pixels: |
| 769 // http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815 |
| 770 resolution.min.SetSize(48, 48); |
| 771 // Use 1088 to account for 16x16 macroblocks. |
| 772 resolution.max.SetSize(1920, 1088); |
| 773 return resolution; |
| 774 } |
| 775 |
| 763 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { | 776 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { |
| 764 HMODULE decoder_dll = NULL; | 777 HMODULE decoder_dll = NULL; |
| 765 | 778 |
| 766 // Profile must fall within the valid range for one of the supported codecs. | 779 // Profile must fall within the valid range for one of the supported codecs. |
| 767 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { | 780 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { |
| 768 // We mimic the steps CoCreateInstance uses to instantiate the object. This | 781 // We mimic the steps CoCreateInstance uses to instantiate the object. This |
| 769 // was previously done because it failed inside the sandbox, and now is done | 782 // was previously done because it failed inside the sandbox, and now is done |
| 770 // as a more minimal approach to avoid other side-effects CCI might have (as | 783 // as a more minimal approach to avoid other side-effects CCI might have (as |
| 771 // we are still in a reduced sandbox). | 784 // we are still in a reduced sandbox). |
| 772 decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); | 785 decoder_dll = ::LoadLibrary(L"msmpeg2vdec.dll"); |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1614 FROM_HERE, | 1627 FROM_HERE, |
| 1615 base::Bind(&DXVAVideoDecodeAccelerator::CopySurfaceComplete, | 1628 base::Bind(&DXVAVideoDecodeAccelerator::CopySurfaceComplete, |
| 1616 weak_this_factory_.GetWeakPtr(), | 1629 weak_this_factory_.GetWeakPtr(), |
| 1617 src_surface, | 1630 src_surface, |
| 1618 dest_surface, | 1631 dest_surface, |
| 1619 picture_buffer_id, | 1632 picture_buffer_id, |
| 1620 input_buffer_id)); | 1633 input_buffer_id)); |
| 1621 } | 1634 } |
| 1622 | 1635 |
| 1623 } // namespace content | 1636 } // namespace content |
| OLD | NEW |