OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; | 38 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; |
39 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; | 39 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; |
40 virtual void NotifyFlushDone() OVERRIDE; | 40 virtual void NotifyFlushDone() OVERRIDE; |
41 virtual void NotifyAbortDone() OVERRIDE; | 41 virtual void NotifyAbortDone() OVERRIDE; |
42 | 42 |
43 // Function to delegate sending to actual sender. | 43 // Function to delegate sending to actual sender. |
44 virtual bool Send(IPC::Message* message); | 44 virtual bool Send(IPC::Message* message); |
45 | 45 |
46 void set_video_decode_accelerator( | 46 void set_video_decode_accelerator( |
47 media::VideoDecodeAccelerator* accelerator) { | 47 media::VideoDecodeAccelerator* accelerator) { |
48 video_decode_accelerator_ = accelerator; | 48 DCHECK(!video_decode_accelerator_.get()); |
| 49 video_decode_accelerator_.reset(accelerator); |
49 } | 50 } |
50 | 51 |
51 private: | 52 private: |
52 // Handlers for IPC messages. | 53 // Handlers for IPC messages. |
53 void OnGetConfigs(const std::vector<uint32>& config, | 54 void OnGetConfigs(const std::vector<uint32>& config, |
54 std::vector<uint32>* configs); | 55 std::vector<uint32>* configs); |
55 void OnInitialize(const std::vector<uint32>& configs); | 56 void OnInitialize(const std::vector<uint32>& configs); |
56 void OnDecode(int32 id, base::SharedMemoryHandle handle, int32 size); | 57 void OnDecode(int32 id, base::SharedMemoryHandle handle, int32 size); |
57 void OnAssignGLESBuffers(const std::vector<int32> buffer_ids, | 58 void OnAssignGLESBuffers(const std::vector<int32> buffer_ids, |
58 const std::vector<uint32> texture_ids, | 59 const std::vector<uint32> texture_ids, |
59 const std::vector<uint32> context_ids, | 60 const std::vector<uint32> context_ids, |
60 const std::vector<gfx::Size> sizes); | 61 const std::vector<gfx::Size> sizes); |
61 void OnAssignSysmemBuffers(const std::vector<int32> buffer_ids, | 62 void OnAssignSysmemBuffers(const std::vector<int32> buffer_ids, |
62 const std::vector<base::SharedMemoryHandle> data, | 63 const std::vector<base::SharedMemoryHandle> data, |
63 const std::vector<gfx::Size> sizes); | 64 const std::vector<gfx::Size> sizes); |
64 void OnReusePictureBuffer(int32 picture_buffer_id); | 65 void OnReusePictureBuffer(int32 picture_buffer_id); |
65 void OnFlush(); | 66 void OnFlush(); |
66 void OnAbort(); | 67 void OnAbort(); |
67 | 68 |
68 // Pointer to the IPC message sender. | 69 // Pointer to the IPC message sender. |
69 IPC::Message::Sender* sender_; | 70 IPC::Message::Sender* sender_; |
70 | 71 |
71 // Route ID to communicate with the host. | 72 // Route ID to communicate with the host. |
72 int32 route_id_; | 73 int32 route_id_; |
73 | 74 |
74 // Pointer to the underlying VideoDecodeAccelerator. | 75 // Pointer to the underlying VideoDecodeAccelerator. |
75 media::VideoDecodeAccelerator* video_decode_accelerator_; | 76 scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_; |
76 | 77 |
77 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); | 78 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); |
78 }; | 79 }; |
79 | 80 |
80 #endif // CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 81 #endif // CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |