| 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_win.h" | 5 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 } | 624 } |
| 625 | 625 |
| 626 bool DXVAVideoDecodeAccelerator::DXVAPictureBuffer::CopySurfaceComplete( | 626 bool DXVAVideoDecodeAccelerator::DXVAPictureBuffer::CopySurfaceComplete( |
| 627 IDirect3DSurface9* src_surface, | 627 IDirect3DSurface9* src_surface, |
| 628 IDirect3DSurface9* dest_surface) { | 628 IDirect3DSurface9* dest_surface) { |
| 629 DCHECK(!available()); | 629 DCHECK(!available()); |
| 630 | 630 |
| 631 GLint current_texture = 0; | 631 GLint current_texture = 0; |
| 632 glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture); | 632 glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture); |
| 633 | 633 |
| 634 glBindTexture(GL_TEXTURE_2D, picture_buffer_.texture_id()); | 634 glBindTexture(GL_TEXTURE_2D, picture_buffer_.texture_ids().ids[0]); |
| 635 | 635 |
| 636 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 636 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 637 | 637 |
| 638 if (src_surface && dest_surface) { | 638 if (src_surface && dest_surface) { |
| 639 DCHECK_EQ(src_surface, decoder_surface_.get()); | 639 DCHECK_EQ(src_surface, decoder_surface_.get()); |
| 640 DCHECK_EQ(dest_surface, target_surface_.get()); | 640 DCHECK_EQ(dest_surface, target_surface_.get()); |
| 641 decoder_surface_.Release(); | 641 decoder_surface_.Release(); |
| 642 target_surface_.Release(); | 642 target_surface_.Release(); |
| 643 } else { | 643 } else { |
| 644 DCHECK(decoder_dx11_texture_.get()); | 644 DCHECK(decoder_dx11_texture_.get()); |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1723 void DXVAVideoDecodeAccelerator::NotifyResetDone() { | 1723 void DXVAVideoDecodeAccelerator::NotifyResetDone() { |
| 1724 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 1724 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 1725 if (client_) | 1725 if (client_) |
| 1726 client_->NotifyResetDone(); | 1726 client_->NotifyResetDone(); |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 void DXVAVideoDecodeAccelerator::RequestPictureBuffers(int width, int height) { | 1729 void DXVAVideoDecodeAccelerator::RequestPictureBuffers(int width, int height) { |
| 1730 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 1730 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 1731 // This task could execute after the decoder has been torn down. | 1731 // This task could execute after the decoder has been torn down. |
| 1732 if (GetState() != kUninitialized && client_) { | 1732 if (GetState() != kUninitialized && client_) { |
| 1733 client_->ProvidePictureBuffers( | 1733 client_->ProvidePictureBuffers(kNumPictureBuffers, 1, |
| 1734 kNumPictureBuffers, | 1734 gfx::Size(width, height), GL_TEXTURE_2D); |
| 1735 gfx::Size(width, height), | |
| 1736 GL_TEXTURE_2D); | |
| 1737 } | 1735 } |
| 1738 } | 1736 } |
| 1739 | 1737 |
| 1740 void DXVAVideoDecodeAccelerator::NotifyPictureReady( | 1738 void DXVAVideoDecodeAccelerator::NotifyPictureReady( |
| 1741 int picture_buffer_id, | 1739 int picture_buffer_id, |
| 1742 int input_buffer_id) { | 1740 int input_buffer_id) { |
| 1743 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 1741 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 1744 // This task could execute after the decoder has been torn down. | 1742 // This task could execute after the decoder has been torn down. |
| 1745 if (GetState() != kUninitialized && client_) { | 1743 if (GetState() != kUninitialized && client_) { |
| 1746 // TODO(henryhsu): Use correct visible size instead of (0, 0). We can't use | 1744 // TODO(henryhsu): Use correct visible size instead of (0, 0). We can't use |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2448 hr = transform->SetOutputType(0, media_type.get(), 0); // No flags | 2446 hr = transform->SetOutputType(0, media_type.get(), 0); // No flags |
| 2449 RETURN_ON_HR_FAILURE(hr, "Failed to set output type", false); | 2447 RETURN_ON_HR_FAILURE(hr, "Failed to set output type", false); |
| 2450 return true; | 2448 return true; |
| 2451 } | 2449 } |
| 2452 media_type.Release(); | 2450 media_type.Release(); |
| 2453 } | 2451 } |
| 2454 return false; | 2452 return false; |
| 2455 } | 2453 } |
| 2456 | 2454 |
| 2457 } // namespace content | 2455 } // namespace content |
| OLD | NEW |