Open Broadcaster Software
Free, open source software for live streaming and recording
obs-source.h
Go to the documentation of this file.
1 /******************************************************************************
2  Copyright (C) 2013-2014 by Hugh Bailey <obs.jim@gmail.com>
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
17 
18 #pragma once
19 
20 #include "obs.h"
21 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 
39 };
40 
41 
55 #define OBS_SOURCE_VIDEO (1<<0)
56 
64 #define OBS_SOURCE_AUDIO (1<<1)
65 
67 #define OBS_SOURCE_ASYNC (1<<2)
68 
80 #define OBS_SOURCE_ASYNC_VIDEO (OBS_SOURCE_ASYNC | OBS_SOURCE_VIDEO)
81 
88 #define OBS_SOURCE_CUSTOM_DRAW (1<<3)
89 
96 #define OBS_SOURCE_INTERACTION (1<<5)
97 
107 #define OBS_SOURCE_COMPOSITE (1<<6)
108 
116 #define OBS_SOURCE_DO_NOT_DUPLICATE (1<<7)
117 
121 #define OBS_SOURCE_DEPRECATED (1<<8)
122 
125 typedef void (*obs_source_enum_proc_t)(obs_source_t *parent,
126  obs_source_t *child, void *param);
127 
130 };
131 
136  /* ----------------------------------------------------------------- */
137  /* Required implementation*/
138 
140  const char *id;
141 
149  enum obs_source_type type;
150 
153 
160  const char *(*get_name)(void *type_data);
161 
169  void *(*create)(obs_data_t *settings, obs_source_t *source);
170 
177  void (*destroy)(void *data);
178 
181  uint32_t (*get_width)(void *data);
182 
185  uint32_t (*get_height)(void *data);
186 
187  /* ----------------------------------------------------------------- */
188  /* Optional implementation */
189 
195  void (*get_defaults)(obs_data_t *settings);
196 
202  obs_properties_t *(*get_properties)(void *data);
203 
210  void (*update)(void *data, obs_data_t *settings);
211 
213  void (*activate)(void *data);
214 
219  void (*deactivate)(void *data);
220 
222  void (*show)(void *data);
223 
225  void (*hide)(void *data);
226 
233  void (*video_tick)(void *data, float seconds);
234 
262  void (*video_render)(void *data, gs_effect_t *effect);
263 
274  struct obs_source_frame *(*filter_video)(void *data,
275  struct obs_source_frame *frame);
276 
291  struct obs_audio_data *(*filter_audio)(void *data,
292  struct obs_audio_data *audio);
293 
303  void (*enum_active_sources)(void *data,
304  obs_source_enum_proc_t enum_callback,
305  void *param);
306 
316  void (*save)(void *data, obs_data_t *settings);
317 
326  void (*load)(void *data, obs_data_t *settings);
327 
338  void (*mouse_click)(void *data,
339  const struct obs_mouse_event *event,
340  int32_t type, bool mouse_up, uint32_t click_count);
348  void (*mouse_move)(void *data,
349  const struct obs_mouse_event *event, bool mouse_leave);
350 
359  void (*mouse_wheel)(void *data,
360  const struct obs_mouse_event *event, int x_delta,
361  int y_delta);
369  void (*focus)(void *data, bool focus);
370 
379  void (*key_click)(void *data, const struct obs_key_event *event,
380  bool key_up);
381 
388  void (*filter_remove)(void *data, obs_source_t *source);
389 
393  void *type_data;
394 
398  void (*free_type_data)(void *type_data);
399 
400  bool (*audio_render)(void *data, uint64_t *ts_out,
401  struct obs_source_audio_mix *audio_output,
402  uint32_t mixers, size_t channels, size_t sample_rate);
403 };
404 
405 EXPORT void obs_register_source_s(const struct obs_source_info *info,
406  size_t size);
407 
414 #define obs_register_source(info) \
415  obs_register_source_s(info, sizeof(struct obs_source_info))
416 
417 #ifdef __cplusplus
418 }
419 #endif
Definition: obs-interaction.h:50
unsigned uint32_t
Definition: vc_stdint.h:31
Definition: obs-interaction.h:44
void(* obs_source_enum_proc_t)(obs_source_t *parent, obs_source_t *child, void *param)
Definition: obs-source.h:125
Definition: obs-internal.h:512
int int32_t
Definition: vc_stdint.h:30
uint32_t output_flags
Definition: obs-source.h:152
Definition: audio-io.h:74
const char * id
Definition: obs-source.h:140
unsigned __int64 uint64_t
Definition: vc_stdint.h:33
Definition: obs-source.h:35
struct obs_data obs_data_t
Definition: obs-data.h:42
Definition: obs-source.h:135
uint8_t * data[MAX_AV_PLANES]
Definition: obs.h:192
void * type_data
Definition: obs-source.h:393
struct audio_output_data output[MAX_AUDIO_MIXES]
Definition: obs-source.h:129
struct obs_properties obs_properties_t
Definition: obs-properties.h:103
#define EXPORT
Definition: c99defs.h:53
obs_source_type
Definition: obs-source.h:34
uint8_t * data[MAX_AV_PLANES]
Definition: obs.h:222
#define MAX_AUDIO_MIXES
Definition: audio-io.h:28
Definition: effect.h:139
Definition: obs-source.h:38
Definition: obs-source.h:37
void(* focus)(void *data, bool focus)
Definition: obs-source.h:369
Definition: obs.h:221
Definition: obs-source.h:36
Definition: obs-source.h:128
Main libobs header used by applications.
EXPORT void obs_register_source_s(const struct obs_source_info *info, size_t size)
#define bool
Definition: vc_stdbool.h:5
Definition: obs.h:191