static void hook_data_capture(struct obs_output *output, bool encoded, bool has_video, bool has_audio) { void (*encoded_callback)(void *data, struct encoder_packet *packet); if (encoded) { output->received_video = false; output->received_video = false; output->highest_audio_ts = 0; output->highest_video_ts = 0; free_packets(output); encoded_callback = (has_video && has_audio) ? interleave_packets : default_encoded_callback; if (has_video) obs_encoder_start(output->video_encoder, encoded_callback, output); if (has_audio) obs_encoder_start(output->audio_encoder, encoded_callback, output); } else { if (has_video) video_output_connect(output->video, get_video_conversion(output), default_raw_video_callback, output); if (has_audio) audio_output_connect(output->audio, get_audio_conversion(output), output->info.raw_audio, output->context.data); } }
static void add_connection(struct obs_encoder *encoder) { if (encoder->info.type == OBS_ENCODER_AUDIO) { struct audio_convert_info audio_info = {0}; get_audio_info(encoder, &audio_info); audio_output_connect(encoder->media, encoder->mixer_idx, &audio_info, receive_audio, encoder); } else { struct video_scale_info info = {0}; get_video_info(encoder, &info); video_output_connect(encoder->media, &info, receive_video, encoder); } encoder->active = true; }
static void hook_data_capture(struct obs_output *output, bool encoded, bool has_video, bool has_audio) { encoded_callback_t encoded_callback; if (encoded) { pthread_mutex_lock(&output->interleaved_mutex); reset_packet_data(output); pthread_mutex_unlock(&output->interleaved_mutex); encoded_callback = (has_video && has_audio) ? interleave_packets : default_encoded_callback; if (output->delay_sec) { output->active_delay_ns = (uint64_t)output->delay_sec * 1000000000ULL; output->delay_cur_flags = output->delay_flags; output->delay_callback = encoded_callback; encoded_callback = process_delay; os_atomic_set_bool(&output->delay_active, true); blog(LOG_INFO, "Output '%s': %"PRIu32" second delay " "active, preserve on disconnect is %s", output->context.name, output->delay_sec, preserve_active(output) ? "on" : "off"); } if (has_audio) start_audio_encoders(output, encoded_callback); if (has_video) obs_encoder_start(output->video_encoder, encoded_callback, output); } else { if (has_video) video_output_connect(output->video, get_video_conversion(output), default_raw_video_callback, output); if (has_audio) audio_output_connect(output->audio, output->mixer_idx, get_audio_conversion(output), default_raw_audio_callback, output); } }
static void hook_data_capture(struct obs_output *output, bool encoded, bool has_video, bool has_audio) { encoded_callback_t encoded_callback; if (encoded) { output->received_audio = false; output->received_video = false; output->highest_audio_ts = 0; output->highest_video_ts = 0; output->video_offset = 0; for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) output->audio_offsets[0] = 0; free_packets(output); encoded_callback = (has_video && has_audio) ? interleave_packets : default_encoded_callback; if (has_video) obs_encoder_start(output->video_encoder, encoded_callback, output); if (has_audio) start_audio_encoders(output, encoded_callback); } else { if (has_video) video_output_connect(output->video, get_video_conversion(output), default_raw_video_callback, output); if (has_audio) audio_output_connect(output->audio, output->mixer_idx, get_audio_conversion(output), default_raw_audio_callback, output); } }