- Make it so that encoders can be assigned to outputs. If an encoder is destroyed, it will automatically remove itself from that output. I specifically didn't want to do reference counting because it leaves too much potential for unchecked references and it just felt like it would be more trouble than it's worth. - Add a 'flags' value to the output definition structure. This lets the output specify if it uses video/audio, and whether the output is meant to be used with OBS encoders or not. - Remove boilerplate code for outputs. This makes it easier to program outputs. The boilerplate code involved before was mostly just involving connecting to the audio/video data streams directly in each output plugin. Instead of doing that, simply add plugin callback functions for receiving video/audio (either encoded or non-encoded, whichever it's set to use), and then call obs_output_begin_data_capture and obs_output_end_data_capture to automatically handle setting up connections to raw or encoded video/audio streams for the plugin. - Remove 'active' function from output callbacks, as it's no longer really needed now that the libobs output context automatically knows when the output is active or not. - Make it so that an encoder cannot be destroyed until all data connections to the encoder have been removed. - Change the 'start' and 'stop' functions in the encoder interface to just an 'initialize' callback, which initializes the encoder. - Make it so that the encoder must be initialized first before the data stream can be started. The reason why initialization was separated from starting the encoder stream was because we need to be able to check that the settings used with the encoder *can* be used first. This problem was especially annoying if you had both video/audio encoding. Before, you'd have to check the return value from obs_encoder_start, and if that second encoder fails, then you basically had to stop the first encoder again, making for unnecessary boilerplate code whenever starting up two encoders.
58 lines
1.8 KiB
C
58 lines
1.8 KiB
C
/******************************************************************************
|
|
Copyright (C) 2013-2014 by Hugh Bailey <obs.jim@gmail.com>
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
******************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
#define OBS_OUTPUT_VIDEO (1<<0)
|
|
#define OBS_OUTPUT_AUDIO (1<<1)
|
|
#define OBS_OUTPUT_AV (OBS_OUTPUT_VIDEO | OBS_OUTPUT_AUDIO)
|
|
#define OBS_OUTPUT_ENCODED (1<<2)
|
|
|
|
struct encoder_packet;
|
|
|
|
struct obs_output_info {
|
|
/* required */
|
|
const char *id;
|
|
|
|
uint32_t flags;
|
|
|
|
const char *(*getname)(const char *locale);
|
|
|
|
void *(*create)(obs_data_t settings, obs_output_t output);
|
|
void (*destroy)(void *data);
|
|
|
|
bool (*start)(void *data);
|
|
void (*stop)(void *data);
|
|
|
|
void (*raw_video)(void *data, struct video_data *frame);
|
|
void (*raw_audio)(void *data, struct audio_data *frames);
|
|
|
|
void (*encoded_video)(void *data, struct encoder_packet *packet);
|
|
void (*encoded_audio)(void *data, struct encoder_packet *packet);
|
|
|
|
/* optional */
|
|
void (*update)(void *data, obs_data_t settings);
|
|
|
|
void (*defaults)(obs_data_t settings);
|
|
|
|
obs_properties_t (*properties)(const char *locale);
|
|
|
|
void (*pause)(void *data);
|
|
};
|
|
|
|
EXPORT void obs_register_output(const struct obs_output_info *info);
|