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 "media/gpu/dxva_video_decode_accelerator_win.h" | 5 #include "media/gpu/dxva_video_decode_accelerator_win.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #if !defined(OS_WIN) | 9 #if !defined(OS_WIN) |
10 #error This file should only be built on Windows. | 10 #error This file should only be built on Windows. |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 UINT guid_count = 0; | 731 UINT guid_count = 0; |
732 base::win::ScopedCoMem<GUID> guids; | 732 base::win::ScopedCoMem<GUID> guids; |
733 hr = video_processor_service_->GetVideoProcessorDeviceGuids( | 733 hr = video_processor_service_->GetVideoProcessorDeviceGuids( |
734 &inputDesc, &guid_count, &guids); | 734 &inputDesc, &guid_count, &guids); |
735 RETURN_ON_HR_FAILURE(hr, "GetVideoProcessorDeviceGuids failed", false); | 735 RETURN_ON_HR_FAILURE(hr, "GetVideoProcessorDeviceGuids failed", false); |
736 | 736 |
737 for (UINT g = 0; g < guid_count; g++) { | 737 for (UINT g = 0; g < guid_count; g++) { |
738 DXVA2_VideoProcessorCaps caps; | 738 DXVA2_VideoProcessorCaps caps; |
739 hr = video_processor_service_->GetVideoProcessorCaps( | 739 hr = video_processor_service_->GetVideoProcessorCaps( |
740 guids[g], &inputDesc, D3DFMT_X8R8G8B8, &caps); | 740 guids[g], &inputDesc, D3DFMT_X8R8G8B8, &caps); |
741 if (hr) | 741 if (FAILED(hr)) |
742 continue; | 742 continue; |
743 | 743 |
744 if (!(caps.VideoProcessorOperations & DXVA2_VideoProcess_YUV2RGB)) | 744 if (!(caps.VideoProcessorOperations & DXVA2_VideoProcess_YUV2RGB)) |
745 continue; | 745 continue; |
746 | 746 |
747 base::win::ScopedCoMem<D3DFORMAT> formats; | 747 base::win::ScopedCoMem<D3DFORMAT> formats; |
748 UINT format_count = 0; | 748 UINT format_count = 0; |
749 hr = video_processor_service_->GetVideoProcessorRenderTargets( | 749 hr = video_processor_service_->GetVideoProcessorRenderTargets( |
750 guids[g], &inputDesc, &format_count, &formats); | 750 guids[g], &inputDesc, &format_count, &formats); |
751 if (hr) | 751 if (FAILED(hr)) |
752 continue; | 752 continue; |
753 | 753 |
754 UINT f; | 754 UINT f; |
755 for (f = 0; f < format_count; f++) { | 755 for (f = 0; f < format_count; f++) { |
756 if (formats[f] == D3DFMT_X8R8G8B8) { | 756 if (formats[f] == D3DFMT_X8R8G8B8) { |
757 break; | 757 break; |
758 } | 758 } |
759 } | 759 } |
760 if (f == format_count) | 760 if (f == format_count) |
761 continue; | 761 continue; |
762 | 762 |
763 // Create video processor | 763 // Create video processor |
764 hr = video_processor_service_->CreateVideoProcessor( | 764 hr = video_processor_service_->CreateVideoProcessor( |
765 guids[g], &inputDesc, D3DFMT_X8R8G8B8, 0, processor_.Receive()); | 765 guids[g], &inputDesc, D3DFMT_X8R8G8B8, 0, processor_.Receive()); |
766 if (hr) | 766 if (FAILED(hr)) |
767 continue; | 767 continue; |
768 | 768 |
769 DXVA2_ValueRange range; | 769 DXVA2_ValueRange range; |
770 processor_->GetProcAmpRange(DXVA2_ProcAmp_Brightness, &range); | 770 processor_->GetProcAmpRange(DXVA2_ProcAmp_Brightness, &range); |
771 default_procamp_values_.Brightness = range.DefaultValue; | 771 default_procamp_values_.Brightness = range.DefaultValue; |
772 processor_->GetProcAmpRange(DXVA2_ProcAmp_Contrast, &range); | 772 processor_->GetProcAmpRange(DXVA2_ProcAmp_Contrast, &range); |
773 default_procamp_values_.Contrast = range.DefaultValue; | 773 default_procamp_values_.Contrast = range.DefaultValue; |
774 processor_->GetProcAmpRange(DXVA2_ProcAmp_Hue, &range); | 774 processor_->GetProcAmpRange(DXVA2_ProcAmp_Hue, &range); |
775 default_procamp_values_.Hue = range.DefaultValue; | 775 default_procamp_values_.Hue = range.DefaultValue; |
776 processor_->GetProcAmpRange(DXVA2_ProcAmp_Saturation, &range); | 776 processor_->GetProcAmpRange(DXVA2_ProcAmp_Saturation, &range); |
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2924 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2924 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
2925 base::Unretained(this))); | 2925 base::Unretained(this))); |
2926 } | 2926 } |
2927 | 2927 |
2928 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { | 2928 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { |
2929 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; | 2929 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; |
2930 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; | 2930 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; |
2931 } | 2931 } |
2932 | 2932 |
2933 } // namespace media | 2933 } // namespace media |
OLD | NEW |