[PresentationAPI] Update PresentationDispatcher to use availability URL.
[chromium-blink-merge.git] / ppapi / proxy / media_stream_video_track_resource.h
blobb6102ecdb5076b836da807dfae40fe655f27b76f
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
3 // found in the LICENSE file.
5 #ifndef PPAPI_PROXY_MEDIA_STREAM_VIDEO_TRACK_RESOURCE_H_
6 #define PPAPI_PROXY_MEDIA_STREAM_VIDEO_TRACK_RESOURCE_H_
8 #include <map>
10 #include "base/memory/ref_counted.h"
11 #include "ppapi/proxy/media_stream_track_resource_base.h"
12 #include "ppapi/proxy/ppapi_proxy_export.h"
13 #include "ppapi/thunk/ppb_media_stream_video_track_api.h"
15 namespace ppapi {
16 namespace proxy {
18 class VideoFrameResource;
20 class PPAPI_PROXY_EXPORT MediaStreamVideoTrackResource
21 : public MediaStreamTrackResourceBase,
22 public thunk::PPB_MediaStreamVideoTrack_API {
23 public:
24 MediaStreamVideoTrackResource(Connection connection,
25 PP_Instance instance,
26 int pending_renderer_id,
27 const std::string& id);
29 MediaStreamVideoTrackResource(Connection connection, PP_Instance instance);
31 ~MediaStreamVideoTrackResource() override;
33 // Resource overrides:
34 thunk::PPB_MediaStreamVideoTrack_API* AsPPB_MediaStreamVideoTrack_API()
35 override;
37 // PPB_MediaStreamVideoTrack_API overrides:
38 PP_Var GetId() override;
39 PP_Bool HasEnded() override;
40 int32_t Configure(const int32_t attrib_list[],
41 scoped_refptr<TrackedCallback> callback) override;
42 int32_t GetAttrib(PP_MediaStreamVideoTrack_Attrib attrib,
43 int32_t* value) override;
44 int32_t GetFrame(PP_Resource* frame,
45 scoped_refptr<TrackedCallback> callback) override;
46 int32_t RecycleFrame(PP_Resource frame) override;
47 void Close() override;
48 int32_t GetEmptyFrame(PP_Resource* frame,
49 scoped_refptr<TrackedCallback> callback) override;
50 int32_t PutFrame(PP_Resource frame) override;
52 // MediaStreamBufferManager::Delegate overrides:
53 void OnNewBufferEnqueued() override;
55 private:
56 PP_Resource GetVideoFrame();
58 void ReleaseFrames();
60 // IPC message handlers.
61 void OnPluginMsgConfigureReply(const ResourceMessageReplyParams& params,
62 const std::string& track_id);
64 // Allocated frame resources by |GetFrame()|.
65 typedef std::map<PP_Resource, scoped_refptr<VideoFrameResource> > FrameMap;
66 FrameMap frames_;
68 PP_Resource* get_frame_output_;
69 scoped_refptr<TrackedCallback> get_frame_callback_;
71 scoped_refptr<TrackedCallback> configure_callback_;
73 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoTrackResource);
76 } // namespace proxy
77 } // namespace ppapi
79 #endif // PPAPI_PROXY_MEDIA_STREAM_VIDEO_TRACK_RESOURCE_H_