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_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 // This class encapsulates the GPU process view of a VideoEncodeAccelerator, | 25 // This class encapsulates the GPU process view of a VideoEncodeAccelerator, |
26 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles | 26 // wrapping the platform-specific VideoEncodeAccelerator instance. It handles |
27 // IPC coming in from the renderer and passes it to the underlying VEA. | 27 // IPC coming in from the renderer and passes it to the underlying VEA. |
28 class GpuVideoEncodeAccelerator | 28 class GpuVideoEncodeAccelerator |
29 : public IPC::Listener, | 29 : public IPC::Listener, |
30 public media::VideoEncodeAccelerator::Client, | 30 public media::VideoEncodeAccelerator::Client, |
31 public GpuCommandBufferStub::DestructionObserver { | 31 public GpuCommandBufferStub::DestructionObserver { |
32 public: | 32 public: |
33 GpuVideoEncodeAccelerator(int32 host_route_id, GpuCommandBufferStub* stub); | 33 GpuVideoEncodeAccelerator(int32 host_route_id, GpuCommandBufferStub* stub); |
34 virtual ~GpuVideoEncodeAccelerator(); | 34 ~GpuVideoEncodeAccelerator() override; |
35 | 35 |
36 // Initialize this accelerator with the given parameters and send | 36 // Initialize this accelerator with the given parameters and send |
37 // |init_done_msg| when complete. | 37 // |init_done_msg| when complete. |
38 void Initialize(media::VideoFrame::Format input_format, | 38 void Initialize(media::VideoFrame::Format input_format, |
39 const gfx::Size& input_visible_size, | 39 const gfx::Size& input_visible_size, |
40 media::VideoCodecProfile output_profile, | 40 media::VideoCodecProfile output_profile, |
41 uint32 initial_bitrate, | 41 uint32 initial_bitrate, |
42 IPC::Message* init_done_msg); | 42 IPC::Message* init_done_msg); |
43 | 43 |
44 // IPC::Listener implementation | 44 // IPC::Listener implementation |
45 virtual bool OnMessageReceived(const IPC::Message& message) override; | 45 bool OnMessageReceived(const IPC::Message& message) override; |
46 | 46 |
47 // media::VideoEncodeAccelerator::Client implementation. | 47 // media::VideoEncodeAccelerator::Client implementation. |
48 virtual void RequireBitstreamBuffers(unsigned int input_count, | 48 void RequireBitstreamBuffers(unsigned int input_count, |
49 const gfx::Size& input_coded_size, | 49 const gfx::Size& input_coded_size, |
50 size_t output_buffer_size) override; | 50 size_t output_buffer_size) override; |
51 virtual void BitstreamBufferReady(int32 bitstream_buffer_id, | 51 void BitstreamBufferReady(int32 bitstream_buffer_id, |
52 size_t payload_size, | 52 size_t payload_size, |
53 bool key_frame) override; | 53 bool key_frame) override; |
54 virtual void NotifyError(media::VideoEncodeAccelerator::Error error) override; | 54 void NotifyError(media::VideoEncodeAccelerator::Error error) override; |
55 | 55 |
56 // GpuCommandBufferStub::DestructionObserver implementation. | 56 // GpuCommandBufferStub::DestructionObserver implementation. |
57 virtual void OnWillDestroyStub() override; | 57 void OnWillDestroyStub() override; |
58 | 58 |
59 // Static query for supported profiles. This query calls the appropriate | 59 // Static query for supported profiles. This query calls the appropriate |
60 // platform-specific version. | 60 // platform-specific version. |
61 static std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 61 static std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
62 GetSupportedProfiles(); | 62 GetSupportedProfiles(); |
63 | 63 |
64 private: | 64 private: |
65 // Create the appropriate platform-specific VEA. | 65 // Create the appropriate platform-specific VEA. |
66 static scoped_ptr<media::VideoEncodeAccelerator> CreateEncoder(); | 66 static scoped_ptr<media::VideoEncodeAccelerator> CreateEncoder(); |
67 | 67 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 // Weak pointer for media::VideoFrames that refer back to |this|. | 105 // Weak pointer for media::VideoFrames that refer back to |this|. |
106 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; | 106 base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); | 108 DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace content | 111 } // namespace content |
112 | 112 |
113 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ | 113 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_ |
OLD | NEW |