2013-09-30 19:37:13 -07:00
|
|
|
/******************************************************************************
|
|
|
|
Copyright (C) 2013 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
|
2013-12-02 21:24:38 -08:00
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
2013-09-30 19:37:13 -07:00
|
|
|
(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/>.
|
|
|
|
******************************************************************************/
|
|
|
|
|
2013-10-14 04:21:15 -07:00
|
|
|
#pragma once
|
2013-09-30 19:37:13 -07:00
|
|
|
|
|
|
|
#include "util/c99defs.h"
|
|
|
|
#include "util/dstr.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ===========================================
|
|
|
|
* Outputs
|
|
|
|
* ===========================================
|
|
|
|
*
|
|
|
|
* An output takes raw audio and/or video and processes and/or outputs it
|
|
|
|
* to a destination, whether that destination be a file, network, or other.
|
|
|
|
*
|
|
|
|
* A module with outputs needs to export these functions:
|
Add preliminary output/encoder interface
- First, I redid the output interface for libobs. I feel like it's
going in a pretty good direction in terms of design.
Right now, the design is so that outputs and encoders are separate.
One or more outputs can connect to a specific encoder to receive its
data, or the output can connect directly to raw data from libobs
output itself, if the output doesn't want to use a designated encoder.
Data is received via callbacks set when you connect to the encoder or
raw output. Multiple outputs can receive the data from a single
encoder context if need be (such as for streaming to multiple channels
at once, and/or recording with the same data).
When an encoder is first connected to, it will connect to raw output,
and start encoding. Additional connections will receive that same
data being encoded as well after that. When the last encoder has
disconnected, it will stop encoding. If for some reason the encoder
needs to stop, it will use the callback with NULL to signal that
encoding has stopped. Some of these things may be subject to change
in the future, though it feels pretty good with this design so far.
Will have to see how well it works out in practice versus theory.
- Second, Started adding preliminary RTMP/x264 output plugin code.
To speed things up, I might just make a direct raw->FFmpeg output to
create a quick output plugin that we can start using for testing all
the subsystems.
2014-01-16 21:34:51 -08:00
|
|
|
* + enum_outputs
|
2013-09-30 19:37:13 -07:00
|
|
|
*
|
|
|
|
* Each individual output is then exported by it's name. For example, an
|
|
|
|
* output named "myoutput" would have the following exports:
|
2013-11-13 05:24:20 -08:00
|
|
|
* + myoutput_getname
|
2013-09-30 19:37:13 -07:00
|
|
|
* + myoutput_create
|
|
|
|
* + myoutput_destroy
|
2014-01-16 23:00:21 -08:00
|
|
|
* + myoutput_update
|
2013-09-30 19:37:13 -07:00
|
|
|
* + myoutput_start
|
|
|
|
* + myoutput_stop
|
2014-01-19 02:16:41 -08:00
|
|
|
* + myoutput_active
|
2013-09-30 19:37:13 -07:00
|
|
|
*
|
|
|
|
* [and optionally]
|
|
|
|
* + myoutput_pause
|
|
|
|
*
|
|
|
|
* ===========================================
|
|
|
|
* Primary Exports
|
|
|
|
* ===========================================
|
|
|
|
* const char *enum_outputs(size_t idx);
|
|
|
|
* idx: index of the output.
|
|
|
|
* Return value: Output identifier name. NULL when no more available.
|
|
|
|
*
|
|
|
|
* ===========================================
|
|
|
|
* Output Exports
|
|
|
|
* ===========================================
|
2013-11-13 05:24:20 -08:00
|
|
|
* const char *[name]_getname(const char *locale);
|
|
|
|
* Returns the full translated name of the output type (seen by the user).
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------------
|
2014-01-27 22:14:58 -08:00
|
|
|
* void *[name]_create(obs_data_t settings, obs_output_t output);
|
2013-09-30 19:37:13 -07:00
|
|
|
* Creates an output.
|
|
|
|
*
|
|
|
|
* settings: Settings of the output.
|
|
|
|
* output: pointer to main output
|
|
|
|
* Return value: Internal output pointer, or NULL if failed.
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------------
|
|
|
|
* void [name]_destroy(void *data);
|
|
|
|
* Destroys the output.
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------------
|
2014-01-27 22:14:58 -08:00
|
|
|
* void [name]_update(void *data, obs_data_t settings)
|
2013-09-30 19:37:13 -07:00
|
|
|
* Updates the output's settings
|
|
|
|
*
|
|
|
|
* settings: New settings of the output
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------------
|
Add preliminary output/encoder interface
- First, I redid the output interface for libobs. I feel like it's
going in a pretty good direction in terms of design.
Right now, the design is so that outputs and encoders are separate.
One or more outputs can connect to a specific encoder to receive its
data, or the output can connect directly to raw data from libobs
output itself, if the output doesn't want to use a designated encoder.
Data is received via callbacks set when you connect to the encoder or
raw output. Multiple outputs can receive the data from a single
encoder context if need be (such as for streaming to multiple channels
at once, and/or recording with the same data).
When an encoder is first connected to, it will connect to raw output,
and start encoding. Additional connections will receive that same
data being encoded as well after that. When the last encoder has
disconnected, it will stop encoding. If for some reason the encoder
needs to stop, it will use the callback with NULL to signal that
encoding has stopped. Some of these things may be subject to change
in the future, though it feels pretty good with this design so far.
Will have to see how well it works out in practice versus theory.
- Second, Started adding preliminary RTMP/x264 output plugin code.
To speed things up, I might just make a direct raw->FFmpeg output to
create a quick output plugin that we can start using for testing all
the subsystems.
2014-01-16 21:34:51 -08:00
|
|
|
* bool [name]_start(void *data)
|
2013-09-30 19:37:13 -07:00
|
|
|
* Starts output
|
|
|
|
*
|
Add preliminary output/encoder interface
- First, I redid the output interface for libobs. I feel like it's
going in a pretty good direction in terms of design.
Right now, the design is so that outputs and encoders are separate.
One or more outputs can connect to a specific encoder to receive its
data, or the output can connect directly to raw data from libobs
output itself, if the output doesn't want to use a designated encoder.
Data is received via callbacks set when you connect to the encoder or
raw output. Multiple outputs can receive the data from a single
encoder context if need be (such as for streaming to multiple channels
at once, and/or recording with the same data).
When an encoder is first connected to, it will connect to raw output,
and start encoding. Additional connections will receive that same
data being encoded as well after that. When the last encoder has
disconnected, it will stop encoding. If for some reason the encoder
needs to stop, it will use the callback with NULL to signal that
encoding has stopped. Some of these things may be subject to change
in the future, though it feels pretty good with this design so far.
Will have to see how well it works out in practice versus theory.
- Second, Started adding preliminary RTMP/x264 output plugin code.
To speed things up, I might just make a direct raw->FFmpeg output to
create a quick output plugin that we can start using for testing all
the subsystems.
2014-01-16 21:34:51 -08:00
|
|
|
* Return value: true if successful
|
|
|
|
*
|
2013-09-30 19:37:13 -07:00
|
|
|
* ---------------------------------------------------------
|
|
|
|
* void [name]_stop(void *data)
|
|
|
|
* Stops output
|
|
|
|
*
|
Add preliminary output/encoder interface
- First, I redid the output interface for libobs. I feel like it's
going in a pretty good direction in terms of design.
Right now, the design is so that outputs and encoders are separate.
One or more outputs can connect to a specific encoder to receive its
data, or the output can connect directly to raw data from libobs
output itself, if the output doesn't want to use a designated encoder.
Data is received via callbacks set when you connect to the encoder or
raw output. Multiple outputs can receive the data from a single
encoder context if need be (such as for streaming to multiple channels
at once, and/or recording with the same data).
When an encoder is first connected to, it will connect to raw output,
and start encoding. Additional connections will receive that same
data being encoded as well after that. When the last encoder has
disconnected, it will stop encoding. If for some reason the encoder
needs to stop, it will use the callback with NULL to signal that
encoding has stopped. Some of these things may be subject to change
in the future, though it feels pretty good with this design so far.
Will have to see how well it works out in practice versus theory.
- Second, Started adding preliminary RTMP/x264 output plugin code.
To speed things up, I might just make a direct raw->FFmpeg output to
create a quick output plugin that we can start using for testing all
the subsystems.
2014-01-16 21:34:51 -08:00
|
|
|
* ---------------------------------------------------------
|
|
|
|
* bool [name]_active(void *data)
|
|
|
|
* Returns whether currently active or not
|
|
|
|
*
|
2013-09-30 19:37:13 -07:00
|
|
|
* ===========================================
|
|
|
|
* Optional Output Exports
|
|
|
|
* ===========================================
|
|
|
|
* void [name]_pause(void *data)
|
|
|
|
* Pauses output. Typically only usable for local recordings.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct obs_output;
|
|
|
|
|
|
|
|
struct output_info {
|
2013-12-20 16:23:19 -08:00
|
|
|
const char *id;
|
2013-09-30 19:37:13 -07:00
|
|
|
|
2013-11-13 05:24:20 -08:00
|
|
|
const char *(*getname)(const char *locale);
|
|
|
|
|
2014-01-27 22:14:58 -08:00
|
|
|
void *(*create)(obs_data_t settings, struct obs_output *output);
|
2013-09-30 19:37:13 -07:00
|
|
|
void (*destroy)(void *data);
|
|
|
|
|
2014-01-27 22:14:58 -08:00
|
|
|
void (*update)(void *data, obs_data_t settings);
|
2014-01-16 23:00:21 -08:00
|
|
|
|
Add preliminary output/encoder interface
- First, I redid the output interface for libobs. I feel like it's
going in a pretty good direction in terms of design.
Right now, the design is so that outputs and encoders are separate.
One or more outputs can connect to a specific encoder to receive its
data, or the output can connect directly to raw data from libobs
output itself, if the output doesn't want to use a designated encoder.
Data is received via callbacks set when you connect to the encoder or
raw output. Multiple outputs can receive the data from a single
encoder context if need be (such as for streaming to multiple channels
at once, and/or recording with the same data).
When an encoder is first connected to, it will connect to raw output,
and start encoding. Additional connections will receive that same
data being encoded as well after that. When the last encoder has
disconnected, it will stop encoding. If for some reason the encoder
needs to stop, it will use the callback with NULL to signal that
encoding has stopped. Some of these things may be subject to change
in the future, though it feels pretty good with this design so far.
Will have to see how well it works out in practice versus theory.
- Second, Started adding preliminary RTMP/x264 output plugin code.
To speed things up, I might just make a direct raw->FFmpeg output to
create a quick output plugin that we can start using for testing all
the subsystems.
2014-01-16 21:34:51 -08:00
|
|
|
bool (*start)(void *data);
|
2013-09-30 19:37:13 -07:00
|
|
|
void (*stop)(void *data);
|
|
|
|
|
Add preliminary output/encoder interface
- First, I redid the output interface for libobs. I feel like it's
going in a pretty good direction in terms of design.
Right now, the design is so that outputs and encoders are separate.
One or more outputs can connect to a specific encoder to receive its
data, or the output can connect directly to raw data from libobs
output itself, if the output doesn't want to use a designated encoder.
Data is received via callbacks set when you connect to the encoder or
raw output. Multiple outputs can receive the data from a single
encoder context if need be (such as for streaming to multiple channels
at once, and/or recording with the same data).
When an encoder is first connected to, it will connect to raw output,
and start encoding. Additional connections will receive that same
data being encoded as well after that. When the last encoder has
disconnected, it will stop encoding. If for some reason the encoder
needs to stop, it will use the callback with NULL to signal that
encoding has stopped. Some of these things may be subject to change
in the future, though it feels pretty good with this design so far.
Will have to see how well it works out in practice versus theory.
- Second, Started adding preliminary RTMP/x264 output plugin code.
To speed things up, I might just make a direct raw->FFmpeg output to
create a quick output plugin that we can start using for testing all
the subsystems.
2014-01-16 21:34:51 -08:00
|
|
|
bool (*active)(void *data);
|
|
|
|
|
2013-09-30 19:37:13 -07:00
|
|
|
/* optional */
|
|
|
|
void (*pause)(void *data);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct obs_output {
|
Add preliminary output/encoder interface
- First, I redid the output interface for libobs. I feel like it's
going in a pretty good direction in terms of design.
Right now, the design is so that outputs and encoders are separate.
One or more outputs can connect to a specific encoder to receive its
data, or the output can connect directly to raw data from libobs
output itself, if the output doesn't want to use a designated encoder.
Data is received via callbacks set when you connect to the encoder or
raw output. Multiple outputs can receive the data from a single
encoder context if need be (such as for streaming to multiple channels
at once, and/or recording with the same data).
When an encoder is first connected to, it will connect to raw output,
and start encoding. Additional connections will receive that same
data being encoded as well after that. When the last encoder has
disconnected, it will stop encoding. If for some reason the encoder
needs to stop, it will use the callback with NULL to signal that
encoding has stopped. Some of these things may be subject to change
in the future, though it feels pretty good with this design so far.
Will have to see how well it works out in practice versus theory.
- Second, Started adding preliminary RTMP/x264 output plugin code.
To speed things up, I might just make a direct raw->FFmpeg output to
create a quick output plugin that we can start using for testing all
the subsystems.
2014-01-16 21:34:51 -08:00
|
|
|
char *name;
|
|
|
|
void *data;
|
2013-09-30 19:37:13 -07:00
|
|
|
struct output_info callbacks;
|
2014-01-27 22:14:58 -08:00
|
|
|
obs_data_t settings;
|
2013-09-30 19:37:13 -07:00
|
|
|
};
|
|
|
|
|
2013-12-30 05:56:39 -08:00
|
|
|
extern bool load_output_info(void *module, const char *module_name,
|
2013-09-30 19:37:13 -07:00
|
|
|
const char *output_name, struct output_info *info);
|