Ben Murdoch | eb525c5 | 2013-07-10 11:40:50 +0100 | [diff] [blame] | 1 | // Copyright 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_RTC_ENCODING_VIDEO_CAPTURER_FACTORY_H_ |
| 6 | #define CONTENT_RENDERER_MEDIA_RTC_ENCODING_VIDEO_CAPTURER_FACTORY_H_ |
| 7 | |
| 8 | #include "base/memory/weak_ptr.h" |
| 9 | #include "base/observer_list.h" |
| 10 | #include "media/video/encoded_video_source.h" |
| 11 | #include "media/video/video_encode_types.h" |
| 12 | #include "third_party/libjingle/source/talk/media/webrtc/webrtcvideoencoderfactory.h" |
| 13 | |
| 14 | namespace content { |
| 15 | |
| 16 | class RtcEncodingVideoCapturer; |
| 17 | |
| 18 | class RtcEncodingVideoCapturerFactory : |
| 19 | public cricket::WebRtcVideoEncoderFactory, |
| 20 | public base::SupportsWeakPtr<RtcEncodingVideoCapturerFactory> { |
| 21 | public: |
| 22 | RtcEncodingVideoCapturerFactory(); |
| 23 | |
| 24 | // WebRtcVideoEncoderFactory interface. |
| 25 | virtual webrtc::VideoEncoder* CreateVideoEncoder( |
| 26 | webrtc::VideoCodecType type) OVERRIDE; |
| 27 | virtual void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) OVERRIDE; |
| 28 | |
| 29 | virtual const std::vector<VideoCodec>& codecs() const OVERRIDE; |
| 30 | |
| 31 | virtual void AddObserver( |
| 32 | WebRtcVideoEncoderFactory::Observer* observer) OVERRIDE; |
| 33 | virtual void RemoveObserver( |
| 34 | WebRtcVideoEncoderFactory::Observer* observer) OVERRIDE; |
| 35 | |
| 36 | // Callback for RequestCapabilities(). |
| 37 | void OnCapabilitiesAvailable(const media::VideoEncodingCapabilities& caps); |
| 38 | |
| 39 | // Invoked when an EncodedVideoSource is added/removed. |
| 40 | void OnEncodedVideoSourceAdded(media::EncodedVideoSource* source); |
| 41 | void OnEncodedVideoSourceRemoved(media::EncodedVideoSource* source); |
| 42 | |
| 43 | private: |
| 44 | virtual ~RtcEncodingVideoCapturerFactory(); |
| 45 | |
| 46 | // Set of registered encoding capable video capturers. |
| 47 | typedef std::set<webrtc::VideoEncoder*> EncoderSet; |
| 48 | |
| 49 | media::EncodedVideoSource* encoded_video_source_; |
| 50 | std::vector<VideoCodec> codecs_; |
| 51 | |
| 52 | EncoderSet encoder_set_; |
| 53 | |
| 54 | ObserverList<WebRtcVideoEncoderFactory::Observer, true> observers_; |
| 55 | |
| 56 | DISALLOW_COPY_AND_ASSIGN(RtcEncodingVideoCapturerFactory); |
| 57 | }; |
| 58 | |
| 59 | } // namespace content |
| 60 | |
| 61 | #endif // CONTENT_RENDERER_MEDIA_RTC_ENCODING_VIDEO_CAPTURER_FACTORY_H_ |