OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ | |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "ipc/ipc_listener.h" | |
13 #include "media/video/video_encode_accelerator.h" | |
14 | |
15 namespace gfx { | |
16 | |
17 class Size; | |
18 | |
19 } // namespace gfx | |
20 | |
21 namespace content { | |
22 | |
23 class GpuChannelHost; | |
24 | |
25 // This class is the renderer-side host for the VideoEncodeAccelerator in the | |
26 // GPU process, coordinated over IPC. | |
27 class GpuVideoEncodeAcceleratorHost | |
28 : public IPC::Listener, | |
29 public media::VideoEncodeAccelerator, | |
30 public base::SupportsWeakPtr<GpuVideoEncodeAcceleratorHost> { | |
31 public: | |
32 // |client| is assumed to outlive this object. Since the GpuChannelHost does | |
33 // _not_ own this object, a reference to |gpu_channel_host| is taken. | |
34 GpuVideoEncodeAcceleratorHost( | |
35 media::VideoEncodeAccelerator::Client* client, | |
36 const scoped_refptr<GpuChannelHost>& gpu_channel_host, | |
37 int32 route_id); | |
38 virtual ~GpuVideoEncodeAcceleratorHost(); | |
39 | |
40 // Static query for the supported profiles. This query proxies to | |
41 // GpuVideoEncodeAcceleratorHost::GetSupportedProfiles(). | |
Ami GONE FROM CHROMIUM
2013/07/31 23:01:12
s/GpuVideoEncodeAcceleratorHost/GpuVideoEncodeAcce
sheu
2013/08/02 01:27:49
Done.
| |
42 static std::vector<SupportedProfile> GetSupportedProfiles(); | |
43 | |
44 // IPC::Listener implementation. | |
45 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
46 virtual void OnChannelError() OVERRIDE; | |
47 | |
48 // media::VideoEncodeAccelerator implementation. | |
49 virtual void Initialize(media::VideoFrame::Format format, | |
50 const gfx::Size& input_resolution, | |
51 media::VideoCodecProfile output_profile, | |
52 int32 initial_bitrate) OVERRIDE; | |
53 virtual void Encode(const media::BitstreamBuffer& buffer, | |
54 bool force_keyframe) OVERRIDE; | |
55 virtual void UseOutputBitstreamBuffer( | |
56 const media::BitstreamBuffer& buffer) OVERRIDE; | |
57 virtual void RequestEncodingParameterChange(int32 bitrate) OVERRIDE; | |
58 virtual void Destroy() OVERRIDE; | |
59 | |
60 private: | |
61 bool Send(IPC::Message* message); | |
62 | |
63 // Unowned pointer to the client. | |
64 media::VideoEncodeAccelerator::Client* client_; | |
65 | |
66 // IPC channel and route ID. | |
67 scoped_refptr<GpuChannelHost> channel_; | |
68 const int32 route_id_; | |
69 | |
70 // IPC handlers | |
Ami GONE FROM CHROMIUM
2013/07/31 23:01:12
s/$/ proxying media::VideoEncodeAccelerator::Clien
sheu
2013/08/02 01:27:49
Done.
| |
71 void OnNotifyInitializeDone(); | |
72 void OnRequireBitstreamBuffers(int input_count, | |
73 const gfx::Size& input_dimensions, | |
74 uint32 output_size); | |
75 void OnNotifyInputDone(int32 bitstream_buffer_id); | |
76 void OnBitstreamBufferReady(int32 bitstream_buffer_id, | |
77 uint32 payload_size, | |
78 bool key_frame); | |
79 void OnNotifyError(Error error); | |
80 | |
81 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAcceleratorHost); | |
82 }; | |
83 | |
84 } // namespace content | |
85 | |
86 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_H_ | |
OLD | NEW |