-
Notifications
You must be signed in to change notification settings - Fork 23
/
obs-source-old.h
322 lines (285 loc) · 10 KB
/
obs-source-old.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
#pragma once
#include <obs-source.h>
/**
* This is for compatibility.
*/
struct obs_source_info_old {
/* ----------------------------------------------------------------- */
/* Required implementation*/
/** Unique string identifier for the source */
const char* id;
/**
* Type of source.
*
* OBS_SOURCE_TYPE_INPUT for input sources,
* OBS_SOURCE_TYPE_FILTER for filter sources, and
* OBS_SOURCE_TYPE_TRANSITION for transition sources.
*/
enum obs_source_type type;
/** Source output flags */
uint32_t output_flags;
/**
* Get the translated name of the source type
*
* @param type_data The type_data variable of this structure
* @return The translated name of the source type
*/
const char* (*get_name)(void* type_data);
/**
* Creates the source data for the source
*
* @param settings Settings to initialize the source with
* @param source Source that this data is associated with
* @return The data associated with this source
*/
void* (*create)(obs_data_t* settings, obs_source_t* source);
/**
* Destroys the private data for the source
*
* Async sources must not call obs_source_output_video after returning
* from destroy
*/
void (*destroy)(void* data);
/** Returns the width of the source. Required if this is an input
* source and has non-async video */
uint32_t(*get_width)(void* data);
/** Returns the height of the source. Required if this is an input
* source and has non-async video */
uint32_t(*get_height)(void* data);
/* ----------------------------------------------------------------- */
/* Optional implementation */
/**
* Gets the default settings for this source
*
* @param[out] settings Data to assign default settings to
* @deprecated Use get_defaults2 if type_data is needed
*/
void (*get_defaults)(obs_data_t* settings);
/**
* Gets the property information of this source
*
* @return The properties data
* @deprecated Use get_properties2 if type_data is needed
*/
obs_properties_t* (*get_properties)(void* data);
/**
* Updates the settings for this source
*
* @param data Source data
* @param settings New settings for this source
*/
void (*update)(void* data, obs_data_t* settings);
/** Called when the source has been activated in the main view */
void (*activate)(void* data);
/**
* Called when the source has been deactivated from the main view
* (no longer being played/displayed)
*/
void (*deactivate)(void* data);
/** Called when the source is visible */
void (*show)(void* data);
/** Called when the source is no longer visible */
void (*hide)(void* data);
/**
* Called each video frame with the time elapsed
*
* @param data Source data
* @param seconds Seconds elapsed since the last frame
*/
void (*video_tick)(void* data, float seconds);
/**
* Called when rendering the source with the graphics subsystem.
*
* If this is an input/transition source, this is called to draw the
* source texture with the graphics subsystem using the specified
* effect.
*
* If this is a filter source, it wraps source draw calls (for
* example applying a custom effect with custom parameters to a
* source). In this case, it's highly recommended to use the
* obs_source_process_filter function to automatically handle
* effect-based filter processing. However, you can implement custom
* draw handling as desired as well.
*
* If the source output flags do not include SOURCE_CUSTOM_DRAW, all
* a source needs to do is set the "image" parameter of the effect to
* the desired texture, and then draw. If the output flags include
* SOURCE_COLOR_MATRIX, you may optionally set the "color_matrix"
* parameter of the effect to a custom 4x4 conversion matrix (by
* default it will be set to an YUV->RGB conversion matrix)
*
* @param data Source data
* @param effect Effect to be used with this source. If the source
* output flags include SOURCE_CUSTOM_DRAW, this will
* be NULL, and the source is expected to process with
* an effect manually.
*/
void (*video_render)(void* data, gs_effect_t* effect);
/**
* Called to filter raw async video data.
*
* @note This function is only used with filter sources.
*
* @param data Filter data
* @param frame Video frame to filter
* @return New video frame data. This can defer video data to
* be drawn later if time is needed for processing
*/
struct obs_source_frame* (*filter_video)(
void* data, struct obs_source_frame* frame);
/**
* Called to filter raw audio data.
*
* @note This function is only used with filter sources.
*
* @param data Filter data
* @param audio Audio data to filter.
* @return Modified or new audio data. You can directly modify
* the data passed and return it, or you can defer audio
* data for later if time is needed for processing. If
* you are returning new data, that data must exist
* until the next call to the filter_audio callback or
* until the filter is removed/destroyed.
*/
struct obs_audio_data* (*filter_audio)(void* data,
struct obs_audio_data* audio);
/**
* Called to enumerate all active sources being used within this
* source. If the source has children that render audio/video it must
* implement this callback.
*
* @param data Filter data
* @param enum_callback Enumeration callback
* @param param User data to pass to callback
*/
void (*enum_active_sources)(void* data,
obs_source_enum_proc_t enum_callback,
void* param);
/**
* Called when saving a source. This is a separate function because
* sometimes a source needs to know when it is being saved so it
* doesn't always have to update the current settings until a certain
* point.
*
* @param data Source data
* @param settings Settings
*/
void (*save)(void* data, obs_data_t* settings);
/**
* Called when loading a source from saved data. This should be called
* after all the loading sources have actually been created because
* sometimes there are sources that depend on each other.
*
* @param data Source data
* @param settings Settings
*/
void (*load)(void* data, obs_data_t* settings);
/**
* Called when interacting with a source and a mouse-down or mouse-up
* occurs.
*
* @param data Source data
* @param event Mouse event properties
* @param type Mouse button pushed
* @param mouse_up Mouse event type (true if mouse-up)
* @param click_count Mouse click count (1 for single click, etc.)
*/
void (*mouse_click)(void* data, const struct obs_mouse_event* event,
int32_t type, bool mouse_up, uint32_t click_count);
/**
* Called when interacting with a source and a mouse-move occurs.
*
* @param data Source data
* @param event Mouse event properties
* @param mouse_leave Mouse leave state (true if mouse left source)
*/
void (*mouse_move)(void* data, const struct obs_mouse_event* event,
bool mouse_leave);
/**
* Called when interacting with a source and a mouse-wheel occurs.
*
* @param data Source data
* @param event Mouse event properties
* @param x_delta Movement delta in the horizontal direction
* @param y_delta Movement delta in the vertical direction
*/
void (*mouse_wheel)(void* data, const struct obs_mouse_event* event,
int x_delta, int y_delta);
/**
* Called when interacting with a source and gain focus/lost focus event
* occurs.
*
* @param data Source data
* @param focus Focus state (true if focus gained)
*/
void (*focus)(void* data, bool focus);
/**
* Called when interacting with a source and a key-up or key-down
* occurs.
*
* @param data Source data
* @param event Key event properties
* @param focus Key event type (true if mouse-up)
*/
void (*key_click)(void* data, const struct obs_key_event* event,
bool key_up);
/**
* Called when the filter is removed from a source
*
* @param data Filter data
* @param source Source that the filter being removed from
*/
void (*filter_remove)(void* data, obs_source_t* source);
/**
* Private data associated with this entry
*/
void* type_data;
/**
* If defined, called to free private data on shutdown
*/
void (*free_type_data)(void* type_data);
bool (*audio_render)(void* data, uint64_t* ts_out,
struct obs_source_audio_mix* audio_output,
uint32_t mixers, size_t channels,
size_t sample_rate);
/**
* Called to enumerate all active and inactive sources being used
* within this source. If this callback isn't implemented,
* enum_active_sources will be called instead.
*
* This is typically used if a source can have inactive child sources.
*
* @param data Filter data
* @param enum_callback Enumeration callback
* @param param User data to pass to callback
*/
void (*enum_all_sources)(void* data,
obs_source_enum_proc_t enum_callback,
void* param);
void (*transition_start)(void* data);
void (*transition_stop)(void* data);
/**
* Gets the default settings for this source
*
* If get_defaults is also defined both will be called, and the first
* call will be to get_defaults, then to get_defaults2.
*
* @param type_data The type_data variable of this structure
* @param[out] settings Data to assign default settings to
*/
void (*get_defaults2)(void* type_data, obs_data_t* settings);
/**
* Gets the property information of this source
*
* @param data Source data
* @param type_data The type_data variable of this structure
* @return The properties data
*/
obs_properties_t* (*get_properties2)(void* data, void* type_data);
bool (*audio_mix)(void* data, uint64_t* ts_out,
struct audio_output_data* audio_output,
size_t channels, size_t sample_rate);
/** Icon type for the source */
// NOT SUPPORTED IN VERSION EARLIER THAN 24.0.6
//enum obs_icon_type icon_type;
};