| 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,89 @@
|
| +// 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"
|
| +#include "base/synchronization/lock.h"
|
| +#include "content/common/content_export.h"
|
| +#include "content/renderer/media/media_stream_registry_interface.h"
|
| +#include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h"
|
| +#include "third_party/libjingle/source/talk/media/base/videoframe.h"
|
| +#include "third_party/libjingle/source/talk/media/base/videorenderer.h"
|
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h"
|
| +
|
| +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:
|
| + // Gets the last captured frame.
|
| + // The ownership of the |frame| transfers to the caller. So the caller must
|
| + // release |frame| when done with it.
|
| + virtual bool GetFrame(cricket::VideoFrame** frame) = 0;
|
| +
|
| + protected:
|
| + virtual ~FrameReaderInterface() {}
|
| +};
|
| +
|
| +// PpFrameReader implements cricket::VideoRenderer so that it can be attached
|
| +// to native video track's video source. It also implements
|
| +// FrameReaderInterface, which will be used by the effects pepper plugin to
|
| +// get the captured frame.
|
| +class CONTENT_EXPORT PpFrameReader
|
| + : public NON_EXPORTED_BASE(cricket::VideoRenderer),
|
| + public FrameReaderInterface {
|
| + public:
|
| + PpFrameReader();
|
| + virtual ~PpFrameReader();
|
| +
|
| + // Implements VideoRenderer.
|
| + virtual bool SetSize(int width, int height, int reserved) OVERRIDE;
|
| + virtual bool RenderFrame(const cricket::VideoFrame* frame) OVERRIDE;
|
| +
|
| + // Implements FrameReaderInterface.
|
| + virtual bool GetFrame(cricket::VideoFrame** frame) OVERRIDE;
|
| +
|
| + private:
|
| + scoped_ptr<cricket::VideoFrame> last_frame_;
|
| + base::Lock lock_;
|
| +};
|
| +
|
| +// 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
|
| + // outputs a handler as |frame_reader| for receiving captured frames.
|
| + // Returns true on success and false on failure.
|
| + bool Open(const std::string& url, FrameReaderInterface** frame_reader);
|
| + // Closes |frame_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* frame_reader);
|
| +
|
| + private:
|
| + scoped_refptr<webrtc::VideoSourceInterface> GetFirstVideoSource(
|
| + const std::string& url);
|
| +
|
| + MediaStreamDependencyFactory* factory_;
|
| + MediaStreamRegistryInterface* registry_;
|
| +};
|
| +
|
| +} // 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
|
|
|
|
|