obs-output.h 2.5 KB
Newer Older
J
jp9000 已提交
1
/******************************************************************************
J
jp9000 已提交
2
    Copyright (C) 2013-2014 by Hugh Bailey <obs.jim@gmail.com>
J
jp9000 已提交
3 4 5

    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
6
    the Free Software Foundation, either version 2 of the License, or
J
jp9000 已提交
7 8 9 10 11 12 13 14 15 16 17
    (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/>.
******************************************************************************/

18
#pragma once
J
jp9000 已提交
19

20 21 22 23
#ifdef __cplusplus
extern "C" {
#endif

J
jp9000 已提交
24 25 26 27 28 29
#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)
#define OBS_OUTPUT_SERVICE (1 << 3)
#define OBS_OUTPUT_MULTI_TRACK (1 << 4)
J
jp9000 已提交
30
#define OBS_OUTPUT_CAN_PAUSE (1 << 5)
J
jp9000 已提交
31 32 33

struct encoder_packet;

J
jp9000 已提交
34 35
struct obs_output_info {
	/* required */
36
	const char *id;
J
jp9000 已提交
37

J
jp9000 已提交
38 39
	uint32_t flags;

40
	const char *(*get_name)(void *type_data);
41

42
	void *(*create)(obs_data_t *settings, obs_output_t *output);
J
jp9000 已提交
43 44
	void (*destroy)(void *data);

45
	bool (*start)(void *data);
46
	void (*stop)(void *data, uint64_t ts);
J
jp9000 已提交
47

J
jp9000 已提交
48 49 50
	void (*raw_video)(void *data, struct video_data *frame);
	void (*raw_audio)(void *data, struct audio_data *frames);

J
jp9000 已提交
51
	void (*encoded_packet)(void *data, struct encoder_packet *packet);
52

J
jp9000 已提交
53
	/* optional */
54
	void (*update)(void *data, obs_data_t *settings);
J
jp9000 已提交
55

56
	void (*get_defaults)(obs_data_t *settings);
J
jp9000 已提交
57

58
	obs_properties_t *(*get_properties)(void *data);
J
jp9000 已提交
59

J
jp9000 已提交
60
	void (*unused1)(void *data);
J
jp9000 已提交
61

62
	uint64_t (*get_total_bytes)(void *data);
J
jp9000 已提交
63

64
	int (*get_dropped_frames)(void *data);
65 66 67

	void *type_data;
	void (*free_type_data)(void *type_data);
68 69

	float (*get_congestion)(void *data);
70
	int (*get_connect_time_ms)(void *data);
71 72 73 74

	/* only used with encoded outputs, separated with semicolon */
	const char *encoded_video_codecs;
	const char *encoded_audio_codecs;
75 76 77

	/* raw audio callback for multi track outputs */
	void (*raw_audio2)(void *data, size_t idx, struct audio_data *frames);
J
jp9000 已提交
78 79
};

80
EXPORT void obs_register_output_s(const struct obs_output_info *info,
J
jp9000 已提交
81
				  size_t size);
82 83 84

#define obs_register_output(info) \
	obs_register_output_s(info, sizeof(struct obs_output_info))
85 86 87 88

#ifdef __cplusplus
}
#endif