diff options
-rw-r--r-- | chrome/browser/component_updater/ppapi_utils.cc | 2 | ||||
-rw-r--r-- | content/renderer/pepper/plugin_module.cc | 2 | ||||
-rw-r--r-- | ppapi/api/ppb_media_stream_video_track.idl | 9 | ||||
-rw-r--r-- | ppapi/api/ppb_video_frame.idl | 5 | ||||
-rw-r--r-- | ppapi/c/ppb_media_stream_video_track.h | 7 | ||||
-rw-r--r-- | ppapi/c/ppb_video_frame.h | 2 | ||||
-rw-r--r-- | ppapi/cpp/media_stream_video_track.h | 6 | ||||
-rw-r--r-- | ppapi/ppapi_shared.gypi | 4 | ||||
-rw-r--r-- | ppapi/ppapi_sources.gypi | 1 | ||||
-rw-r--r-- | ppapi/proxy/interface_list.cc | 2 | ||||
-rw-r--r-- | ppapi/shared_impl/resource.h | 2 | ||||
-rw-r--r-- | ppapi/thunk/interfaces_ppb_public_dev_channel.h | 3 | ||||
-rw-r--r-- | ppapi/thunk/ppb_media_stream_video_track_api.h | 27 | ||||
-rw-r--r-- | ppapi/thunk/ppb_media_stream_video_track_thunk.cc | 97 | ||||
-rw-r--r-- | ppapi/thunk/ppb_video_frame_api.h | 28 | ||||
-rw-r--r-- | ppapi/thunk/ppb_video_frame_thunk.cc | 92 |
16 files changed, 274 insertions, 15 deletions
diff --git a/chrome/browser/component_updater/ppapi_utils.cc b/chrome/browser/component_updater/ppapi_utils.cc index 5520fba..8e0886e 100644 --- a/chrome/browser/component_updater/ppapi_utils.cc +++ b/chrome/browser/component_updater/ppapi_utils.cc @@ -51,6 +51,7 @@ #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" +#include "ppapi/c/ppb_media_stream_video_track.h" #include "ppapi/c/ppb_messaging.h" #include "ppapi/c/ppb_mouse_cursor.h" #include "ppapi/c/ppb_mouse_lock.h" @@ -69,6 +70,7 @@ #include "ppapi/c/ppb_var_array.h" #include "ppapi/c/ppb_var_array_buffer.h" #include "ppapi/c/ppb_var_dictionary.h" +#include "ppapi/c/ppb_video_frame.h" #include "ppapi/c/ppb_view.h" #include "ppapi/c/ppb_websocket.h" #include "ppapi/c/private/ppb_content_decryptor_private.h" diff --git a/content/renderer/pepper/plugin_module.cc b/content/renderer/pepper/plugin_module.cc index 96ba510..700cba7 100644 --- a/content/renderer/pepper/plugin_module.cc +++ b/content/renderer/pepper/plugin_module.cc @@ -74,6 +74,7 @@ #include "ppapi/c/ppb_host_resolver.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_instance.h" +#include "ppapi/c/ppb_media_stream_video_track.h" #include "ppapi/c/ppb_messaging.h" #include "ppapi/c/ppb_mouse_cursor.h" #include "ppapi/c/ppb_mouse_lock.h" @@ -92,6 +93,7 @@ #include "ppapi/c/ppb_var_array.h" #include "ppapi/c/ppb_var_array_buffer.h" #include "ppapi/c/ppb_var_dictionary.h" +#include "ppapi/c/ppb_video_frame.h" #include "ppapi/c/ppb_view.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_instance.h" diff --git a/ppapi/api/ppb_media_stream_video_track.idl b/ppapi/api/ppb_media_stream_video_track.idl index f6e1238..3052660 100644 --- a/ppapi/api/ppb_media_stream_video_track.idl +++ b/ppapi/api/ppb_media_stream_video_track.idl @@ -8,6 +8,9 @@ * receiving video frames from a MediaStream video track in the browser. * This interface is still in development (Dev API status) and may change. */ + +[generate_thunk] + label Chrome { [channel=dev] M34 = 0.1 }; @@ -65,6 +68,7 @@ interface PPB_MediaStreamVideoTrack { * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given * MediaStream track has ended or <code>PP_FALSE</code> otherwise. */ + [on_failure=PP_TRUE] PP_Bool HasEnded([in] PP_Resource video_track); /** @@ -75,11 +79,8 @@ interface PPB_MediaStreamVideoTrack { * a spot for another frame to be buffered. * If there are no frames in the input buffer, * <code>PP_OK_COMPLETIONPENDING</code> will be returned immediately and the - * <code>callback</code> will be called, when a new frame is received or an + * <code>callback</code> will be called when a new frame is received or an * error happens. - * If the caller holds a frame returned by the previous call of - * <code>GetFrame()</code>, <code>PP_ERROR_INPROGRESS</code> will be returned. - * The caller should recycle the previous frame before getting the next frame. * * @param[in] video_track A <code>PP_Resource</code> corresponding to a video * resource. diff --git a/ppapi/api/ppb_video_frame.idl b/ppapi/api/ppb_video_frame.idl index 1cb8336..e853b10 100644 --- a/ppapi/api/ppb_video_frame.idl +++ b/ppapi/api/ppb_video_frame.idl @@ -6,6 +6,9 @@ /** * Defines the <code>PPB_VideoFrame</code> interface. */ + +[generate_thunk] + label Chrome { [channel=dev] M34 = 0.1 }; @@ -62,6 +65,7 @@ interface PPB_VideoFrame { * @return A <code>PP_TimeDelta</code> containing the timestamp of the video * frame. Given in seconds since the start of the containing video stream. */ + [on_failure=0.0] PP_TimeDelta GetTimestamp([in] PP_Resource frame); /** @@ -85,6 +89,7 @@ interface PPB_VideoFrame { * @return A <code>PP_VideoFrame_Format</code> containing the format of the * video frame. */ + [on_failure=PP_VIDEOFRAME_FORMAT_UNKNOWN] PP_VideoFrame_Format GetFormat([in] PP_Resource frame); /** diff --git a/ppapi/c/ppb_media_stream_video_track.h b/ppapi/c/ppb_media_stream_video_track.h index ff12c20..0979b2e 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 Fri Dec 27 17:28:11 2013. */ +/* From ppb_media_stream_video_track.idl modified Thu Jan 9 14:02:56 2014. */ #ifndef PPAPI_C_PPB_MEDIA_STREAM_VIDEO_TRACK_H_ #define PPAPI_C_PPB_MEDIA_STREAM_VIDEO_TRACK_H_ @@ -87,11 +87,8 @@ struct PPB_MediaStreamVideoTrack_0_1 { /* dev */ * a spot for another frame to be buffered. * If there are no frames in the input buffer, * <code>PP_OK_COMPLETIONPENDING</code> will be returned immediately and the - * <code>callback</code> will be called, when a new frame is received or an + * <code>callback</code> will be called when a new frame is received or an * error happens. - * If the caller holds a frame returned by the previous call of - * <code>GetFrame()</code>, <code>PP_ERROR_INPROGRESS</code> will be returned. - * The caller should recycle the previous frame before getting the next frame. * * @param[in] video_track A <code>PP_Resource</code> corresponding to a video * resource. diff --git a/ppapi/c/ppb_video_frame.h b/ppapi/c/ppb_video_frame.h index 02fdc80..4bf043f 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 Fri Dec 27 17:21:52 2013. */ +/* From ppb_video_frame.idl modified Wed Jan 8 14:06:25 2014. */ #ifndef PPAPI_C_PPB_VIDEO_FRAME_H_ #define PPAPI_C_PPB_VIDEO_FRAME_H_ diff --git a/ppapi/cpp/media_stream_video_track.h b/ppapi/cpp/media_stream_video_track.h index 4151077..b056178 100644 --- a/ppapi/cpp/media_stream_video_track.h +++ b/ppapi/cpp/media_stream_video_track.h @@ -76,12 +76,8 @@ class MediaStreamVideoTrack : public Resource { /// a spot for another frame to be buffered. /// If there are no frames in the input buffer, /// <code>PP_OK_COMPLETIONPENDING</code> will be returned immediately and the - /// <code>callback</code> will be called, when a new frame is received or some + /// <code>callback</code> will be called when a new frame is received or some /// error happens. - /// If the caller holds a frame returned by the previous call of - /// <code>GetFrame()</code>, <code>PP_ERROR_INPROGRESS</code> will be - /// returned. The caller should recycle the previous frame before getting - /// the next frame. /// /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon /// completion of <code>GetFrame()</code>. If success, a VideoFrame will be diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index 8e5f50b..e87bf7c 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -201,6 +201,8 @@ 'thunk/ppb_instance_thunk.cc', 'thunk/ppb_isolated_file_system_private_api.h', 'thunk/ppb_isolated_file_system_private_thunk.cc', + 'thunk/ppb_media_stream_video_track_api.h', + 'thunk/ppb_media_stream_video_track_thunk.cc', 'thunk/ppb_message_loop_api.h', 'thunk/ppb_messaging_thunk.cc', 'thunk/ppb_mouse_cursor_thunk.cc', @@ -256,6 +258,8 @@ 'thunk/ppb_video_decoder_thunk.cc', 'thunk/ppb_video_destination_private_api.h', 'thunk/ppb_video_destination_private_thunk.cc', + 'thunk/ppb_video_frame_api.h', + 'thunk/ppb_video_frame_thunk.cc', 'thunk/ppb_video_source_private_api.h', 'thunk/ppb_video_source_private_thunk.cc', 'thunk/ppb_view_api.h', diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index d84d9ec..9e83be1 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -61,6 +61,7 @@ 'c/ppb_var_array.h', 'c/ppb_var_array_buffer.h', 'c/ppb_var_dictionary.h', + 'c/ppb_video_frame.h', 'c/ppb_view.h', 'c/ppb_websocket.h', 'c/ppp.h', diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index c734710..154ffc1 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -43,6 +43,7 @@ #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_input_event.h" #include "ppapi/c/ppb_instance.h" +#include "ppapi/c/ppb_media_stream_video_track.h" #include "ppapi/c/ppb_message_loop.h" #include "ppapi/c/ppb_messaging.h" #include "ppapi/c/ppb_mouse_lock.h" @@ -61,6 +62,7 @@ #include "ppapi/c/ppb_var_array.h" #include "ppapi/c/ppb_var_array_buffer.h" #include "ppapi/c/ppb_var_dictionary.h" +#include "ppapi/c/ppb_video_frame.h" #include "ppapi/c/ppb_view.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppp_instance.h" diff --git a/ppapi/shared_impl/resource.h b/ppapi/shared_impl/resource.h index a3c15d1..6a11076 100644 --- a/ppapi/shared_impl/resource.h +++ b/ppapi/shared_impl/resource.h @@ -53,6 +53,7 @@ F(PPB_InputEvent_API) \ F(PPB_IsolatedFileSystem_Private_API) \ F(PPB_LayerCompositor_API) \ + F(PPB_MediaStreamVideoTrack_API) \ F(PPB_MessageLoop_API) \ F(PPB_NetAddress_API) \ F(PPB_NetworkList_API) \ @@ -77,6 +78,7 @@ F(PPB_VideoCapture_API) \ F(PPB_VideoDecoder_API) \ F(PPB_VideoDestination_Private_API) \ + F(PPB_VideoFrame_API) \ F(PPB_VideoLayer_API) \ F(PPB_VideoSource_Private_API) \ F(PPB_View_API) \ diff --git a/ppapi/thunk/interfaces_ppb_public_dev_channel.h b/ppapi/thunk/interfaces_ppb_public_dev_channel.h index a70442b..1f5861d 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev_channel.h +++ b/ppapi/thunk/interfaces_ppb_public_dev_channel.h @@ -8,5 +8,8 @@ #include "ppapi/thunk/interfaces_preamble.h" // Interfaces go here. +PROXIED_IFACE(PPB_MEDIASTREAMVIDEOTRACK_INTERFACE_0_1, + PPB_MediaStreamVideoTrack_0_1) +PROXIED_IFACE(PPB_VIDEOFRAME_INTERFACE_0_1, PPB_VideoFrame_0_1) #include "ppapi/thunk/interfaces_postamble.h" diff --git a/ppapi/thunk/ppb_media_stream_video_track_api.h b/ppapi/thunk/ppb_media_stream_video_track_api.h new file mode 100644 index 0000000..065bf67 --- /dev/null +++ b/ppapi/thunk/ppb_media_stream_video_track_api.h @@ -0,0 +1,27 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_THUNK_PPB_MEDIA_STREAM_VIDEO_TRACK_API_H_ +#define PPAPI_THUNK_PPB_MEDIA_STREAM_VIDEO_TRACK_API_H_ + +namespace ppapi { +namespace thunk { + +class PPAPI_THUNK_EXPORT PPB_MediaStreamVideoTrack_API { + public: + 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 RecycleFrame(PP_Resource frame) = 0; + virtual void Close() = 0; +}; + +} // namespace thunk +} // namespace ppapi + +#endif // PPAPI_THUNK_PPB_MEDIA_STREAM_VIDEO_TRACK_API_H_ diff --git a/ppapi/thunk/ppb_media_stream_video_track_thunk.cc b/ppapi/thunk/ppb_media_stream_video_track_thunk.cc new file mode 100644 index 0000000..9a6b92a --- /dev/null +++ b/ppapi/thunk/ppb_media_stream_video_track_thunk.cc @@ -0,0 +1,97 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// 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 Wed Jan 8 14:08:11 2014. + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_media_stream_video_track.h" +#include "ppapi/shared_impl/tracked_callback.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_instance_api.h" +#include "ppapi/thunk/ppb_media_stream_video_track_api.h" +#include "ppapi/thunk/resource_creation_api.h" +#include "ppapi/thunk/thunk.h" + +namespace ppapi { +namespace thunk { + +namespace { + +PP_Bool IsMediaStreamVideoTrack(PP_Resource resource) { + VLOG(4) << "PPB_MediaStreamVideoTrack::IsMediaStreamVideoTrack()"; + EnterResource<PPB_MediaStreamVideoTrack_API> enter(resource, false); + return PP_FromBool(enter.succeeded()); +} + +int32_t Configure(PP_Resource video_track, uint32_t max_buffered_frames) { + VLOG(4) << "PPB_MediaStreamVideoTrack::Configure()"; + EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true); + if (enter.failed()) + return enter.retval(); + return enter.object()->Configure(max_buffered_frames); +} + +struct PP_Var GetId(PP_Resource video_track) { + VLOG(4) << "PPB_MediaStreamVideoTrack::GetId()"; + EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true); + if (enter.failed()) + return PP_MakeUndefined(); + return enter.object()->GetId(); +} + +PP_Bool HasEnded(PP_Resource video_track) { + VLOG(4) << "PPB_MediaStreamVideoTrack::HasEnded()"; + EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true); + if (enter.failed()) + return PP_TRUE; + return enter.object()->HasEnded(); +} + +int32_t GetFrame(PP_Resource video_track, + PP_Resource* frame, + struct PP_CompletionCallback callback) { + VLOG(4) << "PPB_MediaStreamVideoTrack::GetFrame()"; + EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, + callback, + true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.object()->GetFrame(frame, enter.callback())); +} + +int32_t RecycleFrame(PP_Resource video_track, PP_Resource frame) { + VLOG(4) << "PPB_MediaStreamVideoTrack::RecycleFrame()"; + EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true); + if (enter.failed()) + return enter.retval(); + return enter.object()->RecycleFrame(frame); +} + +void Close(PP_Resource video_track) { + VLOG(4) << "PPB_MediaStreamVideoTrack::Close()"; + EnterResource<PPB_MediaStreamVideoTrack_API> enter(video_track, true); + if (enter.failed()) + return; + enter.object()->Close(); +} + +const PPB_MediaStreamVideoTrack_0_1 g_ppb_mediastreamvideotrack_thunk_0_1 = { + &IsMediaStreamVideoTrack, + &Configure, + &GetId, + &HasEnded, + &GetFrame, + &RecycleFrame, + &Close +}; + +} // namespace + +const PPB_MediaStreamVideoTrack_0_1* GetPPB_MediaStreamVideoTrack_0_1_Thunk() { + return &g_ppb_mediastreamvideotrack_thunk_0_1; +} + +} // namespace thunk +} // namespace ppapi diff --git a/ppapi/thunk/ppb_video_frame_api.h b/ppapi/thunk/ppb_video_frame_api.h new file mode 100644 index 0000000..50f2247 --- /dev/null +++ b/ppapi/thunk/ppb_video_frame_api.h @@ -0,0 +1,28 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef PPAPI_THUNK_PPB_VIDEO_FRAME_API_H_ +#define PPAPI_THUNK_PPB_VIDEO_FRAME_API_H_ + +#include "ppapi/c/ppb_video_frame.h" +#include "ppapi/thunk/ppapi_thunk_export.h" + +namespace ppapi { +namespace thunk { + +class PPAPI_THUNK_EXPORT PPB_VideoFrame_API { + public: + virtual ~PPB_VideoFrame_API() {} + virtual PP_TimeDelta GetTimestamp() = 0; + virtual void SetTimestamp(PP_TimeDelta timestamp) = 0; + virtual PP_VideoFrame_Format GetFormat() = 0; + virtual PP_Bool GetSize(PP_Size* size) = 0; + virtual void* GetDataBuffer() = 0; + virtual uint32_t GetDataBufferSize() = 0; +}; + +} // namespace thunk +} // namespace ppapi + +#endif // PPAPI_THUNK_PPB_VIDEO_FRAME_API_H_ diff --git a/ppapi/thunk/ppb_video_frame_thunk.cc b/ppapi/thunk/ppb_video_frame_thunk.cc new file mode 100644 index 0000000..82457fd --- /dev/null +++ b/ppapi/thunk/ppb_video_frame_thunk.cc @@ -0,0 +1,92 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// From ppb_video_frame.idl modified Wed Jan 8 13:30:05 2014. + +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/ppb_video_frame.h" +#include "ppapi/shared_impl/tracked_callback.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_instance_api.h" +#include "ppapi/thunk/ppb_video_frame_api.h" +#include "ppapi/thunk/resource_creation_api.h" +#include "ppapi/thunk/thunk.h" + +namespace ppapi { +namespace thunk { + +namespace { + +PP_Bool IsVideoFrame(PP_Resource resource) { + VLOG(4) << "PPB_VideoFrame::IsVideoFrame()"; + EnterResource<PPB_VideoFrame_API> enter(resource, false); + return PP_FromBool(enter.succeeded()); +} + +PP_TimeDelta GetTimestamp(PP_Resource frame) { + VLOG(4) << "PPB_VideoFrame::GetTimestamp()"; + EnterResource<PPB_VideoFrame_API> enter(frame, true); + if (enter.failed()) + return 0.0; + return enter.object()->GetTimestamp(); +} + +void SetTimestamp(PP_Resource frame, PP_TimeDelta timestamp) { + VLOG(4) << "PPB_VideoFrame::SetTimestamp()"; + EnterResource<PPB_VideoFrame_API> enter(frame, true); + if (enter.failed()) + return; + enter.object()->SetTimestamp(timestamp); +} + +PP_VideoFrame_Format GetFormat(PP_Resource frame) { + VLOG(4) << "PPB_VideoFrame::GetFormat()"; + EnterResource<PPB_VideoFrame_API> enter(frame, true); + if (enter.failed()) + return PP_VIDEOFRAME_FORMAT_UNKNOWN; + return enter.object()->GetFormat(); +} + +PP_Bool GetSize(PP_Resource frame, struct PP_Size* size) { + VLOG(4) << "PPB_VideoFrame::GetSize()"; + EnterResource<PPB_VideoFrame_API> enter(frame, true); + if (enter.failed()) + return PP_FALSE; + return enter.object()->GetSize(size); +} + +void* GetDataBuffer(PP_Resource frame) { + VLOG(4) << "PPB_VideoFrame::GetDataBuffer()"; + EnterResource<PPB_VideoFrame_API> enter(frame, true); + if (enter.failed()) + return NULL; + return enter.object()->GetDataBuffer(); +} + +uint32_t GetDataBufferSize(PP_Resource frame) { + VLOG(4) << "PPB_VideoFrame::GetDataBufferSize()"; + EnterResource<PPB_VideoFrame_API> enter(frame, true); + if (enter.failed()) + return 0; + return enter.object()->GetDataBufferSize(); +} + +const PPB_VideoFrame_0_1 g_ppb_videoframe_thunk_0_1 = { + &IsVideoFrame, + &GetTimestamp, + &SetTimestamp, + &GetFormat, + &GetSize, + &GetDataBuffer, + &GetDataBufferSize +}; + +} // namespace + +const PPB_VideoFrame_0_1* GetPPB_VideoFrame_0_1_Thunk() { + return &g_ppb_videoframe_thunk_0_1; +} + +} // namespace thunk +} // namespace ppapi |