1 // Copyright (c) 2013 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 CONTENT_RENDERER_MEDIA_WEBRTC_VIDEO_DESTINATION_HANDLER_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_VIDEO_DESTINATION_HANDLER_H_
11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/common/content_export.h"
17 class PeerConnectionDependencyFactory
;
18 class MediaStreamRegistryInterface
;
19 class PPB_ImageData_Impl
;
21 // Interface used by a Pepper plugin to output frames to a video track.
22 class CONTENT_EXPORT FrameWriterInterface
{
24 // The ownership of the |image_data| doesn't transfer. So the implementation
25 // of this interface should make a copy of the |image_data| before return.
26 virtual void PutFrame(PPB_ImageData_Impl
* image_data
,
27 int64 time_stamp_ns
) = 0;
28 virtual ~FrameWriterInterface() {}
31 // PepperToVideoTrackAdapter is a glue class between the content MediaStream and
32 // the effects pepper plugin host.
33 class CONTENT_EXPORT PepperToVideoTrackAdapter
{
35 // Instantiates and adds a new video track to the MediaStream specified by
36 // |url|. Returns a handler for delivering frames to the new video track as
38 // If |registry| is NULL the global blink::WebMediaStreamRegistry will be
39 // used to look up the media stream.
40 // The caller of the function takes the ownership of |frame_writer|.
41 // Returns true on success and false on failure.
42 static bool Open(MediaStreamRegistryInterface
* registry
,
43 const std::string
& url
,
44 FrameWriterInterface
** frame_writer
);
47 DISALLOW_COPY_AND_ASSIGN(PepperToVideoTrackAdapter
);
50 } // namespace content
52 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_VIDEO_DESTINATION_HANDLER_H_