OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 class VideoSource : public Notifier<VideoSourceInterface>, | 59 class VideoSource : public Notifier<VideoSourceInterface>, |
60 public sigslot::has_slots<> { | 60 public sigslot::has_slots<> { |
61 public: | 61 public: |
62 // Creates an instance of VideoSource. | 62 // Creates an instance of VideoSource. |
63 // VideoSource take ownership of |capturer|. | 63 // VideoSource take ownership of |capturer|. |
64 // |constraints| can be NULL and in that case the camera is opened using a | 64 // |constraints| can be NULL and in that case the camera is opened using a |
65 // default resolution. | 65 // default resolution. |
66 static rtc::scoped_refptr<VideoSource> Create( | 66 static rtc::scoped_refptr<VideoSource> Create( |
67 cricket::ChannelManager* channel_manager, | 67 cricket::ChannelManager* channel_manager, |
68 cricket::VideoCapturer* capturer, | 68 cricket::VideoCapturer* capturer, |
69 const webrtc::MediaConstraintsInterface* constraints); | 69 const webrtc::MediaConstraintsInterface* constraints, |
| 70 bool remote); |
70 | 71 |
71 virtual SourceState state() const { return state_; } | 72 SourceState state() const override { return state_; } |
| 73 bool remote() const override { return remote_; } |
| 74 |
72 virtual const cricket::VideoOptions* options() const { return &options_; } | 75 virtual const cricket::VideoOptions* options() const { return &options_; } |
73 virtual cricket::VideoRenderer* FrameInput(); | 76 virtual cricket::VideoRenderer* FrameInput(); |
74 | 77 |
75 virtual cricket::VideoCapturer* GetVideoCapturer() { | 78 virtual cricket::VideoCapturer* GetVideoCapturer() { |
76 return video_capturer_.get(); | 79 return video_capturer_.get(); |
77 } | 80 } |
78 | 81 |
79 void Stop() override; | 82 void Stop() override; |
80 void Restart() override; | 83 void Restart() override; |
81 | 84 |
82 // |output| will be served video frames as long as the underlying capturer | 85 // |output| will be served video frames as long as the underlying capturer |
83 // is running video frames. | 86 // is running video frames. |
84 virtual void AddSink(cricket::VideoRenderer* output); | 87 virtual void AddSink(cricket::VideoRenderer* output); |
85 virtual void RemoveSink(cricket::VideoRenderer* output); | 88 virtual void RemoveSink(cricket::VideoRenderer* output); |
86 | 89 |
87 protected: | 90 protected: |
88 VideoSource(cricket::ChannelManager* channel_manager, | 91 VideoSource(cricket::ChannelManager* channel_manager, |
89 cricket::VideoCapturer* capturer); | 92 cricket::VideoCapturer* capturer, |
| 93 bool remote); |
90 virtual ~VideoSource(); | 94 virtual ~VideoSource(); |
91 void Initialize(const webrtc::MediaConstraintsInterface* constraints); | 95 void Initialize(const webrtc::MediaConstraintsInterface* constraints); |
92 | 96 |
93 private: | 97 private: |
94 void OnStateChange(cricket::VideoCapturer* capturer, | 98 void OnStateChange(cricket::VideoCapturer* capturer, |
95 cricket::CaptureState capture_state); | 99 cricket::CaptureState capture_state); |
96 void SetState(SourceState new_state); | 100 void SetState(SourceState new_state); |
97 | 101 |
98 cricket::ChannelManager* channel_manager_; | 102 cricket::ChannelManager* channel_manager_; |
99 rtc::scoped_ptr<cricket::VideoCapturer> video_capturer_; | 103 rtc::scoped_ptr<cricket::VideoCapturer> video_capturer_; |
100 rtc::scoped_ptr<cricket::VideoRenderer> frame_input_; | 104 rtc::scoped_ptr<cricket::VideoRenderer> frame_input_; |
101 | 105 |
102 std::list<cricket::VideoRenderer*> sinks_; | 106 std::list<cricket::VideoRenderer*> sinks_; |
103 | 107 |
104 cricket::VideoFormat format_; | 108 cricket::VideoFormat format_; |
105 cricket::VideoOptions options_; | 109 cricket::VideoOptions options_; |
106 SourceState state_; | 110 SourceState state_; |
| 111 const bool remote_; |
107 }; | 112 }; |
108 | 113 |
109 } // namespace webrtc | 114 } // namespace webrtc |
110 | 115 |
111 #endif // TALK_APP_WEBRTC_VIDEOSOURCE_H_ | 116 #endif // TALK_APP_WEBRTC_VIDEOSOURCE_H_ |
OLD | NEW |