Chromium Code Reviews| Index: content/renderer/media/video_source_handler.h |
| =================================================================== |
| --- content/renderer/media/video_source_handler.h (revision 0) |
| +++ content/renderer/media/video_source_handler.h (revision 0) |
| @@ -0,0 +1,73 @@ |
| +// Copyright (c) 2013 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 CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ |
| +#define CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
|
wjia(left Chromium)
2013/05/03 02:00:38
this one is not needed.
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Done.
|
| +#include "base/synchronization/lock.h" |
|
wjia(left Chromium)
2013/05/03 02:00:38
no lock is used.
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Done.
|
| +#include "content/common/content_export.h" |
| +#include "content/renderer/media/media_stream_registry_interface.h" |
|
wjia(left Chromium)
2013/05/03 02:00:38
it's already forward declared. do you still need t
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Moved to ccl
|
| +#include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" |
| +#include "third_party/libjingle/source/talk/media/base/videoframe.h" |
|
wjia(left Chromium)
2013/05/03 02:00:38
use forward declaration.
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Done.
|
| +#include "third_party/libjingle/source/talk/media/base/videorenderer.h" |
|
wjia(left Chromium)
2013/05/03 02:00:38
not needed.
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Moved to cc
|
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" |
|
wjia(left Chromium)
2013/05/03 02:00:38
Is this one needed?
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
dito
|
| + |
| +namespace content { |
| + |
| +class MediaStreamDependencyFactory; |
| +class MediaStreamRegistryInterface; |
| + |
| +// Interface used by the effects pepper plugin to get captured frame |
| +// from the video track. |
| +class CONTENT_EXPORT FrameReaderInterface { |
| + public: |
| + // Got a new captured frame. |
| + // The ownership of the |frame| transfers to the caller. So the caller must |
| + // delete |frame| when done with it. |
| + virtual bool GotFrame(cricket::VideoFrame* frame) = 0; |
| + |
| + protected: |
| + virtual ~FrameReaderInterface() {} |
| +}; |
| + |
| +// VideoSourceHandler is a glue class between the webrtc MediaStream and |
| +// the effects pepper plugin host. |
| +class CONTENT_EXPORT VideoSourceHandler { |
| + public: |
| + VideoSourceHandler(MediaStreamDependencyFactory* factory, |
| + MediaStreamRegistryInterface* registry); |
| + // Connects to the first video track in the MediaStream specified by |url| and |
| + // the received frames will be delivered via |reader|. |
| + // Returns true on success and false on failure. |
| + bool Open(const std::string& url, FrameReaderInterface* reader); |
| + // Closes |reader|'s connection with the first video track in |
| + // the MediaStream specified by |url|, i.e. stops receiving frames from the |
| + // video track. |
| + // Returns true on success and false on failure. |
| + bool Close(const std::string& url, FrameReaderInterface* reader); |
| + |
| + // Gets the VideoRenderer associated with |reader|. |
| + // Made it public only for testing purpose. |
| + cricket::VideoRenderer* GetReceiver(FrameReaderInterface* reader); |
| + |
| + private: |
| + scoped_refptr<webrtc::VideoSourceInterface> GetFirstVideoSource( |
| + const std::string& url); |
| + |
| + MediaStreamDependencyFactory* factory_; |
| + MediaStreamRegistryInterface* registry_; |
| + std::map<FrameReaderInterface*, cricket::VideoRenderer*> reader_to_receiver_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(VideoSourceHandler); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ |
| + |
| Property changes on: content/renderer/media/video_source_handler.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |