obs-output.h 2.1 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
#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)
28
#define OBS_OUTPUT_SERVICE     (1<<3)
J
jp9000 已提交
29 30 31

struct encoder_packet;

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

J
jp9000 已提交
36 37
	uint32_t flags;

38
	const char *(*get_name)(void);
39

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

43
	bool (*start)(void *data);
J
jp9000 已提交
44 45
	void (*stop)(void *data);

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

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

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

54
	void (*get_defaults)(obs_data_t *settings);
J
jp9000 已提交
55

56
	obs_properties_t *(*get_properties)(void *data);
J
jp9000 已提交
57

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

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

62
	int (*get_dropped_frames)(void *data);
J
jp9000 已提交
63 64
};

65 66 67 68 69
EXPORT void obs_register_output_s(const struct obs_output_info *info,
		size_t size);

#define obs_register_output(info) \
	obs_register_output_s(info, sizeof(struct obs_output_info))
70 71 72 73

#ifdef __cplusplus
}
#endif