OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_API_OBJC_AVFOUNDATION_VIDEO_CAPTURER_H_ |
| 12 #define WEBRTC_API_OBJC_AVFOUNDATION_VIDEO_CAPTURER_H_ |
| 13 |
| 14 #import <AVFoundation/AVFoundation.h> |
| 15 |
| 16 #include "webrtc/api/video/video_frame.h" |
| 17 #include "webrtc/common_video/include/i420_buffer_pool.h" |
| 18 #include "webrtc/media/base/videocapturer.h" |
| 19 |
| 20 @class RTCAVFoundationVideoCapturerInternal; |
| 21 |
| 22 namespace rtc { |
| 23 class Thread; |
| 24 } // namespace rtc |
| 25 |
| 26 namespace webrtc { |
| 27 |
| 28 class AVFoundationVideoCapturer : public cricket::VideoCapturer { |
| 29 public: |
| 30 AVFoundationVideoCapturer(); |
| 31 ~AVFoundationVideoCapturer(); |
| 32 |
| 33 cricket::CaptureState Start(const cricket::VideoFormat& format) override; |
| 34 void Stop() override; |
| 35 bool IsRunning() override; |
| 36 bool IsScreencast() const override { |
| 37 return false; |
| 38 } |
| 39 bool GetPreferredFourccs(std::vector<uint32_t> *fourccs) override { |
| 40 fourccs->push_back(cricket::FOURCC_NV12); |
| 41 return true; |
| 42 } |
| 43 |
| 44 // Returns the active capture session. Calls to the capture session should |
| 45 // occur on the RTCDispatcherTypeCaptureSession queue in RTCDispatcher. |
| 46 AVCaptureSession* GetCaptureSession(); |
| 47 |
| 48 // Returns whether the rear-facing camera can be used. |
| 49 // e.g. It can't be used because it doesn't exist. |
| 50 bool CanUseBackCamera() const; |
| 51 |
| 52 // Switches the camera being used (either front or back). |
| 53 void SetUseBackCamera(bool useBackCamera); |
| 54 bool GetUseBackCamera() const; |
| 55 |
| 56 // Converts the sample buffer into a cricket::CapturedFrame and signals the |
| 57 // frame for capture. |
| 58 void CaptureSampleBuffer(CMSampleBufferRef sample_buffer, |
| 59 webrtc::VideoRotation rotation); |
| 60 |
| 61 // Called to adjust the size of output frames to supplied |width| and |
| 62 // |height|. Also drops frames to make the output match |fps|. |
| 63 void AdaptOutputFormat(int width, int height, int fps); |
| 64 |
| 65 private: |
| 66 RTCAVFoundationVideoCapturerInternal *_capturer; |
| 67 webrtc::I420BufferPool _buffer_pool; |
| 68 }; // AVFoundationVideoCapturer |
| 69 |
| 70 } // namespace webrtc |
| 71 |
| 72 #endif // WEBRTC_API_OBJC_AVFOUNDATION_VIDEO_CAPTURER_H_ |
OLD | NEW |