OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_DESTINATION_HANDLER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_VIDEO_DESTINATION_HANDLER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/compiler_specific.h" |
| 12 #include "content/common/content_export.h" |
| 13 #include "third_party/libjingle/source/talk/media/base/videocapturer.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" |
| 15 |
| 16 namespace content { |
| 17 |
| 18 class MediaStreamDependencyFactory; |
| 19 class MediaStreamRegistryInterface; |
| 20 |
| 21 // Interface used by the effects pepper plugin to output the processed frame |
| 22 // to the video track. |
| 23 class CONTENT_EXPORT FrameWriterInterface { |
| 24 public: |
| 25 // The ownership of the |frame| deosn't transfer. So the implementation of |
| 26 // this interface should make a copy of the |frame| before return. |
| 27 virtual void PutFrame(cricket::CapturedFrame* frame) = 0; |
| 28 |
| 29 protected: |
| 30 virtual ~FrameWriterInterface() {} |
| 31 }; |
| 32 |
| 33 // PpFrameWriter implements cricket::VideoCapturer so that it can be used in |
| 34 // the native video track's video source. It also implements |
| 35 // FrameWriterInterface, which will be used by the effects pepper plugin to |
| 36 // inject the processed frame. |
| 37 class CONTENT_EXPORT PpFrameWriter |
| 38 : public NON_EXPORTED_BASE(cricket::VideoCapturer), |
| 39 public FrameWriterInterface { |
| 40 public: |
| 41 PpFrameWriter(); |
| 42 virtual ~PpFrameWriter(); |
| 43 |
| 44 // cricket::VideoCapturer implementation. |
| 45 // These methods are accessed from a libJingle worker thread. |
| 46 virtual cricket::CaptureState Start( |
| 47 const cricket::VideoFormat& capture_format) OVERRIDE; |
| 48 virtual void Stop() OVERRIDE; |
| 49 virtual bool IsRunning() OVERRIDE; |
| 50 virtual bool GetPreferredFourccs(std::vector<uint32>* fourccs) OVERRIDE; |
| 51 virtual bool GetBestCaptureFormat(const cricket::VideoFormat& desired, |
| 52 cricket::VideoFormat* best_format) OVERRIDE; |
| 53 virtual bool IsScreencast() const OVERRIDE; |
| 54 |
| 55 // FrameWriterInterface implementation. |
| 56 virtual void PutFrame(cricket::CapturedFrame* frame) OVERRIDE; |
| 57 |
| 58 private: |
| 59 bool started_; |
| 60 }; |
| 61 |
| 62 // VideoDestinationHandler is a glue class between the webrtc MediaStream and |
| 63 // the effects pepper plugin host. |
| 64 class CONTENT_EXPORT VideoDestinationHandler { |
| 65 public: |
| 66 VideoDestinationHandler(MediaStreamDependencyFactory* factory, |
| 67 MediaStreamRegistryInterface* registry); |
| 68 bool Open(const std::string& url, FrameWriterInterface** frame_writer); |
| 69 virtual ~VideoDestinationHandler(); |
| 70 |
| 71 private: |
| 72 MediaStreamDependencyFactory* factory_; |
| 73 MediaStreamRegistryInterface* registry_; |
| 74 }; |
| 75 |
| 76 } // namespace content |
| 77 |
| 78 #endif // CONTENT_RENDERER_MEDIA_VIDEO_DESTINATION_HANDLER_H_ |
| 79 |
OLD | NEW |