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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 class VideoCapturer; | 45 class VideoCapturer; |
46 class VideoProcessor; | 46 class VideoProcessor; |
47 class VideoRenderer; | 47 class VideoRenderer; |
48 | 48 |
49 class CaptureRenderAdapter : public sigslot::has_slots<> { | 49 class CaptureRenderAdapter : public sigslot::has_slots<> { |
50 public: | 50 public: |
51 static CaptureRenderAdapter* Create(VideoCapturer* video_capturer); | 51 static CaptureRenderAdapter* Create(VideoCapturer* video_capturer); |
52 ~CaptureRenderAdapter(); | 52 ~CaptureRenderAdapter(); |
53 | 53 |
54 bool AddRenderer(VideoRenderer* video_renderer); | 54 void AddRenderer(VideoRenderer* video_renderer); |
55 bool RemoveRenderer(VideoRenderer* video_renderer); | 55 void RemoveRenderer(VideoRenderer* video_renderer); |
56 | 56 |
57 VideoCapturer* video_capturer() { return video_capturer_; } | 57 VideoCapturer* video_capturer() { return video_capturer_; } |
58 private: | 58 private: |
59 struct VideoRendererInfo { | |
60 explicit VideoRendererInfo(VideoRenderer* r) | |
61 : renderer(r), | |
62 render_width(0), | |
63 render_height(0) { | |
64 } | |
65 VideoRenderer* renderer; | |
66 size_t render_width; | |
67 size_t render_height; | |
68 }; | |
69 | 59 |
70 // Just pointers since ownership is not handed over to this class. | 60 // Just pointers since ownership is not handed over to this class. |
71 typedef std::vector<VideoRendererInfo> VideoRenderers; | 61 typedef std::vector<VideoRenderer*> VideoRenderers; |
72 | 62 |
73 explicit CaptureRenderAdapter(VideoCapturer* video_capturer); | 63 explicit CaptureRenderAdapter(VideoCapturer* video_capturer); |
74 void Init(); | 64 void Init(); |
75 | 65 |
76 // Callback for frames received from the capturer. | 66 // Callback for frames received from the capturer. |
77 void OnVideoFrame(VideoCapturer* capturer, const VideoFrame* video_frame); | 67 void OnVideoFrame(VideoCapturer* capturer, const VideoFrame* video_frame); |
78 | 68 |
79 void MaybeSetRenderingSize(const VideoFrame* frame); | |
80 | |
81 bool IsRendererRegistered(const VideoRenderer& video_renderer) const; | |
82 | |
83 VideoRenderers video_renderers_; | 69 VideoRenderers video_renderers_; |
84 VideoCapturer* video_capturer_; | 70 VideoCapturer* video_capturer_; |
85 // Critical section synchronizing the capture thread. | 71 // Critical section synchronizing the capture thread. |
86 mutable rtc::CriticalSection capture_crit_; | 72 mutable rtc::CriticalSection capture_crit_; |
87 }; | 73 }; |
88 | 74 |
89 } // namespace cricket | 75 } // namespace cricket |
90 | 76 |
91 #endif // TALK_MEDIA_BASE_CAPTURERENDERADAPTER_H_ | 77 #endif // TALK_MEDIA_BASE_CAPTURERENDERADAPTER_H_ |
OLD | NEW |