Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: webrtc/modules/video_capture/video_capture_impl.h

Issue 2534553002: Replace VideoCaptureDataCallback by VideoSinkInterface. (Closed)
Patch Set: Break overlong lines. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 21 matching lines...) Expand all
32 { 32 {
33 public: 33 public:
34 34
35 /* 35 /*
36 * Create a video capture module object 36 * Create a video capture module object
37 * 37 *
38 * id - unique identifier of this video capture module object 38 * id - unique identifier of this video capture module object
39 * deviceUniqueIdUTF8 - name of the device. Available names can be found by using GetDeviceName 39 * deviceUniqueIdUTF8 - name of the device. Available names can be found by using GetDeviceName
40 */ 40 */
41 static rtc::scoped_refptr<VideoCaptureModule> Create( 41 static rtc::scoped_refptr<VideoCaptureModule> Create(
42 const int32_t id,
43 const char* deviceUniqueIdUTF8); 42 const char* deviceUniqueIdUTF8);
44 43
45 /* 44 /*
46 * Create a video capture module object used for external capture. 45 * Create a video capture module object used for external capture.
47 * 46 *
48 * id - unique identifier of this video capture module object 47 * id - unique identifier of this video capture module object
49 * externalCapture - [out] interface to call when a new frame is captured. 48 * externalCapture - [out] interface to call when a new frame is captured.
50 */ 49 */
51 static rtc::scoped_refptr<VideoCaptureModule> Create( 50 static rtc::scoped_refptr<VideoCaptureModule> Create(
52 const int32_t id,
53 VideoCaptureExternal*& externalCapture); 51 VideoCaptureExternal*& externalCapture);
54 52
55 static DeviceInfo* CreateDeviceInfo(const int32_t id); 53 static DeviceInfo* CreateDeviceInfo();
56 54
57 // Helpers for converting between (integral) degrees and 55 // Helpers for converting between (integral) degrees and
58 // VideoRotation values. Return 0 on success. 56 // VideoRotation values. Return 0 on success.
59 static int32_t RotationFromDegrees(int degrees, VideoRotation* rotation); 57 static int32_t RotationFromDegrees(int degrees, VideoRotation* rotation);
60 static int32_t RotationInDegrees(VideoRotation rotation, int* degrees); 58 static int32_t RotationInDegrees(VideoRotation rotation, int* degrees);
61 59
62 //Call backs 60 //Call backs
63 virtual void RegisterCaptureDataCallback( 61 void RegisterCaptureDataCallback(
64 VideoCaptureDataCallback& dataCallback); 62 rtc::VideoSinkInterface<VideoFrame>* dataCallback) override;
65 virtual void DeRegisterCaptureDataCallback(); 63 void DeRegisterCaptureDataCallback() override;
66 virtual void RegisterCaptureCallback(VideoCaptureFeedBack& callBack);
67 virtual void DeRegisterCaptureCallback();
68 64
69 virtual void SetCaptureDelay(int32_t delayMS); 65 int32_t SetCaptureRotation(VideoRotation rotation) override;
70 virtual int32_t CaptureDelay(); 66 bool SetApplyRotation(bool enable) override;
71 virtual int32_t SetCaptureRotation(VideoRotation rotation); 67 bool GetApplyRotation() override {
72 virtual bool SetApplyRotation(bool enable);
73 virtual bool GetApplyRotation() {
74 return apply_rotation_; 68 return apply_rotation_;
75 } 69 }
76 70
77 virtual void EnableFrameRateCallback(const bool enable); 71 const char* CurrentDeviceName() const override;
78 virtual void EnableNoPictureAlarm(const bool enable);
79
80 virtual const char* CurrentDeviceName() const;
81
82 // Module handling
83 virtual int64_t TimeUntilNextProcess();
84 virtual void Process();
85 72
86 // Implement VideoCaptureExternal 73 // Implement VideoCaptureExternal
87 // |capture_time| must be specified in NTP time format in milliseconds. 74 // |capture_time| must be specified in NTP time format in milliseconds.
88 virtual int32_t IncomingFrame(uint8_t* videoFrame, 75 int32_t IncomingFrame(uint8_t* videoFrame,
89 size_t videoFrameLength, 76 size_t videoFrameLength,
90 const VideoCaptureCapability& frameInfo, 77 const VideoCaptureCapability& frameInfo,
91 int64_t captureTime = 0); 78 int64_t captureTime = 0) override;
92 79
93 // Platform dependent 80 // Platform dependent
94 virtual int32_t StartCapture(const VideoCaptureCapability& capability) 81 int32_t StartCapture(const VideoCaptureCapability& capability) override
95 { 82 {
96 _requestedCapability = capability; 83 _requestedCapability = capability;
97 return -1; 84 return -1;
98 } 85 }
99 virtual int32_t StopCapture() { return -1; } 86 int32_t StopCapture() override { return -1; }
100 virtual bool CaptureStarted() {return false; } 87 bool CaptureStarted() override {return false; }
101 virtual int32_t CaptureSettings(VideoCaptureCapability& /*settings*/) 88 int32_t CaptureSettings(VideoCaptureCapability& /*settings*/) override
102 { return -1; } 89 { return -1; }
103 VideoCaptureEncodeInterface* GetEncodeInterface(const VideoCodec& /*codec*/)
104 { return NULL; }
105 90
106 protected: 91 protected:
107 VideoCaptureImpl(const int32_t id); 92 VideoCaptureImpl();
108 virtual ~VideoCaptureImpl(); 93 virtual ~VideoCaptureImpl();
109 int32_t DeliverCapturedFrame(VideoFrame& captureFrame); 94 int32_t DeliverCapturedFrame(VideoFrame& captureFrame);
110 95
111 int32_t _id; // Module ID
112 char* _deviceUniqueId; // current Device unique name; 96 char* _deviceUniqueId; // current Device unique name;
113 CriticalSectionWrapper& _apiCs; 97 CriticalSectionWrapper& _apiCs;
114 int32_t _captureDelay; // Current capture delay. May be changed of platform dependent parts. 98 int32_t _captureDelay; // Current capture delay. May be changed of platform dependent parts.
115 VideoCaptureCapability _requestedCapability; // Should be set by platform de pendent code in StartCapture. 99 VideoCaptureCapability _requestedCapability; // Should be set by platform de pendent code in StartCapture.
116 private: 100 private:
117 void UpdateFrameCount(); 101 void UpdateFrameCount();
118 uint32_t CalculateFrameRate(int64_t now_ns); 102 uint32_t CalculateFrameRate(int64_t now_ns);
119 103
120 CriticalSectionWrapper& _callBackCs;
121
122 // last time the module process function was called. 104 // last time the module process function was called.
123 int64_t _lastProcessTimeNanos; 105 int64_t _lastProcessTimeNanos;
124 // last time the frame rate callback function was called. 106 // last time the frame rate callback function was called.
125 int64_t _lastFrameRateCallbackTimeNanos; 107 int64_t _lastFrameRateCallbackTimeNanos;
126 bool _frameRateCallBack; // true if EnableFrameRateCallback
127 bool _noPictureAlarmCallBack; //true if EnableNoPictureAlarm
128 VideoCaptureAlarm _captureAlarm; // current value of the noPictureAlarm
129 108
130 int32_t _setCaptureDelay; // The currently used capture delay 109 rtc::VideoSinkInterface<VideoFrame>* _dataCallBack;
131 VideoCaptureDataCallback* _dataCallBack;
132 VideoCaptureFeedBack* _captureCallBack;
133 110
134 int64_t _lastProcessFrameTimeNanos; 111 int64_t _lastProcessFrameTimeNanos;
135 // timestamp for local captured frames 112 // timestamp for local captured frames
136 int64_t _incomingFrameTimesNanos[kFrameRateCountHistorySize]; 113 int64_t _incomingFrameTimesNanos[kFrameRateCountHistorySize];
137 VideoRotation _rotateFrame; // Set if the frame should be rotated by the 114 VideoRotation _rotateFrame; // Set if the frame should be rotated by the
138 // capture module. 115 // capture module.
139 116
140 // Indicate whether rotation should be applied before delivered externally. 117 // Indicate whether rotation should be applied before delivered externally.
141 bool apply_rotation_; 118 bool apply_rotation_;
142 }; 119 };
143 } // namespace videocapturemodule 120 } // namespace videocapturemodule
144 } // namespace webrtc 121 } // namespace webrtc
145 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_ 122 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_VIDEO_CAPTURE_IMPL_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_capture/video_capture_factory.cc ('k') | webrtc/modules/video_capture/video_capture_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698