diff options
author | penghuang@chromium.org <penghuang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-23 22:03:13 +0000 |
---|---|---|
committer | penghuang@chromium.org <penghuang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-23 22:03:13 +0000 |
commit | 8c7747f02380085d196b7c844ebf65f1092fafdf (patch) | |
tree | d6221e58ce1898ef101fdce23b988cf1ca68050a /ppapi | |
parent | bad74669cd0485f8b7503cabdb5001ede7f113dd (diff) | |
download | chromium_src-8c7747f02380085d196b7c844ebf65f1092fafdf.zip chromium_src-8c7747f02380085d196b7c844ebf65f1092fafdf.tar.gz chromium_src-8c7747f02380085d196b7c844ebf65f1092fafdf.tar.bz2 |
[PPAPI] Refine Configure() for Pepper MediaStream API.
BUG=330851
Review URL: https://codereview.chromium.org/141993002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246697 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
22 files changed, 575 insertions, 117 deletions
diff --git a/ppapi/api/ppb_audio_frame.idl b/ppapi/api/ppb_audio_frame.idl index b0c14d4..6600716 100644 --- a/ppapi/api/ppb_audio_frame.idl +++ b/ppapi/api/ppb_audio_frame.idl @@ -13,6 +13,24 @@ label Chrome { [channel=dev] M34 = 0.1 }; +/** + * PP_AudioFrame_SampleRate is an enumeration of the different audio sample + * rates. + */ +enum PP_AudioFrame_SampleRate { + PP_AUDIOFRAME_SAMPLERATE_UNKNOWN = 0, + PP_AUDIOFRAME_SAMPLERATE_44100 = 44100 +}; + +/** + * PP_AudioFrame_SampleSize is an enumeration of the different audio sample + * sizes. + */ +enum PP_AudioFrame_SampleSize { + PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN = 0, + PP_AUDIOFRAME_SAMPLESIZE_16_BITS = 2 +}; + interface PPB_AudioFrame { /** * Determines if a resource is an AudioFrame resource. @@ -55,7 +73,8 @@ interface PPB_AudioFrame { * * @return The sample size of the audio frame. */ - uint32_t GetSampleSize([in] PP_Resource frame); + [on_failure=PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN] + PP_AudioFrame_SampleSize GetSampleSize([in] PP_Resource frame); /** * Gets the number of channels in the audio frame. diff --git a/ppapi/api/ppb_media_stream_audio_track.idl b/ppapi/api/ppb_media_stream_audio_track.idl index 0f435ea..680a61a 100644 --- a/ppapi/api/ppb_media_stream_audio_track.idl +++ b/ppapi/api/ppb_media_stream_audio_track.idl @@ -16,7 +16,52 @@ label Chrome { }; /** + * This enumeration contains audio track attributes which are used by + * <code>Configure()</code>. */ +enum PP_MediaStreamAudioTrack_Attrib { + /** + * Attribute list terminator. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE = 0, + + /** + * The maximum number of frames to hold in the input buffer. + * Note: this is only used as advisory; the browser may allocate more or fewer + * based on available resources. How many frames to buffer depends on usage - + * request at least 2 to make sure latency doesn't cause lost frames. If + * the plugin expects to hold on to more than one frame at a time (e.g. to do + * multi-frame processing), it should request that many more. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERED_FRAMES = 1, + + /** + * The sample rate of audio frames. The attribute value is a + * <code>PP_AudioFrame_SampleRate</code>. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_RATE = 2, + + /** + * The sample size of audio frames in bytes. The attribute value is a + * <code>PP_AudioFrame_SampleSize</code>. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_SIZE = 3, + + /** + * The number of channels in audio frames. + * + * Supported values: 1, 2 + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_CHANNELS = 4, + + /** + * The duration of audio frames in milliseconds. + * + * Valid range: 10 to 10000 + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION = 5 +}; + interface PPB_MediaStreamAudioTrack { /** * Determines if a resource is a MediaStream audio track resource. @@ -32,23 +77,51 @@ interface PPB_MediaStreamAudioTrack { /** * Configures underlying frame buffers for incoming frames. * If the application doesn't want to drop frames, then the - * <code>max_buffered_frames</code> should be chosen such that inter-frame - * processing time variability won't overrun the input buffer. If the buffer - * is overfilled, then frames will be dropped. The application can detect - * this by examining the timestamp on returned frames. - * If <code>Configure()</code> is not used, default settings will be used. + * <code>PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERED_FRAMES</code> should be + * chosen such that inter-frame processing time variability won't overrun the + * input buffer. If the buffer is overfilled, then frames will be dropped. + * The application can detect this by examining the timestamp on returned + * frames. If <code>Configure()</code> is not called, default settings will be + * used. + * Example usage from plugin code: + * @code + * int32_t attribs[] = { + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERED_FRAMES, 4, + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION, 10, + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE}; + * track_if->Configure(track, attribs, callback); + * @endcode * * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio * resource. - * @param[in] samples_per_frame The number of audio samples in an audio frame. - * @param[in] max_buffered_frames The maximum number of audio frames to - * hold in the input buffer. + * @param[in] attrib_list A list of attribute name-value pairs in which each + * attribute is immediately followed by the corresponding desired value. + * The list is terminated by + * <code>PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE</code>. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of <code>Configure()</code>. * * @return An int32_t containing a result code from <code>pp_errors.h</code>. */ int32_t Configure([in] PP_Resource audio_track, - [in] uint32_t samples_per_frame, - [in] uint32_t max_buffered_frames); + [in] int32_t[] attrib_list, + [in] PP_CompletionCallback callback); + + /** + * Gets attribute value for a given attribute name. + * + * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio + * resource. + * @param[in] attrib A <code>PP_MediaStreamAudioTrack_Attrib</code> for + * querying. + * @param[out] value A int32_t for storing the attribute value on success. + * Otherwise, the value will not be changed. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t GetAttrib([in] PP_Resource audio_track, + [in] PP_MediaStreamAudioTrack_Attrib attrib, + [out] int32_t value); /** * Returns the track ID of the underlying MediaStream audio track. diff --git a/ppapi/api/ppb_media_stream_video_track.idl b/ppapi/api/ppb_media_stream_video_track.idl index 3052660..1f331c0 100644 --- a/ppapi/api/ppb_media_stream_video_track.idl +++ b/ppapi/api/ppb_media_stream_video_track.idl @@ -16,7 +16,46 @@ label Chrome { }; /** + * This enumeration contains video track attributes which are used by + * <code>Configure()</code>. */ +enum PP_MediaStreamVideoTrack_Attrib { + /** + * Attribute list terminator. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE = 0, + + /** + * The maximum number of frames to hold in the input buffer. + * Note: this is only used as advisory; the browser may allocate more or fewer + * based on available resources. How many frames to buffer depends on usage - + * request at least 2 to make sure latency doesn't cause lost frames. If + * the plugin expects to hold on to more than one frame at a time (e.g. to do + * multi-frame processing), it should request that many more. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES = 1, + + /** + * The width of video frames in pixels. It should be a multiple of 4. + * + * Maximum value: 4096 (4K resolution). + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_WIDTH = 2, + + /** + * The height of video frames in pixels. It should be a multiple of 4. + * + * Maximum value: 4096 (4K resolution). + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_HEIGHT = 3, + + /** + * The format of video frames. The attribute value is + * a <code>PP_VideoFrame_Format</code>. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_FORMAT = 4 +}; + interface PPB_MediaStreamVideoTrack { /** * Determines if a resource is a MediaStream video track resource. @@ -32,21 +71,50 @@ interface PPB_MediaStreamVideoTrack { /** * Configures underlying frame buffers for incoming frames. * If the application doesn't want to drop frames, then the - * <code>max_buffered_frames</code> should be chosen such that inter-frame - * processing time variability won't overrun the input buffer. If the buffer - * is overfilled, then frames will be dropped. The application can detect - * this by examining the timestamp on returned frames. - * If <code>Configure()</code> is not used, default settings will be used. + * <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES</code> should be + * chosen such that inter-frame processing time variability won't overrun the + * input buffer. If the buffer is overfilled, then frames will be dropped. + * The application can detect this by examining the timestamp on returned + * frames. If <code>Configure()</code> is not called, default settings will be + * used. + * Example usage from plugin code: + * @code + * int32_t attribs[] = { + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES, 4, + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE}; + * track_if->Configure(track, attribs, callback); + * @endcode * * @param[in] video_track A <code>PP_Resource</code> corresponding to a video * resource. - * @param[in] max_buffered_frames The maximum number of video frames to - * hold in the input buffer. + * @param[in] attrib_list A list of attribute name-value pairs in which each + * attribute is immediately followed by the corresponding desired value. + * The list is terminated by + * <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE</code>. + * @param[in] callback <code>PP_CompletionCallback</code> to be called upon + * completion of <code>Configure()</code>. * * @return An int32_t containing a result code from <code>pp_errors.h</code>. */ int32_t Configure([in] PP_Resource video_track, - [in] uint32_t max_buffered_frames); + [in] int32_t[] attrib_list, + [in] PP_CompletionCallback callback); + + /** + * Gets attribute value for a given attribute name. + * + * @param[in] video_track A <code>PP_Resource</code> corresponding to a video + * resource. + * @param[in] attrib A <code>PP_MediaStreamVideoTrack_Attrib</code> for + * querying. + * @param[out] value A int32_t for storing the attribute value on success. + * Otherwise, the value will not be changed. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t GetAttrib([in] PP_Resource video_track, + [in] PP_MediaStreamVideoTrack_Attrib attrib, + [out] int32_t value); /** * Returns the track ID of the underlying MediaStream video track. diff --git a/ppapi/api/ppb_video_frame.idl b/ppapi/api/ppb_video_frame.idl index e853b10..0ca6419 100644 --- a/ppapi/api/ppb_video_frame.idl +++ b/ppapi/api/ppb_video_frame.idl @@ -30,7 +30,7 @@ enum PP_VideoFrame_Format { PP_VIDEOFRAME_FORMAT_YV16 = 2, /** - * 12bpp YVU planar 1x1 Y, 2x2 VU samples. + * 12bpp YVU planar 1x1 Y, 2x2 UV samples. */ PP_VIDEOFRAME_FORMAT_I420 = 3, diff --git a/ppapi/c/ppb_audio_frame.h b/ppapi/c/ppb_audio_frame.h index 3f2b2a3..095a3ab 100644 --- a/ppapi/c/ppb_audio_frame.h +++ b/ppapi/c/ppb_audio_frame.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_audio_frame.idl modified Thu Jan 9 14:39:24 2014. */ +/* From ppb_audio_frame.idl modified Wed Jan 22 21:25:31 2014. */ #ifndef PPAPI_C_PPB_AUDIO_FRAME_H_ #define PPAPI_C_PPB_AUDIO_FRAME_H_ @@ -22,6 +22,31 @@ /** + * @addtogroup Enums + * @{ + */ +/** + * PP_AudioFrame_SampleRate is an enumeration of the different audio sample + * rates. + */ +typedef enum { + PP_AUDIOFRAME_SAMPLERATE_UNKNOWN = 0, + PP_AUDIOFRAME_SAMPLERATE_44100 = 44100 +} PP_AudioFrame_SampleRate; + +/** + * PP_AudioFrame_SampleSize is an enumeration of the different audio sample + * sizes. + */ +typedef enum { + PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN = 0, + PP_AUDIOFRAME_SAMPLESIZE_16_BITS = 2 +} PP_AudioFrame_SampleSize; +/** + * @} + */ + +/** * @addtogroup Interfaces * @{ */ @@ -63,7 +88,7 @@ struct PPB_AudioFrame_0_1 { /* dev */ * * @return The sample size of the audio frame. */ - uint32_t (*GetSampleSize)(PP_Resource frame); + PP_AudioFrame_SampleSize (*GetSampleSize)(PP_Resource frame); /** * Gets the number of channels in the audio frame. * diff --git a/ppapi/c/ppb_media_stream_audio_track.h b/ppapi/c/ppb_media_stream_audio_track.h index 89c78d0..ad1fc45 100644 --- a/ppapi/c/ppb_media_stream_audio_track.h +++ b/ppapi/c/ppb_media_stream_audio_track.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_media_stream_audio_track.idl modified Tue Jan 7 17:05:06 2014. */ +/* From ppb_media_stream_audio_track.idl modified Thu Jan 23 14:08:10 2014. */ #ifndef PPAPI_C_PPB_MEDIA_STREAM_AUDIO_TRACK_H_ #define PPAPI_C_PPB_MEDIA_STREAM_AUDIO_TRACK_H_ @@ -26,10 +26,57 @@ /** - * @addtogroup Interfaces + * @addtogroup Enums * @{ */ /** + * This enumeration contains audio track attributes which are used by + * <code>Configure()</code>. + */ +typedef enum { + /** + * Attribute list terminator. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE = 0, + /** + * The maximum number of frames to hold in the input buffer. + * Note: this is only used as advisory; the browser may allocate more or fewer + * based on available resources. How many frames to buffer depends on usage - + * request at least 2 to make sure latency doesn't cause lost frames. If + * the plugin expects to hold on to more than one frame at a time (e.g. to do + * multi-frame processing), it should request that many more. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERED_FRAMES = 1, + /** + * The sample rate of audio frames. The attribute value is a + * <code>PP_AudioFrame_SampleRate</code>. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_RATE = 2, + /** + * The sample size of audio frames in bytes. The attribute value is a + * <code>PP_AudioFrame_SampleSize</code>. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_SIZE = 3, + /** + * The number of channels in audio frames. + * + * Supported values: 1, 2 + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_CHANNELS = 4, + /** + * The duration of audio frames in milliseconds. + * + * Valid range: 10 to 10000 + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION = 5 +} PP_MediaStreamAudioTrack_Attrib; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ */ struct PPB_MediaStreamAudioTrack_0_1 { /* dev */ /** @@ -45,23 +92,50 @@ struct PPB_MediaStreamAudioTrack_0_1 { /* dev */ /** * Configures underlying frame buffers for incoming frames. * If the application doesn't want to drop frames, then the - * <code>max_buffered_frames</code> should be chosen such that inter-frame - * processing time variability won't overrun the input buffer. If the buffer - * is overfilled, then frames will be dropped. The application can detect - * this by examining the timestamp on returned frames. - * If <code>Configure()</code> is not used, default settings will be used. + * <code>PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERED_FRAMES</code> should be + * chosen such that inter-frame processing time variability won't overrun the + * input buffer. If the buffer is overfilled, then frames will be dropped. + * The application can detect this by examining the timestamp on returned + * frames. If <code>Configure()</code> is not called, default settings will be + * used. + * Example usage from plugin code: + * @code + * int32_t attribs[] = { + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERED_FRAMES, 4, + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION, 10, + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE}; + * track_if->Configure(track, attribs, callback); + * @endcode * * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio * resource. - * @param[in] samples_per_frame The number of audio samples in an audio frame. - * @param[in] max_buffered_frames The maximum number of audio frames to - * hold in the input buffer. + * @param[in] attrib_list A list of attribute name-value pairs in which each + * attribute is immediately followed by the corresponding desired value. + * The list is terminated by + * <code>PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE</code>. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of <code>Configure()</code>. * * @return An int32_t containing a result code from <code>pp_errors.h</code>. */ int32_t (*Configure)(PP_Resource audio_track, - uint32_t samples_per_frame, - uint32_t max_buffered_frames); + const int32_t attrib_list[], + struct PP_CompletionCallback callback); + /** + * Gets attribute value for a given attribute name. + * + * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio + * resource. + * @param[in] attrib A <code>PP_MediaStreamAudioTrack_Attrib</code> for + * querying. + * @param[out] value A int32_t for storing the attribute value on success. + * Otherwise, the value will not be changed. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*GetAttrib)(PP_Resource audio_track, + PP_MediaStreamAudioTrack_Attrib attrib, + int32_t* value); /** * Returns the track ID of the underlying MediaStream audio track. * diff --git a/ppapi/c/ppb_media_stream_video_track.h b/ppapi/c/ppb_media_stream_video_track.h index 0979b2e..650ccd2 100644 --- a/ppapi/c/ppb_media_stream_video_track.h +++ b/ppapi/c/ppb_media_stream_video_track.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_media_stream_video_track.idl modified Thu Jan 9 14:02:56 2014. */ +/* From ppb_media_stream_video_track.idl modified Thu Jan 23 14:09:56 2014. */ #ifndef PPAPI_C_PPB_MEDIA_STREAM_VIDEO_TRACK_H_ #define PPAPI_C_PPB_MEDIA_STREAM_VIDEO_TRACK_H_ @@ -26,10 +26,52 @@ /** - * @addtogroup Interfaces + * @addtogroup Enums * @{ */ /** + * This enumeration contains video track attributes which are used by + * <code>Configure()</code>. + */ +typedef enum { + /** + * Attribute list terminator. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE = 0, + /** + * The maximum number of frames to hold in the input buffer. + * Note: this is only used as advisory; the browser may allocate more or fewer + * based on available resources. How many frames to buffer depends on usage - + * request at least 2 to make sure latency doesn't cause lost frames. If + * the plugin expects to hold on to more than one frame at a time (e.g. to do + * multi-frame processing), it should request that many more. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES = 1, + /** + * The width of video frames in pixels. It should be a multiple of 4. + * + * Maximum value: 4096 (4K resolution). + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_WIDTH = 2, + /** + * The height of video frames in pixels. It should be a multiple of 4. + * + * Maximum value: 4096 (4K resolution). + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_HEIGHT = 3, + /** + * The format of video frames. The attribute value is + * a <code>PP_VideoFrame_Format</code>. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_FORMAT = 4 +} PP_MediaStreamVideoTrack_Attrib; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ */ struct PPB_MediaStreamVideoTrack_0_1 { /* dev */ /** @@ -45,20 +87,49 @@ struct PPB_MediaStreamVideoTrack_0_1 { /* dev */ /** * Configures underlying frame buffers for incoming frames. * If the application doesn't want to drop frames, then the - * <code>max_buffered_frames</code> should be chosen such that inter-frame - * processing time variability won't overrun the input buffer. If the buffer - * is overfilled, then frames will be dropped. The application can detect - * this by examining the timestamp on returned frames. - * If <code>Configure()</code> is not used, default settings will be used. + * <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES</code> should be + * chosen such that inter-frame processing time variability won't overrun the + * input buffer. If the buffer is overfilled, then frames will be dropped. + * The application can detect this by examining the timestamp on returned + * frames. If <code>Configure()</code> is not called, default settings will be + * used. + * Example usage from plugin code: + * @code + * int32_t attribs[] = { + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES, 4, + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE}; + * track_if->Configure(track, attribs, callback); + * @endcode + * + * @param[in] video_track A <code>PP_Resource</code> corresponding to a video + * resource. + * @param[in] attrib_list A list of attribute name-value pairs in which each + * attribute is immediately followed by the corresponding desired value. + * The list is terminated by + * <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE</code>. + * @param[in] callback <code>PP_CompletionCallback</code> to be called upon + * completion of <code>Configure()</code>. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*Configure)(PP_Resource video_track, + const int32_t attrib_list[], + struct PP_CompletionCallback callback); + /** + * Gets attribute value for a given attribute name. * * @param[in] video_track A <code>PP_Resource</code> corresponding to a video * resource. - * @param[in] max_buffered_frames The maximum number of video frames to - * hold in the input buffer. + * @param[in] attrib A <code>PP_MediaStreamVideoTrack_Attrib</code> for + * querying. + * @param[out] value A int32_t for storing the attribute value on success. + * Otherwise, the value will not be changed. * * @return An int32_t containing a result code from <code>pp_errors.h</code>. */ - int32_t (*Configure)(PP_Resource video_track, uint32_t max_buffered_frames); + int32_t (*GetAttrib)(PP_Resource video_track, + PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value); /** * Returns the track ID of the underlying MediaStream video track. * diff --git a/ppapi/c/ppb_video_frame.h b/ppapi/c/ppb_video_frame.h index 4bf043f..3acfdc7 100644 --- a/ppapi/c/ppb_video_frame.h +++ b/ppapi/c/ppb_video_frame.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From ppb_video_frame.idl modified Wed Jan 8 14:06:25 2014. */ +/* From ppb_video_frame.idl modified Wed Jan 22 21:25:01 2014. */ #ifndef PPAPI_C_PPB_VIDEO_FRAME_H_ #define PPAPI_C_PPB_VIDEO_FRAME_H_ @@ -40,7 +40,7 @@ typedef enum { */ PP_VIDEOFRAME_FORMAT_YV16 = 2, /** - * 12bpp YVU planar 1x1 Y, 2x2 VU samples. + * 12bpp YVU planar 1x1 Y, 2x2 UV samples. */ PP_VIDEOFRAME_FORMAT_I420 = 3, /** diff --git a/ppapi/cpp/media_stream_audio_track.cc b/ppapi/cpp/media_stream_audio_track.cc index 54dcba2..9fb41d3 100644 --- a/ppapi/cpp/media_stream_audio_track.cc +++ b/ppapi/cpp/media_stream_audio_track.cc @@ -40,11 +40,21 @@ MediaStreamAudioTrack::MediaStreamAudioTrack(PassRef, PP_Resource resource) MediaStreamAudioTrack::~MediaStreamAudioTrack() { } -int32_t MediaStreamAudioTrack::Configure(uint32_t samples_per_frame, - uint32_t frame_buffer_size) { +int32_t MediaStreamAudioTrack::Configure( + const int32_t attributes[], + const CompletionCallback& callback) { if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { return get_interface<PPB_MediaStreamAudioTrack_0_1>()->Configure( - pp_resource(), samples_per_frame, frame_buffer_size); + pp_resource(), attributes, callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +int32_t MediaStreamAudioTrack::GetAttrib(PP_MediaStreamAudioTrack_Attrib attrib, + int32_t* value) { + if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { + return get_interface<PPB_MediaStreamAudioTrack_0_1>()->GetAttrib( + pp_resource(), attrib, value); } return PP_ERROR_NOINTERFACE; } @@ -68,12 +78,12 @@ bool MediaStreamAudioTrack::HasEnded() const { } int32_t MediaStreamAudioTrack::GetFrame( - const CompletionCallbackWithOutput<AudioFrame>& cc) { + const CompletionCallbackWithOutput<AudioFrame>& callback) { if (has_interface<PPB_MediaStreamAudioTrack_0_1>()) { return get_interface<PPB_MediaStreamAudioTrack_0_1>()->GetFrame( - pp_resource(), cc.output(), cc.pp_completion_callback()); + pp_resource(), callback.output(), callback.pp_completion_callback()); } - return cc.MayForce(PP_ERROR_NOINTERFACE); + return callback.MayForce(PP_ERROR_NOINTERFACE); } int32_t MediaStreamAudioTrack::RecycleFrame(const AudioFrame& frame) { diff --git a/ppapi/cpp/media_stream_audio_track.h b/ppapi/cpp/media_stream_audio_track.h index 28b978b..c547bbb 100644 --- a/ppapi/cpp/media_stream_audio_track.h +++ b/ppapi/cpp/media_stream_audio_track.h @@ -7,8 +7,9 @@ #include <string> -#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb_media_stream_audio_track.h" #include "ppapi/cpp/resource.h" +#include "ppapi/cpp/var.h" /// @file /// This file defines the <code>MediaStreamAudioTrack</code> interface for an @@ -18,6 +19,7 @@ namespace pp { class AudioFrame; +class CompletionCallback; template <typename T> class CompletionCallbackWithOutput; /// The <code>MediaStreamAudioTrack</code> class contains methods for @@ -49,20 +51,41 @@ class MediaStreamAudioTrack : public Resource { /// Configures underlying frame buffers for incoming frames. /// If the application doesn't want to drop frames, then the - /// <code>max_buffered_frames</code> should be chosen such that inter-frame - /// processing time variability won't overrun the input buffer. If the buffer - /// is overfilled, then frames will be dropped. The application can detect - /// this by examining the timestamp on returned frames. - /// If <code>Configure()</code> is not used, default settings will be used. + /// <code>PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERED_FRAMES</code> should be + /// chosen such that inter-frame processing time variability won't overrun the + /// input buffer. If the buffer is overfilled, then frames will be dropped. + /// The application can detect this by examining the timestamp on returned + /// frames. If <code>Configure()</code> is not called, default settings will + /// be used. + /// Example usage from plugin code: + /// @code + /// int32_t attribs[] = { + /// PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERED_FRAMES, 4, + /// PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION, 10, + /// PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE}; + /// track.Configure(attribs, callback); + /// @endcode /// - /// @param[in] samples_per_frame The number of audio samples in an audio - /// frame. - /// @param[in] max_buffered_frames The maximum number of audio frames to - /// hold in the input buffer. + /// @param[in] attrib_list A list of attribute name-value pairs in which each + /// attribute is immediately followed by the corresponding desired value. + /// The list is terminated by + /// <code>PP_MEDIASTREAMAUDIOTRACK_AUDIO_NONE</code>. + /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + /// completion of <code>Configure()</code>. + /// + /// @return An int32_t containing a result code from <code>pp_errors.h</code>. + int32_t Configure(const int32_t attributes[], + const CompletionCallback& callback); + + /// Gets attribute value for a given attribute name. + /// + /// @param[in] attrib A <code>PP_MediaStreamAudioTrack_Attrib</code> for + /// querying. + /// @param[out] value A int32_t for storing the attribute value. /// /// @return An int32_t containing a result code from <code>pp_errors.h</code>. - int32_t Configure(uint32_t samples_per_frame, - uint32_t max_buffered_frames); + int32_t GetAttrib(PP_MediaStreamAudioTrack_Attrib attrib, + int32_t* value); /// Returns the track ID of the underlying MediaStream audio track. std::string GetId() const; diff --git a/ppapi/cpp/media_stream_video_track.cc b/ppapi/cpp/media_stream_video_track.cc index e33333e..38065a3 100644 --- a/ppapi/cpp/media_stream_video_track.cc +++ b/ppapi/cpp/media_stream_video_track.cc @@ -40,10 +40,21 @@ MediaStreamVideoTrack::MediaStreamVideoTrack(PassRef, PP_Resource resource) MediaStreamVideoTrack::~MediaStreamVideoTrack() { } -int32_t MediaStreamVideoTrack::Configure(uint32_t frame_buffer_size) { +int32_t MediaStreamVideoTrack::Configure( + const int32_t attributes[], + const CompletionCallback& callback) { if (has_interface<PPB_MediaStreamVideoTrack_0_1>()) { return get_interface<PPB_MediaStreamVideoTrack_0_1>()->Configure( - pp_resource(), frame_buffer_size); + pp_resource(), attributes, callback.pp_completion_callback()); + } + return callback.MayForce(PP_ERROR_NOINTERFACE); +} + +int32_t MediaStreamVideoTrack::GetAttrib(PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value) { + if (has_interface<PPB_MediaStreamVideoTrack_0_1>()) { + return get_interface<PPB_MediaStreamVideoTrack_0_1>()->GetAttrib( + pp_resource(), attrib, value); } return PP_ERROR_NOINTERFACE; } @@ -67,12 +78,12 @@ bool MediaStreamVideoTrack::HasEnded() const { } int32_t MediaStreamVideoTrack::GetFrame( - const CompletionCallbackWithOutput<VideoFrame>& cc) { + const CompletionCallbackWithOutput<VideoFrame>& callback) { if (has_interface<PPB_MediaStreamVideoTrack_0_1>()) { return get_interface<PPB_MediaStreamVideoTrack_0_1>()->GetFrame( - pp_resource(), cc.output(), cc.pp_completion_callback()); + pp_resource(), callback.output(), callback.pp_completion_callback()); } - return cc.MayForce(PP_ERROR_NOINTERFACE); + return callback.MayForce(PP_ERROR_NOINTERFACE); } int32_t MediaStreamVideoTrack::RecycleFrame(const VideoFrame& frame) { diff --git a/ppapi/cpp/media_stream_video_track.h b/ppapi/cpp/media_stream_video_track.h index ed7c93d..52a0551 100644 --- a/ppapi/cpp/media_stream_video_track.h +++ b/ppapi/cpp/media_stream_video_track.h @@ -7,8 +7,9 @@ #include <string> -#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb_media_stream_video_track.h" #include "ppapi/cpp/resource.h" +#include "ppapi/cpp/var.h" /// @file /// This file defines the <code>MediaStreamVideoTrack</code> interface for a @@ -18,6 +19,7 @@ namespace pp { class VideoFrame; +class CompletionCallback; template <typename T> class CompletionCallbackWithOutput; /// The <code>MediaStreamVideoTrack</code> class contains methods for @@ -49,17 +51,40 @@ class MediaStreamVideoTrack : public Resource { /// Configures underlying frame buffers for incoming frames. /// If the application doesn't want to drop frames, then the - /// <code>max_buffered_frames</code> should be chosen such that inter-frame - /// processing time variability won't overrun the input buffer. If the buffer - /// is overfilled, then frames will be dropped. The application can detect - /// this by examining the timestamp on returned frames. - /// If <code>Configure()</code> is not used, default settings will be used. + /// <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES</code> should be + /// chosen such that inter-frame processing time variability won't overrun the + /// input buffer. If the buffer is overfilled, then frames will be dropped. + /// The application can detect this by examining the timestamp on returned + /// frames. If <code>Configure()</code> is not called, default settings will + /// be used. + /// Example usage from plugin code: + /// @code + /// int32_t attribs[] = { + /// PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES, 4, + /// PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE}; + /// track.Configure(attribs, callback); + /// @endcode /// - /// @param[in] max_buffered_frames The maximum number of video frames to - /// hold in the input buffer. + /// @param[in] attrib_list A list of attribute name-value pairs in which each + /// attribute is immediately followed by the corresponding desired value. + /// The list is terminated by + /// <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE</code>. + /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + /// completion of <code>Configure()</code>. + /// + /// @return An int32_t containing a result code from <code>pp_errors.h</code>. + int32_t Configure(const int32_t attributes[], + const CompletionCallback& callback); + + /// Gets attribute value for a given attribute name. + /// + /// @param[in] attrib A <code>PP_MediaStreamVideoTrack_Attrib</code> for + /// querying. + /// @param[out] value A int32_t for storing the attribute value. /// /// @return An int32_t containing a result code from <code>pp_errors.h</code>. - int32_t Configure(uint32_t max_buffered_frames); + int32_t GetAttrib(PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value); /// Returns the track ID of the underlying MediaStream video track. std::string GetId() const; diff --git a/ppapi/examples/media_stream_video/media_stream_video.cc b/ppapi/examples/media_stream_video/media_stream_video.cc index 08590d7..b23f3ed 100644 --- a/ppapi/examples/media_stream_video/media_stream_video.cc +++ b/ppapi/examples/media_stream_video/media_stream_video.cc @@ -343,6 +343,7 @@ void MediaStreamVideoDemoInstance::OnGetFrame( const char* data = static_cast<const char*>(frame.GetDataBuffer()); pp::Size size; PP_DCHECK(frame.GetSize(&size)); + if (size != frame_size_) { frame_size_ = size; CreateYUVTextures(); diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 5988173..ecc08a4 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -992,9 +992,14 @@ static PP_Bool Pnacl_M34_PPB_MediaStreamAudioTrack_IsMediaStreamAudioTrack(PP_Re return iface->IsMediaStreamAudioTrack(resource); } -static int32_t Pnacl_M34_PPB_MediaStreamAudioTrack_Configure(PP_Resource audio_track, uint32_t samples_per_frame, uint32_t max_buffered_frames) { +static int32_t Pnacl_M34_PPB_MediaStreamAudioTrack_Configure(PP_Resource audio_track, const int32_t attrib_list[], struct PP_CompletionCallback* callback) { const struct PPB_MediaStreamAudioTrack_0_1 *iface = Pnacl_WrapperInfo_PPB_MediaStreamAudioTrack_0_1.real_iface; - return iface->Configure(audio_track, samples_per_frame, max_buffered_frames); + return iface->Configure(audio_track, attrib_list, *callback); +} + +static int32_t Pnacl_M34_PPB_MediaStreamAudioTrack_GetAttrib(PP_Resource audio_track, PP_MediaStreamAudioTrack_Attrib attrib, int32_t* value) { + const struct PPB_MediaStreamAudioTrack_0_1 *iface = Pnacl_WrapperInfo_PPB_MediaStreamAudioTrack_0_1.real_iface; + return iface->GetAttrib(audio_track, attrib, value); } static void Pnacl_M34_PPB_MediaStreamAudioTrack_GetId(struct PP_Var* _struct_result, PP_Resource audio_track) { @@ -1031,9 +1036,14 @@ static PP_Bool Pnacl_M34_PPB_MediaStreamVideoTrack_IsMediaStreamVideoTrack(PP_Re return iface->IsMediaStreamVideoTrack(resource); } -static int32_t Pnacl_M34_PPB_MediaStreamVideoTrack_Configure(PP_Resource video_track, uint32_t max_buffered_frames) { +static int32_t Pnacl_M34_PPB_MediaStreamVideoTrack_Configure(PP_Resource video_track, const int32_t attrib_list[], struct PP_CompletionCallback* callback) { + const struct PPB_MediaStreamVideoTrack_0_1 *iface = Pnacl_WrapperInfo_PPB_MediaStreamVideoTrack_0_1.real_iface; + return iface->Configure(video_track, attrib_list, *callback); +} + +static int32_t Pnacl_M34_PPB_MediaStreamVideoTrack_GetAttrib(PP_Resource video_track, PP_MediaStreamVideoTrack_Attrib attrib, int32_t* value) { const struct PPB_MediaStreamVideoTrack_0_1 *iface = Pnacl_WrapperInfo_PPB_MediaStreamVideoTrack_0_1.real_iface; - return iface->Configure(video_track, max_buffered_frames); + return iface->GetAttrib(video_track, attrib, value); } static void Pnacl_M34_PPB_MediaStreamVideoTrack_GetId(struct PP_Var* _struct_result, PP_Resource video_track) { @@ -4335,7 +4345,8 @@ static struct PPB_IMEInputEvent_1_0 Pnacl_Wrappers_PPB_IMEInputEvent_1_0 = { static struct PPB_MediaStreamAudioTrack_0_1 Pnacl_Wrappers_PPB_MediaStreamAudioTrack_0_1 = { .IsMediaStreamAudioTrack = (PP_Bool (*)(PP_Resource resource))&Pnacl_M34_PPB_MediaStreamAudioTrack_IsMediaStreamAudioTrack, - .Configure = (int32_t (*)(PP_Resource audio_track, uint32_t samples_per_frame, uint32_t max_buffered_frames))&Pnacl_M34_PPB_MediaStreamAudioTrack_Configure, + .Configure = (int32_t (*)(PP_Resource audio_track, const int32_t attrib_list[], struct PP_CompletionCallback callback))&Pnacl_M34_PPB_MediaStreamAudioTrack_Configure, + .GetAttrib = (int32_t (*)(PP_Resource audio_track, PP_MediaStreamAudioTrack_Attrib attrib, int32_t* value))&Pnacl_M34_PPB_MediaStreamAudioTrack_GetAttrib, .GetId = (struct PP_Var (*)(PP_Resource audio_track))&Pnacl_M34_PPB_MediaStreamAudioTrack_GetId, .HasEnded = (PP_Bool (*)(PP_Resource audio_track))&Pnacl_M34_PPB_MediaStreamAudioTrack_HasEnded, .GetFrame = (int32_t (*)(PP_Resource audio_track, PP_Resource* frame, struct PP_CompletionCallback callback))&Pnacl_M34_PPB_MediaStreamAudioTrack_GetFrame, @@ -4345,7 +4356,8 @@ static struct PPB_MediaStreamAudioTrack_0_1 Pnacl_Wrappers_PPB_MediaStreamAudioT static struct PPB_MediaStreamVideoTrack_0_1 Pnacl_Wrappers_PPB_MediaStreamVideoTrack_0_1 = { .IsMediaStreamVideoTrack = (PP_Bool (*)(PP_Resource resource))&Pnacl_M34_PPB_MediaStreamVideoTrack_IsMediaStreamVideoTrack, - .Configure = (int32_t (*)(PP_Resource video_track, uint32_t max_buffered_frames))&Pnacl_M34_PPB_MediaStreamVideoTrack_Configure, + .Configure = (int32_t (*)(PP_Resource video_track, const int32_t attrib_list[], struct PP_CompletionCallback callback))&Pnacl_M34_PPB_MediaStreamVideoTrack_Configure, + .GetAttrib = (int32_t (*)(PP_Resource video_track, PP_MediaStreamVideoTrack_Attrib attrib, int32_t* value))&Pnacl_M34_PPB_MediaStreamVideoTrack_GetAttrib, .GetId = (struct PP_Var (*)(PP_Resource video_track))&Pnacl_M34_PPB_MediaStreamVideoTrack_GetId, .HasEnded = (PP_Bool (*)(PP_Resource video_track))&Pnacl_M34_PPB_MediaStreamVideoTrack_HasEnded, .GetFrame = (int32_t (*)(PP_Resource video_track, PP_Resource* frame, struct PP_CompletionCallback callback))&Pnacl_M34_PPB_MediaStreamVideoTrack_GetFrame, diff --git a/ppapi/proxy/media_stream_video_track_resource.cc b/ppapi/proxy/media_stream_video_track_resource.cc index 0b76fb8..e8ab4c5 100644 --- a/ppapi/proxy/media_stream_video_track_resource.cc +++ b/ppapi/proxy/media_stream_video_track_resource.cc @@ -39,12 +39,22 @@ PP_Bool MediaStreamVideoTrackResource::HasEnded() { return PP_FromBool(has_ended()); } -int32_t MediaStreamVideoTrackResource::Configure(uint32_t max_buffered_frames) { + +int32_t MediaStreamVideoTrackResource::Configure( + const int32_t attrib_list[], + scoped_refptr<TrackedCallback> callback) { // TODO(penghuang): redesign and implement Configure() to support format, // size, etc. return PP_ERROR_NOTSUPPORTED; } +int32_t MediaStreamVideoTrackResource::GetAttrib( + PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value) { + // TODO(penghuang): implement this function. + return PP_ERROR_NOTSUPPORTED; +} + int32_t MediaStreamVideoTrackResource::GetFrame( PP_Resource* frame, scoped_refptr<TrackedCallback> callback) { diff --git a/ppapi/proxy/media_stream_video_track_resource.h b/ppapi/proxy/media_stream_video_track_resource.h index e402b0c..935a8a9 100644 --- a/ppapi/proxy/media_stream_video_track_resource.h +++ b/ppapi/proxy/media_stream_video_track_resource.h @@ -35,10 +35,12 @@ class PPAPI_PROXY_EXPORT MediaStreamVideoTrackResource // PPB_MediaStreamVideoTrack_API overrides: virtual PP_Var GetId() OVERRIDE; virtual PP_Bool HasEnded() OVERRIDE; - virtual int32_t Configure(uint32_t max_buffered_frames) OVERRIDE; - virtual int32_t GetFrame( - PP_Resource* frame, - scoped_refptr<TrackedCallback> callback) OVERRIDE; + virtual int32_t Configure(const int32_t attrib_list[], + scoped_refptr<TrackedCallback> callback) OVERRIDE; + virtual int32_t GetAttrib(PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value) OVERRIDE; + virtual int32_t GetFrame(PP_Resource* frame, + scoped_refptr<TrackedCallback> callback) OVERRIDE; virtual int32_t RecycleFrame(PP_Resource frame) OVERRIDE; virtual void Close() OVERRIDE; diff --git a/ppapi/thunk/ppb_audio_frame_api.h b/ppapi/thunk/ppb_audio_frame_api.h index d900538..21c4d71 100644 --- a/ppapi/thunk/ppb_audio_frame_api.h +++ b/ppapi/thunk/ppb_audio_frame_api.h @@ -16,7 +16,7 @@ class PPAPI_THUNK_EXPORT PPB_AudioFrame_API { virtual ~PPB_AudioFrame_API() {} virtual PP_TimeDelta GetTimestamp() = 0; virtual void SetTimestamp(PP_TimeDelta timestamp) = 0; - virtual uint32_t GetSampleSize() = 0; + virtual PP_AudioFrame_SampleSize GetSampleSize() = 0; virtual uint32_t GetNumberOfChannels() = 0; virtual uint32_t GetNumberOfSamples() = 0; virtual void* GetDataBuffer() = 0; diff --git a/ppapi/thunk/ppb_audio_frame_thunk.cc b/ppapi/thunk/ppb_audio_frame_thunk.cc index fa4d865..18cfdc4 100644 --- a/ppapi/thunk/ppb_audio_frame_thunk.cc +++ b/ppapi/thunk/ppb_audio_frame_thunk.cc @@ -2,16 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// From ppb_audio_frame.idl modified Mon Jan 13 11:39:02 2014. +// From ppb_audio_frame.idl modified Wed Jan 22 09:11:35 2014. #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_audio_frame.h" #include "ppapi/shared_impl/tracked_callback.h" #include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppapi_thunk_export.h" #include "ppapi/thunk/ppb_audio_frame_api.h" -#include "ppapi/thunk/ppb_instance_api.h" -#include "ppapi/thunk/resource_creation_api.h" -#include "ppapi/thunk/thunk.h" namespace ppapi { namespace thunk { @@ -40,11 +38,11 @@ void SetTimestamp(PP_Resource frame, PP_TimeDelta timestamp) { enter.object()->SetTimestamp(timestamp); } -uint32_t GetSampleSize(PP_Resource frame) { +PP_AudioFrame_SampleSize GetSampleSize(PP_Resource frame) { VLOG(4) << "PPB_AudioFrame::GetSampleSize()"; EnterResource<PPB_AudioFrame_API> enter(frame, true); if (enter.failed()) - return 0; + return PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN; return enter.object()->GetSampleSize(); } @@ -93,7 +91,7 @@ const PPB_AudioFrame_0_1 g_ppb_audioframe_thunk_0_1 = { } // namespace -const PPB_AudioFrame_0_1* GetPPB_AudioFrame_0_1_Thunk() { +PPAPI_THUNK_EXPORT const PPB_AudioFrame_0_1* GetPPB_AudioFrame_0_1_Thunk() { return &g_ppb_audioframe_thunk_0_1; } diff --git a/ppapi/thunk/ppb_media_stream_audio_track_api.h b/ppapi/thunk/ppb_media_stream_audio_track_api.h index 7b2068a..e013c4f1 100644 --- a/ppapi/thunk/ppb_media_stream_audio_track_api.h +++ b/ppapi/thunk/ppb_media_stream_audio_track_api.h @@ -5,6 +5,8 @@ #ifndef PPAPI_THUNK_PPB_MEDIA_STREAM_AUDIO_TRACK_API_H_ #define PPAPI_THUNK_PPB_MEDIA_STREAM_AUDIO_TRACK_API_H_ +#include "ppapi/c/ppb_media_stream_audio_track.h" + namespace ppapi { namespace thunk { @@ -13,11 +15,12 @@ class PPAPI_THUNK_EXPORT PPB_MediaStreamAudioTrack_API { virtual ~PPB_MediaStreamAudioTrack_API() {} virtual PP_Var GetId() = 0; virtual PP_Bool HasEnded() = 0; - virtual int32_t Configure(uint32_t samples_per_frame, - uint32_t max_buffered_frames) = 0; - virtual int32_t GetFrame( - PP_Resource* frame, - scoped_refptr<ppapi::TrackedCallback> callback) = 0; + virtual int32_t Configure(const int32_t attrib_list[], + scoped_refptr<ppapi::TrackedCallback> callback) = 0; + virtual int32_t GetAttrib(PP_MediaStreamAudioTrack_Attrib attrib, + int32_t* value) = 0; + virtual int32_t GetFrame(PP_Resource* frame, + scoped_refptr<ppapi::TrackedCallback> callback) = 0; virtual int32_t RecycleFrame(PP_Resource frame) = 0; virtual void Close() = 0; }; diff --git a/ppapi/thunk/ppb_media_stream_audio_track_thunk.cc b/ppapi/thunk/ppb_media_stream_audio_track_thunk.cc index ca066c1..34e4937 100644 --- a/ppapi/thunk/ppb_media_stream_audio_track_thunk.cc +++ b/ppapi/thunk/ppb_media_stream_audio_track_thunk.cc @@ -2,17 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// From ppb_media_stream_audio_track.idl modified Mon Jan 13 11:50:41 2014. +// From ppb_media_stream_audio_track.idl modified Thu Jan 23 08:57:17 2014. #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_media_stream_audio_track.h" #include "ppapi/shared_impl/tracked_callback.h" #include "ppapi/thunk/enter.h" -#include "ppapi/thunk/ppb_instance_api.h" +#include "ppapi/thunk/ppapi_thunk_export.h" #include "ppapi/thunk/ppb_media_stream_audio_track_api.h" -#include "ppapi/thunk/resource_creation_api.h" -#include "ppapi/thunk/thunk.h" namespace ppapi { namespace thunk { @@ -26,13 +24,26 @@ PP_Bool IsMediaStreamAudioTrack(PP_Resource resource) { } int32_t Configure(PP_Resource audio_track, - uint32_t samples_per_frame, - uint32_t max_buffered_frames) { + const int32_t attrib_list[], + struct PP_CompletionCallback callback) { VLOG(4) << "PPB_MediaStreamAudioTrack::Configure()"; + EnterResource<PPB_MediaStreamAudioTrack_API> enter(audio_track, + callback, + true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.object()->Configure(attrib_list, + enter.callback())); +} + +int32_t GetAttrib(PP_Resource audio_track, + PP_MediaStreamAudioTrack_Attrib attrib, + int32_t* value) { + VLOG(4) << "PPB_MediaStreamAudioTrack::GetAttrib()"; EnterResource<PPB_MediaStreamAudioTrack_API> enter(audio_track, true); if (enter.failed()) return enter.retval(); - return enter.object()->Configure(samples_per_frame, max_buffered_frames); + return enter.object()->GetAttrib(attrib, value); } struct PP_Var GetId(PP_Resource audio_track) { @@ -82,6 +93,7 @@ void Close(PP_Resource audio_track) { const PPB_MediaStreamAudioTrack_0_1 g_ppb_mediastreamaudiotrack_thunk_0_1 = { &IsMediaStreamAudioTrack, &Configure, + &GetAttrib, &GetId, &HasEnded, &GetFrame, @@ -91,7 +103,8 @@ const PPB_MediaStreamAudioTrack_0_1 g_ppb_mediastreamaudiotrack_thunk_0_1 = { } // namespace -const PPB_MediaStreamAudioTrack_0_1* GetPPB_MediaStreamAudioTrack_0_1_Thunk() { +PPAPI_THUNK_EXPORT const PPB_MediaStreamAudioTrack_0_1* + GetPPB_MediaStreamAudioTrack_0_1_Thunk() { return &g_ppb_mediastreamaudiotrack_thunk_0_1; } diff --git a/ppapi/thunk/ppb_media_stream_video_track_api.h b/ppapi/thunk/ppb_media_stream_video_track_api.h index 065bf67..9f18eaf 100644 --- a/ppapi/thunk/ppb_media_stream_video_track_api.h +++ b/ppapi/thunk/ppb_media_stream_video_track_api.h @@ -5,6 +5,8 @@ #ifndef PPAPI_THUNK_PPB_MEDIA_STREAM_VIDEO_TRACK_API_H_ #define PPAPI_THUNK_PPB_MEDIA_STREAM_VIDEO_TRACK_API_H_ +#include "ppapi/c/ppb_media_stream_video_track.h" + namespace ppapi { namespace thunk { @@ -13,10 +15,12 @@ class PPAPI_THUNK_EXPORT PPB_MediaStreamVideoTrack_API { virtual ~PPB_MediaStreamVideoTrack_API() {} virtual PP_Var GetId() = 0; virtual PP_Bool HasEnded() = 0; - virtual int32_t Configure(uint32_t max_buffered_frames) = 0; - virtual int32_t GetFrame( - PP_Resource* frame, - scoped_refptr<ppapi::TrackedCallback> callback) = 0; + virtual int32_t Configure(const int32_t attrib_list[], + scoped_refptr<ppapi::TrackedCallback> callback) = 0; + virtual int32_t GetAttrib(PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value) = 0; + virtual int32_t GetFrame(PP_Resource* frame, + scoped_refptr<ppapi::TrackedCallback> callback) = 0; virtual int32_t RecycleFrame(PP_Resource frame) = 0; virtual void Close() = 0; }; diff --git a/ppapi/thunk/ppb_media_stream_video_track_thunk.cc b/ppapi/thunk/ppb_media_stream_video_track_thunk.cc index 08e3899..d55ed38 100644 --- a/ppapi/thunk/ppb_media_stream_video_track_thunk.cc +++ b/ppapi/thunk/ppb_media_stream_video_track_thunk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// From ppb_media_stream_video_track.idl modified Mon Jan 13 12:02:23 2014. +// From ppb_media_stream_video_track.idl modified Thu Jan 23 08:56:57 2014. #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" @@ -23,12 +23,27 @@ PP_Bool IsMediaStreamVideoTrack(PP_Resource resource) { return PP_FromBool(enter.succeeded()); } -int32_t Configure(PP_Resource video_track, uint32_t max_buffered_frames) { +int32_t Configure(PP_Resource video_track, + const int32_t attrib_list[], + struct PP_CompletionCallback callback) { VLOG(4) << "PPB_MediaStreamVideoTrack::Configure()"; + EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, + callback, + true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.object()->Configure(attrib_list, + enter.callback())); +} + +int32_t GetAttrib(PP_Resource video_track, + PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value) { + VLOG(4) << "PPB_MediaStreamVideoTrack::GetAttrib()"; EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true); if (enter.failed()) return enter.retval(); - return enter.object()->Configure(max_buffered_frames); + return enter.object()->GetAttrib(attrib, value); } struct PP_Var GetId(PP_Resource video_track) { @@ -78,6 +93,7 @@ void Close(PP_Resource video_track) { const PPB_MediaStreamVideoTrack_0_1 g_ppb_mediastreamvideotrack_thunk_0_1 = { &IsMediaStreamVideoTrack, &Configure, + &GetAttrib, &GetId, &HasEnded, &GetFrame, |