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

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: f2a9ccb5 Rebase, posciak@ comments. Created 6 years, 9 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
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
52 class MEDIA_EXPORT Client { 52 class MEDIA_EXPORT Client {
53 public: 53 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 54 // 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 55 // for input and output. The VEA disclaims use or ownership of all
59 // previously provided buffers once this callback is made. 56 // previously provided buffers once this callback is made.
60 // Parameters: 57 // Parameters:
61 // |input_count| is the number of input VideoFrames required for encoding. 58 // |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 59 // 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 60 // encoder before being returned any input frames, since the encoder may
64 // need to hold onto some subset of inputs as reference pictures. 61 // 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 62 // |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 63 // by VideoFrame::coded_size()) to encode, in pixels. The encoder may have
(...skipping 10 matching lines...) Expand all
77 // is transferred back to the VEA::Client once this callback is made. 74 // is transferred back to the VEA::Client once this callback is made.
78 // Parameters: 75 // Parameters:
79 // |bitstream_buffer_id| is the id of the buffer that is ready. 76 // |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. 77 // |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. 78 // |key_frame| is true if this delivered frame is a keyframe.
82 virtual void BitstreamBufferReady(int32 bitstream_buffer_id, 79 virtual void BitstreamBufferReady(int32 bitstream_buffer_id,
83 size_t payload_size, 80 size_t payload_size,
84 bool key_frame) = 0; 81 bool key_frame) = 0;
85 82
86 // Error notification callback. 83 // Error notification callback.
87 virtual void NotifyError(Error error) = 0; 84 virtual void NotifyError(Error error) = 0;
Ami GONE FROM CHROMIUM 2014/03/17 03:17:54 Ditto
sheu 2014/03/18 22:38:35 Done.
88 85
89 protected: 86 protected:
90 // Clients are not owned by VEA instances and should not be deleted through 87 // Clients are not owned by VEA instances and should not be deleted through
91 // these pointers. 88 // these pointers.
92 virtual ~Client() {} 89 virtual ~Client() {}
93 }; 90 };
94 91
95 // Video encoder functions. 92 // Video encoder functions.
96 93
97 // Initialize the video encoder with a specific configuration. Called once 94 // Initializes the video encoder with specific configuration. Called once per
98 // per encoder construction. 95 // encoder construction. This call is synchronous and returns true iff
96 // initialization is successful.
99 // Parameters: 97 // Parameters:
100 // |input_format| is the frame format of the input stream (as would be 98 // |input_format| is the frame format of the input stream (as would be
101 // reported by VideoFrame::format() for frames passed to Encode()). 99 // reported by VideoFrame::format() for frames passed to Encode()).
102 // |input_visible_size| is the resolution of the input stream (as would be 100 // |input_visible_size| is the resolution of the input stream (as would be
103 // reported by VideoFrame::visible_rect().size() for frames passed to 101 // reported by VideoFrame::visible_rect().size() for frames passed to
104 // Encode()). 102 // Encode()).
105 // |output_profile| is the codec profile of the encoded output stream. 103 // |output_profile| is the codec profile of the encoded output stream.
106 // |initial_bitrate| is the initial bitrate of the encoded output stream, 104 // |initial_bitrate| is the initial bitrate of the encoded output stream,
107 // in bits per second. 105 // in bits per second.
108 // |client| is the client of this video encoder. The provided pointer must 106 // |client| is the client of this video encoder. The provided pointer must
109 // be valid until Destroy() is called. 107 // be valid until Destroy() is called.
110 // TODO(sheu): handle resolution changes. http://crbug.com/249944 108 // TODO(sheu): handle resolution changes. http://crbug.com/249944
111 virtual void Initialize(VideoFrame::Format input_format, 109 virtual bool Initialize(VideoFrame::Format input_format,
112 const gfx::Size& input_visible_size, 110 const gfx::Size& input_visible_size,
113 VideoCodecProfile output_profile, 111 VideoCodecProfile output_profile,
114 uint32 initial_bitrate, 112 uint32 initial_bitrate,
115 Client* client) = 0; 113 Client* client) = 0;
116 114
117 // Encodes the given frame. 115 // Encodes the given frame.
118 // Parameters: 116 // Parameters:
119 // |frame| is the VideoFrame that is to be encoded. 117 // |frame| is the VideoFrame that is to be encoded.
120 // |force_keyframe| forces the encoding of a keyframe for this frame. 118 // |force_keyframe| forces the encoding of a keyframe for this frame.
121 virtual void Encode(const scoped_refptr<VideoFrame>& frame, 119 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 138 // immediately and the component is freed. This call may asynchronously free
141 // system resources, but its client-visible effects are synchronous. After 139 // system resources, but its client-visible effects are synchronous. After
142 // this method returns no more callbacks will be made on the client. Deletes 140 // 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! 141 // |this| unconditionally, so make sure to drop all pointers to it!
144 virtual void Destroy() = 0; 142 virtual void Destroy() = 0;
145 }; 143 };
146 144
147 } // namespace media 145 } // namespace media
148 146
149 #endif // MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_ 147 #endif // MEDIA_VIDEO_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW
« media/video/video_decode_accelerator.h ('K') | « media/video/video_decode_accelerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698