blob: ed813623f7fc80b4acab6902cb048c56a7310d58 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
phoglund@webrtc.org4aa57b42012-03-22 12:56:54 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
Henrik Kjellander5dda80a2015-11-12 12:46:09 +010011#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEFINES_H_
12#define WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEFINES_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
nisseaf916892017-01-10 07:44:26 -080014#include "webrtc/api/video/video_frame.h"
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010015#include "webrtc/modules/include/module_common_types.h"
pbos@webrtc.orga9b74ad2013-07-12 10:03:52 +000016#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000017
18namespace webrtc
19{
20// Defines
21#ifndef NULL
22 #define NULL 0
23#endif
24
25enum {kVideoCaptureUniqueNameLength =1024}; //Max unique capture device name lenght
26enum {kVideoCaptureDeviceNameLength =256}; //Max capture device name lenght
27enum {kVideoCaptureProductIdLength =128}; //Max product id length
28
niklase@google.com470e71d2011-07-07 08:21:25 +000029struct VideoCaptureCapability
30{
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000031 int32_t width;
32 int32_t height;
33 int32_t maxFPS;
nisseeb44b392017-04-28 07:18:05 -070034 VideoType videoType;
niklase@google.com470e71d2011-07-07 08:21:25 +000035 bool interlaced;
36
37 VideoCaptureCapability()
38 {
39 width = 0;
40 height = 0;
41 maxFPS = 0;
nisseeb44b392017-04-28 07:18:05 -070042 videoType = VideoType::kUnknown;
niklase@google.com470e71d2011-07-07 08:21:25 +000043 interlaced = false;
44 }
45 ;
46 bool operator!=(const VideoCaptureCapability &other) const
47 {
48 if (width != other.width)
49 return true;
50 if (height != other.height)
51 return true;
52 if (maxFPS != other.maxFPS)
53 return true;
nisseeb44b392017-04-28 07:18:05 -070054 if (videoType != other.videoType)
55 return true;
niklase@google.com470e71d2011-07-07 08:21:25 +000056 if (interlaced != other.interlaced)
57 return true;
58 return false;
59 }
60 bool operator==(const VideoCaptureCapability &other) const
61 {
62 return !operator!=(other);
63 }
64};
65
niklase@google.com470e71d2011-07-07 08:21:25 +000066/* External Capture interface. Returned by Create
67 and implemented by the capture module.
68 */
69class VideoCaptureExternal
70{
71public:
stefan@webrtc.orgb8e7f4c2013-04-12 11:56:23 +000072 // |capture_time| must be specified in the NTP time format in milliseconds.
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000073 virtual int32_t IncomingFrame(uint8_t* videoFrame,
pkasting@chromium.org4591fbd2014-11-20 22:28:14 +000074 size_t videoFrameLength,
pbos@webrtc.orgdfc5bb92013-04-10 08:23:13 +000075 const VideoCaptureCapability& frameInfo,
76 int64_t captureTime = 0) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000077protected:
78 ~VideoCaptureExternal() {}
79};
80
andrew@webrtc.org94caca72012-10-30 21:58:00 +000081} // namespace webrtc
82
Henrik Kjellander5dda80a2015-11-12 12:46:09 +010083#endif // WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEFINES_H_