OLD | NEW |
---|---|
(Empty) | |
1 /* Copyright (c) 2015 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 | |
6 /** | |
7 * This file defines the <code>PPB_VideoEncoder</code> interface. | |
8 */ | |
9 | |
10 [generate_thunk] | |
11 | |
12 label Chrome { | |
13 M42 = 0.1 | |
14 }; | |
15 | |
16 /** | |
17 * Video encoder interface. | |
18 * | |
19 * Typical usage: | |
20 * - Call Create() to create a new video encoder resource. | |
21 * - Call GetSupportedFormats() to determine which codecs and profiles are | |
22 * - available. | |
23 * - Call Initialize() to initialize the encoder for a supported profile. | |
24 * - Call GetVideoFrame() to get a video frame resource, copy the frame into | |
25 * - its buffer, and call Encode() to push the video frame to the encoder. Do | |
26 * - this continuously, waiting for completion of each call. | |
27 * - Call GetBitstreamBuffer() continuously (waiting for each previous call to | |
28 * complete) to pull encoded pictures from the encoder. | |
29 * - Call RecycleBitstreamBuffer() after consuming the data in the bitstream | |
30 * - buffer. | |
31 * - To destroy the decoder, the plugin should release all of its references to | |
32 * it. Any pending callbacks will abort before the decoder is destroyed. | |
33 * | |
34 * Available video codecs vary by platform. | |
35 * All: theora, vorbis, vp8. | |
36 * Chrome and ChromeOS: aac, h264. | |
37 * ChromeOS: mpeg4. | |
38 */ | |
39 interface PPB_VideoEncoder { | |
40 /** | |
41 * Creates a new video encoder resource. | |
42 * | |
43 * @param[in] instance A <code>PP_Instance</code> identifying the instance | |
44 * with the video encoder. | |
45 * | |
46 * @return A <code>PP_Resource</code> corresponding to a video encoder if | |
47 * successful or 0 otherwise. | |
48 */ | |
49 PP_Resource Create( | |
50 [in] PP_Instance instance); | |
51 | |
52 /** | |
53 * Determines if the given resource is a video encoder. | |
54 * | |
55 * @param[in] resource A <code>PP_Resource</code> identifying a resource. | |
56 * | |
57 * @return <code>PP_TRUE</code> if the resource is a | |
58 * <code>PPB_VideoEncoder</code>, <code>PP_FALSE</code> if the resource is | |
59 * invalid or some other type. | |
60 */ | |
61 PP_Bool IsVideoEncoder( | |
62 [in] PP_Resource resource); | |
63 | |
64 /** | |
65 * Gets an array of supported video encoder profiles. | |
66 * These can be used to choose profiles when calling Initialize(). | |
67 * | |
68 * @param[in] video_encoder A <code>PP_Resource</code> identifying the video | |
69 * encoder. | |
70 * @param[in] output A <code>PP_ArrayOutput</code> to hold the supported | |
71 * <code>PP_SupportedVideoProfile</code> structs. | |
72 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | |
73 * completion of GetSupportedProfiles. | |
74 * | |
75 * @return If >= 0, the number of supported profiles returned, otherwise an | |
76 * error code from <code>pp_errors.h</code>. | |
77 */ | |
78 int32_t GetSupportedProfiles( | |
79 [in] PP_Resource video_encoder, | |
80 [in] PP_ArrayOutput output, | |
81 [in] PP_CompletionCallback callback); | |
82 | |
83 /** | |
84 * Initializes a video encoder resource. This should be called after Create() | |
85 * and before any functions below. | |
86 * | |
87 * @param[in] video_encoder A <code>PP_Resource</code> identifying the video | |
88 * encoder. | |
89 * @param[in] input_format The <code>PP_VideoFrame_Format</code> of the | |
90 * frames which will be encoded. | |
91 * @param[in] input_visible_size A <code>PP_Size</code> specifying the | |
92 * dimensions of the visible part of the input frames. | |
93 * @param[in] output_profile A <code>PP_VideoProfile</code> specifying the | |
94 * codec profile of the encoded output stream. | |
95 * @param[in] acceleration A <code>PP_HardwareAcceleration</code> specifying | |
96 * whether to use a hardware accelerated or a software implementation. | |
97 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon | |
98 * completion. | |
99 * | |
100 * @return An int32_t containing an error code from <code>pp_errors.h</code>. | |
101 * Returns PP_ERROR_NOTSUPPORTED if video encoding is not available, or the | |
102 * requested codec profile is not supported. | |
103 */ | |
104 int32_t Initialize( | |
105 [in] PP_Resource video_decoder, | |
106 [in] PP_VideoFrame_Format input_format, | |
107 [in] PP_Size input_visible_size, | |
108 [in] PP_VideoProfile output_profile, | |
109 [in] uint32_t initial_bitrate, | |
110 [in] PP_HardwareAcceleration acceleration, | |
111 [in] PP_CompletionCallback callback); | |
112 | |
113 int32_t GetVideoFrame( | |
llandwerlin-old
2015/01/13 12:43:55
How would we like to have GetVideoFrame() behave w
bbudge
2015/01/14 02:01:13
This should work like PPB_VIdeoDecoder or PPB_Medi
llandwerlin-old
2015/01/14 11:56:13
As far I as I can tell, the Vaapi/V4L2/Android enc
bbudge
2015/01/14 16:38:10
Here's a VEA that shares the frame with the GPU pr
llandwerlin-old
2015/01/14 16:57:08
The frame is kept in a hash table :
https://code.
bbudge
2015/01/14 17:20:11
Thanks for the explanation! Then we can distinguis
llandwerlin-old
2015/01/14 20:21:26
Maybe I'm missing something, but I would have thou
bbudge
2015/01/14 22:07:46
You're correct, the plugin can keep track of which
| |
114 [in] PP_Resource video_encoder, | |
115 [out] PP_Resource video_frame, | |
dmichael (off chromium)
2015/01/14 00:25:20
I take it this is a PPB_VideoFrame?
bbudge
2015/01/14 02:01:13
Yes, owned by the proxy and loaned to the plugin,
| |
116 [in] PP_CompletionCallback callback); | |
117 | |
118 int32_t Encode( | |
llandwerlin-old
2015/01/12 11:48:04
PPB_VideoDecoder has a |decode_id| parameter on it
bbudge
2015/01/12 18:38:53
I don't see any way to pass in such id's to the en
llandwerlin-old
2015/01/13 12:02:11
Looking at the Vaapi (Intel accelerator) code, I t
| |
119 [in] PP_Resource video_encoder, | |
120 [in] PP_Resource video_frame, | |
llandwerlin-old
2015/01/12 11:48:04
Will Encode() allow to pass video frame coming out
bbudge
2015/01/12 18:38:53
Great question.
This seems like a common use case
llandwerlin-old
2015/01/13 12:02:10
Sounds good.
| |
121 [in] PP_Bool force_keyframe, | |
122 [in] PP_CompletionCallback callback); | |
123 | |
124 int32_t GetBitstreamBuffer( | |
125 [in] PP_Resource video_encoder, | |
126 [out] PP_BitstreamBuffer bitstream_buffer, | |
127 [in] PP_CompletionCallback callback); | |
128 | |
129 void RecycleBitstreamBuffer( | |
130 [in] PP_Resource video_decoder, | |
131 [in] PP_BitstreamBuffer bitstream_buffer); | |
132 | |
133 void RequestEncodingParametersChange( | |
dmichael (off chromium)
2015/01/14 00:25:20
Does there need to be a CompletionCallback for thi
bbudge
2015/01/14 02:01:13
media::VideoEncodeAccelerator doesn't return a val
| |
134 [in] PP_Resource video_decoder, | |
135 [in] uint32_t bitrate, | |
136 [in] uint32_t framerate); | |
137 }; | |
llandwerlin-old
2015/01/12 11:48:04
Should there be a Reset() method?
We could use Des
bbudge
2015/01/12 18:38:53
I tried to match 1:1 with VideoDecodeAccelerator w
llandwerlin-old
2015/01/13 12:02:11
I'm thinking that if we allow frames from the Medi
bbudge
2015/01/14 02:01:13
I don't think VEA has a Reset method. See above fo
| |
OLD | NEW |