Browse Source

libobs: Clarify filter-related comments

Certain callbacks and API functions were a bit vague on when and how
they were supposed to be used.
jp9000 10 years ago
parent
commit
76a9c90043
2 changed files with 17 additions and 6 deletions
  1. 7 4
      libobs/obs-source.h
  2. 10 2
      libobs/obs.h

+ 7 - 4
libobs/obs-source.h

@@ -244,7 +244,7 @@ struct obs_source_info {
 	 *
 	 * @note          This function is only used with filter sources.
 	 *
-	 * @param  data   Source data
+	 * @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
@@ -257,11 +257,14 @@ struct obs_source_info {
 	 *
 	 * @note          This function is only used with filter sources.
 	 *
-	 * @param  data   Source data
+	 * @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.
+	 *                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);
@@ -270,7 +273,7 @@ struct obs_source_info {
 	 * Called to enumerate all sources being used within this source.
 	 * If the source has children it must implement this callback.
 	 *
-	 * @param  data           Source data
+	 * @param  data           Filter data
 	 * @param  enum_callback  Enumeration callback
 	 * @param  param          User data to pass to callback
 	 */

+ 10 - 2
libobs/obs.h

@@ -674,10 +674,18 @@ EXPORT uint32_t obs_source_get_width(obs_source_t *source);
 /** Gets the height of a source (if it has video) */
 EXPORT uint32_t obs_source_get_height(obs_source_t *source);
 
-/** If the source is a filter, returns the parent source of the filter */
+/**
+ * If the source is a filter, returns the parent source of the filter.  Only
+ * guaranteed to be valid inside of the video_render, filter_audio,
+ * filter_video, and filter_remove callbacks.
+ */
 EXPORT obs_source_t *obs_filter_get_parent(const obs_source_t *filter);
 
-/** If the source is a filter, returns the target source of the filter */
+/**
+ * If the source is a filter, returns the target source of the filter.  Only
+ * guaranteed to be valid inside of the video_render, filter_audio,
+ * filter_video, and filter_remove callbacks.
+ */
 EXPORT obs_source_t *obs_filter_get_target(const obs_source_t *filter);
 
 /** Adds a filter to the source (which is used whenever the source is used) */