OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 CHROME_GPU_GPU_ARC_VIDEO_ENCODE_ACCELERATOR_H_ | |
6 #define CHROME_GPU_GPU_ARC_VIDEO_ENCODE_ACCELERATOR_H_ | |
7 | |
8 #include <memory> | |
9 #include <vector> | |
10 | |
11 #include "base/files/scoped_file.h" | |
12 #include "base/macros.h" | |
13 #include "components/arc/common/video_encode_accelerator.mojom.h" | |
14 #include "components/arc/video_accelerator/video_accelerator.h" | |
15 #include "gpu/command_buffer/service/gpu_preferences.h" | |
16 #include "media/video/video_encode_accelerator.h" | |
17 | |
18 namespace chromeos { | |
19 namespace arc { | |
20 | |
21 // GpuArcVideoEncodeAccelerator manages life-cycle and IPC message translation | |
22 // for media::VideoEncodeAccelerator. | |
23 class GpuArcVideoEncodeAccelerator | |
24 : public ::arc::mojom::VideoEncodeAccelerator, | |
25 public media::VideoEncodeAccelerator::Client { | |
26 public: | |
27 explicit GpuArcVideoEncodeAccelerator( | |
28 const gpu::GpuPreferences& gpu_preferences); | |
29 ~GpuArcVideoEncodeAccelerator() override; | |
30 | |
31 private: | |
32 using VideoPixelFormat = media::VideoPixelFormat; | |
33 using VideoCodecProfile = media::VideoCodecProfile; | |
34 using Error = media::VideoEncodeAccelerator::Error; | |
35 using VideoEncodeClientPtr = ::arc::mojom::VideoEncodeClientPtr; | |
36 | |
37 // VideoEncodeAccelerator::Client implementation. | |
38 void RequireBitstreamBuffers(unsigned int input_count, | |
39 const gfx::Size& input_coded_size, | |
40 size_t output_buffer_size) override; | |
41 void BitstreamBufferReady(int32_t bitstream_buffer_id, | |
42 size_t payload_size, | |
43 bool key_frame, | |
44 base::TimeDelta timestamp) override; | |
45 void NotifyError(Error error) override; | |
46 | |
47 // ::arc::mojom::VideoEncodeAccelerator implementation. | |
48 void GetSupportedProfiles( | |
49 const GetSupportedProfilesCallback& callback) override; | |
50 | |
51 void Initialize(VideoPixelFormat input_format, | |
52 const gfx::Size& visible_size, | |
53 VideoEncodeAccelerator::StorageType input_storage, | |
54 VideoCodecProfile output_profile, | |
55 uint32_t initial_bitrate, | |
56 VideoEncodeClientPtr client, | |
57 const InitializeCallback& callback) override; | |
58 | |
59 void Encode(mojo::ScopedHandle fd, | |
60 std::vector<::arc::VideoFramePlane> planes, | |
61 int64_t timestamp, | |
62 bool force_keyframe) override; | |
63 | |
64 void UseOutputBitstreamBuffer(int32_t bitstream_buffer_id, | |
65 mojo::ScopedHandle shmem_fd, | |
66 uint32_t offset, | |
67 uint32_t size) override; | |
68 | |
69 void RequestEncodingParametersChange(uint32_t bitrate, | |
70 uint32_t framerate) override; | |
Luis Héctor Chávez
2017/06/07 16:02:37
Can you remove blank lines in L58, 63, 68? That wa
Owen Lin
2017/06/08 04:15:47
Done.
| |
71 | |
72 base::ScopedFD UnwrapFdFromMojoHandle(mojo::ScopedHandle handle); | |
Luis Héctor Chávez
2017/06/07 16:02:36
Can you add a small comment?
Owen Lin
2017/06/08 04:15:47
Done.
| |
73 | |
74 gpu::GpuPreferences gpu_preferences_; | |
75 std::unique_ptr<media::VideoEncodeAccelerator> accelerator_; | |
76 ::arc::mojom::VideoEncodeClientPtr client_; | |
77 gfx::Size coded_size_; | |
78 gfx::Size visible_size_; | |
79 media::VideoPixelFormat input_pixel_format_; | |
80 | |
81 DISALLOW_COPY_AND_ASSIGN(GpuArcVideoEncodeAccelerator); | |
82 }; | |
83 | |
84 } // namespace arc | |
85 } // namespace chromeos | |
86 | |
87 #endif // CHROME_GPU_GPU_ARC_VIDEO_ENCODE_ACCELERATOR_H_ | |
OLD | NEW |