obs-output.h 2.0 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

J
jp9000 已提交
20 21 22 23
#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)
24
#define OBS_OUTPUT_SERVICE     (1<<3)
J
jp9000 已提交
25 26 27

struct encoder_packet;

J
jp9000 已提交
28 29
struct obs_output_info {
	/* required */
30
	const char *id;
J
jp9000 已提交
31

J
jp9000 已提交
32 33
	uint32_t flags;

34
	const char *(*getname)(void);
35

J
jp9000 已提交
36
	void *(*create)(obs_data_t settings, obs_output_t output);
J
jp9000 已提交
37 38
	void (*destroy)(void *data);

39
	bool (*start)(void *data);
J
jp9000 已提交
40 41
	void (*stop)(void *data);

J
jp9000 已提交
42 43 44
	void (*raw_video)(void *data, struct video_data *frame);
	void (*raw_audio)(void *data, struct audio_data *frames);

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

J
jp9000 已提交
47
	/* optional */
J
jp9000 已提交
48 49
	void (*update)(void *data, obs_data_t settings);

J
jp9000 已提交
50 51
	void (*defaults)(obs_data_t settings);

52
	obs_properties_t (*properties)(void);
J
jp9000 已提交
53

J
jp9000 已提交
54
	void (*pause)(void *data);
J
jp9000 已提交
55 56 57 58

	uint64_t (*total_bytes)(void *data);

	int (*dropped_frames)(void *data);
J
jp9000 已提交
59 60
};

61 62 63 64 65
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))