Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: media/video/video_encode_accelerator.h

Issue 185403020: Make VEA client of command buffer; move sync. IPC to VDA/VEA::Initialize() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 7da5b6ec Rebase. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/video/video_decode_accelerator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 30 matching lines...) Expand all
41 // Invalid argument was passed to an API method. 41 // Invalid argument was passed to an API method.
42 kInvalidArgumentError, 42 kInvalidArgumentError,
43 // A failure occurred at the GPU process or one of its dependencies. 43 // A failure occurred at the GPU process or one of its dependencies.
44 // Examples of such failures include GPU hardware failures, GPU driver 44 // Examples of such failures include GPU hardware failures, GPU driver
45 // failures, GPU library failures, GPU process programming errors, and so 45 // failures, GPU library failures, GPU process programming errors, and so
46 // on. 46 // on.
47 kPlatformFailureError, 47 kPlatformFailureError,
48 kErrorMax = kPlatformFailureError 48 kErrorMax = kPlatformFailureError
49 }; 49 };
50 50
51 // Interface for clients that use VideoEncodeAccelerator. 51 // Interface for clients that use VideoEncodeAccelerator. These callbacks will
52 // not be made unless Initialize() has returned successfully.
52 class MEDIA_EXPORT Client { 53 class MEDIA_EXPORT Client {
53 public: 54 public:
54 // Callback to notify client that encoder has been successfully initialized.
55 virtual void NotifyInitializeDone() = 0;
56
57 // Callback to tell the client what size of frames and buffers to provide 55 // Callback to tell the client what size of frames and buffers to provide
58 // for input and output. The VEA disclaims use or ownership of all 56 // for input and output. The VEA disclaims use or ownership of all
59 // previously provided buffers once this callback is made. 57 // previously provided buffers once this callback is made.
60 // Parameters: 58 // Parameters:
61 // |input_count| is the number of input VideoFrames required for encoding. 59 // |input_count| is the number of input VideoFrames required for encoding.
62 // The client should be prepared to feed at least this many frames into the 60 // The client should be prepared to feed at least this many frames into the
63 // encoder before being returned any input frames, since the encoder may 61 // encoder before being returned any input frames, since the encoder may
64 // need to hold onto some subset of inputs as reference pictures. 62 // need to hold onto some subset of inputs as reference pictures.
65 // |input_coded_size| is the logical size of the input frames (as reported 63 // |input_coded_size| is the logical size of the input frames (as reported
66 // by VideoFrame::coded_size()) to encode, in pixels. The encoder may have 64 // by VideoFrame::coded_size()) to encode, in pixels. The encoder may have
67 // hardware alignment requirements that make this different from 65 // hardware alignment requirements that make this different from
68 // |input_visible_size|, as requested in Initialize(), in which case the 66 // |input_visible_size|, as requested in Initialize(), in which case the
69 // input VideoFrame to Encode() should be padded appropriately. 67 // input VideoFrame to Encode() should be padded appropriately.
70 // |output_buffer_size| is the required size of output buffers for this 68 // |output_buffer_size| is the required size of output buffers for this
71 // encoder in bytes. 69 // encoder in bytes.
72 virtual void RequireBitstreamBuffers(unsigned int input_count, 70 virtual void RequireBitstreamBuffers(unsigned int input_count,
73 const gfx::Size& input_coded_size, 71 const gfx::Size& input_coded_size,
74 size_t output_buffer_size) = 0; 72 size_t output_buffer_size) = 0;
75 73
76 // Callback to deliver encoded bitstream buffers. Ownership of the buffer 74 // Callback to deliver encoded bitstream buffers. Ownership of the buffer
77 // is transferred back to the VEA::Client once this callback is made. 75 // is transferred back to the VEA::Client once this callback is made.
78 // Parameters: 76 // Parameters:
79 // |bitstream_buffer_id| is the id of the buffer that is ready. 77 // |bitstream_buffer_id| is the id of the buffer that is ready.
80 // |payload_size| is the byte size of the used portion of the buffer. 78 // |payload_size| is the byte size of the used portion of the buffer.
81 // |key_frame| is true if this delivered frame is a keyframe. 79 // |key_frame| is true if this delivered frame is a keyframe.
82 virtual void BitstreamBufferReady(int32 bitstream_buffer_id, 80 virtual void BitstreamBufferReady(int32 bitstream_buffer_id,
83 size_t payload_size, 81 size_t payload_size,
84 bool key_frame) = 0; 82 bool key_frame) = 0;
85 83
86 // Error notification callback. 84 // Error notification callback. Note that errors in Initialize() will not be
85 // reported here, but will instead be indicated by a false return value
86 // there.
87 virtual void NotifyError(Error error) = 0; 87 virtual void NotifyError(Error error) = 0;
88 88
89 protected: 89 protected:
90 // Clients are not owned by VEA instances and should not be deleted through 90 // Clients are not owned by VEA instances and should not be deleted through
91 // these pointers. 91 // these pointers.
92 virtual ~Client() {} 92 virtual ~Client() {}
93 }; 93 };
94 94
95 // Video encoder functions. 95 // Video encoder functions.
96 96
97 // Initialize the video encoder with a specific configuration. Called once 97 // Initializes the video encoder with specific configuration. Called once per
98 // per encoder construction. 98 // encoder construction. This call is synchronous and returns true iff
99 // initialization is successful.
99 // Parameters: 100 // Parameters:
100 // |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
101 // reported by VideoFrame::format() for frames passed to Encode()). 102 // reported by VideoFrame::format() for frames passed to Encode()).
102 // |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
103 // reported by VideoFrame::visible_rect().size() for frames passed to 104 // reported by VideoFrame::visible_rect().size() for frames passed to
104 // Encode()). 105 // Encode()).
105 // |output_profile| is the codec profile of the encoded output stream. 106 // |output_profile| is the codec profile of the encoded output stream.
106 // |initial_bitrate| is the initial bitrate of the encoded output stream, 107 // |initial_bitrate| is the initial bitrate of the encoded output stream,
107 // in bits per second. 108 // in bits per second.
108 // |client| is the client of this video encoder. The provided pointer must 109 // |client| is the client of this video encoder. The provided pointer must
109 // be valid until Destroy() is called. 110 // be valid until Destroy() is called.
110 // TODO(sheu): handle resolution changes. http://crbug.com/249944 111 // TODO(sheu): handle resolution changes. http://crbug.com/249944
111 virtual void Initialize(VideoFrame::Format input_format, 112 virtual bool Initialize(VideoFrame::Format input_format,
112 const gfx::Size& input_visible_size, 113 const gfx::Size& input_visible_size,
113 VideoCodecProfile output_profile, 114 VideoCodecProfile output_profile,
114 uint32 initial_bitrate, 115 uint32 initial_bitrate,
115 Client* client) = 0; 116 Client* client) = 0;
116 117
117 // Encodes the given frame. 118 // Encodes the given frame.
118 // Parameters: 119 // Parameters:
119 // |frame| is the VideoFrame that is to be encoded. 120 // |frame| is the VideoFrame that is to be encoded.
120 // |force_keyframe| forces the encoding of a keyframe for this frame. 121 // |force_keyframe| forces the encoding of a keyframe for this frame.
121 virtual void Encode(const scoped_refptr<VideoFrame>& frame, 122 virtual void Encode(const scoped_refptr<VideoFrame>& frame,
(...skipping 18 matching lines...) Expand all
140 // immediately and the component is freed. This call may asynchronously free 141 // immediately and the component is freed. This call may asynchronously free
141 // system resources, but its client-visible effects are synchronous. After 142 // system resources, but its client-visible effects are synchronous. After
142 // this method returns no more callbacks will be made on the client. Deletes 143 // this method returns no more callbacks will be made on the client. Deletes
143 // |this| unconditionally, so make sure to drop all pointers to it! 144 // |this| unconditionally, so make sure to drop all pointers to it!
144 virtual void Destroy() = 0; 145 virtual void Destroy() = 0;
145 }; 146 };
146 147
147 } // namespace media 148 } // namespace media
148 149
149 #endif // MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ 150 #endif // MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « media/video/video_decode_accelerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698