Open Broadcaster Software
Free, open source software for live streaming and recording
obs-encoder.h
Go to the documentation of this file.
1 /******************************************************************************
2  Copyright (C) 2013-2014 by Hugh Bailey <obs.jim@gmail.com>
3 
4  This program is free software: you can redistribute it and/or modify
5  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
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
17 
18 #pragma once
19 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #define OBS_ENCODER_CAP_DEPRECATED (1<<0)
33 
38 };
39 
43  size_t size;
53  bool keyframe;
55  /* ---------------------------------------------------------------- */
56  /* Internal video variables (will be parsed automatically) */
57 
58  /* DTS in microseconds */
60 
61  /* System DTS in microseconds */
63 
70  int priority;
71 
79 
81  size_t track_idx;
82 
85 };
86 
88 struct encoder_frame {
91 
94 
97 
100 };
101 
113  /* ----------------------------------------------------------------- */
114  /* Required implementation*/
115 
117  const char *id;
118 
121 
123  const char *codec;
124 
131  const char *(*get_name)(void *type_data);
132 
141  void *(*create)(obs_data_t *settings, obs_encoder_t *encoder);
142 
148  void (*destroy)(void *data);
149 
162  bool (*encode)(void *data, struct encoder_frame *frame,
163  struct encoder_packet *packet, bool *received_packet);
164 
166  size_t (*get_frame_size)(void *data);
167 
168  /* ----------------------------------------------------------------- */
169  /* Optional implementation */
170 
176  void (*get_defaults)(obs_data_t *settings);
177 
183  obs_properties_t *(*get_properties)(void *data);
184 
193  bool (*update)(void *data, obs_data_t *settings);
194 
205  bool (*get_extra_data)(void *data, uint8_t **extra_data, size_t *size);
206 
215  bool (*get_sei_data)(void *data, uint8_t **sei_data, size_t *size);
216 
223  void (*get_audio_info)(void *data, struct audio_convert_info *info);
224 
231  void (*get_video_info)(void *data, struct video_scale_info *info);
232 
233  void *type_data;
234  void (*free_type_data)(void *type_data);
235 
237 };
238 
239 EXPORT void obs_register_encoder_s(const struct obs_encoder_info *info,
240  size_t size);
241 
248 #define obs_register_encoder(info) \
249  obs_register_encoder_s(info, sizeof(struct obs_encoder_info))
250 
251 #ifdef __cplusplus
252 }
253 #endif
Definition: obs-encoder.h:37
uint8_t * data
Definition: obs-encoder.h:42
uint32_t frames
Definition: obs-encoder.h:96
Definition: video-io.h:135
size_t size
Definition: obs-encoder.h:43
size_t track_idx
Definition: obs-encoder.h:81
int64_t sys_dts_usec
Definition: obs-encoder.h:62
unsigned uint32_t
Definition: vc_stdint.h:31
bool keyframe
Definition: obs-encoder.h:53
uint32_t caps
Definition: obs-encoder.h:236
int int32_t
Definition: vc_stdint.h:30
int32_t timebase_den
Definition: obs-encoder.h:49
EXPORT void obs_register_encoder_s(const struct obs_encoder_info *info, size_t size)
enum obs_encoder_type type
Definition: obs-encoder.h:51
Definition: audio-io.h:93
Definition: obs-encoder.h:41
unsigned char uint8_t
Definition: vc_stdint.h:27
struct obs_data obs_data_t
Definition: obs-data.h:42
struct obs_properties obs_properties_t
Definition: obs-properties.h:103
#define EXPORT
Definition: c99defs.h:49
int32_t timebase_num
Definition: obs-encoder.h:48
Definition: obs-internal.h:920
int64_t dts
Definition: obs-encoder.h:46
Definition: obs-encoder.h:112
int64_t pts
Definition: obs-encoder.h:45
obs_encoder_t * encoder
Definition: obs-encoder.h:84
int64_t pts
Definition: obs-encoder.h:99
const char * codec
Definition: obs-encoder.h:123
int priority
Definition: obs-encoder.h:70
int drop_priority
Definition: obs-encoder.h:78
#define MAX_AV_PLANES
Definition: media-io-defs.h:20
Definition: obs-encoder.h:88
obs_encoder_type
Definition: obs-encoder.h:35
int64_t dts_usec
Definition: obs-encoder.h:59
const char * id
Definition: obs-encoder.h:117
void * type_data
Definition: obs-encoder.h:233
__int64 int64_t
Definition: vc_stdint.h:32
#define bool
Definition: vc_stdbool.h:5
Definition: obs-encoder.h:36