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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
13 #include "ipc/ipc_channel.h" | 13 #include "ipc/ipc_listener.h" |
14 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_sender.h" |
15 #include "media/video/video_decode_accelerator.h" | 15 #include "media/video/video_decode_accelerator.h" |
16 | 16 |
17 class GpuCommandBufferStub; | 17 class GpuCommandBufferStub; |
18 | 18 |
19 class GpuVideoDecodeAccelerator | 19 class GpuVideoDecodeAccelerator |
20 : public IPC::Channel::Listener, | 20 : public IPC::Listener, |
21 public IPC::Message::Sender, | 21 public IPC::Sender, |
22 public media::VideoDecodeAccelerator::Client { | 22 public media::VideoDecodeAccelerator::Client { |
23 public: | 23 public: |
24 // Each of the arguments to the constructor must outlive this object. | 24 // Each of the arguments to the constructor must outlive this object. |
25 // |stub->decoder()| will be made current around any operation that touches | 25 // |stub->decoder()| will be made current around any operation that touches |
26 // the underlying VDA so that it can make GL calls safely. | 26 // the underlying VDA so that it can make GL calls safely. |
27 GpuVideoDecodeAccelerator(IPC::Message::Sender* sender, | 27 GpuVideoDecodeAccelerator(IPC::Sender* sender, |
28 int32 host_route_id, | 28 int32 host_route_id, |
29 GpuCommandBufferStub* stub); | 29 GpuCommandBufferStub* stub); |
30 virtual ~GpuVideoDecodeAccelerator(); | 30 virtual ~GpuVideoDecodeAccelerator(); |
31 | 31 |
32 // IPC::Channel::Listener implementation. | 32 // IPC::Listener implementation. |
33 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 33 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
34 | 34 |
35 // media::VideoDecodeAccelerator::Client implementation. | 35 // media::VideoDecodeAccelerator::Client implementation. |
36 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | 36 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, |
37 const gfx::Size& dimensions, | 37 const gfx::Size& dimensions, |
38 uint32 texture_target) OVERRIDE; | 38 uint32 texture_target) OVERRIDE; |
39 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; | 39 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; |
40 virtual void PictureReady(const media::Picture& picture) OVERRIDE; | 40 virtual void PictureReady(const media::Picture& picture) OVERRIDE; |
41 virtual void NotifyInitializeDone() OVERRIDE; | 41 virtual void NotifyInitializeDone() OVERRIDE; |
42 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; | 42 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; |
(...skipping 18 matching lines...) Expand all Loading... |
61 const std::vector<int32>& buffer_ids, | 61 const std::vector<int32>& buffer_ids, |
62 const std::vector<uint32>& texture_ids, | 62 const std::vector<uint32>& texture_ids, |
63 const std::vector<gfx::Size>& sizes); | 63 const std::vector<gfx::Size>& sizes); |
64 void OnReusePictureBuffer( | 64 void OnReusePictureBuffer( |
65 int32 picture_buffer_id); | 65 int32 picture_buffer_id); |
66 void OnFlush(); | 66 void OnFlush(); |
67 void OnReset(); | 67 void OnReset(); |
68 void OnDestroy(); | 68 void OnDestroy(); |
69 | 69 |
70 // Pointer to the IPC message sender. | 70 // Pointer to the IPC message sender. |
71 IPC::Message::Sender* sender_; | 71 IPC::Sender* sender_; |
72 | 72 |
73 // Message to Send() when initialization is done. Is only non-NULL during | 73 // Message to Send() when initialization is done. Is only non-NULL during |
74 // initialization and is owned by the IPC channel underlying the | 74 // initialization and is owned by the IPC channel underlying the |
75 // GpuCommandBufferStub. | 75 // GpuCommandBufferStub. |
76 IPC::Message* init_done_msg_; | 76 IPC::Message* init_done_msg_; |
77 | 77 |
78 // Route ID to communicate with the host. | 78 // Route ID to communicate with the host. |
79 int32 host_route_id_; | 79 int32 host_route_id_; |
80 | 80 |
81 // Unowned pointer to the underlying GpuCommandBufferStub. | 81 // Unowned pointer to the underlying GpuCommandBufferStub. |
82 GpuCommandBufferStub* stub_; | 82 GpuCommandBufferStub* stub_; |
83 | 83 |
84 // Pointer to the underlying VideoDecodeAccelerator. | 84 // Pointer to the underlying VideoDecodeAccelerator. |
85 scoped_refptr<media::VideoDecodeAccelerator> video_decode_accelerator_; | 85 scoped_refptr<media::VideoDecodeAccelerator> video_decode_accelerator_; |
86 | 86 |
87 // Callback for making the relevant context current for GL calls. | 87 // Callback for making the relevant context current for GL calls. |
88 // Returns false if failed. | 88 // Returns false if failed. |
89 base::Callback<bool(void)> make_context_current_; | 89 base::Callback<bool(void)> make_context_current_; |
90 | 90 |
91 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); | 91 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); |
92 }; | 92 }; |
93 | 93 |
94 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 94 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |