| 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 /* From ppb_video_frame.idl modified Fri Dec 27 17:21:52 2013. */ | 6 /* From ppb_audio_frame.idl modified Thu Jan 9 14:39:24 2014. */ |
| 7 | 7 |
| 8 #ifndef PPAPI_C_PPB_VIDEO_FRAME_H_ | 8 #ifndef PPAPI_C_PPB_AUDIO_FRAME_H_ |
| 9 #define PPAPI_C_PPB_VIDEO_FRAME_H_ | 9 #define PPAPI_C_PPB_AUDIO_FRAME_H_ |
| 10 | 10 |
| 11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
| 12 #include "ppapi/c/pp_macros.h" | 12 #include "ppapi/c/pp_macros.h" |
| 13 #include "ppapi/c/pp_resource.h" | 13 #include "ppapi/c/pp_resource.h" |
| 14 #include "ppapi/c/pp_size.h" | |
| 15 #include "ppapi/c/pp_stdint.h" | 14 #include "ppapi/c/pp_stdint.h" |
| 16 #include "ppapi/c/pp_time.h" | 15 #include "ppapi/c/pp_time.h" |
| 17 | 16 |
| 18 #define PPB_VIDEOFRAME_INTERFACE_0_1 "PPB_VideoFrame;0.1" /* dev */ | 17 #define PPB_AUDIOFRAME_INTERFACE_0_1 "PPB_AudioFrame;0.1" /* dev */ |
| 19 /** | 18 /** |
| 20 * @file | 19 * @file |
| 21 * Defines the <code>PPB_VideoFrame</code> interface. | 20 * Defines the <code>PPB_AudioFrame</code> interface. |
| 22 */ | 21 */ |
| 23 | 22 |
| 24 | 23 |
| 25 /** | 24 /** |
| 26 * @addtogroup Enums | |
| 27 * @{ | |
| 28 */ | |
| 29 typedef enum { | |
| 30 /** | |
| 31 * Unknown format value. | |
| 32 */ | |
| 33 PP_VIDEOFRAME_FORMAT_UNKNOWN = 0, | |
| 34 /** | |
| 35 * 12bpp YVU planar 1x1 Y, 2x2 VU samples. | |
| 36 */ | |
| 37 PP_VIDEOFRAME_FORMAT_YV12 = 1, | |
| 38 /** | |
| 39 * 16bpp YVU planar 1x1 Y, 2x1 VU samples. | |
| 40 */ | |
| 41 PP_VIDEOFRAME_FORMAT_YV16 = 2, | |
| 42 /** | |
| 43 * 12bpp YVU planar 1x1 Y, 2x2 VU samples. | |
| 44 */ | |
| 45 PP_VIDEOFRAME_FORMAT_I420 = 3, | |
| 46 /** | |
| 47 * 20bpp YVU planar 1x1 Y, 2x2 VU, 1x1 A samples. | |
| 48 */ | |
| 49 PP_VIDEOFRAME_FORMAT_YV12A = 4, | |
| 50 /** | |
| 51 * JPEG color range version of YV12. | |
| 52 */ | |
| 53 PP_VIDEOFRAME_FORMAT_YV12J = 5 | |
| 54 } PP_VideoFrame_Format; | |
| 55 /** | |
| 56 * @} | |
| 57 */ | |
| 58 | |
| 59 /** | |
| 60 * @addtogroup Interfaces | 25 * @addtogroup Interfaces |
| 61 * @{ | 26 * @{ |
| 62 */ | 27 */ |
| 63 struct PPB_VideoFrame_0_1 { /* dev */ | 28 struct PPB_AudioFrame_0_1 { /* dev */ |
| 64 /** | 29 /** |
| 65 * Determines if a resource is a VideoFrame resource. | 30 * Determines if a resource is an AudioFrame resource. |
| 66 * | 31 * |
| 67 * @param[in] resource The <code>PP_Resource</code> to test. | 32 * @param[in] resource The <code>PP_Resource</code> to test. |
| 68 * | 33 * |
| 69 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given | 34 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given |
| 70 * resource is a VideoFrame resource or <code>PP_FALSE</code> otherwise. | 35 * resource is an AudioFrame resource or <code>PP_FALSE</code> otherwise. |
| 71 */ | 36 */ |
| 72 PP_Bool (*IsVideoFrame)(PP_Resource resource); | 37 PP_Bool (*IsAudioFrame)(PP_Resource resource); |
| 73 /** | 38 /** |
| 74 * Gets the timestamp of the video frame. | 39 * Gets the timestamp of the audio frame. |
| 75 * | 40 * |
| 76 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 41 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 77 * resource. | 42 * resource. |
| 78 * | 43 * |
| 79 * @return A <code>PP_TimeDelta</code> containing the timestamp of the video | 44 * @return A <code>PP_TimeDelta</code> containing the timestamp of the audio |
| 80 * frame. Given in seconds since the start of the containing video stream. | 45 * frame. Given in seconds since the start of the containing audio stream. |
| 81 */ | 46 */ |
| 82 PP_TimeDelta (*GetTimestamp)(PP_Resource frame); | 47 PP_TimeDelta (*GetTimestamp)(PP_Resource frame); |
| 83 /** | 48 /** |
| 84 * Sets the timestamp of the video frame. Given in seconds since the | 49 * Sets the timestamp of the audio frame. |
| 85 * start of the containing video stream. | |
| 86 * | 50 * |
| 87 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 51 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 88 * resource. | 52 * resource. |
| 89 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp | 53 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp |
| 90 * of the video frame. Given in seconds since the start of the containing | 54 * of the audio frame. Given in seconds since the start of the containing |
| 91 * video stream. | 55 * audio stream. |
| 92 */ | 56 */ |
| 93 void (*SetTimestamp)(PP_Resource frame, PP_TimeDelta timestamp); | 57 void (*SetTimestamp)(PP_Resource frame, PP_TimeDelta timestamp); |
| 94 /** | 58 /** |
| 95 * Gets the format of the video frame. | 59 * Gets the sample size of the audio frame. |
| 96 * | 60 * |
| 97 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 61 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 98 * resource. | 62 * resource. |
| 99 * | 63 * |
| 100 * @return A <code>PP_VideoFrame_Format</code> containing the format of the | 64 * @return The sample size of the audio frame. |
| 101 * video frame. | |
| 102 */ | 65 */ |
| 103 PP_VideoFrame_Format (*GetFormat)(PP_Resource frame); | 66 uint32_t (*GetSampleSize)(PP_Resource frame); |
| 104 /** | 67 /** |
| 105 * Gets the size of the video frame. | 68 * Gets the number of channels in the audio frame. |
| 106 * | 69 * |
| 107 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 70 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 108 * resource. | 71 * resource. |
| 109 * @param[out] size A <code>PP_Size</code>. | |
| 110 * | 72 * |
| 111 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or | 73 * @return The number of channels in the audio frame. |
| 112 * <code>PP_FALSE</code> on failure. | |
| 113 */ | 74 */ |
| 114 PP_Bool (*GetSize)(PP_Resource frame, struct PP_Size* size); | 75 uint32_t (*GetNumberOfChannels)(PP_Resource frame); |
| 115 /** | 76 /** |
| 116 * Gets the data buffer for video frame pixels. | 77 * Gets the number of samples in the audio frame. |
| 117 * | 78 * |
| 118 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 79 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 80 * resource. |
| 81 * |
| 82 * @return The number of samples in the audio frame. |
| 83 * For example, at a sampling rate of 44,100 Hz in stereo audio, a frame |
| 84 * containing 4410 * 2 samples would have a duration of 100 milliseconds. |
| 85 */ |
| 86 uint32_t (*GetNumberOfSamples)(PP_Resource frame); |
| 87 /** |
| 88 * Gets the data buffer containing the audio frame samples. |
| 89 * |
| 90 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 119 * resource. | 91 * resource. |
| 120 * | 92 * |
| 121 * @return A pointer to the beginning of the data buffer. | 93 * @return A pointer to the beginning of the data buffer. |
| 122 */ | 94 */ |
| 123 void* (*GetDataBuffer)(PP_Resource frame); | 95 void* (*GetDataBuffer)(PP_Resource frame); |
| 124 /** | 96 /** |
| 125 * Gets the size of data buffer. | 97 * Gets the size of the data buffer in bytes. |
| 126 * | 98 * |
| 127 * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame | 99 * @param[in] frame A <code>PP_Resource</code> corresponding to an audio frame |
| 128 * resource. | 100 * resource. |
| 129 * | 101 * |
| 130 * @return The size of the data buffer. | 102 * @return The size of the data buffer in bytes. |
| 131 */ | 103 */ |
| 132 uint32_t (*GetDataBufferSize)(PP_Resource frame); | 104 uint32_t (*GetDataBufferSize)(PP_Resource frame); |
| 133 }; | 105 }; |
| 134 /** | 106 /** |
| 135 * @} | 107 * @} |
| 136 */ | 108 */ |
| 137 | 109 |
| 138 #endif /* PPAPI_C_PPB_VIDEO_FRAME_H_ */ | 110 #endif /* PPAPI_C_PPB_AUDIO_FRAME_H_ */ |
| 139 | 111 |
| OLD | NEW |