Vuo  2.3.2
VuoBlackmagicInputDevice.c
Go to the documentation of this file.
1 
10 #include "type.h"
12 
14 #ifdef VUO_COMPILER
16  "title" : "Blackmagic Input Device",
17  "description" : "Information about a Blackmagic video capture device.",
18  "keywords" : [ ],
19  "version" : "1.0.0",
20  "dependencies" : [
21  "VuoBlackmagicConnection",
22  "VuoBlackmagicVideoMode",
23  "VuoDeinterlacing",
24  "VuoInteger",
25  "VuoText"
26  ]
27 });
28 #endif
30 
45 {
46  return (VuoBlackmagicInputDevice){
47  VuoJson_getObjectValue(VuoText, js, "name", NULL),
48  VuoJson_getObjectValue(VuoInteger, js, "subDevice", 0),
49  VuoJson_getObjectValue(VuoBlackmagicConnection, js, "connection", VuoBlackmagicConnection_Composite),
50  VuoJson_getObjectValue(VuoBlackmagicVideoMode, js, "videoMode", VuoBlackmagicVideoMode_NTSC),
51  VuoJson_getObjectValue(VuoDeinterlacing, js, "deinterlacing", VuoDeinterlacing_None),
52  };
53 }
54 
59 {
60  json_object *js = json_object_new_object();
61 
62  if (value.name)
63  json_object_object_add(js, "name", VuoText_getJson(value.name));
64 
65  if (value.subDevice)
66  json_object_object_add(js, "subDevice", VuoInteger_getJson(value.subDevice));
67 
68  json_object_object_add(js, "connection", VuoBlackmagicConnection_getJson(value.connection));
69 
70  json_object_object_add(js, "videoMode", VuoBlackmagicVideoMode_getJson(value.videoMode));
71 
72  json_object_object_add(js, "deinterlacing", VuoDeinterlacing_getJson(value.deinterlacing));
73 
74  return js;
75 }
76 
81 {
82  char *connection = VuoBlackmagicConnection_getSummary(value.connection);
83  char *mode = VuoBlackmagicVideoMode_getSummary(value.videoMode);
84  char *deinterlacing = VuoDeinterlacing_getSummary(value.deinterlacing);
85 
86  char *summary;
87  if (value.name)
88  summary = VuoText_format("%s<br>Sub-device %lld<br>Connection: %s<br>Mode: %s<br>Deinterlacing: %s",
89  value.name, value.subDevice, connection, mode, deinterlacing);
90  else
91  summary = VuoText_format("First available Blackmagic input device<br>Connection: %s<br>Mode: %s<br>Deinterlacing: %s",
92  connection, mode, deinterlacing);
93 
94  free(connection);
95  free(mode);
96  free(deinterlacing);
97  return summary;
98 }
99 
104 {
105  if (value.name)
106  return VuoText_format("%s, sub-device %lld", value.name, value.subDevice);
107  else
108  return strdup("First available Blackmagic input device");
109 }
110 
114 VuoBlackmagicInputDevice VuoBlackmagicInputDevice_make(const VuoText name, const VuoInteger subDevice, const VuoBlackmagicConnection connection, const VuoBlackmagicVideoMode videoMode, const VuoDeinterlacing deinterlacing)
115 {
116  return (VuoBlackmagicInputDevice){name, subDevice, connection, videoMode, deinterlacing};
117 }
118 
123 {
124  if (!VuoText_areEqual(value1.name, value2.name))
125  return false;
126 
127  if (value1.subDevice != value2.subDevice)
128  return false;
129 
130  if (!VuoBlackmagicConnection_areEqual(value1.connection, value2.connection))
131  return false;
132 
133  if (!VuoBlackmagicVideoMode_areEqual(value1.videoMode, value2.videoMode))
134  return false;
135 
136  if (!VuoDeinterlacing_areEqual(value1.deinterlacing, value2.deinterlacing))
137  return false;
138 
139  return true;
140 }
141 
146 {
147  VuoType_returnInequality(VuoText, a.name, b.name);
148  VuoType_returnInequality(VuoInteger, a.subDevice, b.subDevice);
149  VuoType_returnInequality(VuoBlackmagicConnection, a.connection, b.connection);
150  VuoType_returnInequality(VuoBlackmagicVideoMode, a.videoMode, b.videoMode);
151  VuoType_returnInequality(VuoDeinterlacing, a.deinterlacing, b.deinterlacing);
152  return false;
153 }