obs-output.h 2.2 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)
29
#define OBS_OUTPUT_MULTI_TRACK (1<<4)
J
jp9000 已提交
30 31 32

struct encoder_packet;

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

J
jp9000 已提交
37 38
	uint32_t flags;

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

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

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

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

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

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

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

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

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

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

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

	void *type_data;
	void (*free_type_data)(void *type_data);
J
jp9000 已提交
67 68
};

69 70 71 72 73
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))
74 75 76 77

#ifdef __cplusplus
}
#endif