1 /*
2  *  Copyright (c) 2012 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 MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEFINES_H_
12 #define MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEFINES_H_
13 
14 #include "api/video/video_frame.h"
15 #include "modules/include/module_common_types.h"
16 #include "typedefs.h"  // NOLINT(build/include)
17 
18 #ifdef XP_WIN
19 typedef int pid_t;
20 #endif
21 
22 namespace webrtc
23 {
24 // Defines
25 #ifndef NULL
26     #define NULL    0
27 #endif
28 
29 enum {kVideoCaptureUniqueNameSize =1024}; //Max unique capture device name length
30 enum {kVideoCaptureProductIdSize =128}; //Max product id length
31 
32 struct VideoCaptureCapability
33 {
34     int32_t width;
35     int32_t height;
36     int32_t maxFPS;
37     VideoType videoType;
38     bool interlaced;
39 
VideoCaptureCapabilityVideoCaptureCapability40     VideoCaptureCapability()
41     {
42         width = 0;
43         height = 0;
44         maxFPS = 0;
45         videoType = VideoType::kUnknown;
46         interlaced = false;
47     }
48     ;
49     bool operator!=(const VideoCaptureCapability &other) const
50     {
51         if (width != other.width)
52             return true;
53         if (height != other.height)
54             return true;
55         if (maxFPS != other.maxFPS)
56             return true;
57         if (videoType != other.videoType)
58           return true;
59         if (interlaced != other.interlaced)
60             return true;
61         return false;
62     }
63     bool operator==(const VideoCaptureCapability &other) const
64     {
65         return !operator!=(other);
66     }
67 };
68 
69 /* External Capture interface. Returned by Create
70  and implemented by the capture module.
71  */
72 class VideoCaptureExternal
73 {
74 public:
75     // |capture_time| must be specified in the NTP time format in milliseconds.
76     virtual int32_t IncomingFrame(uint8_t* videoFrame,
77                                   size_t videoFrameLength,
78                                   const VideoCaptureCapability& frameInfo,
79                                   int64_t captureTime = 0) = 0;
80 protected:
~VideoCaptureExternal()81     ~VideoCaptureExternal() {}
82 };
83 
84 
85 // Callback class to be implemented by module user
86 class VideoCaptureDataCallback
87 {
88 public:
89     virtual void OnIncomingCapturedFrame(const int32_t id,
90                                          const VideoFrame& videoFrame) = 0;
91     virtual void OnCaptureDelayChanged(const int32_t id,
92                                        const int32_t delay) = 0;
93 protected:
~VideoCaptureDataCallback()94     virtual ~VideoCaptureDataCallback(){}
95 };
96 
97 }  // namespace webrtc
98 
99 #endif  // MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_DEFINES_H_
100