Browse Source

libobs: Add functions to get private type data

The private type data is the type_data variable that's provided when
object types are registered by plugins.
jp9000 10 years ago
parent
commit
0ed913a136
5 changed files with 32 additions and 0 deletions
  1. 6 0
      libobs/obs-encoder.c
  2. 6 0
      libobs/obs-output.c
  3. 6 0
      libobs/obs-service.c
  4. 6 0
      libobs/obs-source.c
  5. 8 0
      libobs/obs.h

+ 6 - 0
libobs/obs-encoder.c

@@ -932,3 +932,9 @@ bool obs_weak_encoder_references_encoder(obs_weak_encoder_t *weak,
 {
 	return weak && encoder && weak->encoder == encoder;
 }
+
+void *obs_encoder_get_type_data(obs_encoder_t *encoder)
+{
+	return obs_encoder_valid(encoder, "obs_encoder_get_type_data")
+		? encoder->info.type_data : NULL;
+}

+ 6 - 0
libobs/obs-output.c

@@ -1506,3 +1506,9 @@ bool obs_weak_output_references_output(obs_weak_output_t *weak,
 {
 	return weak && output && weak->output == output;
 }
+
+void *obs_output_get_type_data(obs_output_t *output)
+{
+	return obs_output_valid(output, "obs_output_get_type_data")
+		? output->info.type_data : NULL;
+}

+ 6 - 0
libobs/obs-service.c

@@ -334,3 +334,9 @@ bool obs_weak_service_references_service(obs_weak_service_t *weak,
 {
 	return weak && service && weak->service == service;
 }
+
+void *obs_service_get_type_data(obs_service_t *service)
+{
+	return obs_service_valid(service, "obs_service_get_type_data")
+		? service->info.type_data : NULL;
+}

+ 6 - 0
libobs/obs-source.c

@@ -3070,3 +3070,9 @@ void obs_source_set_push_to_talk_delay(obs_source_t *source, uint64_t delay)
 	source_signal_push_to_delay(source, "push_to_talk_delay", delay);
 	pthread_mutex_unlock(&source->audio_mutex);
 }
+
+void *obs_source_get_type_data(obs_source_t *source)
+{
+	return obs_source_valid(source, "obs_source_get_type_data")
+		? source->info.type_data : NULL;
+}

+ 8 - 0
libobs/obs.h

@@ -886,6 +886,8 @@ EXPORT void obs_source_set_push_to_talk_delay(obs_source_t *source,
 /* ------------------------------------------------------------------------- */
 /* Functions used by sources */
 
+EXPORT void *obs_source_get_type_data(obs_source_t *source);
+
 /**
  * Helper function to set the color matrix information when drawing the source.
  *
@@ -1306,6 +1308,8 @@ EXPORT uint32_t obs_output_get_height(const obs_output_t *output);
 /* ------------------------------------------------------------------------- */
 /* Functions used by outputs */
 
+EXPORT void *obs_output_get_type_data(obs_output_t *output);
+
 /** Optionally sets the video conversion info.  Used only for raw output */
 EXPORT void obs_output_set_video_conversion(obs_output_t *output,
 		const struct video_scale_info *conversion);
@@ -1485,6 +1489,8 @@ EXPORT audio_t *obs_encoder_audio(const obs_encoder_t *encoder);
 /** Returns true if encoder is active, false otherwise */
 EXPORT bool obs_encoder_active(const obs_encoder_t *encoder);
 
+EXPORT void *obs_encoder_get_type_data(obs_encoder_t *encoder);
+
 /** Duplicates an encoder packet */
 EXPORT void obs_duplicate_encoder_packet(struct encoder_packet *dst,
 		const struct encoder_packet *src);
@@ -1562,6 +1568,8 @@ EXPORT void obs_service_apply_encoder_settings(obs_service_t *service,
 		obs_data_t *video_encoder_settings,
 		obs_data_t *audio_encoder_settings);
 
+EXPORT void *obs_service_get_type_data(obs_service_t *service);
+
 
 /* ------------------------------------------------------------------------- */
 /* Source frame allocation functions */