| 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 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 public GpuCommandBufferStub::DestructionObserver { | 31 public GpuCommandBufferStub::DestructionObserver { |
| 32 public: | 32 public: |
| 33 // Each of the arguments to the constructor must outlive this object. | 33 // Each of the arguments to the constructor must outlive this object. |
| 34 // |stub->decoder()| will be made current around any operation that touches | 34 // |stub->decoder()| will be made current around any operation that touches |
| 35 // the underlying VDA so that it can make GL calls safely. | 35 // the underlying VDA so that it can make GL calls safely. |
| 36 GpuVideoDecodeAccelerator( | 36 GpuVideoDecodeAccelerator( |
| 37 int32 host_route_id, | 37 int32 host_route_id, |
| 38 GpuCommandBufferStub* stub, | 38 GpuCommandBufferStub* stub, |
| 39 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 39 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
| 40 | 40 |
| 41 // Static query for supported profiles. This query calls the appropriate |
| 42 // platform-specific version. The returned supported profiles vector will |
| 43 // not contain duplicates. |
| 44 static gpu::VideoDecodeAcceleratorSupportedProfiles GetSupportedProfiles(); |
| 45 |
| 41 // IPC::Listener implementation. | 46 // IPC::Listener implementation. |
| 42 bool OnMessageReceived(const IPC::Message& message) override; | 47 bool OnMessageReceived(const IPC::Message& message) override; |
| 43 | 48 |
| 44 // media::VideoDecodeAccelerator::Client implementation. | 49 // media::VideoDecodeAccelerator::Client implementation. |
| 50 void NotifyCdmAttached(bool success) override; |
| 45 void ProvidePictureBuffers(uint32 requested_num_of_buffers, | 51 void ProvidePictureBuffers(uint32 requested_num_of_buffers, |
| 46 const gfx::Size& dimensions, | 52 const gfx::Size& dimensions, |
| 47 uint32 texture_target) override; | 53 uint32 texture_target) override; |
| 48 void DismissPictureBuffer(int32 picture_buffer_id) override; | 54 void DismissPictureBuffer(int32 picture_buffer_id) override; |
| 49 void PictureReady(const media::Picture& picture) override; | 55 void PictureReady(const media::Picture& picture) override; |
| 50 void NotifyError(media::VideoDecodeAccelerator::Error error) override; | |
| 51 void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) override; | 56 void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) override; |
| 52 void NotifyFlushDone() override; | 57 void NotifyFlushDone() override; |
| 53 void NotifyResetDone() override; | 58 void NotifyResetDone() override; |
| 59 void NotifyError(media::VideoDecodeAccelerator::Error error) override; |
| 54 | 60 |
| 55 // GpuCommandBufferStub::DestructionObserver implementation. | 61 // GpuCommandBufferStub::DestructionObserver implementation. |
| 56 void OnWillDestroyStub() override; | 62 void OnWillDestroyStub() override; |
| 57 | 63 |
| 58 // Function to delegate sending to actual sender. | 64 // Function to delegate sending to actual sender. |
| 59 bool Send(IPC::Message* message) override; | 65 bool Send(IPC::Message* message) override; |
| 60 | 66 |
| 61 // Initialize VDAs from the set of VDAs supported for current platform until | 67 // Initialize VDAs from the set of VDAs supported for current platform until |
| 62 // one of them succeeds for given |profile|. Send the |init_done_msg| when | 68 // one of them succeeds for given |profile|. Send the |init_done_msg| when |
| 63 // done. filter_ is passed to GpuCommandBufferStub channel only if the chosen | 69 // done. filter_ is passed to GpuCommandBufferStub channel only if the chosen |
| 64 // VDA can decode on IO thread. | 70 // VDA can decode on IO thread. |
| 65 void Initialize(const media::VideoCodecProfile profile, | 71 void Initialize(const media::VideoCodecProfile profile, |
| 66 IPC::Message* init_done_msg); | 72 IPC::Message* init_done_msg); |
| 67 | 73 |
| 68 // Static query for supported profiles. This query calls the appropriate | |
| 69 // platform-specific version. The returned supported profiles vector will | |
| 70 // not contain duplicates. | |
| 71 static gpu::VideoDecodeAcceleratorSupportedProfiles GetSupportedProfiles(); | |
| 72 | |
| 73 private: | 74 private: |
| 74 typedef scoped_ptr<media::VideoDecodeAccelerator>( | 75 typedef scoped_ptr<media::VideoDecodeAccelerator>( |
| 75 GpuVideoDecodeAccelerator::*CreateVDAFp)(); | 76 GpuVideoDecodeAccelerator::*CreateVDAFp)(); |
| 76 | 77 |
| 77 class MessageFilter; | 78 class MessageFilter; |
| 78 | 79 |
| 79 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); | 80 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); |
| 80 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA(); | 81 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA(); |
| 81 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA(); | 82 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA(); |
| 82 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(); | 83 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA(); |
| 83 scoped_ptr<media::VideoDecodeAccelerator> CreateVTVDA(); | 84 scoped_ptr<media::VideoDecodeAccelerator> CreateVTVDA(); |
| 84 scoped_ptr<media::VideoDecodeAccelerator> CreateOzoneVDA(); | 85 scoped_ptr<media::VideoDecodeAccelerator> CreateOzoneVDA(); |
| 85 scoped_ptr<media::VideoDecodeAccelerator> CreateAndroidVDA(); | 86 scoped_ptr<media::VideoDecodeAccelerator> CreateAndroidVDA(); |
| 86 | 87 |
| 87 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there. | 88 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there. |
| 88 ~GpuVideoDecodeAccelerator() override; | 89 ~GpuVideoDecodeAccelerator() override; |
| 89 | 90 |
| 90 // Handlers for IPC messages. | 91 // Handlers for IPC messages. |
| 92 void OnSetCdm(int cdm_id); |
| 91 void OnDecode(const AcceleratedVideoDecoderMsg_Decode_Params& params); | 93 void OnDecode(const AcceleratedVideoDecoderMsg_Decode_Params& params); |
| 92 void OnAssignPictureBuffers(const std::vector<int32>& buffer_ids, | 94 void OnAssignPictureBuffers(const std::vector<int32>& buffer_ids, |
| 93 const std::vector<uint32>& texture_ids); | 95 const std::vector<uint32>& texture_ids); |
| 94 void OnReusePictureBuffer(int32 picture_buffer_id); | 96 void OnReusePictureBuffer(int32 picture_buffer_id); |
| 95 void OnFlush(); | 97 void OnFlush(); |
| 96 void OnReset(); | 98 void OnReset(); |
| 97 void OnDestroy(); | 99 void OnDestroy(); |
| 98 | 100 |
| 99 // Called on IO thread when |filter_| has been removed. | 101 // Called on IO thread when |filter_| has been removed. |
| 100 void OnFilterRemoved(); | 102 void OnFilterRemoved(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 156 |
| 155 // A map from picture buffer ID to TextureRef that have not been cleared. | 157 // A map from picture buffer ID to TextureRef that have not been cleared. |
| 156 std::map<int32, scoped_refptr<gpu::gles2::TextureRef> > uncleared_textures_; | 158 std::map<int32, scoped_refptr<gpu::gles2::TextureRef> > uncleared_textures_; |
| 157 | 159 |
| 158 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); | 160 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); |
| 159 }; | 161 }; |
| 160 | 162 |
| 161 } // namespace content | 163 } // namespace content |
| 162 | 164 |
| 163 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 165 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |