Skip to content

Commit

Permalink
libobs: Add video_output_disconnect2()
Browse files Browse the repository at this point in the history
  • Loading branch information
derrod committed Dec 10, 2024
1 parent b4cd523 commit 32b92b9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/sphinx/reference-libobs-media-io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ Video Handler

---------------------

.. function:: bool video_output_disconnect2(video_t *video, void (*callback)(void *param, struct video_data *frame), void *param)

Disconnects a raw video callback from the video output handler.

:param video: Video output handler object
:param callback: Callback
:param param: Private data
:return: *true* if callback was removed, *false* otherwise (e.g. already removed)

---------------------

.. function:: const struct video_output_info *video_output_get_info(const video_t *video)

Gets the full video information of the video output handler.
Expand Down
9 changes: 8 additions & 1 deletion libobs/media-io/video-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,14 @@ static void log_skipped(video_t *video)
}

void video_output_disconnect(video_t *video, void (*callback)(void *param, struct video_data *frame), void *param)
{
video_output_disconnect2(video, callback, param);
}

bool video_output_disconnect2(video_t *video, void (*callback)(void *param, struct video_data *frame), void *param)
{
if (!video || !callback)
return;
return false;

video = get_root(video);

Expand All @@ -485,6 +490,8 @@ void video_output_disconnect(video_t *video, void (*callback)(void *param, struc
}

pthread_mutex_unlock(&video->input_mutex);

return idx != DARRAY_INVALID;
}

bool video_output_active(const video_t *video)
Expand Down
2 changes: 2 additions & 0 deletions libobs/media-io/video-io.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ EXPORT bool video_output_connect2(video_t *video, const struct video_scale_info
void *param);
EXPORT void video_output_disconnect(video_t *video, void (*callback)(void *param, struct video_data *frame),
void *param);
EXPORT bool video_output_disconnect2(video_t *video, void (*callback)(void *param, struct video_data *frame),
void *param);

EXPORT bool video_output_active(const video_t *video);

Expand Down

0 comments on commit 32b92b9

Please sign in to comment.