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 MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ |
6 #define MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ | 6 #define MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "media/base/bitstream_buffer.h" | 12 #include "media/base/bitstream_buffer.h" |
13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
14 #include "media/base/video_decoder_config.h" | 14 #include "media/base/video_decoder_config.h" |
15 #include "media/base/video_frame.h" | 15 #include "media/base/video_frame.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 | 18 |
19 class BitstreamBuffer; | 19 class BitstreamBuffer; |
20 class VideoFrame; | 20 class VideoFrame; |
21 | 21 |
22 // Video encoder interface. | 22 // Video encoder interface. |
23 class MEDIA_EXPORT VideoEncodeAccelerator { | 23 class MEDIA_EXPORT VideoEncodeAccelerator { |
24 public: | 24 public: |
25 // Specification of an encoding profile supported by an encoder. | 25 // Specification of an encoding profile supported by an encoder. |
26 struct SupportedProfile { | 26 struct SupportedProfile { |
27 VideoCodecProfile profile; | 27 VideoCodecProfile profile; |
28 gfx::Size max_resolution; | 28 gfx::Size max_resolution; |
29 struct { | 29 uint32 max_framerate_numerator; |
30 uint32 numerator; | 30 uint32 max_framerate_denominator; |
31 uint32 denominator; | |
32 } max_framerate; | |
33 }; | 31 }; |
34 | 32 |
35 // Enumeration of potential errors generated by the API. | 33 // Enumeration of potential errors generated by the API. |
36 enum Error { | 34 enum Error { |
37 // An operation was attempted during an incompatible encoder state. | 35 // An operation was attempted during an incompatible encoder state. |
38 kIllegalStateError, | 36 kIllegalStateError, |
39 // Invalid argument was passed to an API method. | 37 // Invalid argument was passed to an API method. |
40 kInvalidArgumentError, | 38 kInvalidArgumentError, |
41 // A failure occurred at the GPU process or one of its dependencies. | 39 // A failure occurred at the GPU process or one of its dependencies. |
42 // Examples of such failures include GPU hardware failures, GPU driver | 40 // Examples of such failures include GPU hardware failures, GPU driver |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 virtual void NotifyError(Error error) = 0; | 83 virtual void NotifyError(Error error) = 0; |
86 | 84 |
87 protected: | 85 protected: |
88 // Clients are not owned by VEA instances and should not be deleted through | 86 // Clients are not owned by VEA instances and should not be deleted through |
89 // these pointers. | 87 // these pointers. |
90 virtual ~Client() {} | 88 virtual ~Client() {} |
91 }; | 89 }; |
92 | 90 |
93 // Video encoder functions. | 91 // Video encoder functions. |
94 | 92 |
| 93 // Returns a list of the supported codec profiles of the video encoder. This |
| 94 // can be called before Initialize(). |
| 95 virtual std::vector<SupportedProfile> GetSupportedProfiles() = 0; |
| 96 |
95 // Initializes the video encoder with specific configuration. Called once per | 97 // Initializes the video encoder with specific configuration. Called once per |
96 // encoder construction. This call is synchronous and returns true iff | 98 // encoder construction. This call is synchronous and returns true iff |
97 // initialization is successful. | 99 // initialization is successful. |
98 // Parameters: | 100 // Parameters: |
99 // |input_format| is the frame format of the input stream (as would be | 101 // |input_format| is the frame format of the input stream (as would be |
100 // reported by VideoFrame::format() for frames passed to Encode()). | 102 // reported by VideoFrame::format() for frames passed to Encode()). |
101 // |input_visible_size| is the resolution of the input stream (as would be | 103 // |input_visible_size| is the resolution of the input stream (as would be |
102 // reported by VideoFrame::visible_rect().size() for frames passed to | 104 // reported by VideoFrame::visible_rect().size() for frames passed to |
103 // Encode()). | 105 // Encode()). |
104 // |output_profile| is the codec profile of the encoded output stream. | 106 // |output_profile| is the codec profile of the encoded output stream. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // uses "Destroy()" instead of trying to use the destructor. | 161 // uses "Destroy()" instead of trying to use the destructor. |
160 template <> | 162 template <> |
161 struct MEDIA_EXPORT DefaultDeleter<media::VideoEncodeAccelerator> { | 163 struct MEDIA_EXPORT DefaultDeleter<media::VideoEncodeAccelerator> { |
162 public: | 164 public: |
163 void operator()(void* video_encode_accelerator) const; | 165 void operator()(void* video_encode_accelerator) const; |
164 }; | 166 }; |
165 | 167 |
166 } // namespace base | 168 } // namespace base |
167 | 169 |
168 #endif // MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ | 170 #endif // MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ |
OLD | NEW |