| OLD | NEW |
| 1 /* Copyright 2014 The Chromium Authors. All rights reserved. | 1 /* Copyright 2014 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 | 5 |
| 6 /** | 6 /** |
| 7 * Defines the <code>PPB_VideoFrame</code> interface. | 7 * Defines the <code>PPB_AudioFrame</code> interface. |
| 8 */ | 8 */ |
| 9 label Chrome { | 9 label Chrome { |
| 10 [channel=dev] M34 = 0.1 | 10 [channel=dev] M34 = 0.1 |
| 11 }; | 11 }; |
| 12 | 12 |
| 13 enum PP_VideoFrame_Format { | 13 interface PPB_AudioFrame { |
| 14 /** | 14 /** |
| 15 * Unknown format value. | 15 * Determines if a resource is an AudioFrame resource. |
| 16 */ | |
| 17 PP_VIDEOFRAME_FORMAT_UNKNOWN = 0, | |
| 18 | |
| 19 /** | |
| 20 * 12bpp YVU planar 1x1 Y, 2x2 VU samples. | |
| 21 */ | |
| 22 PP_VIDEOFRAME_FORMAT_YV12 = 1, | |
| 23 | |
| 24 /** | |
| 25 * 16bpp YVU planar 1x1 Y, 2x1 VU samples. | |
| 26 */ | |
| 27 PP_VIDEOFRAME_FORMAT_YV16 = 2, | |
| 28 | |
| 29 /** | |
| 30 * 12bpp YVU planar 1x1 Y, 2x2 VU samples. | |
| 31 */ | |
| 32 PP_VIDEOFRAME_FORMAT_I420 = 3, | |
| 33 | |
| 34 /** | |
| 35 * 20bpp YVU planar 1x1 Y, 2x2 VU, 1x1 A samples. | |
| 36 */ | |
| 37 PP_VIDEOFRAME_FORMAT_YV12A = 4, | |
| 38 | |
| 39 /** | |
| 40 * JPEG color range version of YV12. | |
| 41 */ | |
| 42 PP_VIDEOFRAME_FORMAT_YV12J = 5 | |
| 43 }; | |
| 44 | |
| 45 interface PPB_VideoFrame { | |
| 46 /** | |
| 47 * Determines if a resource is a VideoFrame resource. | |
| 48 * | 16 * |
| 49 * @param[in] resource The <code>PP_Resource</code> to test. | 17 * @param[in] resource The <code>PP_Resource</code> to test. |
| 50 * | 18 * |
| 51 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 19 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
| 52 * resource is a VideoFrame resource or <code>PP_FALSE</code> otherwise. | 20 * resource is an AudioFrame resource or <code>PP_FALSE</code> otherwise. |
| 53 */ | 21 */ |
| 54 PP_Bool IsVideoFrame([in] PP_Resource resource); | 22 PP_Bool IsAudioFrame([in] PP_Resource resource); |
| 55 | 23 |
| 56 /** | 24 /** |
| 57 * Gets the timestamp of the video frame. | 25 * Gets the timestamp of the audio frame. |
| 58 * | 26 * |
| 59 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 27 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 60 * resource. | 28 * resource. |
| 61 * | 29 * |
| 62 * @return A <code>PP_TimeDelta</code> containing the timestamp of the video | 30 * @return A <code>PP_TimeDelta</code> containing the timestamp of the audio |
| 63 * frame. Given in seconds since the start of the containing video stream. | 31 * frame. Given in seconds since the start of the containing audio stream. |
| 64 */ | 32 */ |
| 65 PP_TimeDelta GetTimestamp([in] PP_Resource frame); | 33 PP_TimeDelta GetTimestamp([in] PP_Resource frame); |
| 66 | 34 |
| 67 /** | 35 /** |
| 68 * Sets the timestamp of the video frame. Given in seconds since the | 36 * Sets the timestamp of the audio frame. |
| 69 * start of the containing video stream. | |
| 70 * | 37 * |
| 71 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 38 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 72 * resource. | 39 * resource. |
| 73 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp | 40 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp |
| 74 * of the video frame. Given in seconds since the start of the containing | 41 * of the audio frame. Given in seconds since the start of the containing |
| 75 * video stream. | 42 * audio stream. |
| 76 */ | 43 */ |
| 77 void SetTimestamp([in] PP_Resource frame, [in] PP_TimeDelta timestamp); | 44 void SetTimestamp([in] PP_Resource frame, [in] PP_TimeDelta timestamp); |
| 78 | 45 |
| 79 /** | 46 /** |
| 80 * Gets the format of the video frame. | 47 * Gets the sample size of the audio frame. |
| 81 * | 48 * |
| 82 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 49 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 83 * resource. | 50 * resource. |
| 84 * | 51 * |
| 85 * @return A <code>PP_VideoFrame_Format</code> containing the format of the | 52 * @return The sample size of the audio frame. |
| 86 * video frame. | |
| 87 */ | 53 */ |
| 88 PP_VideoFrame_Format GetFormat([in] PP_Resource frame); | 54 uint32_t GetSampleSize([in] PP_Resource frame); |
| 55 |
| 56 /** |
| 57 * Gets the number of channels in the audio frame. |
| 58 * |
| 59 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 60 * resource. |
| 61 * |
| 62 * @return The number of channels in the audio frame. |
| 63 */ |
| 64 uint32_t GetNumberOfChannels([in] PP_Resource frame); |
| 89 | 65 |
| 90 /** | 66 /** |
| 91 * Gets the size of the video frame. | 67 * Gets the number of samples in the audio frame. |
| 92 * | 68 * |
| 93 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 69 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 94 * resource. | 70 * resource. |
| 95 * @param[out] size A <code>PP_Size</code>. | |
| 96 * | 71 * |
| 97 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or | 72 * @return The number of samples in the audio frame. |
| 98 * <code>PP_FALSE</code> on failure. | 73 * For example, at a sampling rate of 44,100 Hz in stereo audio, a frame |
| 74 * containing 4410 * 2 samples would have a duration of 100 milliseconds. |
| 99 */ | 75 */ |
| 100 PP_Bool GetSize([in] PP_Resource frame, [out] PP_Size size); | 76 uint32_t GetNumberOfSamples([in] PP_Resource frame); |
| 101 | 77 |
| 102 /** | 78 /** |
| 103 * Gets the data buffer for video frame pixels. | 79 * Gets the data buffer containing the audio frame samples. |
| 104 * | 80 * |
| 105 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 81 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 106 * resource. | 82 * resource. |
| 107 * | 83 * |
| 108 * @return A pointer to the beginning of the data buffer. | 84 * @return A pointer to the beginning of the data buffer. |
| 109 */ | 85 */ |
| 110 mem_t GetDataBuffer([in] PP_Resource frame); | 86 mem_t GetDataBuffer([in] PP_Resource frame); |
| 111 | 87 |
| 112 /** | 88 /** |
| 113 * Gets the size of data buffer. | 89 * Gets the size of the data buffer in bytes. |
| 114 * | 90 * |
| 115 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 91 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 116 * resource. | 92 * resource. |
| 117 * | 93 * |
| 118 * @return The size of the data buffer. | 94 * @return The size of the data buffer in bytes. |
| 119 */ | 95 */ |
| 120 uint32_t GetDataBufferSize([in] PP_Resource frame); | 96 uint32_t GetDataBufferSize([in] PP_Resource frame); |
| 121 }; | 97 }; |
| OLD | NEW |