OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXYNOS_VIDEO_ENCODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_ENCODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_ENCODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_ENCODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 namespace content { | 30 namespace content { |
31 | 31 |
32 // This class handles Exynos video encode acceleration by interfacing with the | 32 // This class handles Exynos video encode acceleration by interfacing with the |
33 // V4L2 devices exported by the Multi Format Codec and GScaler hardware blocks | 33 // V4L2 devices exported by the Multi Format Codec and GScaler hardware blocks |
34 // on the Exynos platform. The threading model of this class is the same as the | 34 // on the Exynos platform. The threading model of this class is the same as the |
35 // ExynosVideoDecodeAccelerator (from which class this was designed). | 35 // ExynosVideoDecodeAccelerator (from which class this was designed). |
36 class CONTENT_EXPORT ExynosVideoEncodeAccelerator | 36 class CONTENT_EXPORT ExynosVideoEncodeAccelerator |
37 : public media::VideoEncodeAccelerator { | 37 : public media::VideoEncodeAccelerator { |
38 public: | 38 public: |
39 explicit ExynosVideoEncodeAccelerator( | 39 ExynosVideoEncodeAccelerator(); |
40 media::VideoEncodeAccelerator::Client* client); | |
41 virtual ~ExynosVideoEncodeAccelerator(); | 40 virtual ~ExynosVideoEncodeAccelerator(); |
42 | 41 |
43 // media::VideoEncodeAccelerator implementation. | 42 // media::VideoEncodeAccelerator implementation. |
44 virtual void Initialize(media::VideoFrame::Format format, | 43 virtual void Initialize(media::VideoFrame::Format format, |
45 const gfx::Size& input_visible_size, | 44 const gfx::Size& input_visible_size, |
46 media::VideoCodecProfile output_profile, | 45 media::VideoCodecProfile output_profile, |
47 uint32 initial_bitrate) OVERRIDE; | 46 uint32 initial_bitrate, |
| 47 Client* client) OVERRIDE; |
48 virtual void Encode(const scoped_refptr<media::VideoFrame>& frame, | 48 virtual void Encode(const scoped_refptr<media::VideoFrame>& frame, |
49 bool force_keyframe) OVERRIDE; | 49 bool force_keyframe) OVERRIDE; |
50 virtual void UseOutputBitstreamBuffer( | 50 virtual void UseOutputBitstreamBuffer( |
51 const media::BitstreamBuffer& buffer) OVERRIDE; | 51 const media::BitstreamBuffer& buffer) OVERRIDE; |
52 virtual void RequestEncodingParametersChange(uint32 bitrate, | 52 virtual void RequestEncodingParametersChange(uint32 bitrate, |
53 uint32 framerate) OVERRIDE; | 53 uint32 framerate) OVERRIDE; |
54 virtual void Destroy() OVERRIDE; | 54 virtual void Destroy() OVERRIDE; |
55 | 55 |
56 static std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 56 static std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
57 GetSupportedProfiles(); | 57 GetSupportedProfiles(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // are members of this class, any task running on those threads is guaranteed | 196 // are members of this class, any task running on those threads is guaranteed |
197 // that this object is still alive. As a result, tasks posted from the child | 197 // that this object is still alive. As a result, tasks posted from the child |
198 // thread to the encoder or device thread should use base::Unretained(this), | 198 // thread to the encoder or device thread should use base::Unretained(this), |
199 // and tasks posted the other way should use |weak_this_|. | 199 // and tasks posted the other way should use |weak_this_|. |
200 base::WeakPtrFactory<ExynosVideoEncodeAccelerator> weak_this_ptr_factory_; | 200 base::WeakPtrFactory<ExynosVideoEncodeAccelerator> weak_this_ptr_factory_; |
201 base::WeakPtr<ExynosVideoEncodeAccelerator> weak_this_; | 201 base::WeakPtr<ExynosVideoEncodeAccelerator> weak_this_; |
202 | 202 |
203 // To expose client callbacks from VideoEncodeAccelerator. | 203 // To expose client callbacks from VideoEncodeAccelerator. |
204 // NOTE: all calls to these objects *MUST* be executed on | 204 // NOTE: all calls to these objects *MUST* be executed on |
205 // child_message_loop_proxy_. | 205 // child_message_loop_proxy_. |
206 base::WeakPtrFactory<Client> client_ptr_factory_; | 206 scoped_ptr<base::WeakPtrFactory<Client> > client_ptr_factory_; |
207 base::WeakPtr<Client> client_; | 207 base::WeakPtr<Client> client_; |
208 | 208 |
209 // | 209 // |
210 // Encoder state, owned and operated by encoder_thread_. | 210 // Encoder state, owned and operated by encoder_thread_. |
211 // Before encoder_thread_ has started, the encoder state is managed by | 211 // Before encoder_thread_ has started, the encoder state is managed by |
212 // the child (main) thread. After encoder_thread_ has started, the encoder | 212 // the child (main) thread. After encoder_thread_ has started, the encoder |
213 // thread should be the only one managing these. | 213 // thread should be the only one managing these. |
214 // | 214 // |
215 | 215 |
216 // This thread services tasks posted from the VEA API entry points by the | 216 // This thread services tasks posted from the VEA API entry points by the |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 // eventfd fd to signal device poll thread when its poll() should be | 299 // eventfd fd to signal device poll thread when its poll() should be |
300 // interrupted. | 300 // interrupted. |
301 int device_poll_interrupt_fd_; | 301 int device_poll_interrupt_fd_; |
302 | 302 |
303 DISALLOW_COPY_AND_ASSIGN(ExynosVideoEncodeAccelerator); | 303 DISALLOW_COPY_AND_ASSIGN(ExynosVideoEncodeAccelerator); |
304 }; | 304 }; |
305 | 305 |
306 } // namespace content | 306 } // namespace content |
307 | 307 |
308 #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_ENCODE_ACCELERATOR_H_ | 308 #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_ENCODE_ACCELERATOR_H_ |
OLD | NEW |