Skip to content

Commit

Permalink
libobs: Merge obs_encoder_stop() and ..._stop_internal()
Browse files Browse the repository at this point in the history
No longer any need for them to be separate functions. This is just
code cleanup
  • Loading branch information
tt2468 authored and palana committed Jun 20, 2024
1 parent 51933d6 commit 46db6cd
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions libobs/obs-encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,14 +856,19 @@ void obs_encoder_start(obs_encoder_t *encoder,
pthread_mutex_unlock(&encoder->init_mutex);
}

static inline void obs_encoder_stop_internal(
obs_encoder_t *encoder,
void (*new_packet)(void *param, struct encoder_packet *packet),
void *param)
void obs_encoder_stop(obs_encoder_t *encoder,
void (*new_packet)(void *param,
struct encoder_packet *packet),
void *param)
{
bool last = false;
size_t idx;

if (!obs_encoder_valid(encoder, "obs_encoder_stop"))
return;
if (!obs_ptr_valid(new_packet, "obs_encoder_stop"))
return;

pthread_mutex_lock(&encoder->init_mutex);
pthread_mutex_lock(&encoder->callbacks_mutex);

Expand Down Expand Up @@ -910,21 +915,6 @@ static inline void obs_encoder_stop_internal(
pthread_mutex_unlock(&encoder->init_mutex);
}

void obs_encoder_stop(obs_encoder_t *encoder,
void (*new_packet)(void *param,
struct encoder_packet *packet),
void *param)
{
bool destroyed;

if (!obs_encoder_valid(encoder, "obs_encoder_stop"))
return;
if (!obs_ptr_valid(new_packet, "obs_encoder_stop"))
return;

obs_encoder_stop_internal(encoder, new_packet, param);
}

const char *obs_encoder_get_codec(const obs_encoder_t *encoder)
{
return obs_encoder_valid(encoder, "obs_encoder_get_codec")
Expand Down

0 comments on commit 46db6cd

Please sign in to comment.