(API Change) Remove pointers from all typedefs

Typedef pointers are unsafe.  If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data.  I admit this was a fundamental mistake that must
be corrected.

All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.

This does not break ABI though, which is pretty nice.
master
jp9000 2014-09-25 17:44:05 -07:00
parent 4a06960188
commit c9df41c1e2
146 changed files with 3105 additions and 3079 deletions

View File

@ -37,7 +37,7 @@ void gs_index_buffer::InitBuffer()
throw HRError("Failed to create buffer", hr);
}
gs_index_buffer::gs_index_buffer(gs_device_t device, enum gs_index_type type,
gs_index_buffer::gs_index_buffer(gs_device_t *device, enum gs_index_type type,
void *indices, size_t num, uint32_t flags)
: device (device),
type (type),

View File

@ -59,7 +59,7 @@ static inline D3D11_FILTER ConvertGSFilter( gs_sample_filter filter)
return D3D11_FILTER_MIN_MAG_MIP_POINT;
}
gs_sampler_state::gs_sampler_state(gs_device_t device, gs_sampler_info *info)
gs_sampler_state::gs_sampler_state(gs_device_t *device, gs_sampler_info *info)
: device (device),
info (*info)
{

View File

@ -38,7 +38,7 @@ void gs_vertex_shader::GetBuffersExpected(
}
}
gs_vertex_shader::gs_vertex_shader(gs_device_t device, const char *file,
gs_vertex_shader::gs_vertex_shader(gs_device_t *device, const char *file,
const char *shaderString)
: gs_shader (device, GS_SHADER_VERTEX),
hasNormals (false),
@ -76,7 +76,7 @@ gs_vertex_shader::gs_vertex_shader(gs_device_t device, const char *file,
world = gs_shader_get_param_by_name(this, "World");
}
gs_pixel_shader::gs_pixel_shader(gs_device_t device, const char *file,
gs_pixel_shader::gs_pixel_shader(gs_device_t *device, const char *file,
const char *shaderString)
: gs_shader(device, GS_SHADER_PIXEL)
{
@ -216,9 +216,9 @@ inline void gs_shader::UpdateParam(vector<uint8_t> &constData,
upload = true;
param.changed = false;
}
} else if (param.curValue.size() == sizeof(gs_texture_t)) {
gs_texture_t tex;
memcpy(&tex, param.curValue.data(), sizeof(gs_texture_t));
} else if (param.curValue.size() == sizeof(gs_texture_t*)) {
gs_texture_t *tex;
memcpy(&tex, param.curValue.data(), sizeof(gs_texture_t*));
device_load_texture(device, tex, param.textureID);
}
}
@ -250,22 +250,22 @@ void gs_shader::UploadParams()
}
}
void gs_shader_destroy(gs_shader_t shader)
void gs_shader_destroy(gs_shader_t *shader)
{
delete shader;
}
int gs_shader_get_num_params(gs_shader_t shader)
int gs_shader_get_num_params(gs_shader_t *shader)
{
return (int)shader->params.size();
}
gs_sparam_t gs_shader_get_param_by_idx(gs_shader_t shader, uint32_t param)
gs_sparam_t *gs_shader_get_param_by_idx(gs_shader_t *shader, uint32_t param)
{
return &shader->params[param];
}
gs_sparam_t gs_shader_get_param_by_name(gs_shader_t shader, const char *name)
gs_sparam_t *gs_shader_get_param_by_name(gs_shader_t *shader, const char *name)
{
for (size_t i = 0; i < shader->params.size(); i++) {
gs_shader_param &param = shader->params[i];
@ -276,7 +276,7 @@ gs_sparam_t gs_shader_get_param_by_name(gs_shader_t shader, const char *name)
return NULL;
}
gs_sparam_t gs_shader_get_viewproj_matrix(gs_shader_t shader)
gs_sparam_t *gs_shader_get_viewproj_matrix(gs_shader_t *shader)
{
if (shader->type != GS_SHADER_VERTEX)
return NULL;
@ -284,7 +284,7 @@ gs_sparam_t gs_shader_get_viewproj_matrix(gs_shader_t shader)
return static_cast<gs_vertex_shader*>(shader)->viewProj;
}
gs_sparam_t gs_shader_get_world_matrix(gs_shader_t shader)
gs_sparam_t *gs_shader_get_world_matrix(gs_shader_t *shader)
{
if (shader->type != GS_SHADER_VERTEX)
return NULL;
@ -292,7 +292,7 @@ gs_sparam_t gs_shader_get_world_matrix(gs_shader_t shader)
return static_cast<gs_vertex_shader*>(shader)->world;
}
void gs_shader_get_param_info(gs_sparam_t param,
void gs_shader_get_param_info(gs_sparam_t *param,
struct gs_shader_param_info *info)
{
if (!param)
@ -319,59 +319,59 @@ static inline void shader_setval_inline(gs_shader_param *param,
}
}
void gs_shader_set_bool(gs_sparam_t param, bool val)
void gs_shader_set_bool(gs_sparam_t *param, bool val)
{
shader_setval_inline(param, &val, sizeof(bool));
}
void gs_shader_set_float(gs_sparam_t param, float val)
void gs_shader_set_float(gs_sparam_t *param, float val)
{
shader_setval_inline(param, &val, sizeof(float));
}
void gs_shader_set_int(gs_sparam_t param, int val)
void gs_shader_set_int(gs_sparam_t *param, int val)
{
shader_setval_inline(param, &val, sizeof(int));
}
void gs_shader_setmatrix3(gs_sparam_t param, const struct matrix3 *val)
void gs_shader_setmatrix3(gs_sparam_t *param, const struct matrix3 *val)
{
struct matrix4 mat;
matrix4_from_matrix3(&mat, val);
shader_setval_inline(param, &mat, sizeof(matrix4));
}
void gs_shader_set_matrix4(gs_sparam_t param, const struct matrix4 *val)
void gs_shader_set_matrix4(gs_sparam_t *param, const struct matrix4 *val)
{
shader_setval_inline(param, val, sizeof(matrix4));
}
void gs_shader_set_vec2(gs_sparam_t param, const struct vec2 *val)
void gs_shader_set_vec2(gs_sparam_t *param, const struct vec2 *val)
{
shader_setval_inline(param, val, sizeof(vec2));
}
void gs_shader_set_vec3(gs_sparam_t param, const struct vec3 *val)
void gs_shader_set_vec3(gs_sparam_t *param, const struct vec3 *val)
{
shader_setval_inline(param, val, sizeof(float) * 3);
}
void gs_shader_set_vec4(gs_sparam_t param, const struct vec4 *val)
void gs_shader_set_vec4(gs_sparam_t *param, const struct vec4 *val)
{
shader_setval_inline(param, val, sizeof(vec4));
}
void gs_shader_set_texture(gs_sparam_t param, gs_texture_t val)
void gs_shader_set_texture(gs_sparam_t *param, gs_texture_t *val)
{
shader_setval_inline(param, &val, sizeof(gs_texture_t));
shader_setval_inline(param, &val, sizeof(gs_texture_t*));
}
void gs_shader_set_val(gs_sparam_t param, const void *val, size_t size)
void gs_shader_set_val(gs_sparam_t *param, const void *val, size_t size)
{
shader_setval_inline(param, val, size);
}
void gs_shader_set_default(gs_sparam_t param)
void gs_shader_set_default(gs_sparam_t *param)
{
if (param->defaultValue.size())
shader_setval_inline(param, param->defaultValue.data(),

View File

@ -180,7 +180,7 @@ void ShaderProcessor::BuildParams(vector<gs_shader_param> &params)
AddParam(parser.params.array[i], params, texCounter);
}
static inline void AddSampler(gs_device_t device, shader_sampler &sampler,
static inline void AddSampler(gs_device_t *device, shader_sampler &sampler,
vector<ShaderSampler> &samplers)
{
gs_sampler_info si;

View File

@ -25,7 +25,7 @@ struct ShaderParser : shader_parser {
};
struct ShaderProcessor {
gs_device_t device;
gs_device_t *device;
ShaderParser parser;
void BuildInputLayout(vector<D3D11_INPUT_ELEMENT_DESC> &inputs);
@ -34,7 +34,7 @@ struct ShaderProcessor {
void BuildString(string &outputString);
void Process(const char *shader_string, const char *file);
inline ShaderProcessor(gs_device_t device) : device(device)
inline ShaderProcessor(gs_device_t *device) : device(device)
{
}
};

View File

@ -17,7 +17,7 @@
#include "d3d11-subsystem.hpp"
gs_stage_surface::gs_stage_surface(gs_device_t device, uint32_t width,
gs_stage_surface::gs_stage_surface(gs_device_t *device, uint32_t width,
uint32_t height, gs_color_format colorFormat)
: device (device),
width (width),

View File

@ -443,7 +443,7 @@ const char *device_preprocessor_name(void)
return "_D3D11";
}
int device_create(gs_device_t *p_device, gs_init_data *data)
int device_create(gs_device_t **p_device, gs_init_data *data)
{
gs_device *device = NULL;
int errorcode = GS_SUCCESS;
@ -466,24 +466,24 @@ int device_create(gs_device_t *p_device, gs_init_data *data)
return errorcode;
}
void device_destroy(gs_device_t device)
void device_destroy(gs_device_t *device)
{
delete device;
}
void device_enter_context(gs_device_t device)
void device_enter_context(gs_device_t *device)
{
/* does nothing */
UNUSED_PARAMETER(device);
}
void device_leave_context(gs_device_t device)
void device_leave_context(gs_device_t *device)
{
/* does nothing */
UNUSED_PARAMETER(device);
}
gs_swapchain_t device_swapchain_create(gs_device_t device,
gs_swapchain_t *device_swapchain_create(gs_device_t *device,
struct gs_init_data *data)
{
gs_swap_chain *swap = NULL;
@ -498,7 +498,7 @@ gs_swapchain_t device_swapchain_create(gs_device_t device,
return swap;
}
void device_resize(gs_device_t device, uint32_t cx, uint32_t cy)
void device_resize(gs_device_t *device, uint32_t cx, uint32_t cy)
{
try {
ID3D11RenderTargetView *renderView = NULL;
@ -520,23 +520,23 @@ void device_resize(gs_device_t device, uint32_t cx, uint32_t cy)
}
}
void device_get_size(gs_device_t device, uint32_t *cx, uint32_t *cy)
void device_get_size(gs_device_t *device, uint32_t *cx, uint32_t *cy)
{
*cx = device->curSwapChain->target.width;
*cy = device->curSwapChain->target.height;
}
uint32_t device_get_width(gs_device_t device)
uint32_t device_get_width(gs_device_t *device)
{
return device->curSwapChain->target.width;
}
uint32_t device_get_height(gs_device_t device)
uint32_t device_get_height(gs_device_t *device)
{
return device->curSwapChain->target.height;
}
gs_texture_t device_texture_create(gs_device_t device, uint32_t width,
gs_texture_t *device_texture_create(gs_device_t *device, uint32_t width,
uint32_t height, enum gs_color_format color_format,
uint32_t levels, const uint8_t **data, uint32_t flags)
{
@ -555,7 +555,7 @@ gs_texture_t device_texture_create(gs_device_t device, uint32_t width,
return texture;
}
gs_texture_t device_cubetexture_create(gs_device_t device, uint32_t size,
gs_texture_t *device_cubetexture_create(gs_device_t *device, uint32_t size,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags)
{
@ -576,7 +576,7 @@ gs_texture_t device_cubetexture_create(gs_device_t device, uint32_t size,
return texture;
}
gs_texture_t device_voltexture_create(gs_device_t device, uint32_t width,
gs_texture_t *device_voltexture_create(gs_device_t *device, uint32_t width,
uint32_t height, uint32_t depth,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags)
@ -593,7 +593,7 @@ gs_texture_t device_voltexture_create(gs_device_t device, uint32_t width,
return NULL;
}
gs_zstencil_t device_zstencil_create(gs_device_t device, uint32_t width,
gs_zstencil_t *device_zstencil_create(gs_device_t *device, uint32_t width,
uint32_t height, enum gs_zstencil_format format)
{
gs_zstencil_buffer *zstencil = NULL;
@ -608,7 +608,7 @@ gs_zstencil_t device_zstencil_create(gs_device_t device, uint32_t width,
return zstencil;
}
gs_stagesurf_t device_stagesurface_create(gs_device_t device, uint32_t width,
gs_stagesurf_t *device_stagesurface_create(gs_device_t *device, uint32_t width,
uint32_t height, enum gs_color_format color_format)
{
gs_stage_surface *surf = NULL;
@ -624,7 +624,7 @@ gs_stagesurf_t device_stagesurface_create(gs_device_t device, uint32_t width,
return surf;
}
gs_samplerstate_t device_samplerstate_create(gs_device_t device,
gs_samplerstate_t *device_samplerstate_create(gs_device_t *device,
struct gs_sampler_info *info)
{
gs_sampler_state *ss = NULL;
@ -639,7 +639,7 @@ gs_samplerstate_t device_samplerstate_create(gs_device_t device,
return ss;
}
gs_shader_t device_vertexshader_create(gs_device_t device,
gs_shader_t *device_vertexshader_create(gs_device_t *device,
const char *shader_string, const char *file,
char **error_string)
{
@ -668,7 +668,7 @@ gs_shader_t device_vertexshader_create(gs_device_t device,
return shader;
}
gs_shader_t device_pixelshader_create(gs_device_t device,
gs_shader_t *device_pixelshader_create(gs_device_t *device,
const char *shader_string, const char *file,
char **error_string)
{
@ -697,7 +697,7 @@ gs_shader_t device_pixelshader_create(gs_device_t device,
return shader;
}
gs_vertbuffer_t device_vertexbuffer_create(gs_device_t device,
gs_vertbuffer_t *device_vertexbuffer_create(gs_device_t *device,
struct gs_vb_data *data, uint32_t flags)
{
gs_vertex_buffer *buffer = NULL;
@ -715,7 +715,7 @@ gs_vertbuffer_t device_vertexbuffer_create(gs_device_t device,
return buffer;
}
gs_indexbuffer_t device_indexbuffer_create(gs_device_t device,
gs_indexbuffer_t *device_indexbuffer_create(gs_device_t *device,
enum gs_index_type type, void *indices, size_t num,
uint32_t flags)
{
@ -730,12 +730,12 @@ gs_indexbuffer_t device_indexbuffer_create(gs_device_t device,
return buffer;
}
enum gs_texture_type device_get_texture_type(gs_texture_t texture)
enum gs_texture_type device_get_texture_type(gs_texture_t *texture)
{
return texture->type;
}
void device_load_vertexbuffer(gs_device_t device, gs_vertbuffer_t vertbuffer)
void device_load_vertexbuffer(gs_device_t *device, gs_vertbuffer_t *vertbuffer)
{
if (device->curVertexBuffer == vertbuffer)
return;
@ -764,7 +764,7 @@ void device_load_vertexbuffer(gs_device_t device, gs_vertbuffer_t vertbuffer)
buffers.data(), strides.data(), offsets.data());
}
void device_load_indexbuffer(gs_device_t device, gs_indexbuffer_t indexbuffer)
void device_load_indexbuffer(gs_device_t *device, gs_indexbuffer_t *indexbuffer)
{
DXGI_FORMAT format;
ID3D11Buffer *buffer;
@ -789,7 +789,7 @@ void device_load_indexbuffer(gs_device_t device, gs_indexbuffer_t indexbuffer)
device->context->IASetIndexBuffer(buffer, format, 0);
}
void device_load_texture(gs_device_t device, gs_texture_t tex, int unit)
void device_load_texture(gs_device_t *device, gs_texture_t *tex, int unit)
{
ID3D11ShaderResourceView *view = NULL;
@ -803,8 +803,8 @@ void device_load_texture(gs_device_t device, gs_texture_t tex, int unit)
device->context->PSSetShaderResources(unit, 1, &view);
}
void device_load_samplerstate(gs_device_t device,
gs_samplerstate_t samplerstate, int unit)
void device_load_samplerstate(gs_device_t *device,
gs_samplerstate_t *samplerstate, int unit)
{
ID3D11SamplerState *state = NULL;
@ -818,7 +818,7 @@ void device_load_samplerstate(gs_device_t device,
device->context->PSSetSamplers(unit, 1, &state);
}
void device_load_vertexshader(gs_device_t device, gs_shader_t vertshader)
void device_load_vertexshader(gs_device_t *device, gs_shader_t *vertshader)
{
ID3D11VertexShader *shader = NULL;
ID3D11InputLayout *layout = NULL;
@ -855,7 +855,7 @@ void device_load_vertexshader(gs_device_t device, gs_shader_t vertshader)
device_load_vertexbuffer(device, curVB);
}
static inline void clear_textures(gs_device_t device)
static inline void clear_textures(gs_device_t *device)
{
ID3D11ShaderResourceView *views[GS_MAX_TEXTURES];
memset(views, 0, sizeof(views));
@ -863,7 +863,7 @@ static inline void clear_textures(gs_device_t device)
device->context->PSSetShaderResources(0, GS_MAX_TEXTURES, views);
}
void device_load_pixelshader(gs_device_t device, gs_shader_t pixelshader)
void device_load_pixelshader(gs_device_t *device, gs_shader_t *pixelshader)
{
ID3D11PixelShader *shader = NULL;
ID3D11Buffer *constants = NULL;
@ -902,7 +902,7 @@ void device_load_pixelshader(gs_device_t device, gs_shader_t pixelshader)
device->curSamplers[i] = nullptr;
}
void device_load_default_samplerstate(gs_device_t device, bool b_3d, int unit)
void device_load_default_samplerstate(gs_device_t *device, bool b_3d, int unit)
{
/* TODO */
UNUSED_PARAMETER(device);
@ -910,17 +910,17 @@ void device_load_default_samplerstate(gs_device_t device, bool b_3d, int unit)
UNUSED_PARAMETER(unit);
}
gs_shader_t device_get_vertex_shader(gs_device_t device)
gs_shader_t *device_get_vertex_shader(gs_device_t *device)
{
return device->curVertexShader;
}
gs_shader_t device_get_pixel_shader(gs_device_t device)
gs_shader_t *device_get_pixel_shader(gs_device_t *device)
{
return device->curPixelShader;
}
gs_texture_t device_get_render_target(gs_device_t device)
gs_texture_t *device_get_render_target(gs_device_t *device)
{
if (device->curRenderTarget == &device->curSwapChain->target)
return NULL;
@ -928,7 +928,7 @@ gs_texture_t device_get_render_target(gs_device_t device)
return device->curRenderTarget;
}
gs_zstencil_t device_get_zstencil_target(gs_device_t device)
gs_zstencil_t *device_get_zstencil_target(gs_device_t *device)
{
if (device->curZStencilBuffer == &device->curSwapChain->zs)
return NULL;
@ -936,8 +936,8 @@ gs_zstencil_t device_get_zstencil_target(gs_device_t device)
return device->curZStencilBuffer;
}
void device_set_render_target(gs_device_t device, gs_texture_t tex,
gs_zstencil_t zstencil)
void device_set_render_target(gs_device_t *device, gs_texture_t *tex,
gs_zstencil_t *zstencil)
{
if (!tex)
tex = &device->curSwapChain->target;
@ -969,8 +969,8 @@ void device_set_render_target(gs_device_t device, gs_texture_t tex,
device->context->OMSetRenderTargets(1, &rt, zstencil->view);
}
void device_set_cube_render_target(gs_device_t device, gs_texture_t tex,
int side, gs_zstencil_t zstencil)
void device_set_cube_render_target(gs_device_t *device, gs_texture_t *tex,
int side, gs_zstencil_t *zstencil)
{
if (!tex) {
tex = &device->curSwapChain->target;
@ -1008,7 +1008,7 @@ void device_set_cube_render_target(gs_device_t device, gs_texture_t tex,
inline void gs_device::CopyTex(ID3D11Texture2D *dst,
uint32_t dst_x, uint32_t dst_y,
gs_texture_t src, uint32_t src_x, uint32_t src_y,
gs_texture_t *src, uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h)
{
if (src->type != GS_TEXTURE_2D)
@ -1043,9 +1043,9 @@ inline void gs_device::CopyTex(ID3D11Texture2D *dst,
}
}
void device_copy_texture_region(gs_device_t device,
gs_texture_t dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t src, uint32_t src_x, uint32_t src_y,
void device_copy_texture_region(gs_device_t *device,
gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t *src, uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h)
{
try {
@ -1092,13 +1092,14 @@ void device_copy_texture_region(gs_device_t device,
}
}
void device_copy_texture(gs_device_t device, gs_texture_t dst, gs_texture_t src)
void device_copy_texture(gs_device_t *device, gs_texture_t *dst,
gs_texture_t *src)
{
device_copy_texture_region(device, dst, 0, 0, src, 0, 0, 0, 0);
}
void device_stage_texture(gs_device_t device, gs_stagesurf_t dst,
gs_texture_t src)
void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst,
gs_texture_t *src)
{
try {
gs_texture_2d *src2d = static_cast<gs_texture_2d*>(src);
@ -1123,12 +1124,12 @@ void device_stage_texture(gs_device_t device, gs_stagesurf_t dst,
}
}
void device_begin_scene(gs_device_t device)
void device_begin_scene(gs_device_t *device)
{
clear_textures(device);
}
void device_draw(gs_device_t device, enum gs_draw_mode draw_mode,
void device_draw(gs_device_t *device, enum gs_draw_mode draw_mode,
uint32_t start_vert, uint32_t num_verts)
{
try {
@ -1141,7 +1142,7 @@ void device_draw(gs_device_t device, enum gs_draw_mode draw_mode,
if (!device->curVertexBuffer)
throw "No vertex buffer specified";
gs_effect_t effect = gs_get_effect();
gs_effect_t *effect = gs_get_effect();
if (effect)
gs_effect_update_params(effect);
@ -1179,16 +1180,16 @@ void device_draw(gs_device_t device, enum gs_draw_mode draw_mode,
}
}
void device_end_scene(gs_device_t device)
void device_end_scene(gs_device_t *device)
{
/* does nothing in D3D11 */
UNUSED_PARAMETER(device);
}
void device_load_swapchain(gs_device_t device, gs_swapchain_t swapchain)
void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swapchain)
{
gs_texture_t target = device->curRenderTarget;
gs_zstencil_t zs = device->curZStencilBuffer;
gs_texture_t *target = device->curRenderTarget;
gs_zstencil_t *zs = device->curZStencilBuffer;
bool is_cube = device->curRenderTarget->type == GS_TEXTURE_CUBE;
if (target == &device->curSwapChain->target)
@ -1208,7 +1209,7 @@ void device_load_swapchain(gs_device_t device, gs_swapchain_t swapchain)
device_set_render_target(device, target, zs);
}
void device_clear(gs_device_t device, uint32_t clear_flags, struct vec4 *color,
void device_clear(gs_device_t *device, uint32_t clear_flags, struct vec4 *color,
float depth, uint8_t stencil)
{
int side = device->curRenderSide;
@ -1231,17 +1232,17 @@ void device_clear(gs_device_t device, uint32_t clear_flags, struct vec4 *color,
}
}
void device_present(gs_device_t device)
void device_present(gs_device_t *device)
{
device->curSwapChain->swap->Present(0, 0);
}
void device_flush(gs_device_t device)
void device_flush(gs_device_t *device)
{
device->context->Flush();
}
void device_set_cull_mode(gs_device_t device, enum gs_cull_mode mode)
void device_set_cull_mode(gs_device_t *device, enum gs_cull_mode mode)
{
if (mode == device->rasterState.cullMode)
return;
@ -1250,12 +1251,12 @@ void device_set_cull_mode(gs_device_t device, enum gs_cull_mode mode)
device->rasterStateChanged = true;
}
enum gs_cull_mode device_get_cull_mode(gs_device_t device)
enum gs_cull_mode device_get_cull_mode(gs_device_t *device)
{
return device->rasterState.cullMode;
}
void device_enable_blending(gs_device_t device, bool enable)
void device_enable_blending(gs_device_t *device, bool enable)
{
if (enable == device->blendState.blendEnabled)
return;
@ -1264,7 +1265,7 @@ void device_enable_blending(gs_device_t device, bool enable)
device->blendStateChanged = true;
}
void device_enable_depth_test(gs_device_t device, bool enable)
void device_enable_depth_test(gs_device_t *device, bool enable)
{
if (enable == device->zstencilState.depthEnabled)
return;
@ -1273,7 +1274,7 @@ void device_enable_depth_test(gs_device_t device, bool enable)
device->zstencilStateChanged = true;
}
void device_enable_stencil_test(gs_device_t device, bool enable)
void device_enable_stencil_test(gs_device_t *device, bool enable)
{
if (enable == device->zstencilState.stencilEnabled)
return;
@ -1282,7 +1283,7 @@ void device_enable_stencil_test(gs_device_t device, bool enable)
device->zstencilStateChanged = true;
}
void device_enable_stencil_write(gs_device_t device, bool enable)
void device_enable_stencil_write(gs_device_t *device, bool enable)
{
if (enable == device->zstencilState.stencilWriteEnabled)
return;
@ -1291,7 +1292,7 @@ void device_enable_stencil_write(gs_device_t device, bool enable)
device->zstencilStateChanged = true;
}
void device_enable_color(gs_device_t device, bool red, bool green,
void device_enable_color(gs_device_t *device, bool red, bool green,
bool blue, bool alpha)
{
if (device->blendState.redEnabled == red &&
@ -1307,7 +1308,7 @@ void device_enable_color(gs_device_t device, bool red, bool green,
device->blendStateChanged = true;
}
void device_blend_function(gs_device_t device, enum gs_blend_type src,
void device_blend_function(gs_device_t *device, enum gs_blend_type src,
enum gs_blend_type dest)
{
if (device->blendState.srcFactor == src &&
@ -1319,7 +1320,7 @@ void device_blend_function(gs_device_t device, enum gs_blend_type src,
device->blendStateChanged = true;
}
void device_depth_function(gs_device_t device, enum gs_depth_test test)
void device_depth_function(gs_device_t *device, enum gs_depth_test test)
{
if (device->zstencilState.depthFunc == test)
return;
@ -1328,8 +1329,8 @@ void device_depth_function(gs_device_t device, enum gs_depth_test test)
device->zstencilStateChanged = true;
}
static inline void update_stencilside_test(gs_device_t device, StencilSide &side,
gs_depth_test test)
static inline void update_stencilside_test(gs_device_t *device,
StencilSide &side, gs_depth_test test)
{
if (side.test == test)
return;
@ -1338,7 +1339,7 @@ static inline void update_stencilside_test(gs_device_t device, StencilSide &side
device->zstencilStateChanged = true;
}
void device_stencil_function(gs_device_t device, enum gs_stencil_side side,
void device_stencil_function(gs_device_t *device, enum gs_stencil_side side,
enum gs_depth_test test)
{
int sideVal = (int)side;
@ -1351,7 +1352,7 @@ void device_stencil_function(gs_device_t device, enum gs_stencil_side side,
device->zstencilState.stencilBack, test);
}
static inline void update_stencilside_op(gs_device_t device, StencilSide &side,
static inline void update_stencilside_op(gs_device_t *device, StencilSide &side,
enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail,
enum gs_stencil_op_type zpass)
{
@ -1364,7 +1365,7 @@ static inline void update_stencilside_op(gs_device_t device, StencilSide &side,
device->zstencilStateChanged = true;
}
void device_stencil_op(gs_device_t device, enum gs_stencil_side side,
void device_stencil_op(gs_device_t *device, enum gs_stencil_side side,
enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail,
enum gs_stencil_op_type zpass)
{
@ -1380,7 +1381,7 @@ void device_stencil_op(gs_device_t device, enum gs_stencil_side side,
fail, zfail, zpass);
}
void device_set_viewport(gs_device_t device, int x, int y, int width,
void device_set_viewport(gs_device_t *device, int x, int y, int width,
int height)
{
D3D11_VIEWPORT vp;
@ -1398,12 +1399,12 @@ void device_set_viewport(gs_device_t device, int x, int y, int width,
device->viewport.cy = height;
}
void device_get_viewport(gs_device_t device, struct gs_rect *rect)
void device_get_viewport(gs_device_t *device, struct gs_rect *rect)
{
memcpy(rect, &device->viewport, sizeof(gs_rect));
}
void device_set_scissor_rect(gs_device_t device, struct gs_rect *rect)
void device_set_scissor_rect(gs_device_t *device, struct gs_rect *rect)
{
D3D11_RECT d3drect;
@ -1420,7 +1421,7 @@ void device_set_scissor_rect(gs_device_t device, struct gs_rect *rect)
device->rasterStateChanged = true;
}
void device_ortho(gs_device_t device, float left, float right, float top,
void device_ortho(gs_device_t *device, float left, float right, float top,
float bottom, float zNear, float zFar)
{
matrix4 *dst = &device->curProjMatrix;
@ -1446,7 +1447,7 @@ void device_ortho(gs_device_t device, float left, float right, float top,
dst->t.w = 1.0f;
}
void device_frustum(gs_device_t device, float left, float right, float top,
void device_frustum(gs_device_t *device, float left, float right, float top,
float bottom, float zNear, float zFar)
{
matrix4 *dst = &device->curProjMatrix;
@ -1473,14 +1474,14 @@ void device_frustum(gs_device_t device, float left, float right, float top,
dst->z.w = 1.0f;
}
void device_projection_push(gs_device_t device)
void device_projection_push(gs_device_t *device)
{
mat4float mat;
memcpy(&mat, &device->curProjMatrix, sizeof(matrix4));
device->projStack.push_back(mat);
}
void device_projection_pop(gs_device_t device)
void device_projection_pop(gs_device_t *device)
{
if (!device->projStack.size())
return;
@ -1493,7 +1494,7 @@ void device_projection_pop(gs_device_t device)
device->projStack.pop_back();
}
void gs_swapchain_destroy(gs_swapchain_t swapchain)
void gs_swapchain_destroy(gs_swapchain_t *swapchain)
{
if (!swapchain)
return;
@ -1505,12 +1506,12 @@ void gs_swapchain_destroy(gs_swapchain_t swapchain)
delete swapchain;
}
void gs_texture_destroy(gs_texture_t tex)
void gs_texture_destroy(gs_texture_t *tex)
{
delete tex;
}
uint32_t gs_texture_get_width(gs_texture_t tex)
uint32_t gs_texture_get_width(gs_texture_t *tex)
{
if (tex->type != GS_TEXTURE_2D)
return 0;
@ -1518,7 +1519,7 @@ uint32_t gs_texture_get_width(gs_texture_t tex)
return static_cast<gs_texture_2d*>(tex)->width;
}
uint32_t gs_texture_get_height(gs_texture_t tex)
uint32_t gs_texture_get_height(gs_texture_t *tex)
{
if (tex->type != GS_TEXTURE_2D)
return 0;
@ -1526,7 +1527,7 @@ uint32_t gs_texture_get_height(gs_texture_t tex)
return static_cast<gs_texture_2d*>(tex)->height;
}
enum gs_color_format gs_texture_get_color_format(gs_texture_t tex)
enum gs_color_format gs_texture_get_color_format(gs_texture_t *tex)
{
if (tex->type != GS_TEXTURE_2D)
return GS_UNKNOWN;
@ -1534,7 +1535,7 @@ enum gs_color_format gs_texture_get_color_format(gs_texture_t tex)
return static_cast<gs_texture_2d*>(tex)->format;
}
bool gs_texture_map(gs_texture_t tex, uint8_t **ptr, uint32_t *linesize)
bool gs_texture_map(gs_texture_t *tex, uint8_t **ptr, uint32_t *linesize)
{
HRESULT hr;
@ -1554,7 +1555,7 @@ bool gs_texture_map(gs_texture_t tex, uint8_t **ptr, uint32_t *linesize)
return true;
}
void gs_texture_unmap(gs_texture_t tex)
void gs_texture_unmap(gs_texture_t *tex)
{
if (tex->type != GS_TEXTURE_2D)
return;
@ -1563,7 +1564,7 @@ void gs_texture_unmap(gs_texture_t tex)
tex2d->device->context->Unmap(tex2d->texture, 0);
}
void *gs_texture_get_obj(gs_texture_t tex)
void *gs_texture_get_obj(gs_texture_t *tex)
{
if (tex->type != GS_TEXTURE_2D)
return nullptr;
@ -1573,12 +1574,12 @@ void *gs_texture_get_obj(gs_texture_t tex)
}
void gs_cubetexture_destroy(gs_texture_t cubetex)
void gs_cubetexture_destroy(gs_texture_t *cubetex)
{
delete cubetex;
}
uint32_t gs_cubetexture_get_size(gs_texture_t cubetex)
uint32_t gs_cubetexture_get_size(gs_texture_t *cubetex)
{
if (cubetex->type != GS_TEXTURE_CUBE)
return 0;
@ -1587,7 +1588,7 @@ uint32_t gs_cubetexture_get_size(gs_texture_t cubetex)
return tex->width;
}
enum gs_color_format gs_cubetexture_get_color_format(gs_texture_t cubetex)
enum gs_color_format gs_cubetexture_get_color_format(gs_texture_t *cubetex)
{
if (cubetex->type != GS_TEXTURE_CUBE)
return GS_UNKNOWN;
@ -1597,33 +1598,33 @@ enum gs_color_format gs_cubetexture_get_color_format(gs_texture_t cubetex)
}
void gs_voltexture_destroy(gs_texture_t voltex)
void gs_voltexture_destroy(gs_texture_t *voltex)
{
delete voltex;
}
uint32_t gs_voltexture_get_width(gs_texture_t voltex)
uint32_t gs_voltexture_get_width(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}
uint32_t gs_voltexture_get_height(gs_texture_t voltex)
uint32_t gs_voltexture_get_height(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}
uint32_t gs_voltexture_getdepth(gs_texture_t voltex)
uint32_t gs_voltexture_getdepth(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}
enum gs_color_format gs_voltexture_get_color_format(gs_texture_t voltex)
enum gs_color_format gs_voltexture_get_color_format(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
@ -1631,27 +1632,27 @@ enum gs_color_format gs_voltexture_get_color_format(gs_texture_t voltex)
}
void gs_stagesurface_destroy(gs_stagesurf_t stagesurf)
void gs_stagesurface_destroy(gs_stagesurf_t *stagesurf)
{
delete stagesurf;
}
uint32_t gs_stagesurface_get_width(gs_stagesurf_t stagesurf)
uint32_t gs_stagesurface_get_width(gs_stagesurf_t *stagesurf)
{
return stagesurf->width;
}
uint32_t gs_stagesurface_get_height(gs_stagesurf_t stagesurf)
uint32_t gs_stagesurface_get_height(gs_stagesurf_t *stagesurf)
{
return stagesurf->height;
}
enum gs_color_format gs_stagesurface_get_color_format(gs_stagesurf_t stagesurf)
enum gs_color_format gs_stagesurface_get_color_format(gs_stagesurf_t *stagesurf)
{
return stagesurf->format;
}
bool gs_stagesurface_map(gs_stagesurf_t stagesurf, uint8_t **data,
bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data,
uint32_t *linesize)
{
D3D11_MAPPED_SUBRESOURCE map;
@ -1664,19 +1665,19 @@ bool gs_stagesurface_map(gs_stagesurf_t stagesurf, uint8_t **data,
return true;
}
void gs_stagesurface_unmap(gs_stagesurf_t stagesurf)
void gs_stagesurface_unmap(gs_stagesurf_t *stagesurf)
{
stagesurf->device->context->Unmap(stagesurf->texture, 0);
}
void gs_zstencil_destroy(gs_zstencil_t zstencil)
void gs_zstencil_destroy(gs_zstencil_t *zstencil)
{
delete zstencil;
}
void gs_samplerstate_destroy(gs_samplerstate_t samplerstate)
void gs_samplerstate_destroy(gs_samplerstate_t *samplerstate)
{
if (!samplerstate)
return;
@ -1691,12 +1692,12 @@ void gs_samplerstate_destroy(gs_samplerstate_t samplerstate)
}
void gs_vertexbuffer_destroy(gs_vertbuffer_t vertbuffer)
void gs_vertexbuffer_destroy(gs_vertbuffer_t *vertbuffer)
{
delete vertbuffer;
}
void gs_vertexbuffer_flush(gs_vertbuffer_t vertbuffer)
void gs_vertexbuffer_flush(gs_vertbuffer_t *vertbuffer)
{
if (!vertbuffer->dynamic) {
blog(LOG_ERROR, "gs_vertexbuffer_flush: vertex buffer is "
@ -1726,18 +1727,18 @@ void gs_vertexbuffer_flush(gs_vertbuffer_t vertbuffer)
}
}
struct gs_vb_data *gs_vertexbuffer_get_data(gs_vertbuffer_t vertbuffer)
struct gs_vb_data *gs_vertexbuffer_get_data(gs_vertbuffer_t *vertbuffer)
{
return vertbuffer->vbd.data;
}
void gs_indexbuffer_destroy(gs_indexbuffer_t indexbuffer)
void gs_indexbuffer_destroy(gs_indexbuffer_t *indexbuffer)
{
delete indexbuffer;
}
void gs_indexbuffer_flush(gs_indexbuffer_t indexbuffer)
void gs_indexbuffer_flush(gs_indexbuffer_t *indexbuffer)
{
HRESULT hr;
@ -1756,17 +1757,17 @@ void gs_indexbuffer_flush(gs_indexbuffer_t indexbuffer)
indexbuffer->device->context->Unmap(indexbuffer->indexBuffer, 0);
}
void *gs_indexbuffer_get_data(gs_indexbuffer_t indexbuffer)
void *gs_indexbuffer_get_data(gs_indexbuffer_t *indexbuffer)
{
return indexbuffer->indices.data;
}
size_t gs_indexbuffer_get_num_indices(gs_indexbuffer_t indexbuffer)
size_t gs_indexbuffer_get_num_indices(gs_indexbuffer_t *indexbuffer)
{
return indexbuffer->num;
}
enum gs_index_type gs_indexbuffer_get_type(gs_indexbuffer_t indexbuffer)
enum gs_index_type gs_indexbuffer_get_type(gs_indexbuffer_t *indexbuffer)
{
return indexbuffer->type;
}
@ -1776,7 +1777,7 @@ extern "C" EXPORT bool device_gdi_texture_available(void)
return true;
}
extern "C" EXPORT gs_texture_t device_texture_create_gdi(gs_device_t device,
extern "C" EXPORT gs_texture_t *device_texture_create_gdi(gs_device_t *device,
uint32_t width, uint32_t height)
{
gs_texture *texture = nullptr;
@ -1805,7 +1806,7 @@ static inline bool TextureGDICompatible(gs_texture_2d *tex2d, const char *func)
return true;
}
extern "C" EXPORT void *gs_texture_get_dc(gs_texture_t tex)
extern "C" EXPORT void *gs_texture_get_dc(gs_texture_t *tex)
{
HDC hDC = nullptr;
@ -1820,7 +1821,7 @@ extern "C" EXPORT void *gs_texture_get_dc(gs_texture_t tex)
return hDC;
}
extern "C" EXPORT void gs_texture_release_dc(gs_texture_t tex)
extern "C" EXPORT void gs_texture_release_dc(gs_texture_t *tex)
{
if (tex->type != GS_TEXTURE_2D)
return;

View File

@ -182,7 +182,7 @@ struct gs_vertex_buffer {
ComPtr<ID3D11Buffer> tangentBuffer;
vector<ComPtr<ID3D11Buffer>> uvBuffers;
gs_device_t device;
gs_device_t *device;
bool dynamic;
VBDataPtr vbd;
size_t numVerts;
@ -199,7 +199,7 @@ struct gs_vertex_buffer {
const size_t numVerts, void *array,
ID3D11Buffer **buffer);
gs_vertex_buffer(gs_device_t device, struct gs_vb_data *data,
gs_vertex_buffer(gs_device_t *device, struct gs_vb_data *data,
uint32_t flags);
};
@ -213,7 +213,7 @@ struct DataPtr {
struct gs_index_buffer {
ComPtr<ID3D11Buffer> indexBuffer;
gs_device_t device;
gs_device_t *device;
bool dynamic;
gs_index_type type;
size_t indexSize;
@ -222,7 +222,7 @@ struct gs_index_buffer {
void InitBuffer();
gs_index_buffer(gs_device_t device, enum gs_index_type type,
gs_index_buffer(gs_device_t *device, enum gs_index_type type,
void *indices, size_t num, uint32_t flags);
};
@ -279,7 +279,7 @@ struct gs_texture_2d : gs_texture {
{
}
gs_texture_2d(gs_device_t device, uint32_t width, uint32_t height,
gs_texture_2d(gs_device_t *device, uint32_t width, uint32_t height,
gs_color_format colorFormat, uint32_t levels,
const uint8_t **data, uint32_t flags,
gs_texture_type type, bool gdiCompatible, bool shared);
@ -304,7 +304,7 @@ struct gs_zstencil_buffer {
{
}
gs_zstencil_buffer(gs_device_t device, uint32_t width, uint32_t height,
gs_zstencil_buffer(gs_device_t *device, uint32_t width, uint32_t height,
gs_zstencil_format format);
};
@ -316,16 +316,16 @@ struct gs_stage_surface {
gs_color_format format;
DXGI_FORMAT dxgiFormat;
gs_stage_surface(gs_device_t device, uint32_t width, uint32_t height,
gs_stage_surface(gs_device_t *device, uint32_t width, uint32_t height,
gs_color_format colorFormat);
};
struct gs_sampler_state {
ComPtr<ID3D11SamplerState> state;
gs_device_t device;
gs_device_t *device;
gs_sampler_info info;
gs_sampler_state(gs_device_t device, gs_sampler_info *info);
gs_sampler_state(gs_device_t *device, gs_sampler_info *info);
};
struct gs_shader_param {
@ -357,7 +357,7 @@ struct ShaderError {
};
struct gs_shader {
gs_device_t device;
gs_device_t *device;
gs_shader_type type;
vector<gs_shader_param> params;
ComPtr<ID3D11Buffer> constants;
@ -371,7 +371,7 @@ struct gs_shader {
void Compile(const char *shaderStr, const char *file,
const char *target, ID3D10Blob **shader);
inline gs_shader(gs_device_t device, gs_shader_type type)
inline gs_shader(gs_device_t *device, gs_shader_type type)
: device (device),
type (type),
constantSize (0)
@ -385,7 +385,7 @@ struct ShaderSampler {
string name;
gs_sampler_state sampler;
inline ShaderSampler(const char *name, gs_device_t device,
inline ShaderSampler(const char *name, gs_device_t *device,
gs_sampler_info *info)
: name (name),
sampler (device, info)
@ -416,7 +416,7 @@ struct gs_vertex_shader : gs_shader {
void GetBuffersExpected(const vector<D3D11_INPUT_ELEMENT_DESC> &inputs);
gs_vertex_shader(gs_device_t device, const char *file,
gs_vertex_shader(gs_device_t *device, const char *file,
const char *shaderString);
};
@ -433,7 +433,7 @@ struct gs_pixel_shader : gs_shader {
states[i] = NULL;
}
gs_pixel_shader(gs_device_t device, const char *file,
gs_pixel_shader(gs_device_t *device, const char *file,
const char *shaderString);
};
@ -623,9 +623,10 @@ struct gs_device {
void UpdateRasterState();
void UpdateBlendState();
inline void CopyTex(ID3D11Texture2D *dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t src, uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h);
inline void CopyTex(ID3D11Texture2D *dst,
uint32_t dst_x, uint32_t dst_y,
gs_texture_t *src, uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h);
void UpdateViewProjMatrix();

View File

@ -141,8 +141,8 @@ void gs_texture_2d::InitRenderTargets()
}
}
gs_texture_2d::gs_texture_2d(gs_device_t device, uint32_t width, uint32_t height,
gs_color_format colorFormat, uint32_t levels,
gs_texture_2d::gs_texture_2d(gs_device_t *device, uint32_t width,
uint32_t height, gs_color_format colorFormat, uint32_t levels,
const uint8_t **data, uint32_t flags, gs_texture_type type,
bool gdiCompatible, bool shared)
: gs_texture (device, type, levels, colorFormat),

View File

@ -93,7 +93,7 @@ inline void gs_vertex_buffer::InitBuffer(const size_t elementSize,
throw HRError("Failed to create buffer", hr);
}
gs_vertex_buffer::gs_vertex_buffer(gs_device_t device, struct gs_vb_data *data,
gs_vertex_buffer::gs_vertex_buffer(gs_device_t *device, struct gs_vb_data *data,
uint32_t flags)
: device (device),
vbd (data),

View File

@ -47,7 +47,7 @@ void gs_zstencil_buffer::InitBuffer()
throw HRError("Failed to create depth stencil view", hr);
}
gs_zstencil_buffer::gs_zstencil_buffer(gs_device_t device,
gs_zstencil_buffer::gs_zstencil_buffer(gs_device_t *device,
uint32_t width, uint32_t height,
gs_zstencil_format format)
: device (device),

View File

@ -96,7 +96,7 @@ static NSOpenGLContext *gl_context_create(struct gs_init_data *info)
return context;
}
static bool gl_init_default_swap(struct gl_platform *plat, gs_device_t dev,
static bool gl_init_default_swap(struct gl_platform *plat, gs_device_t *dev,
struct gs_init_data *info)
{
if(!(plat->context = gl_context_create(info)))
@ -109,7 +109,7 @@ static bool gl_init_default_swap(struct gl_platform *plat, gs_device_t dev,
return plat->swap.wi != NULL;
}
struct gl_platform *gl_platform_create(gs_device_t device,
struct gl_platform *gl_platform_create(gs_device_t *device,
struct gs_init_data *info)
{
struct gl_platform *plat = bzalloc(sizeof(struct gl_platform));
@ -186,24 +186,24 @@ void gl_windowinfo_destroy(struct gl_windowinfo *wi)
bfree(wi);
}
void gl_update(gs_device_t device)
void gl_update(gs_device_t *device)
{
[device->plat->context update];
}
void device_enter_context(gs_device_t device)
void device_enter_context(gs_device_t *device)
{
[device->plat->context makeCurrentContext];
}
void device_leave_context(gs_device_t device)
void device_leave_context(gs_device_t *device)
{
UNUSED_PARAMETER(device);
[NSOpenGLContext clearCurrentContext];
}
void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap)
{
if(!swap)
swap = &device->plat->swap;
@ -215,7 +215,7 @@ void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
[device->plat->context setView:swap->wi->view];
}
void device_present(gs_device_t device)
void device_present(gs_device_t *device)
{
[device->plat->context flushBuffer];
}
@ -227,7 +227,7 @@ void gl_getclientsize(struct gs_swap_chain *swap, uint32_t *width,
if(height) *height = swap->info.cy;
}
gs_texture_t device_texture_create_from_iosurface(gs_device_t device,
gs_texture_t *device_texture_create_from_iosurface(gs_device_t *device,
void *iosurf)
{
IOSurfaceRef ref = (IOSurfaceRef)iosurf;
@ -285,15 +285,15 @@ gs_texture_t device_texture_create_from_iosurface(gs_device_t device,
if (!gl_bind_texture(tex->base.gl_target, 0))
goto fail;
return (gs_texture_t)tex;
return (gs_texture_t*)tex;
fail:
gs_texture_destroy((gs_texture_t)tex);
gs_texture_destroy((gs_texture_t*)tex);
blog(LOG_ERROR, "device_texture_create_from_iosurface (GL) failed");
return NULL;
}
bool gs_texture_rebind_iosurface(gs_texture_t texture, void *iosurf)
bool gs_texture_rebind_iosurface(gs_texture_t *texture, void *iosurf)
{
if (!texture)
return false;

View File

@ -33,7 +33,7 @@ static inline bool init_ib(struct gs_index_buffer *ib)
return success;
}
gs_indexbuffer_t device_indexbuffer_create(gs_device_t device,
gs_indexbuffer_t *device_indexbuffer_create(gs_device_t *device,
enum gs_index_type type, void *indices, size_t num,
uint32_t flags)
{
@ -59,7 +59,7 @@ gs_indexbuffer_t device_indexbuffer_create(gs_device_t device,
return ib;
}
void gs_indexbuffer_destroy(gs_indexbuffer_t ib)
void gs_indexbuffer_destroy(gs_indexbuffer_t *ib)
{
if (ib) {
if (ib->buffer)
@ -70,7 +70,7 @@ void gs_indexbuffer_destroy(gs_indexbuffer_t ib)
}
}
void gs_indexbuffer_flush(gs_indexbuffer_t ib)
void gs_indexbuffer_flush(gs_indexbuffer_t *ib)
{
if (!ib->dynamic) {
blog(LOG_ERROR, "Index buffer is not dynamic");
@ -86,22 +86,22 @@ fail:
blog(LOG_ERROR, "gs_indexbuffer_flush (GL) failed");
}
void *gs_indexbuffer_get_data(gs_indexbuffer_t ib)
void *gs_indexbuffer_get_data(gs_indexbuffer_t *ib)
{
return ib->data;
}
size_t gs_indexbuffer_get_num_indices(gs_indexbuffer_t ib)
size_t gs_indexbuffer_get_num_indices(gs_indexbuffer_t *ib)
{
return ib->num;
}
enum gs_index_type gs_indexbuffer_get_type(gs_indexbuffer_t ib)
enum gs_index_type gs_indexbuffer_get_type(gs_indexbuffer_t *ib)
{
return ib->type;
}
void device_load_indexbuffer(gs_device_t device, gs_indexbuffer_t ib)
void device_load_indexbuffer(gs_device_t *device, gs_indexbuffer_t *ib)
{
if (ib == device->cur_index_buffer)
return;

View File

@ -108,7 +108,7 @@ static inline bool gl_add_params(struct gs_shader *shader,
static inline void gl_add_sampler(struct gs_shader *shader,
struct shader_sampler *sampler)
{
gs_samplerstate_t new_sampler;
gs_samplerstate_t *new_sampler;
struct gs_sampler_info info;
shader_sampler_convert(sampler, &info);
@ -236,7 +236,7 @@ static bool gl_shader_init(struct gs_shader *shader,
return success;
}
static struct gs_shader *shader_create(gs_device_t device,
static struct gs_shader *shader_create(gs_device_t *device,
enum gs_shader_type type, const char *shader_str,
const char *file, char **error_string)
{
@ -262,7 +262,7 @@ static struct gs_shader *shader_create(gs_device_t device,
return shader;
}
gs_shader_t device_vertexshader_create(gs_device_t device,
gs_shader_t *device_vertexshader_create(gs_device_t *device,
const char *shader, const char *file,
char **error_string)
{
@ -274,7 +274,7 @@ gs_shader_t device_vertexshader_create(gs_device_t device,
return ptr;
}
gs_shader_t device_pixelshader_create(gs_device_t device,
gs_shader_t *device_pixelshader_create(gs_device_t *device,
const char *shader, const char *file,
char **error_string)
{
@ -309,7 +309,7 @@ static void remove_program_references(struct gs_shader *shader)
}
}
void gs_shader_destroy(gs_shader_t shader)
void gs_shader_destroy(gs_shader_t *shader)
{
size_t i;
@ -338,18 +338,18 @@ void gs_shader_destroy(gs_shader_t shader)
bfree(shader);
}
int gs_shader_get_num_params(gs_shader_t shader)
int gs_shader_get_num_params(gs_shader_t *shader)
{
return (int)shader->params.num;
}
gs_sparam_t gs_shader_get_param_by_idx(gs_shader_t shader, uint32_t param)
gs_sparam_t *gs_shader_get_param_by_idx(gs_shader_t *shader, uint32_t param)
{
assert(param < shader->params.num);
return shader->params.array+param;
}
gs_sparam_t gs_shader_get_param_by_name(gs_shader_t shader, const char *name)
gs_sparam_t *gs_shader_get_param_by_name(gs_shader_t *shader, const char *name)
{
size_t i;
for (i = 0; i < shader->params.num; i++) {
@ -362,40 +362,40 @@ gs_sparam_t gs_shader_get_param_by_name(gs_shader_t shader, const char *name)
return NULL;
}
gs_sparam_t gs_shader_get_viewproj_matrix(gs_shader_t shader)
gs_sparam_t *gs_shader_get_viewproj_matrix(gs_shader_t *shader)
{
return shader->viewproj;
}
gs_sparam_t gs_shader_get_world_matrix(gs_shader_t shader)
gs_sparam_t *gs_shader_get_world_matrix(gs_shader_t *shader)
{
return shader->world;
}
void gs_shader_get_param_info(gs_sparam_t param,
void gs_shader_get_param_info(gs_sparam_t *param,
struct gs_shader_param_info *info)
{
info->type = param->type;
info->name = param->name;
}
void gs_shader_set_bool(gs_sparam_t param, bool val)
void gs_shader_set_bool(gs_sparam_t *param, bool val)
{
int int_val = val;
da_copy_array(param->cur_value, &int_val, sizeof(int_val));
}
void gs_shader_set_float(gs_sparam_t param, float val)
void gs_shader_set_float(gs_sparam_t *param, float val)
{
da_copy_array(param->cur_value, &val, sizeof(val));
}
void gs_shader_set_int(gs_sparam_t param, int val)
void gs_shader_set_int(gs_sparam_t *param, int val)
{
da_copy_array(param->cur_value, &val, sizeof(val));
}
void gs_shader_setmatrix3(gs_sparam_t param, const struct matrix3 *val)
void gs_shader_setmatrix3(gs_sparam_t *param, const struct matrix3 *val)
{
struct matrix4 mat;
matrix4_from_matrix3(&mat, val);
@ -403,27 +403,27 @@ void gs_shader_setmatrix3(gs_sparam_t param, const struct matrix3 *val)
da_copy_array(param->cur_value, &mat, sizeof(mat));
}
void gs_shader_set_matrix4(gs_sparam_t param, const struct matrix4 *val)
void gs_shader_set_matrix4(gs_sparam_t *param, const struct matrix4 *val)
{
da_copy_array(param->cur_value, val, sizeof(*val));
}
void gs_shader_set_vec2(gs_sparam_t param, const struct vec2 *val)
void gs_shader_set_vec2(gs_sparam_t *param, const struct vec2 *val)
{
da_copy_array(param->cur_value, val->ptr, sizeof(*val));
}
void gs_shader_set_vec3(gs_sparam_t param, const struct vec3 *val)
void gs_shader_set_vec3(gs_sparam_t *param, const struct vec3 *val)
{
da_copy_array(param->cur_value, val->ptr, sizeof(*val));
}
void gs_shader_set_vec4(gs_sparam_t param, const struct vec4 *val)
void gs_shader_set_vec4(gs_sparam_t *param, const struct vec4 *val)
{
da_copy_array(param->cur_value, val->ptr, sizeof(*val));
}
void gs_shader_set_texture(gs_sparam_t param, gs_texture_t val)
void gs_shader_set_texture(gs_sparam_t *param, gs_texture_t *val)
{
param->texture = val;
}
@ -681,7 +681,7 @@ void gs_program_destroy(struct gs_program *program)
bfree(program);
}
void gs_shader_set_val(gs_sparam_t param, const void *val, size_t size)
void gs_shader_set_val(gs_sparam_t *param, const void *val, size_t size)
{
int count = param->array_count;
size_t expected_size = 0;
@ -711,12 +711,12 @@ void gs_shader_set_val(gs_sparam_t param, const void *val, size_t size)
}
if (param->type == GS_SHADER_PARAM_TEXTURE)
gs_shader_set_texture(param, *(gs_texture_t*)val);
gs_shader_set_texture(param, *(gs_texture_t**)val);
else
da_copy_array(param->cur_value, val, size);
}
void gs_shader_set_default(gs_sparam_t param)
void gs_shader_set_default(gs_sparam_t *param)
{
gs_shader_set_val(param, param->def_value.array, param->def_value.num);
}

View File

@ -42,7 +42,7 @@ static bool create_pixel_pack_buffer(struct gs_stage_surface *surf)
return success;
}
gs_stagesurf_t device_stagesurface_create(gs_device_t device, uint32_t width,
gs_stagesurf_t *device_stagesurface_create(gs_device_t *device, uint32_t width,
uint32_t height, enum gs_color_format color_format)
{
struct gs_stage_surface *surf;
@ -65,7 +65,7 @@ gs_stagesurf_t device_stagesurface_create(gs_device_t device, uint32_t width,
return surf;
}
void gs_stagesurface_destroy(gs_stagesurf_t stagesurf)
void gs_stagesurface_destroy(gs_stagesurf_t *stagesurf)
{
if (stagesurf) {
if (stagesurf->pack_buffer)
@ -110,8 +110,8 @@ static bool can_stage(struct gs_stage_surface *dst, struct gs_texture_2d *src)
/* Apparently for mac, PBOs won't do an asynchronous transfer unless you use
* FBOs aong with glReadPixels, which is really dumb. */
void device_stage_texture(gs_device_t device, gs_stagesurf_t dst,
gs_texture_t src)
void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst,
gs_texture_t *src)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)src;
struct fbo_info *fbo;
@ -156,8 +156,8 @@ failed:
#else
void device_stage_texture(gs_device_t device, gs_stagesurf_t dst,
gs_texture_t src)
void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst,
gs_texture_t *src)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)src;
if (!can_stage(dst, tex2d))
@ -186,22 +186,22 @@ failed:
#endif
uint32_t gs_stagesurface_get_width(gs_stagesurf_t stagesurf)
uint32_t gs_stagesurface_get_width(gs_stagesurf_t *stagesurf)
{
return stagesurf->width;
}
uint32_t gs_stagesurface_get_height(gs_stagesurf_t stagesurf)
uint32_t gs_stagesurface_get_height(gs_stagesurf_t *stagesurf)
{
return stagesurf->height;
}
enum gs_color_format gs_stagesurface_get_color_format(gs_stagesurf_t stagesurf)
enum gs_color_format gs_stagesurface_get_color_format(gs_stagesurf_t *stagesurf)
{
return stagesurf->format;
}
bool gs_stagesurface_map(gs_stagesurf_t stagesurf, uint8_t **data,
bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data,
uint32_t *linesize)
{
if (!gl_bind_buffer(GL_PIXEL_PACK_BUFFER, stagesurf->pack_buffer))
@ -221,7 +221,7 @@ fail:
return false;
}
void gs_stagesurface_unmap(gs_stagesurf_t stagesurf)
void gs_stagesurface_unmap(gs_stagesurf_t *stagesurf)
{
if (!gl_bind_buffer(GL_PIXEL_PACK_BUFFER, stagesurf->pack_buffer))
return;

View File

@ -191,7 +191,7 @@ const char *device_preprocessor_name(void)
return "_OPENGL";
}
int device_create(gs_device_t *p_device, struct gs_init_data *info)
int device_create(gs_device_t **p_device, struct gs_init_data *info)
{
struct gs_device *device = bzalloc(sizeof(struct gs_device));
int errorcode = GS_ERROR_FAIL;
@ -221,7 +221,7 @@ fail:
return errorcode;
}
void device_destroy(gs_device_t device)
void device_destroy(gs_device_t *device)
{
if (device) {
size_t i;
@ -239,7 +239,7 @@ void device_destroy(gs_device_t device)
}
}
gs_swapchain_t device_swapchain_create(gs_device_t device,
gs_swapchain_t *device_swapchain_create(gs_device_t *device,
struct gs_init_data *info)
{
struct gs_swap_chain *swap = bzalloc(sizeof(struct gs_swap_chain));
@ -262,7 +262,7 @@ gs_swapchain_t device_swapchain_create(gs_device_t device,
return swap;
}
void device_resize(gs_device_t device, uint32_t cx, uint32_t cy)
void device_resize(gs_device_t *device, uint32_t cx, uint32_t cy)
{
/* GL automatically resizes the device, so it doesn't do much */
device->cur_swap->info.cx = cx;
@ -271,23 +271,23 @@ void device_resize(gs_device_t device, uint32_t cx, uint32_t cy)
gl_update(device);
}
void device_get_size(gs_device_t device, uint32_t *cx, uint32_t *cy)
void device_get_size(gs_device_t *device, uint32_t *cx, uint32_t *cy)
{
*cx = device->cur_swap->info.cx;
*cy = device->cur_swap->info.cy;
}
uint32_t device_get_width(gs_device_t device)
uint32_t device_get_width(gs_device_t *device)
{
return device->cur_swap->info.cx;
}
uint32_t device_get_height(gs_device_t device)
uint32_t device_get_height(gs_device_t *device)
{
return device->cur_swap->info.cy;
}
gs_texture_t device_voltexture_create(gs_device_t device, uint32_t width,
gs_texture_t *device_voltexture_create(gs_device_t *device, uint32_t width,
uint32_t height, uint32_t depth,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags)
@ -304,7 +304,7 @@ gs_texture_t device_voltexture_create(gs_device_t device, uint32_t width,
return NULL;
}
gs_samplerstate_t device_samplerstate_create(gs_device_t device,
gs_samplerstate_t *device_samplerstate_create(gs_device_t *device,
struct gs_sampler_info *info)
{
struct gs_sampler_state *sampler;
@ -317,7 +317,7 @@ gs_samplerstate_t device_samplerstate_create(gs_device_t device,
return sampler;
}
enum gs_texture_type device_get_texture_type(gs_texture_t texture)
enum gs_texture_type device_get_texture_type(gs_texture_t *texture)
{
return texture->type;
}
@ -350,7 +350,7 @@ static inline void apply_swizzle(struct gs_texture *tex)
}
}
static bool load_texture_sampler(gs_texture_t tex, gs_samplerstate_t ss)
static bool load_texture_sampler(gs_texture_t *tex, gs_samplerstate_t *ss)
{
bool success = true;
GLint min_filter;
@ -391,7 +391,7 @@ static bool load_texture_sampler(gs_texture_t tex, gs_samplerstate_t ss)
return success;
}
static inline struct gs_shader_param *get_texture_param(gs_device_t device,
static inline struct gs_shader_param *get_texture_param(gs_device_t *device,
int unit)
{
struct gs_shader *shader = device->cur_pixel_shader;
@ -408,7 +408,7 @@ static inline struct gs_shader_param *get_texture_param(gs_device_t device,
return NULL;
}
void device_load_texture(gs_device_t device, gs_texture_t tex, int unit)
void device_load_texture(gs_device_t *device, gs_texture_t *tex, int unit)
{
struct gs_shader_param *param;
struct gs_sampler_state *sampler;
@ -452,7 +452,7 @@ fail:
blog(LOG_ERROR, "device_load_texture (GL) failed");
}
static bool load_sampler_on_textures(gs_device_t device, gs_samplerstate_t ss,
static bool load_sampler_on_textures(gs_device_t *device, gs_samplerstate_t *ss,
int sampler_unit)
{
struct gs_shader *shader = device->cur_pixel_shader;
@ -474,7 +474,7 @@ static bool load_sampler_on_textures(gs_device_t device, gs_samplerstate_t ss,
return true;
}
void device_load_samplerstate(gs_device_t device, gs_samplerstate_t ss,
void device_load_samplerstate(gs_device_t *device, gs_samplerstate_t *ss,
int unit)
{
/* need a pixel shader to properly bind samplers */
@ -495,7 +495,7 @@ void device_load_samplerstate(gs_device_t device, gs_samplerstate_t ss,
return;
}
void device_load_vertexshader(gs_device_t device, gs_shader_t vertshader)
void device_load_vertexshader(gs_device_t *device, gs_shader_t *vertshader)
{
if (device->cur_vertex_shader == vertshader)
return;
@ -525,7 +525,7 @@ static void load_default_pixelshader_samplers(struct gs_device *device,
device->cur_samplers[i] = NULL;
}
void device_load_pixelshader(gs_device_t device, gs_shader_t pixelshader)
void device_load_pixelshader(gs_device_t *device, gs_shader_t *pixelshader)
{
if (device->cur_pixel_shader == pixelshader)
return;
@ -547,7 +547,7 @@ fail:
blog(LOG_ERROR, "device_load_pixelshader (GL) failed");
}
void device_load_default_samplerstate(gs_device_t device, bool b_3d, int unit)
void device_load_default_samplerstate(gs_device_t *device, bool b_3d, int unit)
{
/* TODO */
UNUSED_PARAMETER(device);
@ -555,27 +555,27 @@ void device_load_default_samplerstate(gs_device_t device, bool b_3d, int unit)
UNUSED_PARAMETER(unit);
}
gs_shader_t device_get_vertex_shader(gs_device_t device)
gs_shader_t *device_get_vertex_shader(gs_device_t *device)
{
return device->cur_vertex_shader;
}
gs_shader_t device_get_pixel_shader(gs_device_t device)
gs_shader_t *device_get_pixel_shader(gs_device_t *device)
{
return device->cur_pixel_shader;
}
gs_texture_t device_get_render_target(gs_device_t device)
gs_texture_t *device_get_render_target(gs_device_t *device)
{
return device->cur_render_target;
}
gs_zstencil_t device_get_zstencil_target(gs_device_t device)
gs_zstencil_t *device_get_zstencil_target(gs_device_t *device)
{
return device->cur_zstencil_buffer;
}
static bool get_tex_dimensions(gs_texture_t tex, uint32_t *width,
static bool get_tex_dimensions(gs_texture_t *tex, uint32_t *width,
uint32_t *height)
{
if (tex->type == GS_TEXTURE_2D) {
@ -632,7 +632,7 @@ struct fbo_info *get_fbo(struct gs_device *device,
}
static inline struct fbo_info *get_fbo_by_tex(struct gs_device *device,
gs_texture_t tex)
gs_texture_t *tex)
{
uint32_t width, height;
if (!get_tex_dimensions(tex, &width, &height))
@ -641,7 +641,7 @@ static inline struct fbo_info *get_fbo_by_tex(struct gs_device *device,
return get_fbo(device, width, height, tex->format);
}
static bool set_current_fbo(gs_device_t device, struct fbo_info *fbo)
static bool set_current_fbo(gs_device_t *device, struct fbo_info *fbo)
{
if (device->cur_fbo != fbo) {
GLuint fbo_obj = fbo ? fbo->fbo : 0;
@ -653,7 +653,7 @@ static bool set_current_fbo(gs_device_t device, struct fbo_info *fbo)
return true;
}
static bool attach_rendertarget(struct fbo_info *fbo, gs_texture_t tex,
static bool attach_rendertarget(struct fbo_info *fbo, gs_texture_t *tex,
int side)
{
if (fbo->cur_render_target == tex)
@ -679,7 +679,7 @@ static bool attach_rendertarget(struct fbo_info *fbo, gs_texture_t tex,
return gl_success("glFramebufferTexture2D");
}
static bool attach_zstencil(struct fbo_info *fbo, gs_zstencil_t zs)
static bool attach_zstencil(struct fbo_info *fbo, gs_zstencil_t *zs)
{
GLuint zsbuffer = 0;
GLenum zs_attachment = GL_DEPTH_STENCIL_ATTACHMENT;
@ -702,8 +702,8 @@ static bool attach_zstencil(struct fbo_info *fbo, gs_zstencil_t zs)
return true;
}
static bool set_target(gs_device_t device, gs_texture_t tex, int side,
gs_zstencil_t zs)
static bool set_target(gs_device_t *device, gs_texture_t *tex, int side,
gs_zstencil_t *zs)
{
struct fbo_info *fbo;
@ -733,8 +733,8 @@ static bool set_target(gs_device_t device, gs_texture_t tex, int side,
return true;
}
void device_set_render_target(gs_device_t device, gs_texture_t tex,
gs_zstencil_t zstencil)
void device_set_render_target(gs_device_t *device, gs_texture_t *tex,
gs_zstencil_t *zstencil)
{
if (tex) {
if (tex->type != GS_TEXTURE_2D) {
@ -757,8 +757,8 @@ fail:
blog(LOG_ERROR, "device_set_render_target (GL) failed");
}
void device_set_cube_render_target(gs_device_t device, gs_texture_t cubetex,
int side, gs_zstencil_t zstencil)
void device_set_cube_render_target(gs_device_t *device, gs_texture_t *cubetex,
int side, gs_zstencil_t *zstencil)
{
if (cubetex) {
if (cubetex->type != GS_TEXTURE_CUBE) {
@ -781,9 +781,9 @@ fail:
blog(LOG_ERROR, "device_set_cube_render_target (GL) failed");
}
void device_copy_texture_region(gs_device_t device,
gs_texture_t dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t src, uint32_t src_x, uint32_t src_y,
void device_copy_texture_region(gs_device_t *device,
gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t *src, uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h)
{
struct gs_texture_2d *src2d = (struct gs_texture_2d*)src;
@ -830,17 +830,18 @@ fail:
blog(LOG_ERROR, "device_copy_texture (GL) failed");
}
void device_copy_texture(gs_device_t device, gs_texture_t dst, gs_texture_t src)
void device_copy_texture(gs_device_t *device, gs_texture_t *dst,
gs_texture_t *src)
{
device_copy_texture_region(device, dst, 0, 0, src, 0, 0, 0, 0);
}
void device_begin_scene(gs_device_t device)
void device_begin_scene(gs_device_t *device)
{
clear_textures(device);
}
static inline bool can_render(gs_device_t device)
static inline bool can_render(gs_device_t *device)
{
if (!device->cur_vertex_shader) {
blog(LOG_ERROR, "No vertex shader specified");
@ -898,12 +899,12 @@ static inline struct gs_program *get_shader_program(struct gs_device *device)
return program;
}
void device_draw(gs_device_t device, enum gs_draw_mode draw_mode,
void device_draw(gs_device_t *device, enum gs_draw_mode draw_mode,
uint32_t start_vert, uint32_t num_verts)
{
struct gs_index_buffer *ib = device->cur_index_buffer;
GLenum topology = convert_gs_topology(draw_mode);
gs_effect_t effect = gs_get_effect();
gs_effect_t *effect = gs_get_effect();
struct gs_program *program;
if (!can_render(device))
@ -957,13 +958,13 @@ fail:
blog(LOG_ERROR, "device_draw (GL) failed");
}
void device_end_scene(gs_device_t device)
void device_end_scene(gs_device_t *device)
{
/* does nothing */
UNUSED_PARAMETER(device);
}
void device_clear(gs_device_t device, uint32_t clear_flags,
void device_clear(gs_device_t *device, uint32_t clear_flags,
struct vec4 *color, float depth, uint8_t stencil)
{
GLbitfield gl_flags = 0;
@ -990,14 +991,14 @@ void device_clear(gs_device_t device, uint32_t clear_flags,
UNUSED_PARAMETER(device);
}
void device_flush(gs_device_t device)
void device_flush(gs_device_t *device)
{
glFlush();
UNUSED_PARAMETER(device);
}
void device_set_cull_mode(gs_device_t device, enum gs_cull_mode mode)
void device_set_cull_mode(gs_device_t *device, enum gs_cull_mode mode)
{
if (device->cur_cull_mode == mode)
return;
@ -1015,12 +1016,12 @@ void device_set_cull_mode(gs_device_t device, enum gs_cull_mode mode)
gl_disable(GL_CULL_FACE);
}
enum gs_cull_mode device_get_cull_mode(gs_device_t device)
enum gs_cull_mode device_get_cull_mode(gs_device_t *device)
{
return device->cur_cull_mode;
}
void device_enable_blending(gs_device_t device, bool enable)
void device_enable_blending(gs_device_t *device, bool enable)
{
if (enable)
gl_enable(GL_BLEND);
@ -1030,7 +1031,7 @@ void device_enable_blending(gs_device_t device, bool enable)
UNUSED_PARAMETER(device);
}
void device_enable_depth_test(gs_device_t device, bool enable)
void device_enable_depth_test(gs_device_t *device, bool enable)
{
if (enable)
gl_enable(GL_DEPTH_TEST);
@ -1040,7 +1041,7 @@ void device_enable_depth_test(gs_device_t device, bool enable)
UNUSED_PARAMETER(device);
}
void device_enable_stencil_test(gs_device_t device, bool enable)
void device_enable_stencil_test(gs_device_t *device, bool enable)
{
if (enable)
gl_enable(GL_STENCIL_TEST);
@ -1050,7 +1051,7 @@ void device_enable_stencil_test(gs_device_t device, bool enable)
UNUSED_PARAMETER(device);
}
void device_enable_stencil_write(gs_device_t device, bool enable)
void device_enable_stencil_write(gs_device_t *device, bool enable)
{
if (enable)
glStencilMask(0xFFFFFFFF);
@ -1060,7 +1061,7 @@ void device_enable_stencil_write(gs_device_t device, bool enable)
UNUSED_PARAMETER(device);
}
void device_enable_color(gs_device_t device, bool red, bool green,
void device_enable_color(gs_device_t *device, bool red, bool green,
bool blue, bool alpha)
{
glColorMask(red, green, blue, alpha);
@ -1068,7 +1069,7 @@ void device_enable_color(gs_device_t device, bool red, bool green,
UNUSED_PARAMETER(device);
}
void device_blend_function(gs_device_t device, enum gs_blend_type src,
void device_blend_function(gs_device_t *device, enum gs_blend_type src,
enum gs_blend_type dest)
{
GLenum gl_src = convert_gs_blend_type(src);
@ -1081,7 +1082,7 @@ void device_blend_function(gs_device_t device, enum gs_blend_type src,
UNUSED_PARAMETER(device);
}
void device_depth_function(gs_device_t device, enum gs_depth_test test)
void device_depth_function(gs_device_t *device, enum gs_depth_test test)
{
GLenum gl_test = convert_gs_depth_test(test);
@ -1092,7 +1093,7 @@ void device_depth_function(gs_device_t device, enum gs_depth_test test)
UNUSED_PARAMETER(device);
}
void device_stencil_function(gs_device_t device, enum gs_stencil_side side,
void device_stencil_function(gs_device_t *device, enum gs_stencil_side side,
enum gs_depth_test test)
{
GLenum gl_side = convert_gs_stencil_side(side);
@ -1105,7 +1106,7 @@ void device_stencil_function(gs_device_t device, enum gs_stencil_side side,
UNUSED_PARAMETER(device);
}
void device_stencil_op(gs_device_t device, enum gs_stencil_side side,
void device_stencil_op(gs_device_t *device, enum gs_stencil_side side,
enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail,
enum gs_stencil_op_type zpass)
{
@ -1132,7 +1133,7 @@ static inline uint32_t get_target_height(struct gs_device *device)
return gs_cubetexture_get_size(device->cur_render_target);
}
void device_set_viewport(gs_device_t device, int x, int y, int width,
void device_set_viewport(gs_device_t *device, int x, int y, int width,
int height)
{
uint32_t base_height;
@ -1155,12 +1156,12 @@ void device_set_viewport(gs_device_t device, int x, int y, int width,
device->cur_viewport.cy = height;
}
void device_get_viewport(gs_device_t device, struct gs_rect *rect)
void device_get_viewport(gs_device_t *device, struct gs_rect *rect)
{
*rect = device->cur_viewport;
}
void device_set_scissor_rect(gs_device_t device, struct gs_rect *rect)
void device_set_scissor_rect(gs_device_t *device, struct gs_rect *rect)
{
UNUSED_PARAMETER(device);
@ -1176,7 +1177,7 @@ void device_set_scissor_rect(gs_device_t device, struct gs_rect *rect)
blog(LOG_ERROR, "device_set_scissor_rect (GL) failed");
}
void device_ortho(gs_device_t device, float left, float right,
void device_ortho(gs_device_t *device, float left, float right,
float top, float bottom, float near, float far)
{
struct matrix4 *dst = &device->cur_proj;
@ -1202,7 +1203,7 @@ void device_ortho(gs_device_t device, float left, float right,
dst->t.w = 1.0f;
}
void device_frustum(gs_device_t device, float left, float right,
void device_frustum(gs_device_t *device, float left, float right,
float top, float bottom, float near, float far)
{
struct matrix4 *dst = &device->cur_proj;
@ -1229,12 +1230,12 @@ void device_frustum(gs_device_t device, float left, float right,
dst->z.w = -1.0f;
}
void device_projection_push(gs_device_t device)
void device_projection_push(gs_device_t *device)
{
da_push_back(device->proj_stack, &device->cur_proj);
}
void device_projection_pop(gs_device_t device)
void device_projection_pop(gs_device_t *device)
{
struct matrix4 *end;
if (!device->proj_stack.num)
@ -1245,7 +1246,7 @@ void device_projection_pop(gs_device_t device)
da_pop_back(device->proj_stack);
}
void gs_swapchain_destroy(gs_swapchain_t swapchain)
void gs_swapchain_destroy(gs_swapchain_t *swapchain)
{
if (!swapchain)
return;
@ -1259,41 +1260,41 @@ void gs_swapchain_destroy(gs_swapchain_t swapchain)
bfree(swapchain);
}
void gs_voltexture_destroy(gs_texture_t voltex)
void gs_voltexture_destroy(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
}
uint32_t gs_voltexture_get_width(gs_texture_t voltex)
uint32_t gs_voltexture_get_width(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}
uint32_t gs_voltexture_get_height(gs_texture_t voltex)
uint32_t gs_voltexture_get_height(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}
uint32_t gs_voltexture_getdepth(gs_texture_t voltex)
uint32_t gs_voltexture_getdepth(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}
enum gs_color_format gs_voltexture_get_color_format(gs_texture_t voltex)
enum gs_color_format gs_voltexture_get_color_format(gs_texture_t *voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return GS_UNKNOWN;
}
void gs_samplerstate_destroy(gs_samplerstate_t samplerstate)
void gs_samplerstate_destroy(gs_samplerstate_t *samplerstate)
{
if (!samplerstate)
return;

View File

@ -273,7 +273,7 @@ extern void convert_sampler_info(struct gs_sampler_state *sampler,
struct gs_sampler_info *info);
struct gs_sampler_state {
gs_device_t device;
gs_device_t *device;
volatile long ref;
GLint min_filter;
@ -284,12 +284,12 @@ struct gs_sampler_state {
GLint max_anisotropy;
};
static inline void samplerstate_addref(gs_samplerstate_t ss)
static inline void samplerstate_addref(gs_samplerstate_t *ss)
{
os_atomic_inc_long(&ss->ref);
}
static inline void samplerstate_release(gs_samplerstate_t ss)
static inline void samplerstate_release(gs_samplerstate_t *ss)
{
if (os_atomic_dec_long(&ss->ref) == 0)
bfree(ss);
@ -299,7 +299,7 @@ struct gs_shader_param {
enum gs_shader_param_type type;
char *name;
gs_shader_t shader;
gs_shader_t *shader;
GLint texture_id;
size_t sampler_id;
int array_count;
@ -327,7 +327,7 @@ struct shader_attrib {
};
struct gs_shader {
gs_device_t device;
gs_device_t *device;
enum gs_shader_type type;
GLuint obj;
@ -336,7 +336,7 @@ struct gs_shader {
DARRAY(struct shader_attrib) attribs;
DARRAY(struct gs_shader_param) params;
DARRAY(gs_samplerstate_t) samplers;
DARRAY(gs_samplerstate_t*) samplers;
};
struct program_param {
@ -345,7 +345,7 @@ struct program_param {
};
struct gs_program {
gs_device_t device;
gs_device_t *device;
GLuint obj;
struct gs_shader *vertex_shader;
struct gs_shader *pixel_shader;
@ -370,7 +370,7 @@ struct gs_vertex_buffer {
DARRAY(GLuint) uv_buffers;
DARRAY(size_t) uv_sizes;
gs_device_t device;
gs_device_t *device;
size_t num;
bool dynamic;
struct gs_vb_data *data;
@ -384,7 +384,7 @@ struct gs_index_buffer {
enum gs_index_type type;
GLuint gl_type;
gs_device_t device;
gs_device_t *device;
void *data;
size_t num;
size_t width;
@ -393,7 +393,7 @@ struct gs_index_buffer {
};
struct gs_texture {
gs_device_t device;
gs_device_t *device;
enum gs_texture_type type;
enum gs_color_format format;
GLenum gl_format;
@ -407,7 +407,7 @@ struct gs_texture {
bool is_dummy;
bool gen_mipmaps;
gs_samplerstate_t cur_sampler;
gs_samplerstate_t *cur_sampler;
};
struct gs_texture_2d {
@ -426,7 +426,7 @@ struct gs_texture_cube {
};
struct gs_stage_surface {
gs_device_t device;
gs_device_t *device;
enum gs_color_format format;
uint32_t width;
@ -440,14 +440,14 @@ struct gs_stage_surface {
};
struct gs_zstencil_buffer {
gs_device_t device;
gs_device_t *device;
GLuint buffer;
GLuint attachment;
GLenum format;
};
struct gs_swap_chain {
gs_device_t device;
gs_device_t *device;
struct gl_windowinfo *wi;
struct gs_init_data info;
};
@ -458,9 +458,9 @@ struct fbo_info {
uint32_t height;
enum gs_color_format format;
gs_texture_t cur_render_target;
gs_texture_t *cur_render_target;
int cur_render_side;
gs_zstencil_t cur_zstencil_buffer;
gs_zstencil_t *cur_zstencil_buffer;
};
static inline void fbo_info_destroy(struct fbo_info *fbo)
@ -477,16 +477,16 @@ struct gs_device {
struct gl_platform *plat;
enum copy_type copy_type;
gs_texture_t cur_render_target;
gs_zstencil_t cur_zstencil_buffer;
gs_texture_t *cur_render_target;
gs_zstencil_t *cur_zstencil_buffer;
int cur_render_side;
gs_texture_t cur_textures[GS_MAX_TEXTURES];
gs_samplerstate_t cur_samplers[GS_MAX_TEXTURES];
gs_vertbuffer_t cur_vertex_buffer;
gs_indexbuffer_t cur_index_buffer;
gs_shader_t cur_vertex_shader;
gs_shader_t cur_pixel_shader;
gs_swapchain_t cur_swap;
gs_texture_t *cur_textures[GS_MAX_TEXTURES];
gs_samplerstate_t *cur_samplers[GS_MAX_TEXTURES];
gs_vertbuffer_t *cur_vertex_buffer;
gs_indexbuffer_t *cur_index_buffer;
gs_shader_t *cur_vertex_shader;
gs_shader_t *cur_pixel_shader;
gs_swapchain_t *cur_swap;
struct gs_program *cur_program;
struct gs_program *first_program;
@ -507,9 +507,9 @@ struct gs_device {
extern struct fbo_info *get_fbo(struct gs_device *device,
uint32_t width, uint32_t height, enum gs_color_format format);
extern void gl_update(gs_device_t device);
extern void gl_update(gs_device_t *device);
extern struct gl_platform *gl_platform_create(gs_device_t device,
extern struct gl_platform *gl_platform_create(gs_device_t *device,
struct gs_init_data *info);
extern struct gs_swap_chain *gl_platform_getswap(struct gl_platform *platform);
extern void gl_platform_destroy(struct gl_platform *platform);

View File

@ -74,7 +74,7 @@ static bool create_pixel_unpack_buffer(struct gs_texture_2d *tex)
return success;
}
gs_texture_t device_texture_create(gs_device_t device, uint32_t width,
gs_texture_t *device_texture_create(gs_device_t *device, uint32_t width,
uint32_t height, enum gs_color_format color_format,
uint32_t levels, const uint8_t **data, uint32_t flags)
{
@ -104,15 +104,15 @@ gs_texture_t device_texture_create(gs_device_t device, uint32_t width,
goto fail;
}
return (gs_texture_t)tex;
return (gs_texture_t*)tex;
fail:
gs_texture_destroy((gs_texture_t)tex);
gs_texture_destroy((gs_texture_t*)tex);
blog(LOG_ERROR, "device_texture_create (GL) failed");
return NULL;
}
static inline bool is_texture_2d(gs_texture_t tex, const char *func)
static inline bool is_texture_2d(gs_texture_t *tex, const char *func)
{
bool is_tex2d = tex->type == GS_TEXTURE_2D;
if (!is_tex2d)
@ -120,7 +120,7 @@ static inline bool is_texture_2d(gs_texture_t tex, const char *func)
return is_tex2d;
}
void gs_texture_destroy(gs_texture_t tex)
void gs_texture_destroy(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!tex)
@ -141,7 +141,7 @@ void gs_texture_destroy(gs_texture_t tex)
bfree(tex);
}
uint32_t gs_texture_get_width(gs_texture_t tex)
uint32_t gs_texture_get_width(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!is_texture_2d(tex, "gs_texture_get_width"))
@ -150,7 +150,7 @@ uint32_t gs_texture_get_width(gs_texture_t tex)
return tex2d->width;
}
uint32_t gs_texture_get_height(gs_texture_t tex)
uint32_t gs_texture_get_height(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!is_texture_2d(tex, "gs_texture_get_height"))
@ -159,12 +159,12 @@ uint32_t gs_texture_get_height(gs_texture_t tex)
return tex2d->height;
}
enum gs_color_format gs_texture_get_color_format(gs_texture_t tex)
enum gs_color_format gs_texture_get_color_format(gs_texture_t *tex)
{
return tex->format;
}
bool gs_texture_map(gs_texture_t tex, uint8_t **ptr, uint32_t *linesize)
bool gs_texture_map(gs_texture_t *tex, uint8_t **ptr, uint32_t *linesize)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
@ -194,7 +194,7 @@ fail:
return false;
}
void gs_texture_unmap(gs_texture_t tex)
void gs_texture_unmap(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!is_texture_2d(tex, "gs_texture_unmap"))
@ -226,7 +226,7 @@ failed:
blog(LOG_ERROR, "gs_texture_unmap (GL) failed");
}
bool gs_texture_is_rect(gs_texture_t tex)
bool gs_texture_is_rect(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!is_texture_2d(tex, "gs_texture_unmap")) {
@ -237,7 +237,7 @@ bool gs_texture_is_rect(gs_texture_t tex)
return tex2d->base.gl_target == GL_TEXTURE_RECTANGLE;
}
void *gs_texture_get_obj(gs_texture_t tex)
void *gs_texture_get_obj(gs_texture_t *tex)
{
struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex;
if (!is_texture_2d(tex, "gs_texture_unmap")) {

View File

@ -58,7 +58,7 @@ static inline bool upload_texture_cube(struct gs_texture_cube *tex,
return success;
}
gs_texture_t device_cubetexture_create(gs_device_t device, uint32_t size,
gs_texture_t *device_cubetexture_create(gs_device_t *device, uint32_t size,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags)
{
@ -79,15 +79,15 @@ gs_texture_t device_cubetexture_create(gs_device_t device, uint32_t size,
if (!upload_texture_cube(tex, data))
goto fail;
return (gs_texture_t)tex;
return (gs_texture_t*)tex;
fail:
gs_cubetexture_destroy((gs_texture_t)tex);
gs_cubetexture_destroy((gs_texture_t*)tex);
blog(LOG_ERROR, "device_cubetexture_create (GL) failed");
return NULL;
}
void gs_cubetexture_destroy(gs_texture_t tex)
void gs_cubetexture_destroy(gs_texture_t *tex)
{
if (!tex)
return;
@ -100,7 +100,7 @@ void gs_cubetexture_destroy(gs_texture_t tex)
bfree(tex);
}
static inline bool is_texture_cube(gs_texture_t tex, const char *func)
static inline bool is_texture_cube(gs_texture_t *tex, const char *func)
{
bool is_texcube = tex->type == GS_TEXTURE_CUBE;
if (!is_texcube)
@ -108,7 +108,7 @@ static inline bool is_texture_cube(gs_texture_t tex, const char *func)
return is_texcube;
}
uint32_t gs_cubetexture_get_size(gs_texture_t cubetex)
uint32_t gs_cubetexture_get_size(gs_texture_t *cubetex)
{
struct gs_texture_cube *cube = (struct gs_texture_cube*)cubetex;
if (!is_texture_cube(cubetex, "gs_cubetexture_get_size"))
@ -117,7 +117,7 @@ uint32_t gs_cubetexture_get_size(gs_texture_t cubetex)
return cube->size;
}
enum gs_color_format gs_cubetexture_get_color_format(gs_texture_t cubetex)
enum gs_color_format gs_cubetexture_get_color_format(gs_texture_t *cubetex)
{
return cubetex->format;
}

View File

@ -76,7 +76,7 @@ static bool create_buffers(struct gs_vertex_buffer *vb)
return true;
}
gs_vertbuffer_t device_vertexbuffer_create(gs_device_t device,
gs_vertbuffer_t *device_vertexbuffer_create(gs_device_t *device,
struct gs_vb_data *data, uint32_t flags)
{
struct gs_vertex_buffer *vb = bzalloc(sizeof(struct gs_vertex_buffer));
@ -94,7 +94,7 @@ gs_vertbuffer_t device_vertexbuffer_create(gs_device_t device,
return vb;
}
void gs_vertexbuffer_destroy(gs_vertbuffer_t vb)
void gs_vertexbuffer_destroy(gs_vertbuffer_t *vb)
{
if (vb) {
if (vb->vertex_buffer)
@ -120,7 +120,7 @@ void gs_vertexbuffer_destroy(gs_vertbuffer_t vb)
}
}
void gs_vertexbuffer_flush(gs_vertbuffer_t vb)
void gs_vertexbuffer_flush(gs_vertbuffer_t *vb)
{
size_t i;
@ -170,7 +170,7 @@ failed:
blog(LOG_ERROR, "gs_vertexbuffer_flush (GL) failed");
}
struct gs_vb_data *gs_vertexbuffer_get_data(gs_vertbuffer_t vb)
struct gs_vb_data *gs_vertexbuffer_get_data(gs_vertbuffer_t *vb)
{
return vb->data;
}
@ -251,7 +251,7 @@ bool load_vb_buffers(struct gs_program *program, struct gs_vertex_buffer *vb)
return true;
}
void device_load_vertexbuffer(gs_device_t device, gs_vertbuffer_t vb)
void device_load_vertexbuffer(gs_device_t *device, gs_vertbuffer_t *vb)
{
device->cur_vertex_buffer = vb;
}

View File

@ -350,7 +350,7 @@ static struct gl_windowinfo *gl_windowinfo_bare(struct gs_init_data *info)
return wi;
}
static bool init_default_swap(struct gl_platform *plat, gs_device_t device,
static bool init_default_swap(struct gl_platform *plat, gs_device_t *device,
int pixel_format, PIXELFORMATDESCRIPTOR *pfd,
struct gs_init_data *info)
{
@ -366,13 +366,13 @@ static bool init_default_swap(struct gl_platform *plat, gs_device_t device,
return true;
}
void gl_update(gs_device_t device)
void gl_update(gs_device_t *device)
{
/* does nothing on windows */
UNUSED_PARAMETER(device);
}
struct gl_platform *gl_platform_create(gs_device_t device,
struct gl_platform *gl_platform_create(gs_device_t *device,
struct gs_init_data *info)
{
struct gl_platform *plat = bzalloc(sizeof(struct gl_platform));
@ -475,7 +475,7 @@ void gl_windowinfo_destroy(struct gl_windowinfo *wi)
}
}
void device_enter_context(gs_device_t device)
void device_enter_context(gs_device_t *device)
{
HDC hdc = device->plat->swap.wi->hdc;
if (device->cur_swap)
@ -485,13 +485,13 @@ void device_enter_context(gs_device_t device)
blog(LOG_ERROR, "device_load_swapchain (GL) failed");
}
void device_leave_context(gs_device_t device)
void device_leave_context(gs_device_t *device)
{
wglMakeCurrent(NULL, NULL);
UNUSED_PARAMETER(device);
}
void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap)
{
HDC hdc;
if (!swap)
@ -510,7 +510,7 @@ void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
}
}
void device_present(gs_device_t device)
void device_present(gs_device_t *device)
{
if (!SwapBuffers(device->cur_swap->wi->hdc)) {
blog(LOG_ERROR, "SwapBuffers failed, GetLastError "

View File

@ -135,7 +135,7 @@ static bool handle_x_error(Display *disp, const char *error_string)
return false;
}
struct gl_platform *gl_platform_create(gs_device_t device,
struct gl_platform *gl_platform_create(gs_device_t *device,
struct gs_init_data *info)
{
int num_configs = 0;
@ -366,7 +366,7 @@ void gl_platform_cleanup_swapchain(struct gs_swap_chain *swap)
info->int_id = 0;
}
void device_enter_context(gs_device_t device)
void device_enter_context(gs_device_t *device)
{
GLXContext context = device->plat->context;
XID window = device->cur_swap->wi->glxid;
@ -377,7 +377,7 @@ void device_enter_context(gs_device_t device)
}
}
void device_leave_context(gs_device_t device)
void device_leave_context(gs_device_t *device)
{
Display *display = device->cur_swap->wi->display;
@ -386,7 +386,7 @@ void device_leave_context(gs_device_t device)
}
}
void gl_update(gs_device_t device)
void gl_update(gs_device_t *device)
{
Display *display = device->cur_swap->wi->display;
XID window = device->cur_swap->wi->int_id;
@ -395,7 +395,7 @@ void gl_update(gs_device_t device)
device->cur_swap->info.cx, device->cur_swap->info.cy);
}
void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap)
{
if (!swap)
swap = &device->plat->swap;
@ -414,7 +414,7 @@ void device_load_swapchain(gs_device_t device, gs_swapchain_t swap)
}
}
void device_present(gs_device_t device)
void device_present(gs_device_t *device)
{
Display *display = device->cur_swap->wi->display;
XID window = device->cur_swap->wi->glxid;

View File

@ -48,7 +48,7 @@ static inline GLenum get_attachment(enum gs_zstencil_format format)
return 0;
}
gs_zstencil_t device_zstencil_create(gs_device_t device, uint32_t width,
gs_zstencil_t *device_zstencil_create(gs_device_t *device, uint32_t width,
uint32_t height, enum gs_zstencil_format format)
{
struct gs_zstencil_buffer *zs;
@ -67,7 +67,7 @@ gs_zstencil_t device_zstencil_create(gs_device_t device, uint32_t width,
return zs;
}
void gs_zstencil_destroy(gs_zstencil_t zs)
void gs_zstencil_destroy(gs_zstencil_t *zs)
{
if (zs) {
if (zs->buffer) {

View File

@ -63,7 +63,7 @@ static inline const char *cd_serialize_string(uint8_t **pos)
return (size != 0) ? str : NULL;
}
static bool cd_getparam(calldata_t data, const char *name,
static bool cd_getparam(calldata_t *data, const char *name,
uint8_t **pos)
{
size_t name_size;
@ -114,7 +114,7 @@ static inline void cd_copy_data(uint8_t **pos, const void *in, size_t size)
}
}
static inline void cd_set_first_param(calldata_t data, const char *name,
static inline void cd_set_first_param(calldata_t *data, const char *name,
const void *in, size_t size)
{
uint8_t *pos;
@ -136,7 +136,7 @@ static inline void cd_set_first_param(calldata_t data, const char *name,
*(size_t*)pos = 0;
}
static inline void cd_ensure_capacity(calldata_t data, uint8_t **pos,
static inline void cd_ensure_capacity(calldata_t *data, uint8_t **pos,
size_t new_size)
{
size_t offset;
@ -159,7 +159,7 @@ static inline void cd_ensure_capacity(calldata_t data, uint8_t **pos,
/* ------------------------------------------------------------------------- */
bool calldata_get_data(calldata_t data, const char *name, void *out,
bool calldata_get_data(calldata_t *data, const char *name, void *out,
size_t size)
{
uint8_t *pos;
@ -179,7 +179,7 @@ bool calldata_get_data(calldata_t data, const char *name, void *out,
return true;
}
void calldata_set_data(calldata_t data, const char *name, const void *in,
void calldata_set_data(calldata_t *data, const char *name, const void *in,
size_t size)
{
uint8_t *pos = NULL;
@ -225,7 +225,7 @@ void calldata_set_data(calldata_t data, const char *name, const void *in,
}
}
bool calldata_get_string(calldata_t data, const char *name, const char **str)
bool calldata_get_string(calldata_t *data, const char *name, const char **str)
{
uint8_t *pos;
if (!data || !name || !*name)

View File

@ -49,7 +49,7 @@ struct calldata {
uint8_t *stack;
};
typedef struct calldata *calldata_t;
typedef struct calldata calldata_t;
static inline void calldata_init(struct calldata *data)
{
@ -61,10 +61,10 @@ static inline void calldata_free(struct calldata *data)
bfree(data->stack);
}
EXPORT bool calldata_get_data(calldata_t data, const char *name, void *out,
EXPORT bool calldata_get_data(calldata_t *data, const char *name, void *out,
size_t size);
EXPORT void calldata_set_data(calldata_t data, const char *name, const void *in,
size_t new_size);
EXPORT void calldata_set_data(calldata_t *data, const char *name,
const void *in, size_t new_size);
static inline void calldata_clear(struct calldata *data)
{
@ -78,65 +78,65 @@ static inline void calldata_clear(struct calldata *data)
/* NOTE: 'get' functions return true only if paramter exists, and is the
* same type. They return false otherwise. */
static inline bool calldata_get_int(calldata_t data, const char *name,
static inline bool calldata_get_int(calldata_t *data, const char *name,
long long *val)
{
return calldata_get_data(data, name, val, sizeof(*val));
}
static inline bool calldata_get_float (calldata_t data, const char *name,
static inline bool calldata_get_float (calldata_t *data, const char *name,
double *val)
{
return calldata_get_data(data, name, val, sizeof(*val));
}
static inline bool calldata_get_bool (calldata_t data, const char *name,
static inline bool calldata_get_bool (calldata_t *data, const char *name,
bool *val)
{
return calldata_get_data(data, name, val, sizeof(*val));
}
static inline bool calldata_get_ptr (calldata_t data, const char *name,
static inline bool calldata_get_ptr (calldata_t *data, const char *name,
void *p_ptr)
{
return calldata_get_data(data, name, p_ptr, sizeof(p_ptr));
}
EXPORT bool calldata_get_string(calldata_t data, const char *name,
EXPORT bool calldata_get_string(calldata_t *data, const char *name,
const char **str);
/* ------------------------------------------------------------------------- */
/* call if you know your data is valid */
static inline long long calldata_int(calldata_t data, const char *name)
static inline long long calldata_int(calldata_t *data, const char *name)
{
long long val = 0;
calldata_get_int(data, name, &val);
return val;
}
static inline double calldata_float(calldata_t data, const char *name)
static inline double calldata_float(calldata_t *data, const char *name)
{
double val = 0.0;
calldata_get_float(data, name, &val);
return val;
}
static inline bool calldata_bool(calldata_t data, const char *name)
static inline bool calldata_bool(calldata_t *data, const char *name)
{
bool val = false;
calldata_get_bool(data, name, &val);
return val;
}
static inline void *calldata_ptr(calldata_t data, const char *name)
static inline void *calldata_ptr(calldata_t *data, const char *name)
{
void *val;
calldata_get_ptr(data, name, &val);
return val;
}
static inline const char *calldata_string(calldata_t data, const char *name)
static inline const char *calldata_string(calldata_t *data, const char *name)
{
const char *val;
calldata_get_string(data, name, &val);
@ -145,31 +145,31 @@ static inline const char *calldata_string(calldata_t data, const char *name)
/* ------------------------------------------------------------------------- */
static inline void calldata_set_int (calldata_t data, const char *name,
static inline void calldata_set_int (calldata_t *data, const char *name,
long long val)
{
calldata_set_data(data, name, &val, sizeof(val));
}
static inline void calldata_set_float (calldata_t data, const char *name,
static inline void calldata_set_float (calldata_t *data, const char *name,
double val)
{
calldata_set_data(data, name, &val, sizeof(val));
}
static inline void calldata_set_bool (calldata_t data, const char *name,
static inline void calldata_set_bool (calldata_t *data, const char *name,
bool val)
{
calldata_set_data(data, name, &val, sizeof(val));
}
static inline void calldata_set_ptr (calldata_t data, const char *name,
static inline void calldata_set_ptr (calldata_t *data, const char *name,
void *ptr)
{
calldata_set_data(data, name, &ptr, sizeof(ptr));
}
static inline void calldata_set_string(calldata_t data, const char *name,
static inline void calldata_set_string(calldata_t *data, const char *name,
const char *str)
{
if (str)

View File

@ -35,14 +35,14 @@ struct proc_handler {
DARRAY(struct proc_info) procs;
};
proc_handler_t proc_handler_create(void)
proc_handler_t *proc_handler_create(void)
{
struct proc_handler *handler = bmalloc(sizeof(struct proc_handler));
da_init(handler->procs);
return handler;
}
void proc_handler_destroy(proc_handler_t handler)
void proc_handler_destroy(proc_handler_t *handler)
{
if (handler) {
for (size_t i = 0; i < handler->procs.num; i++)
@ -52,7 +52,7 @@ void proc_handler_destroy(proc_handler_t handler)
}
}
void proc_handler_add(proc_handler_t handler, const char *decl_string,
void proc_handler_add(proc_handler_t *handler, const char *decl_string,
proc_handler_proc_t proc, void *data)
{
if (!handler) return;
@ -72,8 +72,8 @@ void proc_handler_add(proc_handler_t handler, const char *decl_string,
da_push_back(handler->procs, &pi);
}
bool proc_handler_call(proc_handler_t handler, const char *name,
calldata_t params)
bool proc_handler_call(proc_handler_t *handler, const char *name,
calldata_t *params)
{
if (!handler) return false;

View File

@ -33,21 +33,21 @@ extern "C" {
*/
struct proc_handler;
typedef struct proc_handler *proc_handler_t;
typedef void (*proc_handler_proc_t)(void*, calldata_t);
typedef struct proc_handler proc_handler_t;
typedef void (*proc_handler_proc_t)(void*, calldata_t*);
EXPORT proc_handler_t proc_handler_create(void);
EXPORT void proc_handler_destroy(proc_handler_t handler);
EXPORT proc_handler_t *proc_handler_create(void);
EXPORT void proc_handler_destroy(proc_handler_t *handler);
EXPORT void proc_handler_add(proc_handler_t handler, const char *decl_string,
EXPORT void proc_handler_add(proc_handler_t *handler, const char *decl_string,
proc_handler_proc_t proc, void *data);
/**
* Calls a function in a procedure handler. Returns false if the named
* procedure is not found.
*/
EXPORT bool proc_handler_call(proc_handler_t handler, const char *name,
calldata_t params);
EXPORT bool proc_handler_call(proc_handler_t *handler, const char *name,
calldata_t *params);
#ifdef __cplusplus
}

View File

@ -91,7 +91,7 @@ struct signal_handler {
pthread_mutex_t mutex;
};
static struct signal_info *getsignal(signal_handler_t handler,
static struct signal_info *getsignal(signal_handler_t *handler,
const char *name, struct signal_info **p_last)
{
struct signal_info *signal, *last= NULL;
@ -112,7 +112,7 @@ static struct signal_info *getsignal(signal_handler_t handler,
/* ------------------------------------------------------------------------- */
signal_handler_t signal_handler_create(void)
signal_handler_t *signal_handler_create(void)
{
struct signal_handler *handler = bmalloc(sizeof(struct signal_handler));
handler->first = NULL;
@ -126,7 +126,7 @@ signal_handler_t signal_handler_create(void)
return handler;
}
void signal_handler_destroy(signal_handler_t handler)
void signal_handler_destroy(signal_handler_t *handler)
{
if (handler) {
struct signal_info *sig = handler->first;
@ -141,7 +141,7 @@ void signal_handler_destroy(signal_handler_t handler)
}
}
bool signal_handler_add(signal_handler_t handler, const char *signal_decl)
bool signal_handler_add(signal_handler_t *handler, const char *signal_decl)
{
struct decl_info func = {0};
struct signal_info *sig, *last;
@ -172,7 +172,7 @@ bool signal_handler_add(signal_handler_t handler, const char *signal_decl)
return success;
}
void signal_handler_connect(signal_handler_t handler, const char *signal,
void signal_handler_connect(signal_handler_t *handler, const char *signal,
signal_callback_t callback, void *data)
{
struct signal_info *sig, *last;
@ -203,7 +203,7 @@ void signal_handler_connect(signal_handler_t handler, const char *signal,
pthread_mutex_unlock(&sig->mutex);
}
static inline struct signal_info *getsignal_locked(signal_handler_t handler,
static inline struct signal_info *getsignal_locked(signal_handler_t *handler,
const char *name)
{
struct signal_info *sig;
@ -218,7 +218,7 @@ static inline struct signal_info *getsignal_locked(signal_handler_t handler,
return sig;
}
void signal_handler_disconnect(signal_handler_t handler, const char *signal,
void signal_handler_disconnect(signal_handler_t *handler, const char *signal,
signal_callback_t callback, void *data)
{
struct signal_info *sig = getsignal_locked(handler, signal);
@ -240,8 +240,8 @@ void signal_handler_disconnect(signal_handler_t handler, const char *signal,
pthread_mutex_unlock(&sig->mutex);
}
void signal_handler_signal(signal_handler_t handler, const char *signal,
calldata_t params)
void signal_handler_signal(signal_handler_t *handler, const char *signal,
calldata_t *params)
{
struct signal_info *sig = getsignal_locked(handler, signal);

View File

@ -32,16 +32,16 @@ extern "C" {
*/
struct signal_handler;
typedef struct signal_handler *signal_handler_t;
typedef void (*signal_callback_t)(void*, calldata_t);
typedef struct signal_handler signal_handler_t;
typedef void (*signal_callback_t)(void*, calldata_t*);
EXPORT signal_handler_t signal_handler_create(void);
EXPORT void signal_handler_destroy(signal_handler_t handler);
EXPORT signal_handler_t *signal_handler_create(void);
EXPORT void signal_handler_destroy(signal_handler_t *handler);
EXPORT bool signal_handler_add(signal_handler_t handler,
EXPORT bool signal_handler_add(signal_handler_t *handler,
const char *signal_decl);
static inline bool signal_handler_add_array(signal_handler_t handler,
static inline bool signal_handler_add_array(signal_handler_t *handler,
const char **signal_decls)
{
bool success = true;
@ -55,13 +55,13 @@ static inline bool signal_handler_add_array(signal_handler_t handler,
return success;
}
EXPORT void signal_handler_connect(signal_handler_t handler, const char *signal,
signal_callback_t callback, void *data);
EXPORT void signal_handler_disconnect(signal_handler_t handler,
EXPORT void signal_handler_connect(signal_handler_t *handler,
const char *signal, signal_callback_t callback, void *data);
EXPORT void signal_handler_disconnect(signal_handler_t *handler,
const char *signal, signal_callback_t callback, void *data);
EXPORT void signal_handler_signal(signal_handler_t handler, const char *signal,
calldata_t params);
EXPORT void signal_handler_signal(signal_handler_t *handler, const char *signal,
calldata_t *params);
#ifdef __cplusplus
}

View File

@ -26,118 +26,121 @@ extern "C" {
EXPORT const char *device_get_name(void);
EXPORT int device_get_type(void);
EXPORT const char *device_preprocessor_name(void);
EXPORT int device_create(gs_device_t *device, struct gs_init_data *data);
EXPORT void device_destroy(gs_device_t device);
EXPORT void device_enter_context(gs_device_t device);
EXPORT void device_leave_context(gs_device_t device);
EXPORT gs_swapchain_t device_swapchain_create(gs_device_t device,
EXPORT int device_create(gs_device_t **device, struct gs_init_data *data);
EXPORT void device_destroy(gs_device_t *device);
EXPORT void device_enter_context(gs_device_t *device);
EXPORT void device_leave_context(gs_device_t *device);
EXPORT gs_swapchain_t *device_swapchain_create(gs_device_t *device,
struct gs_init_data *data);
EXPORT void device_resize(gs_device_t device, uint32_t x, uint32_t y);
EXPORT void device_get_size(gs_device_t device, uint32_t *x, uint32_t *y);
EXPORT uint32_t device_get_width(gs_device_t device);
EXPORT uint32_t device_get_height(gs_device_t device);
EXPORT gs_texture_t device_texture_create(gs_device_t device, uint32_t width,
EXPORT void device_resize(gs_device_t *device, uint32_t x, uint32_t y);
EXPORT void device_get_size(gs_device_t *device, uint32_t *x, uint32_t *y);
EXPORT uint32_t device_get_width(gs_device_t *device);
EXPORT uint32_t device_get_height(gs_device_t *device);
EXPORT gs_texture_t *device_texture_create(gs_device_t *device, uint32_t width,
uint32_t height, enum gs_color_format color_format,
uint32_t levels, const uint8_t **data, uint32_t flags);
EXPORT gs_texture_t device_cubetexture_create(gs_device_t device, uint32_t size,
EXPORT gs_texture_t *device_cubetexture_create(gs_device_t *device,
uint32_t size, enum gs_color_format color_format,
uint32_t levels, const uint8_t **data, uint32_t flags);
EXPORT gs_texture_t *device_voltexture_create(gs_device_t *device,
uint32_t width, uint32_t height, uint32_t depth,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags);
EXPORT gs_texture_t device_voltexture_create(gs_device_t device, uint32_t width,
uint32_t height, uint32_t depth,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags);
EXPORT gs_zstencil_t device_zstencil_create(gs_device_t device, uint32_t width,
uint32_t height, enum gs_zstencil_format format);
EXPORT gs_stagesurf_t device_stagesurface_create(gs_device_t device,
EXPORT gs_zstencil_t *device_zstencil_create(gs_device_t *device,
uint32_t width, uint32_t height,
enum gs_zstencil_format format);
EXPORT gs_stagesurf_t *device_stagesurface_create(gs_device_t *device,
uint32_t width, uint32_t height,
enum gs_color_format color_format);
EXPORT gs_samplerstate_t device_samplerstate_create(gs_device_t device,
EXPORT gs_samplerstate_t *device_samplerstate_create(gs_device_t *device,
struct gs_sampler_info *info);
EXPORT gs_shader_t device_vertexshader_create(gs_device_t device,
EXPORT gs_shader_t *device_vertexshader_create(gs_device_t *device,
const char *shader, const char *file,
char **error_string);
EXPORT gs_shader_t device_pixelshader_create(gs_device_t device,
EXPORT gs_shader_t *device_pixelshader_create(gs_device_t *device,
const char *shader, const char *file,
char **error_string);
EXPORT gs_vertbuffer_t device_vertexbuffer_create(gs_device_t device,
EXPORT gs_vertbuffer_t *device_vertexbuffer_create(gs_device_t *device,
struct gs_vb_data *data, uint32_t flags);
EXPORT gs_indexbuffer_t device_indexbuffer_create(gs_device_t device,
EXPORT gs_indexbuffer_t *device_indexbuffer_create(gs_device_t *device,
enum gs_index_type type, void *indices, size_t num,
uint32_t flags);
EXPORT enum gs_texture_type device_get_texture_type(gs_texture_t texture);
EXPORT void device_load_vertexbuffer(gs_device_t device,
gs_vertbuffer_t vertbuffer);
EXPORT void device_load_indexbuffer(gs_device_t device,
gs_indexbuffer_t indexbuffer);
EXPORT void device_load_texture(gs_device_t device, gs_texture_t tex, int unit);
EXPORT void device_load_samplerstate(gs_device_t device,
gs_samplerstate_t samplerstate, int unit);
EXPORT void device_load_vertexshader(gs_device_t device,
gs_shader_t vertshader);
EXPORT void device_load_pixelshader(gs_device_t device,
gs_shader_t pixelshader);
EXPORT void device_load_default_samplerstate(gs_device_t device, bool b_3d,
EXPORT enum gs_texture_type device_get_texture_type(gs_texture_t *texture);
EXPORT void device_load_vertexbuffer(gs_device_t *device,
gs_vertbuffer_t *vertbuffer);
EXPORT void device_load_indexbuffer(gs_device_t *device,
gs_indexbuffer_t *indexbuffer);
EXPORT void device_load_texture(gs_device_t *device, gs_texture_t *tex,
int unit);
EXPORT gs_shader_t device_get_vertex_shader(gs_device_t device);
EXPORT gs_shader_t device_get_pixel_shader(gs_device_t device);
EXPORT gs_texture_t device_get_render_target(gs_device_t device);
EXPORT gs_zstencil_t device_get_zstencil_target(gs_device_t device);
EXPORT void device_set_render_target(gs_device_t device, gs_texture_t tex,
gs_zstencil_t zstencil);
EXPORT void device_set_cube_render_target(gs_device_t device,
gs_texture_t cubetex,
int side, gs_zstencil_t zstencil);
EXPORT void device_copy_texture(gs_device_t device, gs_texture_t dst,
gs_texture_t src);
EXPORT void device_copy_texture_region(gs_device_t device,
gs_texture_t dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t src, uint32_t src_x, uint32_t src_y,
EXPORT void device_load_samplerstate(gs_device_t *device,
gs_samplerstate_t *samplerstate, int unit);
EXPORT void device_load_vertexshader(gs_device_t *device,
gs_shader_t *vertshader);
EXPORT void device_load_pixelshader(gs_device_t *device,
gs_shader_t *pixelshader);
EXPORT void device_load_default_samplerstate(gs_device_t *device, bool b_3d,
int unit);
EXPORT gs_shader_t *device_get_vertex_shader(gs_device_t *device);
EXPORT gs_shader_t *device_get_pixel_shader(gs_device_t *device);
EXPORT gs_texture_t *device_get_render_target(gs_device_t *device);
EXPORT gs_zstencil_t *device_get_zstencil_target(gs_device_t *device);
EXPORT void device_set_render_target(gs_device_t *device, gs_texture_t *tex,
gs_zstencil_t *zstencil);
EXPORT void device_set_cube_render_target(gs_device_t *device,
gs_texture_t *cubetex,
int side, gs_zstencil_t *zstencil);
EXPORT void device_copy_texture(gs_device_t *device, gs_texture_t *dst,
gs_texture_t *src);
EXPORT void device_copy_texture_region(gs_device_t *device,
gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t *src, uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h);
EXPORT void device_stage_texture(gs_device_t device, gs_stagesurf_t dst,
gs_texture_t src);
EXPORT void device_begin_scene(gs_device_t device);
EXPORT void device_draw(gs_device_t device, enum gs_draw_mode draw_mode,
EXPORT void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst,
gs_texture_t *src);
EXPORT void device_begin_scene(gs_device_t *device);
EXPORT void device_draw(gs_device_t *device, enum gs_draw_mode draw_mode,
uint32_t start_vert, uint32_t num_verts);
EXPORT void device_end_scene(gs_device_t device);
EXPORT void device_load_swapchain(gs_device_t device, gs_swapchain_t swapchain);
EXPORT void device_clear(gs_device_t device, uint32_t clear_flags,
EXPORT void device_end_scene(gs_device_t *device);
EXPORT void device_load_swapchain(gs_device_t *device,
gs_swapchain_t *swapchain);
EXPORT void device_clear(gs_device_t *device, uint32_t clear_flags,
struct vec4 *color, float depth, uint8_t stencil);
EXPORT void device_present(gs_device_t device);
EXPORT void device_flush(gs_device_t device);
EXPORT void device_set_cull_mode(gs_device_t device, enum gs_cull_mode mode);
EXPORT enum gs_cull_mode device_get_cull_mode(gs_device_t device);
EXPORT void device_enable_blending(gs_device_t device, bool enable);
EXPORT void device_enable_depth_test(gs_device_t device, bool enable);
EXPORT void device_enable_stencil_test(gs_device_t device, bool enable);
EXPORT void device_enable_stencil_write(gs_device_t device, bool enable);
EXPORT void device_enable_color(gs_device_t device, bool red, bool green,
EXPORT void device_present(gs_device_t *device);
EXPORT void device_flush(gs_device_t *device);
EXPORT void device_set_cull_mode(gs_device_t *device, enum gs_cull_mode mode);
EXPORT enum gs_cull_mode device_get_cull_mode(gs_device_t *device);
EXPORT void device_enable_blending(gs_device_t *device, bool enable);
EXPORT void device_enable_depth_test(gs_device_t *device, bool enable);
EXPORT void device_enable_stencil_test(gs_device_t *device, bool enable);
EXPORT void device_enable_stencil_write(gs_device_t *device, bool enable);
EXPORT void device_enable_color(gs_device_t *device, bool red, bool green,
bool blue, bool alpha);
EXPORT void device_blend_function(gs_device_t device, enum gs_blend_type src,
EXPORT void device_blend_function(gs_device_t *device, enum gs_blend_type src,
enum gs_blend_type dest);
EXPORT void device_depth_function(gs_device_t device, enum gs_depth_test test);
EXPORT void device_stencil_function(gs_device_t device,
EXPORT void device_depth_function(gs_device_t *device, enum gs_depth_test test);
EXPORT void device_stencil_function(gs_device_t *device,
enum gs_stencil_side side, enum gs_depth_test test);
EXPORT void device_stencil_op(gs_device_t device, enum gs_stencil_side side,
EXPORT void device_stencil_op(gs_device_t *device, enum gs_stencil_side side,
enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail,
enum gs_stencil_op_type zpass);
EXPORT void device_enable_fullscreen(gs_device_t device, bool enable);
EXPORT int device_fullscreen_enabled(gs_device_t device);
EXPORT void device_setdisplaymode(gs_device_t device,
EXPORT void device_enable_fullscreen(gs_device_t *device, bool enable);
EXPORT int device_fullscreen_enabled(gs_device_t *device);
EXPORT void device_setdisplaymode(gs_device_t *device,
const struct gs_display_mode *mode);
EXPORT void device_getdisplaymode(gs_device_t device,
EXPORT void device_getdisplaymode(gs_device_t *device,
struct gs_display_mode *mode);
EXPORT void device_setcolorramp(gs_device_t device, float gamma,
EXPORT void device_setcolorramp(gs_device_t *device, float gamma,
float brightness, float contrast);
EXPORT void device_set_viewport(gs_device_t device, int x, int y, int width,
EXPORT void device_set_viewport(gs_device_t *device, int x, int y, int width,
int height);
EXPORT void device_get_viewport(gs_device_t device, struct gs_rect *rect);
EXPORT void device_set_scissor_rect(gs_device_t device, struct gs_rect *rect);
EXPORT void device_ortho(gs_device_t device, float left, float right,
EXPORT void device_get_viewport(gs_device_t *device, struct gs_rect *rect);
EXPORT void device_set_scissor_rect(gs_device_t *device, struct gs_rect *rect);
EXPORT void device_ortho(gs_device_t *device, float left, float right,
float top, float bottom, float znear, float zfar);
EXPORT void device_frustum(gs_device_t device, float left, float right,
EXPORT void device_frustum(gs_device_t *device, float left, float right,
float top, float bottom, float znear, float zfar);
EXPORT void device_projection_push(gs_device_t device);
EXPORT void device_projection_pop(gs_device_t device);
EXPORT void device_projection_push(gs_device_t *device);
EXPORT void device_projection_pop(gs_device_t *device);
#ifdef __cplusplus
}

View File

@ -919,7 +919,7 @@ static bool ep_compile(struct effect_parser *ep);
extern const char *gs_preprocessor_name(void);
bool ep_parse(struct effect_parser *ep, gs_effect_t effect,
bool ep_parse(struct effect_parser *ep, gs_effect_t *effect,
const char *effect_string, const char *file)
{
bool success;
@ -1320,7 +1320,7 @@ static void ep_compile_param(struct effect_parser *ep, size_t idx)
static bool ep_compile_pass_shaderparams(struct effect_parser *ep,
struct darray *pass_params, struct darray *used_params,
gs_shader_t shader)
gs_shader_t *shader)
{
size_t i;
darray_resize(sizeof(struct pass_shaderparam), pass_params,
@ -1357,7 +1357,7 @@ static inline bool ep_compile_pass_shader(struct effect_parser *ep,
struct dstr location;
struct darray used_params; /* struct dstr */
struct darray *pass_params = NULL; /* struct pass_shaderparam */
gs_shader_t shader = NULL;
gs_shader_t *shader = NULL;
bool success = true;
dstr_init(&shader_str);

View File

@ -243,7 +243,7 @@ static inline void ep_func_free(struct ep_func *epf)
/* ------------------------------------------------------------------------- */
struct effect_parser {
gs_effect_t effect;
gs_effect_t *effect;
DARRAY(struct ep_param) params;
DARRAY(struct ep_struct) structs;
@ -275,7 +275,7 @@ static inline void ep_init(struct effect_parser *ep)
extern void ep_free(struct effect_parser *ep);
extern bool ep_parse(struct effect_parser *ep, gs_effect_t effect,
extern bool ep_parse(struct effect_parser *ep, gs_effect_t *effect,
const char *effect_string, const char *file);
#ifdef __cplusplus

View File

@ -21,7 +21,7 @@
#include "vec3.h"
#include "vec4.h"
void gs_effect_destroy(gs_effect_t effect)
void gs_effect_destroy(gs_effect_t *effect)
{
if (effect) {
effect_free(effect);
@ -29,7 +29,7 @@ void gs_effect_destroy(gs_effect_t effect)
}
}
gs_technique_t gs_effect_get_technique(gs_effect_t effect, const char *name)
gs_technique_t *gs_effect_get_technique(gs_effect_t *effect, const char *name)
{
if (!effect) return NULL;
@ -42,7 +42,7 @@ gs_technique_t gs_effect_get_technique(gs_effect_t effect, const char *name)
return NULL;
}
size_t gs_technique_begin(gs_technique_t tech)
size_t gs_technique_begin(gs_technique_t *tech)
{
if (!tech) return 0;
@ -52,7 +52,7 @@ size_t gs_technique_begin(gs_technique_t tech)
return tech->passes.num;
}
void gs_technique_end(gs_technique_t tech)
void gs_technique_end(gs_technique_t *tech)
{
if (!tech) return;
@ -91,7 +91,7 @@ static void upload_shader_params(struct darray *pass_params, bool changed_only)
for (i = 0; i < pass_params->num; i++) {
struct pass_shaderparam *param = params+i;
struct gs_effect_param *eparam = param->eparam;
gs_sparam_t sparam = param->sparam;
gs_sparam_t *sparam = param->sparam;
if (changed_only && !eparam->changed)
continue;
@ -125,13 +125,13 @@ static inline void upload_parameters(struct gs_effect *effect,
reset_params(pshader_params);
}
void gs_effect_update_params(gs_effect_t effect)
void gs_effect_update_params(gs_effect_t *effect)
{
if (effect)
upload_parameters(effect, true);
}
bool gs_technique_begin_pass(gs_technique_t tech, size_t idx)
bool gs_technique_begin_pass(gs_technique_t *tech, size_t idx)
{
struct gs_effect_pass *passes;
struct gs_effect_pass *cur_pass;
@ -150,7 +150,7 @@ bool gs_technique_begin_pass(gs_technique_t tech, size_t idx)
return true;
}
bool gs_technique_begin_pass_by_name(gs_technique_t tech,
bool gs_technique_begin_pass_by_name(gs_technique_t *tech,
const char *name)
{
if (!tech)
@ -181,7 +181,7 @@ static inline void clear_tex_params(struct darray *in_params)
}
}
void gs_technique_end_pass(gs_technique_t tech)
void gs_technique_end_pass(gs_technique_t *tech)
{
if (!tech) return;
@ -194,12 +194,12 @@ void gs_technique_end_pass(gs_technique_t tech)
tech->effect->cur_pass = NULL;
}
size_t gs_effect_get_num_params(gs_effect_t effect)
size_t gs_effect_get_num_params(gs_effect_t *effect)
{
return effect ? effect->params.num : 0;
}
gs_eparam_t gs_effect_get_param_by_idx(gs_effect_t effect, size_t param)
gs_eparam_t *gs_effect_get_param_by_idx(gs_effect_t *effect, size_t param)
{
if (!effect) return NULL;
@ -210,7 +210,7 @@ gs_eparam_t gs_effect_get_param_by_idx(gs_effect_t effect, size_t param)
return params+param;
}
gs_eparam_t gs_effect_get_param_by_name(gs_effect_t effect, const char *name)
gs_eparam_t *gs_effect_get_param_by_name(gs_effect_t *effect, const char *name)
{
if (!effect) return NULL;
@ -226,17 +226,17 @@ gs_eparam_t gs_effect_get_param_by_name(gs_effect_t effect, const char *name)
return NULL;
}
gs_eparam_t gs_effect_get_viewproj_matrix(gs_effect_t effect)
gs_eparam_t *gs_effect_get_viewproj_matrix(gs_effect_t *effect)
{
return effect ? effect->view_proj : NULL;
}
gs_eparam_t gs_effect_get_world_matrix(gs_effect_t effect)
gs_eparam_t *gs_effect_get_world_matrix(gs_effect_t *effect)
{
return effect ? effect->world : NULL;
}
void gs_effect_get_param_info(gs_eparam_t param,
void gs_effect_get_param_info(gs_eparam_t *param,
struct gs_effect_param_info *info)
{
if (!param)
@ -246,7 +246,7 @@ void gs_effect_get_param_info(gs_eparam_t param,
info->type = param->type;
}
static inline void effect_setval_inline(gs_eparam_t param,
static inline void effect_setval_inline(gs_eparam_t *param,
const void *data, size_t size)
{
bool size_changed;
@ -272,52 +272,52 @@ static inline void effect_setval_inline(gs_eparam_t param,
}
}
void gs_effect_set_bool(gs_eparam_t param, bool val)
void gs_effect_set_bool(gs_eparam_t *param, bool val)
{
effect_setval_inline(param, &val, sizeof(bool));
}
void gs_effect_set_float(gs_eparam_t param, float val)
void gs_effect_set_float(gs_eparam_t *param, float val)
{
effect_setval_inline(param, &val, sizeof(float));
}
void gs_effect_set_int(gs_eparam_t param, int val)
void gs_effect_set_int(gs_eparam_t *param, int val)
{
effect_setval_inline(param, &val, sizeof(int));
}
void gs_effect_set_matrix4(gs_eparam_t param, const struct matrix4 *val)
void gs_effect_set_matrix4(gs_eparam_t *param, const struct matrix4 *val)
{
effect_setval_inline(param, val, sizeof(struct matrix4));
}
void gs_effect_set_vec2(gs_eparam_t param, const struct vec2 *val)
void gs_effect_set_vec2(gs_eparam_t *param, const struct vec2 *val)
{
effect_setval_inline(param, val, sizeof(struct vec2));
}
void gs_effect_set_vec3(gs_eparam_t param, const struct vec3 *val)
void gs_effect_set_vec3(gs_eparam_t *param, const struct vec3 *val)
{
effect_setval_inline(param, val, sizeof(float) * 3);
}
void gs_effect_set_vec4(gs_eparam_t param, const struct vec4 *val)
void gs_effect_set_vec4(gs_eparam_t *param, const struct vec4 *val)
{
effect_setval_inline(param, val, sizeof(struct vec4));
}
void gs_effect_set_texture(gs_eparam_t param, gs_texture_t val)
void gs_effect_set_texture(gs_eparam_t *param, gs_texture_t *val)
{
effect_setval_inline(param, &val, sizeof(gs_texture_t));
effect_setval_inline(param, &val, sizeof(gs_texture_t*));
}
void gs_effect_set_val(gs_eparam_t param, const void *val, size_t size)
void gs_effect_set_val(gs_eparam_t *param, const void *val, size_t size)
{
effect_setval_inline(param, val, size);
}
void gs_effect_set_default(gs_eparam_t param)
void gs_effect_set_default(gs_eparam_t *param)
{
effect_setval_inline(param, param->default_val.array,
param->default_val.num);

View File

@ -56,7 +56,7 @@ struct gs_effect_param {
DARRAY(uint8_t) cur_val;
DARRAY(uint8_t) default_val;
gs_effect_t effect;
gs_effect_t *effect;
/*char *full_name;
float scroller_min, scroller_max, scroller_inc, scroller_mul;*/
@ -75,22 +75,22 @@ static inline void effect_param_free(struct gs_effect_param *param)
da_free(param->default_val);
}
EXPORT void effect_param_parse_property(gs_eparam_t param,
EXPORT void effect_param_parse_property(gs_eparam_t *param,
const char *property);
/* ------------------------------------------------------------------------- */
struct pass_shaderparam {
struct gs_effect_param *eparam;
gs_sparam_t sparam;
gs_sparam_t *sparam;
};
struct gs_effect_pass {
char *name;
enum effect_section section;
gs_shader_t vertshader;
gs_shader_t pixelshader;
gs_shader_t *vertshader;
gs_shader_t *pixelshader;
DARRAY(struct pass_shaderparam) vertshader_params;
DARRAY(struct pass_shaderparam) pixelshader_params;
};
@ -145,16 +145,16 @@ struct gs_effect {
struct gs_effect_technique *cur_technique;
struct gs_effect_pass *cur_pass;
gs_eparam_t view_proj, world, scale;
graphics_t graphics;
gs_eparam_t *view_proj, *world, *scale;
graphics_t *graphics;
};
static inline void effect_init(gs_effect_t effect)
static inline void effect_init(gs_effect_t *effect)
{
memset(effect, 0, sizeof(struct gs_effect));
}
static inline void effect_free(gs_effect_t effect)
static inline void effect_free(gs_effect_t *effect)
{
size_t i;
for (i = 0; i < effect->params.num; i++)
@ -171,9 +171,10 @@ static inline void effect_free(gs_effect_t effect)
effect->effect_dir = NULL;
}
EXPORT void effect_upload_params(gs_effect_t effect, bool changed_only);
EXPORT void effect_upload_shader_params(gs_effect_t effect, gs_shader_t shader,
struct darray *pass_params, bool changed_only);
EXPORT void effect_upload_params(gs_effect_t *effect, bool changed_only);
EXPORT void effect_upload_shader_params(gs_effect_t *effect,
gs_shader_t *shader, struct darray *pass_params,
bool changed_only);
#ifdef __cplusplus
}

View File

@ -201,10 +201,10 @@ static inline enum gs_color_format convert_format(enum AVPixelFormat format)
return GS_BGRX;
}
gs_texture_t gs_texture_create_from_file(const char *file)
gs_texture_t *gs_texture_create_from_file(const char *file)
{
struct ffmpeg_image image;
gs_texture_t tex = NULL;
gs_texture_t *tex = NULL;
if (ffmpeg_image_init(&image, file)) {
uint8_t *data = malloc(image.cx * image.cy * 4);

View File

@ -27,205 +27,207 @@ struct gs_exports {
const char *(*device_get_name)(void);
int (*device_get_type)(void);
const char *(*device_preprocessor_name)(void);
int (*device_create)(gs_device_t *device, struct gs_init_data *data);
void (*device_destroy)(gs_device_t device);
void (*device_enter_context)(gs_device_t device);
void (*device_leave_context)(gs_device_t device);
gs_swapchain_t (*device_swapchain_create)(gs_device_t device,
int (*device_create)(gs_device_t **device, struct gs_init_data *data);
void (*device_destroy)(gs_device_t *device);
void (*device_enter_context)(gs_device_t *device);
void (*device_leave_context)(gs_device_t *device);
gs_swapchain_t *(*device_swapchain_create)(gs_device_t *device,
struct gs_init_data *data);
void (*device_resize)(gs_device_t device, uint32_t x, uint32_t y);
void (*device_get_size)(gs_device_t device, uint32_t *x, uint32_t *y);
uint32_t (*device_get_width)(gs_device_t device);
uint32_t (*device_get_height)(gs_device_t device);
gs_texture_t (*device_texture_create)(gs_device_t device,
void (*device_resize)(gs_device_t *device, uint32_t x, uint32_t y);
void (*device_get_size)(gs_device_t *device, uint32_t *x, uint32_t *y);
uint32_t (*device_get_width)(gs_device_t *device);
uint32_t (*device_get_height)(gs_device_t *device);
gs_texture_t *(*device_texture_create)(gs_device_t *device,
uint32_t width, uint32_t height,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags);
gs_texture_t (*device_cubetexture_create)(gs_device_t device,
gs_texture_t *(*device_cubetexture_create)(gs_device_t *device,
uint32_t size, enum gs_color_format color_format,
uint32_t levels, const uint8_t **data, uint32_t flags);
gs_texture_t (*device_voltexture_create)(gs_device_t device,
gs_texture_t *(*device_voltexture_create)(gs_device_t *device,
uint32_t width, uint32_t height, uint32_t depth,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags);
gs_zstencil_t (*device_zstencil_create)(gs_device_t device,
gs_zstencil_t *(*device_zstencil_create)(gs_device_t *device,
uint32_t width, uint32_t height,
enum gs_zstencil_format format);
gs_stagesurf_t (*device_stagesurface_create)(gs_device_t device,
gs_stagesurf_t *(*device_stagesurface_create)(gs_device_t *device,
uint32_t width, uint32_t height,
enum gs_color_format color_format);
gs_samplerstate_t (*device_samplerstate_create)(gs_device_t device,
gs_samplerstate_t *(*device_samplerstate_create)(gs_device_t *device,
struct gs_sampler_info *info);
gs_shader_t (*device_vertexshader_create)(gs_device_t device,
gs_shader_t *(*device_vertexshader_create)(gs_device_t *device,
const char *shader, const char *file,
char **error_string);
gs_shader_t (*device_pixelshader_create)(gs_device_t device,
gs_shader_t *(*device_pixelshader_create)(gs_device_t *device,
const char *shader, const char *file,
char **error_string);
gs_vertbuffer_t (*device_vertexbuffer_create)(gs_device_t device,
gs_vertbuffer_t *(*device_vertexbuffer_create)(gs_device_t *device,
struct gs_vb_data *data, uint32_t flags);
gs_indexbuffer_t (*device_indexbuffer_create)(gs_device_t device,
gs_indexbuffer_t *(*device_indexbuffer_create)(gs_device_t *device,
enum gs_index_type type, void *indices, size_t num,
uint32_t flags);
enum gs_texture_type (*device_get_texture_type)(gs_texture_t texture);
void (*device_load_vertexbuffer)(gs_device_t device,
gs_vertbuffer_t vertbuffer);
void (*device_load_indexbuffer)(gs_device_t device,
gs_indexbuffer_t indexbuffer);
void (*device_load_texture)(gs_device_t device, gs_texture_t tex,
enum gs_texture_type (*device_get_texture_type)(gs_texture_t *texture);
void (*device_load_vertexbuffer)(gs_device_t *device,
gs_vertbuffer_t *vertbuffer);
void (*device_load_indexbuffer)(gs_device_t *device,
gs_indexbuffer_t *indexbuffer);
void (*device_load_texture)(gs_device_t *device, gs_texture_t *tex,
int unit);
void (*device_load_samplerstate)(gs_device_t device,
gs_samplerstate_t samplerstate, int unit);
void (*device_load_vertexshader)(gs_device_t device,
gs_shader_t vertshader);
void (*device_load_pixelshader)(gs_device_t device,
gs_shader_t pixelshader);
void (*device_load_default_samplerstate)(gs_device_t device,
void (*device_load_samplerstate)(gs_device_t *device,
gs_samplerstate_t *samplerstate, int unit);
void (*device_load_vertexshader)(gs_device_t *device,
gs_shader_t *vertshader);
void (*device_load_pixelshader)(gs_device_t *device,
gs_shader_t *pixelshader);
void (*device_load_default_samplerstate)(gs_device_t *device,
bool b_3d, int unit);
gs_shader_t (*device_get_vertex_shader)(gs_device_t device);
gs_shader_t (*device_get_pixel_shader)(gs_device_t device);
gs_texture_t (*device_get_render_target)(gs_device_t device);
gs_zstencil_t (*device_get_zstencil_target)(gs_device_t device);
void (*device_set_render_target)(gs_device_t device, gs_texture_t tex,
gs_zstencil_t zstencil);
void (*device_set_cube_render_target)(gs_device_t device,
gs_texture_t cubetex, int side, gs_zstencil_t zstencil);
void (*device_copy_texture)(gs_device_t device, gs_texture_t dst,
gs_texture_t src);
void (*device_copy_texture_region)(gs_device_t device,
gs_texture_t dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t src, uint32_t src_x, uint32_t src_y,
gs_shader_t *(*device_get_vertex_shader)(gs_device_t *device);
gs_shader_t *(*device_get_pixel_shader)(gs_device_t *device);
gs_texture_t *(*device_get_render_target)(gs_device_t *device);
gs_zstencil_t *(*device_get_zstencil_target)(gs_device_t *device);
void (*device_set_render_target)(gs_device_t *device, gs_texture_t *tex,
gs_zstencil_t *zstencil);
void (*device_set_cube_render_target)(gs_device_t *device,
gs_texture_t *cubetex, int side, gs_zstencil_t *zstencil);
void (*device_copy_texture)(gs_device_t *device, gs_texture_t *dst,
gs_texture_t *src);
void (*device_copy_texture_region)(gs_device_t *device,
gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t *src, uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h);
void (*device_stage_texture)(gs_device_t device, gs_stagesurf_t dst,
gs_texture_t src);
void (*device_begin_scene)(gs_device_t device);
void (*device_draw)(gs_device_t device, enum gs_draw_mode draw_mode,
void (*device_stage_texture)(gs_device_t *device, gs_stagesurf_t *dst,
gs_texture_t *src);
void (*device_begin_scene)(gs_device_t *device);
void (*device_draw)(gs_device_t *device, enum gs_draw_mode draw_mode,
uint32_t start_vert, uint32_t num_verts);
void (*device_end_scene)(gs_device_t device);
void (*device_load_swapchain)(gs_device_t device,
gs_swapchain_t swaphchain);
void (*device_clear)(gs_device_t device, uint32_t clear_flags,
void (*device_end_scene)(gs_device_t *device);
void (*device_load_swapchain)(gs_device_t *device,
gs_swapchain_t *swaphchain);
void (*device_clear)(gs_device_t *device, uint32_t clear_flags,
struct vec4 *color, float depth, uint8_t stencil);
void (*device_present)(gs_device_t device);
void (*device_flush)(gs_device_t device);
void (*device_set_cull_mode)(gs_device_t device,
void (*device_present)(gs_device_t *device);
void (*device_flush)(gs_device_t *device);
void (*device_set_cull_mode)(gs_device_t *device,
enum gs_cull_mode mode);
enum gs_cull_mode (*device_get_cull_mode)(gs_device_t device);
void (*device_enable_blending)(gs_device_t device, bool enable);
void (*device_enable_depth_test)(gs_device_t device, bool enable);
void (*device_enable_stencil_test)(gs_device_t device, bool enable);
void (*device_enable_stencil_write)(gs_device_t device, bool enable);
void (*device_enable_color)(gs_device_t device, bool red, bool green,
enum gs_cull_mode (*device_get_cull_mode)(gs_device_t *device);
void (*device_enable_blending)(gs_device_t *device, bool enable);
void (*device_enable_depth_test)(gs_device_t *device, bool enable);
void (*device_enable_stencil_test)(gs_device_t *device, bool enable);
void (*device_enable_stencil_write)(gs_device_t *device, bool enable);
void (*device_enable_color)(gs_device_t *device, bool red, bool green,
bool blue, bool alpha);
void (*device_blend_function)(gs_device_t device,
void (*device_blend_function)(gs_device_t *device,
enum gs_blend_type src, enum gs_blend_type dest);
void (*device_depth_function)(gs_device_t device,
void (*device_depth_function)(gs_device_t *device,
enum gs_depth_test test);
void (*device_stencil_function)(gs_device_t device,
void (*device_stencil_function)(gs_device_t *device,
enum gs_stencil_side side, enum gs_depth_test test);
void (*device_stencil_op)(gs_device_t device, enum gs_stencil_side side,
void (*device_stencil_op)(gs_device_t *device,
enum gs_stencil_side side,
enum gs_stencil_op_type fail,
enum gs_stencil_op_type zfail,
enum gs_stencil_op_type zpass);
void (*device_set_viewport)(gs_device_t device, int x, int y, int width,
int height);
void (*device_get_viewport)(gs_device_t device, struct gs_rect *rect);
void (*device_set_scissor_rect)(gs_device_t device,
void (*device_set_viewport)(gs_device_t *device, int x, int y,
int width, int height);
void (*device_get_viewport)(gs_device_t *device, struct gs_rect *rect);
void (*device_set_scissor_rect)(gs_device_t *device,
struct gs_rect *rect);
void (*device_ortho)(gs_device_t device, float left, float right,
void (*device_ortho)(gs_device_t *device, float left, float right,
float top, float bottom, float znear, float zfar);
void (*device_frustum)(gs_device_t device, float left, float right,
void (*device_frustum)(gs_device_t *device, float left, float right,
float top, float bottom, float znear, float zfar);
void (*device_projection_push)(gs_device_t device);
void (*device_projection_pop)(gs_device_t device);
void (*device_projection_push)(gs_device_t *device);
void (*device_projection_pop)(gs_device_t *device);
void (*gs_swapchain_destroy)(gs_swapchain_t swapchain);
void (*gs_swapchain_destroy)(gs_swapchain_t *swapchain);
void (*gs_texture_destroy)(gs_texture_t tex);
uint32_t (*gs_texture_get_width)(gs_texture_t tex);
uint32_t (*gs_texture_get_height)(gs_texture_t tex);
enum gs_color_format (*gs_texture_get_color_format)(gs_texture_t tex);
bool (*gs_texture_map)(gs_texture_t tex, uint8_t **ptr,
void (*gs_texture_destroy)(gs_texture_t *tex);
uint32_t (*gs_texture_get_width)(gs_texture_t *tex);
uint32_t (*gs_texture_get_height)(gs_texture_t *tex);
enum gs_color_format (*gs_texture_get_color_format)(gs_texture_t *tex);
bool (*gs_texture_map)(gs_texture_t *tex, uint8_t **ptr,
uint32_t *linesize);
void (*gs_texture_unmap)(gs_texture_t tex);
bool (*gs_texture_is_rect)(gs_texture_t tex);
void *(*gs_texture_get_obj)(gs_texture_t tex);
void (*gs_texture_unmap)(gs_texture_t *tex);
bool (*gs_texture_is_rect)(gs_texture_t *tex);
void *(*gs_texture_get_obj)(gs_texture_t *tex);
void (*gs_cubetexture_destroy)(gs_texture_t cubetex);
uint32_t (*gs_cubetexture_get_size)(gs_texture_t cubetex);
void (*gs_cubetexture_destroy)(gs_texture_t *cubetex);
uint32_t (*gs_cubetexture_get_size)(gs_texture_t *cubetex);
enum gs_color_format (*gs_cubetexture_get_color_format)(
gs_texture_t cubetex);
gs_texture_t *cubetex);
void (*gs_voltexture_destroy)(gs_texture_t voltex);
uint32_t (*gs_voltexture_get_width)(gs_texture_t voltex);
uint32_t (*gs_voltexture_get_height)(gs_texture_t voltex);
uint32_t (*gs_voltexture_getdepth)(gs_texture_t voltex);
void (*gs_voltexture_destroy)(gs_texture_t *voltex);
uint32_t (*gs_voltexture_get_width)(gs_texture_t *voltex);
uint32_t (*gs_voltexture_get_height)(gs_texture_t *voltex);
uint32_t (*gs_voltexture_getdepth)(gs_texture_t *voltex);
enum gs_color_format (*gs_voltexture_get_color_format)(
gs_texture_t voltex);
gs_texture_t *voltex);
void (*gs_stagesurface_destroy)(gs_stagesurf_t stagesurf);
uint32_t (*gs_stagesurface_get_width)(gs_stagesurf_t stagesurf);
uint32_t (*gs_stagesurface_get_height)(gs_stagesurf_t stagesurf);
void (*gs_stagesurface_destroy)(gs_stagesurf_t *stagesurf);
uint32_t (*gs_stagesurface_get_width)(gs_stagesurf_t *stagesurf);
uint32_t (*gs_stagesurface_get_height)(gs_stagesurf_t *stagesurf);
enum gs_color_format (*gs_stagesurface_get_color_format)(
gs_stagesurf_t stagesurf);
bool (*gs_stagesurface_map)(gs_stagesurf_t stagesurf,
gs_stagesurf_t *stagesurf);
bool (*gs_stagesurface_map)(gs_stagesurf_t *stagesurf,
uint8_t **data, uint32_t *linesize);
void (*gs_stagesurface_unmap)(gs_stagesurf_t stagesurf);
void (*gs_stagesurface_unmap)(gs_stagesurf_t *stagesurf);
void (*gs_zstencil_destroy)(gs_zstencil_t zstencil);
void (*gs_zstencil_destroy)(gs_zstencil_t *zstencil);
void (*gs_samplerstate_destroy)(gs_samplerstate_t samplerstate);
void (*gs_samplerstate_destroy)(gs_samplerstate_t *samplerstate);
void (*gs_vertexbuffer_destroy)(gs_vertbuffer_t vertbuffer);
void (*gs_vertexbuffer_flush)(gs_vertbuffer_t vertbuffer);
void (*gs_vertexbuffer_destroy)(gs_vertbuffer_t *vertbuffer);
void (*gs_vertexbuffer_flush)(gs_vertbuffer_t *vertbuffer);
struct gs_vb_data *(*gs_vertexbuffer_get_data)(
gs_vertbuffer_t vertbuffer);
gs_vertbuffer_t *vertbuffer);
void (*gs_indexbuffer_destroy)(gs_indexbuffer_t indexbuffer);
void (*gs_indexbuffer_flush)(gs_indexbuffer_t indexbuffer);
void *(*gs_indexbuffer_get_data)(gs_indexbuffer_t indexbuffer);
size_t (*gs_indexbuffer_get_num_indices)(gs_indexbuffer_t indexbuffer);
void (*gs_indexbuffer_destroy)(gs_indexbuffer_t *indexbuffer);
void (*gs_indexbuffer_flush)(gs_indexbuffer_t *indexbuffer);
void *(*gs_indexbuffer_get_data)(gs_indexbuffer_t *indexbuffer);
size_t (*gs_indexbuffer_get_num_indices)(gs_indexbuffer_t *indexbuffer);
enum gs_index_type (*gs_indexbuffer_get_type)(
gs_indexbuffer_t indexbuffer);
gs_indexbuffer_t *indexbuffer);
void (*gs_shader_destroy)(gs_shader_t shader);
int (*gs_shader_get_num_params)(gs_shader_t shader);
gs_sparam_t (*gs_shader_get_param_by_idx)(gs_shader_t shader,
void (*gs_shader_destroy)(gs_shader_t *shader);
int (*gs_shader_get_num_params)(gs_shader_t *shader);
gs_sparam_t *(*gs_shader_get_param_by_idx)(gs_shader_t *shader,
uint32_t param);
gs_sparam_t (*gs_shader_get_param_by_name)(gs_shader_t shader,
gs_sparam_t *(*gs_shader_get_param_by_name)(gs_shader_t *shader,
const char *name);
gs_sparam_t (*gs_shader_get_viewproj_matrix)(gs_shader_t shader);
gs_sparam_t (*gs_shader_get_world_matrix)(gs_shader_t shader);
void (*gs_shader_get_param_info)(gs_sparam_t param,
gs_sparam_t *(*gs_shader_get_viewproj_matrix)(gs_shader_t *shader);
gs_sparam_t *(*gs_shader_get_world_matrix)(gs_shader_t *shader);
void (*gs_shader_get_param_info)(gs_sparam_t *param,
struct gs_shader_param_info *info);
void (*gs_shader_set_bool)(gs_sparam_t param, bool val);
void (*gs_shader_set_float)(gs_sparam_t param, float val);
void (*gs_shader_set_int)(gs_sparam_t param, int val);
void (*gs_shader_setmatrix3)(gs_sparam_t param,
void (*gs_shader_set_bool)(gs_sparam_t *param, bool val);
void (*gs_shader_set_float)(gs_sparam_t *param, float val);
void (*gs_shader_set_int)(gs_sparam_t *param, int val);
void (*gs_shader_setmatrix3)(gs_sparam_t *param,
const struct matrix3 *val);
void (*gs_shader_set_matrix4)(gs_sparam_t param,
void (*gs_shader_set_matrix4)(gs_sparam_t *param,
const struct matrix4 *val);
void (*gs_shader_set_vec2)(gs_sparam_t param, const struct vec2 *val);
void (*gs_shader_set_vec3)(gs_sparam_t param, const struct vec3 *val);
void (*gs_shader_set_vec4)(gs_sparam_t param, const struct vec4 *val);
void (*gs_shader_set_texture)(gs_sparam_t param, gs_texture_t val);
void (*gs_shader_set_val)(gs_sparam_t param, const void *val,
void (*gs_shader_set_vec2)(gs_sparam_t *param, const struct vec2 *val);
void (*gs_shader_set_vec3)(gs_sparam_t *param, const struct vec3 *val);
void (*gs_shader_set_vec4)(gs_sparam_t *param, const struct vec4 *val);
void (*gs_shader_set_texture)(gs_sparam_t *param, gs_texture_t *val);
void (*gs_shader_set_val)(gs_sparam_t *param, const void *val,
size_t size);
void (*gs_shader_set_default)(gs_sparam_t param);
void (*gs_shader_set_default)(gs_sparam_t *param);
#ifdef __APPLE__
/* OSX/Cocoa specific functions */
gs_texture_t (*device_texture_create_from_iosurface)(gs_device_t dev,
gs_texture_t *(*device_texture_create_from_iosurface)(gs_device_t *dev,
void *iosurf);
bool (*gs_texture_rebind_iosurface)(gs_texture_t *texture,
void *iosurf);
bool (*gs_texture_rebind_iosurface)(gs_texture_t texture, void *iosurf);
#elif _WIN32
bool (*device_gdi_texture_available)(void);
gs_texture_t (*device_texture_create_gdi)(gs_device_t device,
gs_texture_t *(*device_texture_create_gdi)(gs_device_t *device,
uint32_t width, uint32_t height);
void *(*gs_texture_get_dc)(gs_texture_t gdi_tex);
void (*gs_texture_release_dc)(gs_texture_t gdi_tex);
void *(*gs_texture_get_dc)(gs_texture_t *gdi_tex);
void (*gs_texture_release_dc)(gs_texture_t *gdi_tex);
#endif
};
@ -237,7 +239,7 @@ struct blend_state {
struct graphics_subsystem {
void *module;
gs_device_t device;
gs_device_t *device;
struct gs_exports exports;
DARRAY(struct gs_rect) viewport_stack;
@ -248,11 +250,11 @@ struct graphics_subsystem {
struct matrix4 projection;
struct gs_effect *cur_effect;
gs_vertbuffer_t sprite_buffer;
gs_vertbuffer_t *sprite_buffer;
bool using_immediate;
struct gs_vb_data *vbd;
gs_vertbuffer_t immediate_vertbuffer;
gs_vertbuffer_t *immediate_vertbuffer;
DARRAY(struct vec3) verts;
DARRAY(struct vec3) norms;
DARRAY(uint32_t) colors;

View File

@ -14,9 +14,9 @@ void gs_free_image_deps()
MagickCoreTerminus();
}
gs_texture_t gs_texture_create_from_file(const char *file)
gs_texture_t *gs_texture_create_from_file(const char *file)
{
gs_texture_t tex = NULL;
gs_texture_t *tex = NULL;
ImageInfo *info;
ExceptionInfo *exception;
Image *image;

File diff suppressed because it is too large Load Diff

View File

@ -247,21 +247,21 @@ struct gs_effect_param;
struct gs_device;
struct graphics_subsystem;
typedef struct gs_texture *gs_texture_t;
typedef struct gs_stage_surface *gs_stagesurf_t;
typedef struct gs_zstencil_buffer *gs_zstencil_t;
typedef struct gs_vertex_buffer *gs_vertbuffer_t;
typedef struct gs_index_buffer *gs_indexbuffer_t;
typedef struct gs_sampler_state *gs_samplerstate_t;
typedef struct gs_swap_chain *gs_swapchain_t;
typedef struct gs_texture_render *gs_texrender_t;
typedef struct gs_shader *gs_shader_t;
typedef struct gs_shader_param *gs_sparam_t;
typedef struct gs_effect *gs_effect_t;
typedef struct gs_effect_technique *gs_technique_t;
typedef struct gs_effect_param *gs_eparam_t;
typedef struct gs_device *gs_device_t;
typedef struct graphics_subsystem *graphics_t;
typedef struct gs_texture gs_texture_t;
typedef struct gs_stage_surface gs_stagesurf_t;
typedef struct gs_zstencil_buffer gs_zstencil_t;
typedef struct gs_vertex_buffer gs_vertbuffer_t;
typedef struct gs_index_buffer gs_indexbuffer_t;
typedef struct gs_sampler_state gs_samplerstate_t;
typedef struct gs_swap_chain gs_swapchain_t;
typedef struct gs_texture_render gs_texrender_t;
typedef struct gs_shader gs_shader_t;
typedef struct gs_shader_param gs_sparam_t;
typedef struct gs_effect gs_effect_t;
typedef struct gs_effect_technique gs_technique_t;
typedef struct gs_effect_param gs_eparam_t;
typedef struct gs_device gs_device_t;
typedef struct graphics_subsystem graphics_t;
/* ---------------------------------------------------
* shader functions
@ -290,30 +290,30 @@ enum gs_shader_type {
GS_SHADER_PIXEL,
};
EXPORT void gs_shader_destroy(gs_shader_t shader);
EXPORT void gs_shader_destroy(gs_shader_t *shader);
EXPORT int gs_shader_get_num_params(gs_shader_t shader);
EXPORT gs_sparam_t gs_shader_get_param_by_idx(gs_shader_t shader,
EXPORT int gs_shader_get_num_params(gs_shader_t *shader);
EXPORT gs_sparam_t *gs_shader_get_param_by_idx(gs_shader_t *shader,
uint32_t param);
EXPORT gs_sparam_t gs_shader_get_param_by_name(gs_shader_t shader,
EXPORT gs_sparam_t *gs_shader_get_param_by_name(gs_shader_t *shader,
const char *name);
EXPORT gs_sparam_t gs_shader_get_viewproj_matrix(gs_shader_t shader);
EXPORT gs_sparam_t gs_shader_get_world_matrix(gs_shader_t shader);
EXPORT gs_sparam_t *gs_shader_get_viewproj_matrix(gs_shader_t *shader);
EXPORT gs_sparam_t *gs_shader_get_world_matrix(gs_shader_t *shader);
EXPORT void gs_shader_get_param_info(gs_sparam_t param,
EXPORT void gs_shader_get_param_info(gs_sparam_t *param,
struct gs_shader_param_info *info);
EXPORT void gs_shader_set_bool(gs_sparam_t param, bool val);
EXPORT void gs_shader_set_float(gs_sparam_t param, float val);
EXPORT void gs_shader_set_int(gs_sparam_t param, int val);
EXPORT void gs_shader_setmatrix3(gs_sparam_t param, const struct matrix3 *val);
EXPORT void gs_shader_set_matrix4(gs_sparam_t param, const struct matrix4 *val);
EXPORT void gs_shader_set_vec2(gs_sparam_t param, const struct vec2 *val);
EXPORT void gs_shader_set_vec3(gs_sparam_t param, const struct vec3 *val);
EXPORT void gs_shader_set_vec4(gs_sparam_t param, const struct vec4 *val);
EXPORT void gs_shader_set_texture(gs_sparam_t param, gs_texture_t val);
EXPORT void gs_shader_set_val(gs_sparam_t param, const void *val, size_t size);
EXPORT void gs_shader_set_default(gs_sparam_t param);
EXPORT void gs_shader_set_bool(gs_sparam_t *param, bool val);
EXPORT void gs_shader_set_float(gs_sparam_t *param, float val);
EXPORT void gs_shader_set_int(gs_sparam_t *param, int val);
EXPORT void gs_shader_setmatrix3(gs_sparam_t *param, const struct matrix3 *val);
EXPORT void gs_shader_set_matrix4(gs_sparam_t *param, const struct matrix4 *val);
EXPORT void gs_shader_set_vec2(gs_sparam_t *param, const struct vec2 *val);
EXPORT void gs_shader_set_vec3(gs_sparam_t *param, const struct vec3 *val);
EXPORT void gs_shader_set_vec4(gs_sparam_t *param, const struct vec4 *val);
EXPORT void gs_shader_set_texture(gs_sparam_t *param, gs_texture_t *val);
EXPORT void gs_shader_set_val(gs_sparam_t *param, const void *val, size_t size);
EXPORT void gs_shader_set_default(gs_sparam_t *param);
/* ---------------------------------------------------
* effect functions
@ -337,54 +337,55 @@ struct gs_effect_param_info {
float min, max, inc, mul; */
};
EXPORT void gs_effect_destroy(gs_effect_t effect);
EXPORT void gs_effect_destroy(gs_effect_t *effect);
EXPORT gs_technique_t gs_effect_get_technique(gs_effect_t effect,
EXPORT gs_technique_t *gs_effect_get_technique(gs_effect_t *effect,
const char *name);
EXPORT size_t gs_technique_begin(gs_technique_t technique);
EXPORT void gs_technique_end(gs_technique_t technique);
EXPORT bool gs_technique_begin_pass(gs_technique_t technique, size_t pass);
EXPORT bool gs_technique_begin_pass_by_name(gs_technique_t technique,
EXPORT size_t gs_technique_begin(gs_technique_t *technique);
EXPORT void gs_technique_end(gs_technique_t *technique);
EXPORT bool gs_technique_begin_pass(gs_technique_t *technique, size_t pass);
EXPORT bool gs_technique_begin_pass_by_name(gs_technique_t *technique,
const char *name);
EXPORT void gs_technique_end_pass(gs_technique_t technique);
EXPORT void gs_technique_end_pass(gs_technique_t *technique);
EXPORT size_t gs_effect_get_num_params(gs_effect_t effect);
EXPORT gs_eparam_t gs_effect_get_param_by_idx(gs_effect_t effect, size_t param);
EXPORT gs_eparam_t gs_effect_get_param_by_name(gs_effect_t effect,
EXPORT size_t gs_effect_get_num_params(gs_effect_t *effect);
EXPORT gs_eparam_t *gs_effect_get_param_by_idx(gs_effect_t *effect, size_t param);
EXPORT gs_eparam_t *gs_effect_get_param_by_name(gs_effect_t *effect,
const char *name);
/** used internally */
EXPORT void gs_effect_update_params(gs_effect_t effect);
EXPORT void gs_effect_update_params(gs_effect_t *effect);
EXPORT gs_eparam_t gs_effect_get_viewproj_matrix(gs_effect_t effect);
EXPORT gs_eparam_t gs_effect_get_world_matrix(gs_effect_t effect);
EXPORT gs_eparam_t *gs_effect_get_viewproj_matrix(gs_effect_t *effect);
EXPORT gs_eparam_t *gs_effect_get_world_matrix(gs_effect_t *effect);
EXPORT void gs_effect_get_param_info(gs_eparam_t param,
EXPORT void gs_effect_get_param_info(gs_eparam_t *param,
struct gs_effect_param_info *info);
EXPORT void gs_effect_set_bool(gs_eparam_t param, bool val);
EXPORT void gs_effect_set_float(gs_eparam_t param, float val);
EXPORT void gs_effect_set_int(gs_eparam_t param, int val);
EXPORT void gs_effect_set_matrix4(gs_eparam_t param, const struct matrix4 *val);
EXPORT void gs_effect_set_vec2(gs_eparam_t param, const struct vec2 *val);
EXPORT void gs_effect_set_vec3(gs_eparam_t param, const struct vec3 *val);
EXPORT void gs_effect_set_vec4(gs_eparam_t param, const struct vec4 *val);
EXPORT void gs_effect_set_texture(gs_eparam_t param, gs_texture_t val);
EXPORT void gs_effect_set_val(gs_eparam_t param, const void *val, size_t size);
EXPORT void gs_effect_set_default(gs_eparam_t param);
EXPORT void gs_effect_set_bool(gs_eparam_t *param, bool val);
EXPORT void gs_effect_set_float(gs_eparam_t *param, float val);
EXPORT void gs_effect_set_int(gs_eparam_t *param, int val);
EXPORT void gs_effect_set_matrix4(gs_eparam_t *param,
const struct matrix4 *val);
EXPORT void gs_effect_set_vec2(gs_eparam_t *param, const struct vec2 *val);
EXPORT void gs_effect_set_vec3(gs_eparam_t *param, const struct vec3 *val);
EXPORT void gs_effect_set_vec4(gs_eparam_t *param, const struct vec4 *val);
EXPORT void gs_effect_set_texture(gs_eparam_t *param, gs_texture_t *val);
EXPORT void gs_effect_set_val(gs_eparam_t *param, const void *val, size_t size);
EXPORT void gs_effect_set_default(gs_eparam_t *param);
/* ---------------------------------------------------
* texture render helper functions
* --------------------------------------------------- */
EXPORT gs_texrender_t gs_texrender_create(enum gs_color_format format,
EXPORT gs_texrender_t *gs_texrender_create(enum gs_color_format format,
enum gs_zstencil_format zsformat);
EXPORT void gs_texrender_destroy(gs_texrender_t texrender);
EXPORT bool gs_texrender_begin(gs_texrender_t texrender, uint32_t cx,
EXPORT void gs_texrender_destroy(gs_texrender_t *texrender);
EXPORT bool gs_texrender_begin(gs_texrender_t *texrender, uint32_t cx,
uint32_t cy);
EXPORT void gs_texrender_end(gs_texrender_t texrender);
EXPORT void gs_texrender_reset(gs_texrender_t texrender);
EXPORT gs_texture_t gs_texrender_get_texture(gs_texrender_t texrender);
EXPORT void gs_texrender_end(gs_texrender_t *texrender);
EXPORT void gs_texrender_reset(gs_texrender_t *texrender);
EXPORT gs_texture_t *gs_texrender_get_texture(gs_texrender_t *texrender);
/* ---------------------------------------------------
* graphics subsystem
@ -430,13 +431,13 @@ struct gs_init_data {
EXPORT const char *gs_get_device_name(void);
EXPORT int gs_get_device_type(void);
EXPORT int gs_create(graphics_t *graphics, const char *module,
EXPORT int gs_create(graphics_t **graphics, const char *module,
struct gs_init_data *data);
EXPORT void gs_destroy(graphics_t graphics);
EXPORT void gs_destroy(graphics_t *graphics);
EXPORT void gs_enter_context(graphics_t graphics);
EXPORT void gs_enter_context(graphics_t *graphics);
EXPORT void gs_leave_context(void);
EXPORT graphics_t gs_get_context(void);
EXPORT graphics_t *gs_get_context(void);
EXPORT void gs_matrix_push(void);
EXPORT void gs_matrix_pop(void);
@ -455,7 +456,7 @@ EXPORT void gs_matrix_scale3f(float x, float y, float z);
EXPORT void gs_render_start(bool b_new);
EXPORT void gs_render_stop(enum gs_draw_mode mode);
EXPORT gs_vertbuffer_t gs_render_save(void);
EXPORT gs_vertbuffer_t *gs_render_save(void);
EXPORT void gs_vertex2f(float x, float y);
EXPORT void gs_vertex3f(float x, float y, float z);
EXPORT void gs_normal3f(float x, float y, float z);
@ -467,20 +468,20 @@ EXPORT void gs_normal3v(const struct vec3 *v);
EXPORT void gs_color4v(const struct vec4 *v);
EXPORT void gs_texcoord2v(const struct vec2 *v, int unit);
EXPORT input_t gs_get_input(void);
EXPORT gs_effect_t gs_get_effect(void);
EXPORT input_t *gs_get_input(void);
EXPORT gs_effect_t *gs_get_effect(void);
EXPORT gs_effect_t gs_effect_create_from_file(const char *file,
EXPORT gs_effect_t *gs_effect_create_from_file(const char *file,
char **error_string);
EXPORT gs_effect_t gs_effect_create(const char *effect_string,
EXPORT gs_effect_t *gs_effect_create(const char *effect_string,
const char *filename, char **error_string);
EXPORT gs_shader_t gs_vertexshader_create_from_file(const char *file,
EXPORT gs_shader_t *gs_vertexshader_create_from_file(const char *file,
char **error_string);
EXPORT gs_shader_t gs_pixelshader_create_from_file(const char *file,
EXPORT gs_shader_t *gs_pixelshader_create_from_file(const char *file,
char **error_string);
EXPORT gs_texture_t gs_texture_create_from_file(const char *file);
EXPORT gs_texture_t *gs_texture_create_from_file(const char *file);
#define GS_FLIP_U (1<<0)
#define GS_FLIP_V (1<<1)
@ -492,10 +493,10 @@ EXPORT gs_texture_t gs_texture_create_from_file(const char *file);
* The flip value specifies whether the texture shoudl be flipped on the U or V
* axis with GS_FLIP_U and GS_FLIP_V.
*/
EXPORT void gs_draw_sprite(gs_texture_t tex, uint32_t flip, uint32_t width,
EXPORT void gs_draw_sprite(gs_texture_t *tex, uint32_t flip, uint32_t width,
uint32_t height);
EXPORT void gs_draw_cube_backdrop(gs_texture_t cubetex, const struct quat *rot,
EXPORT void gs_draw_cube_backdrop(gs_texture_t *cubetex, const struct quat *rot,
float left, float right, float top, float bottom, float znear);
/** sets the viewport to current swap chain size */
@ -509,9 +510,9 @@ EXPORT void gs_set_3d_mode(double fovy, double znear, double zvar);
EXPORT void gs_viewport_push(void);
EXPORT void gs_viewport_pop(void);
EXPORT void gs_texture_set_image(gs_texture_t tex, const uint8_t *data,
EXPORT void gs_texture_set_image(gs_texture_t *tex, const uint8_t *data,
uint32_t linesize, bool invert);
EXPORT void gs_cubetexture_set_image(gs_texture_t cubetex, uint32_t side,
EXPORT void gs_cubetexture_set_image(gs_texture_t *cubetex, uint32_t side,
const void *data, uint32_t linesize, bool invert);
EXPORT void gs_perspective(float fovy, float aspect, float znear, float zfar);
@ -521,68 +522,68 @@ EXPORT void gs_reset_blend_state(void);
/* -------------------------- */
/* library-specific functions */
EXPORT gs_swapchain_t gs_swapchain_create(struct gs_init_data *data);
EXPORT gs_swapchain_t *gs_swapchain_create(struct gs_init_data *data);
EXPORT void gs_resize(uint32_t x, uint32_t y);
EXPORT void gs_get_size(uint32_t *x, uint32_t *y);
EXPORT uint32_t gs_get_width(void);
EXPORT uint32_t gs_get_height(void);
EXPORT gs_texture_t gs_texture_create(uint32_t width, uint32_t height,
EXPORT gs_texture_t *gs_texture_create(uint32_t width, uint32_t height,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags);
EXPORT gs_texture_t gs_cubetexture_create(uint32_t size,
EXPORT gs_texture_t *gs_cubetexture_create(uint32_t size,
enum gs_color_format color_format, uint32_t levels,
const uint8_t **data, uint32_t flags);
EXPORT gs_texture_t gs_voltexture_create(uint32_t width, uint32_t height,
EXPORT gs_texture_t *gs_voltexture_create(uint32_t width, uint32_t height,
uint32_t depth, enum gs_color_format color_format,
uint32_t levels, const uint8_t **data, uint32_t flags);
EXPORT gs_zstencil_t gs_zstencil_create(uint32_t width, uint32_t height,
EXPORT gs_zstencil_t *gs_zstencil_create(uint32_t width, uint32_t height,
enum gs_zstencil_format format);
EXPORT gs_stagesurf_t gs_stagesurface_create(uint32_t width, uint32_t height,
EXPORT gs_stagesurf_t *gs_stagesurface_create(uint32_t width, uint32_t height,
enum gs_color_format color_format);
EXPORT gs_samplerstate_t gs_samplerstate_create(struct gs_sampler_info *info);
EXPORT gs_samplerstate_t *gs_samplerstate_create(struct gs_sampler_info *info);
EXPORT gs_shader_t gs_vertexshader_create(const char *shader,
EXPORT gs_shader_t *gs_vertexshader_create(const char *shader,
const char *file, char **error_string);
EXPORT gs_shader_t gs_pixelshader_create(const char *shader,
EXPORT gs_shader_t *gs_pixelshader_create(const char *shader,
const char *file, char **error_string);
EXPORT gs_vertbuffer_t gs_vertexbuffer_create(struct gs_vb_data *data,
EXPORT gs_vertbuffer_t *gs_vertexbuffer_create(struct gs_vb_data *data,
uint32_t flags);
EXPORT gs_indexbuffer_t gs_indexbuffer_create(enum gs_index_type type,
EXPORT gs_indexbuffer_t *gs_indexbuffer_create(enum gs_index_type type,
void *indices, size_t num, uint32_t flags);
EXPORT enum gs_texture_type gs_get_texture_type(gs_texture_t texture);
EXPORT enum gs_texture_type gs_get_texture_type(gs_texture_t *texture);
EXPORT void gs_load_vertexbuffer(gs_vertbuffer_t vertbuffer);
EXPORT void gs_load_indexbuffer(gs_indexbuffer_t indexbuffer);
EXPORT void gs_load_texture(gs_texture_t tex, int unit);
EXPORT void gs_load_samplerstate(gs_samplerstate_t samplerstate, int unit);
EXPORT void gs_load_vertexshader(gs_shader_t vertshader);
EXPORT void gs_load_pixelshader(gs_shader_t pixelshader);
EXPORT void gs_load_vertexbuffer(gs_vertbuffer_t *vertbuffer);
EXPORT void gs_load_indexbuffer(gs_indexbuffer_t *indexbuffer);
EXPORT void gs_load_texture(gs_texture_t *tex, int unit);
EXPORT void gs_load_samplerstate(gs_samplerstate_t *samplerstate, int unit);
EXPORT void gs_load_vertexshader(gs_shader_t *vertshader);
EXPORT void gs_load_pixelshader(gs_shader_t *pixelshader);
EXPORT void gs_load_default_samplerstate(bool b_3d, int unit);
EXPORT gs_shader_t gs_get_vertex_shader(void);
EXPORT gs_shader_t gs_get_pixel_shader(void);
EXPORT gs_shader_t *gs_get_vertex_shader(void);
EXPORT gs_shader_t *gs_get_pixel_shader(void);
EXPORT gs_texture_t gs_get_render_target(void);
EXPORT gs_zstencil_t gs_get_zstencil_target(void);
EXPORT gs_texture_t *gs_get_render_target(void);
EXPORT gs_zstencil_t *gs_get_zstencil_target(void);
EXPORT void gs_set_render_target(gs_texture_t tex, gs_zstencil_t zstencil);
EXPORT void gs_set_cube_render_target(gs_texture_t cubetex, int side,
gs_zstencil_t zstencil);
EXPORT void gs_set_render_target(gs_texture_t *tex, gs_zstencil_t *zstencil);
EXPORT void gs_set_cube_render_target(gs_texture_t *cubetex, int side,
gs_zstencil_t *zstencil);
EXPORT void gs_copy_texture(gs_texture_t dst, gs_texture_t src);
EXPORT void gs_copy_texture(gs_texture_t *dst, gs_texture_t *src);
EXPORT void gs_copy_texture_region(
gs_texture_t dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t src, uint32_t src_x, uint32_t src_y,
gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y,
gs_texture_t *src, uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h);
EXPORT void gs_stage_texture(gs_stagesurf_t dst, gs_texture_t src);
EXPORT void gs_stage_texture(gs_stagesurf_t *dst, gs_texture_t *src);
EXPORT void gs_begin_scene(void);
EXPORT void gs_draw(enum gs_draw_mode draw_mode, uint32_t start_vert,
@ -593,7 +594,7 @@ EXPORT void gs_end_scene(void);
#define GS_CLEAR_DEPTH (1<<1)
#define GS_CLEAR_STENCIL (1<<2)
EXPORT void gs_load_swapchain(gs_swapchain_t swapchain);
EXPORT void gs_load_swapchain(gs_swapchain_t *swapchain);
EXPORT void gs_clear(uint32_t clear_flags, struct vec4 *color,
float depth, uint8_t stencil);
EXPORT void gs_present(void);
@ -630,75 +631,78 @@ EXPORT void gs_frustum(float left, float right, float top, float bottom,
EXPORT void gs_projection_push(void);
EXPORT void gs_projection_pop(void);
EXPORT void gs_swapchain_destroy(gs_swapchain_t swapchain);
EXPORT void gs_swapchain_destroy(gs_swapchain_t *swapchain);
EXPORT void gs_texture_destroy(gs_texture_t tex);
EXPORT uint32_t gs_texture_get_width(gs_texture_t tex);
EXPORT uint32_t gs_texture_get_height(gs_texture_t tex);
EXPORT enum gs_color_format gs_texture_get_color_format(gs_texture_t tex);
EXPORT bool gs_texture_map(gs_texture_t tex, uint8_t **ptr,
EXPORT void gs_texture_destroy(gs_texture_t *tex);
EXPORT uint32_t gs_texture_get_width(gs_texture_t *tex);
EXPORT uint32_t gs_texture_get_height(gs_texture_t *tex);
EXPORT enum gs_color_format gs_texture_get_color_format(gs_texture_t *tex);
EXPORT bool gs_texture_map(gs_texture_t *tex, uint8_t **ptr,
uint32_t *linesize);
EXPORT void gs_texture_unmap(gs_texture_t tex);
EXPORT void gs_texture_unmap(gs_texture_t *tex);
/** special-case function (GL only) - specifies whether the texture is a
* GL_TEXTURE_RECTANGLE type, which doesn't use normalized texture
* coordinates, doesn't support mipmapping, and requires address clamping */
EXPORT bool gs_texture_is_rect(gs_texture_t tex);
EXPORT bool gs_texture_is_rect(gs_texture_t *tex);
/**
* Gets a pointer to the context-specific object associated with the texture.
* For example, for GL, this is a GLuint*. For D3D11, ID3D11Texture2D*.
*/
EXPORT void *gs_texture_get_obj(gs_texture_t tex);
EXPORT void *gs_texture_get_obj(gs_texture_t *tex);
EXPORT void gs_cubetexture_destroy(gs_texture_t cubetex);
EXPORT uint32_t gs_cubetexture_get_size(gs_texture_t cubetex);
EXPORT void gs_cubetexture_destroy(gs_texture_t *cubetex);
EXPORT uint32_t gs_cubetexture_get_size(gs_texture_t *cubetex);
EXPORT enum gs_color_format gs_cubetexture_get_color_format(
gs_texture_t cubetex);
gs_texture_t *cubetex);
EXPORT void gs_voltexture_destroy(gs_texture_t voltex);
EXPORT uint32_t gs_voltexture_get_width(gs_texture_t voltex);
EXPORT uint32_t gs_voltexture_get_height(gs_texture_t voltex);
EXPORT uint32_t gs_voltexture_getdepth(gs_texture_t voltex);
EXPORT enum gs_color_format gs_voltexture_get_color_format(gs_texture_t voltex);
EXPORT void gs_voltexture_destroy(gs_texture_t *voltex);
EXPORT uint32_t gs_voltexture_get_width(gs_texture_t *voltex);
EXPORT uint32_t gs_voltexture_get_height(gs_texture_t *voltex);
EXPORT uint32_t gs_voltexture_getdepth(gs_texture_t *voltex);
EXPORT enum gs_color_format gs_voltexture_get_color_format(
gs_texture_t *voltex);
EXPORT void gs_stagesurface_destroy(gs_stagesurf_t stagesurf);
EXPORT uint32_t gs_stagesurface_get_width(gs_stagesurf_t stagesurf);
EXPORT uint32_t gs_stagesurface_get_height(gs_stagesurf_t stagesurf);
EXPORT void gs_stagesurface_destroy(gs_stagesurf_t *stagesurf);
EXPORT uint32_t gs_stagesurface_get_width(gs_stagesurf_t *stagesurf);
EXPORT uint32_t gs_stagesurface_get_height(gs_stagesurf_t *stagesurf);
EXPORT enum gs_color_format gs_stagesurface_get_color_format(
gs_stagesurf_t stagesurf);
EXPORT bool gs_stagesurface_map(gs_stagesurf_t stagesurf, uint8_t **data,
gs_stagesurf_t *stagesurf);
EXPORT bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data,
uint32_t *linesize);
EXPORT void gs_stagesurface_unmap(gs_stagesurf_t stagesurf);
EXPORT void gs_stagesurface_unmap(gs_stagesurf_t *stagesurf);
EXPORT void gs_zstencil_destroy(gs_zstencil_t zstencil);
EXPORT void gs_zstencil_destroy(gs_zstencil_t *zstencil);
EXPORT void gs_samplerstate_destroy(gs_samplerstate_t samplerstate);
EXPORT void gs_samplerstate_destroy(gs_samplerstate_t *samplerstate);
EXPORT void gs_vertexbuffer_destroy(gs_vertbuffer_t vertbuffer);
EXPORT void gs_vertexbuffer_flush(gs_vertbuffer_t vertbuffer);
EXPORT struct gs_vb_data *gs_vertexbuffer_get_data(gs_vertbuffer_t vertbuffer);
EXPORT void gs_vertexbuffer_destroy(gs_vertbuffer_t *vertbuffer);
EXPORT void gs_vertexbuffer_flush(gs_vertbuffer_t *vertbuffer);
EXPORT struct gs_vb_data *gs_vertexbuffer_get_data(gs_vertbuffer_t *vertbuffer);
EXPORT void gs_indexbuffer_destroy(gs_indexbuffer_t indexbuffer);
EXPORT void gs_indexbuffer_flush(gs_indexbuffer_t indexbuffer);
EXPORT void *gs_indexbuffer_get_data(gs_indexbuffer_t indexbuffer);
EXPORT size_t gs_indexbuffer_get_num_indices(gs_indexbuffer_t indexbuffer);
EXPORT enum gs_index_type gs_indexbuffer_get_type(gs_indexbuffer_t indexbuffer);
EXPORT void gs_indexbuffer_destroy(gs_indexbuffer_t *indexbuffer);
EXPORT void gs_indexbuffer_flush(gs_indexbuffer_t *indexbuffer);
EXPORT void *gs_indexbuffer_get_data(gs_indexbuffer_t *indexbuffer);
EXPORT size_t gs_indexbuffer_get_num_indices(gs_indexbuffer_t *indexbuffer);
EXPORT enum gs_index_type gs_indexbuffer_get_type(
gs_indexbuffer_t *indexbuffer);
#ifdef __APPLE__
/** platform specific function for creating (GL_TEXTURE_RECTANGLE) textures
* from shared surface resources */
EXPORT gs_texture_t gs_texture_create_from_iosurface(void *iosurf);
EXPORT bool gs_texture_rebind_iosurface(gs_texture_t texture, void *iosurf);
EXPORT gs_texture_t *gs_texture_create_from_iosurface(void *iosurf);
EXPORT bool gs_texture_rebind_iosurface(gs_texture_t *texture,
void *iosurf);
#elif _WIN32
EXPORT bool gs_gdi_texture_available(void);
/** creates a windows GDI-lockable texture */
EXPORT gs_texture_t gs_texture_create_gdi(uint32_t width, uint32_t height);
EXPORT gs_texture_t *gs_texture_create_gdi(uint32_t width, uint32_t height);
EXPORT void *gs_texture_get_dc(gs_texture_t gdi_tex);
EXPORT void gs_texture_release_dc(gs_texture_t gdi_tex);
EXPORT void *gs_texture_get_dc(gs_texture_t *gdi_tex);
EXPORT void gs_texture_release_dc(gs_texture_t *gdi_tex);
#endif

View File

@ -143,9 +143,9 @@ extern "C" {
/* wrapped opaque data types */
struct input_subsystem;
typedef struct input_subsystem* input_t;
typedef struct input_subsystem input_t;
EXPORT int input_getbuttonstate(input_t input, uint32_t button);
EXPORT int input_getbuttonstate(input_t *input, uint32_t button);
#ifdef __cplusplus
}

View File

@ -24,8 +24,8 @@
#include "graphics.h"
struct gs_texture_render {
gs_texture_t target, prev_target;
gs_zstencil_t zs, prev_zs;
gs_texture_t *target, *prev_target;
gs_zstencil_t *zs, *prev_zs;
uint32_t cx, cy;
@ -35,7 +35,7 @@ struct gs_texture_render {
bool rendered;
};
gs_texrender_t gs_texrender_create(enum gs_color_format format,
gs_texrender_t *gs_texrender_create(enum gs_color_format format,
enum gs_zstencil_format zsformat)
{
struct gs_texture_render *texrender;
@ -46,7 +46,7 @@ gs_texrender_t gs_texrender_create(enum gs_color_format format,
return texrender;
}
void gs_texrender_destroy(gs_texrender_t texrender)
void gs_texrender_destroy(gs_texrender_t *texrender)
{
if (texrender) {
gs_texture_destroy(texrender->target);
@ -55,7 +55,7 @@ void gs_texrender_destroy(gs_texrender_t texrender)
}
}
static bool texrender_resetbuffer(gs_texrender_t texrender, uint32_t cx,
static bool texrender_resetbuffer(gs_texrender_t *texrender, uint32_t cx,
uint32_t cy)
{
if (!texrender)
@ -87,7 +87,7 @@ static bool texrender_resetbuffer(gs_texrender_t texrender, uint32_t cx,
return true;
}
bool gs_texrender_begin(gs_texrender_t texrender, uint32_t cx, uint32_t cy)
bool gs_texrender_begin(gs_texrender_t *texrender, uint32_t cx, uint32_t cy)
{
if (!texrender || texrender->rendered)
return false;
@ -119,7 +119,7 @@ bool gs_texrender_begin(gs_texrender_t texrender, uint32_t cx, uint32_t cy)
return true;
}
void gs_texrender_end(gs_texrender_t texrender)
void gs_texrender_end(gs_texrender_t *texrender)
{
if (!texrender)
return;
@ -133,13 +133,13 @@ void gs_texrender_end(gs_texrender_t texrender)
texrender->rendered = true;
}
void gs_texrender_reset(gs_texrender_t texrender)
void gs_texrender_reset(gs_texrender_t *texrender)
{
if (texrender)
texrender->rendered = false;
}
gs_texture_t gs_texrender_get_texture(gs_texrender_t texrender)
gs_texture_t *gs_texrender_get_texture(gs_texrender_t *texrender)
{
return texrender ? texrender->target : NULL;
}

View File

@ -32,7 +32,7 @@
struct audio_input {
struct audio_convert_info conversion;
audio_resampler_t resampler;
audio_resampler_t *resampler;
void (*callback)(void *param, struct audio_data *data);
void *param;
@ -82,7 +82,7 @@ struct audio_output {
size_t planes;
pthread_t thread;
os_event_t stop_event;
os_event_t *stop_event;
DARRAY(uint8_t) mix_buffers[MAX_AV_PLANES];
@ -112,7 +112,7 @@ static inline void audio_output_removeline(struct audio_output *audio,
* timestamps. this will actually work accurately as long as you handle the
* values correctly */
static inline double ts_to_frames(audio_t audio, uint64_t ts)
static inline double ts_to_frames(audio_t *audio, uint64_t ts)
{
double audio_offset_d = (double)ts;
audio_offset_d /= 1000000000.0;
@ -126,19 +126,19 @@ static inline double positive_round(double val)
return floor(val+0.5);
}
static size_t ts_diff_frames(audio_t audio, uint64_t ts1, uint64_t ts2)
static size_t ts_diff_frames(audio_t *audio, uint64_t ts1, uint64_t ts2)
{
double diff = ts_to_frames(audio, ts1) - ts_to_frames(audio, ts2);
return (size_t)positive_round(diff);
}
static size_t ts_diff_bytes(audio_t audio, uint64_t ts1, uint64_t ts2)
static size_t ts_diff_bytes(audio_t *audio, uint64_t ts1, uint64_t ts2)
{
return ts_diff_frames(audio, ts1, ts2) * audio->block_size;
}
/* unless the value is 3+ hours worth of frames, this won't overflow */
static inline uint64_t conv_frames_to_time(audio_t audio, uint32_t frames)
static inline uint64_t conv_frames_to_time(audio_t *audio, uint32_t frames)
{
return (uint64_t)frames * 1000000000ULL /
(uint64_t)audio->info.samples_per_sec;
@ -369,7 +369,7 @@ static void *audio_thread(void *param)
/* ------------------------------------------------------------------------- */
static size_t audio_get_input_idx(audio_t video,
static size_t audio_get_input_idx(audio_t *video,
void (*callback)(void *param, struct audio_data *data),
void *param)
{
@ -413,7 +413,7 @@ static inline bool audio_input_init(struct audio_input *input,
return true;
}
bool audio_output_connect(audio_t audio,
bool audio_output_connect(audio_t *audio,
const struct audio_convert_info *conversion,
void (*callback)(void *param, struct audio_data *data),
void *param)
@ -456,7 +456,7 @@ bool audio_output_connect(audio_t audio,
return success;
}
void audio_output_disconnect(audio_t audio,
void audio_output_disconnect(audio_t *audio,
void (*callback)(void *param, struct audio_data *data),
void *param)
{
@ -479,7 +479,7 @@ static inline bool valid_audio_params(struct audio_output_info *info)
info->speakers > 0;
}
int audio_output_open(audio_t *audio, struct audio_output_info *info)
int audio_output_open(audio_t **audio, struct audio_output_info *info)
{
struct audio_output *out;
pthread_mutexattr_t attr;
@ -521,7 +521,7 @@ fail:
return AUDIO_OUTPUT_FAIL;
}
void audio_output_close(audio_t audio)
void audio_output_close(audio_t *audio)
{
void *thread_ret;
struct audio_line *line;
@ -553,7 +553,7 @@ void audio_output_close(audio_t audio)
bfree(audio);
}
audio_line_t audio_output_create_line(audio_t audio, const char *name)
audio_line_t *audio_output_create_line(audio_t *audio, const char *name)
{
if (!audio) return NULL;
@ -584,7 +584,7 @@ audio_line_t audio_output_create_line(audio_t audio, const char *name)
return line;
}
const struct audio_output_info *audio_output_get_info(audio_t audio)
const struct audio_output_info *audio_output_get_info(audio_t *audio)
{
return audio ? &audio->info : NULL;
}
@ -599,28 +599,28 @@ void audio_line_destroy(struct audio_line *line)
}
}
bool audio_output_active(audio_t audio)
bool audio_output_active(audio_t *audio)
{
if (!audio) return false;
return audio->inputs.num != 0;
}
size_t audio_output_get_block_size(audio_t audio)
size_t audio_output_get_block_size(audio_t *audio)
{
return audio ? audio->block_size : 0;
}
size_t audio_output_get_planes(audio_t audio)
size_t audio_output_get_planes(audio_t *audio)
{
return audio ? audio->planes : 0;
}
size_t audio_output_get_channels(audio_t audio)
size_t audio_output_get_channels(audio_t *audio)
{
return audio ? audio->channels : 0;
}
uint32_t audio_output_get_sample_rate(audio_t audio)
uint32_t audio_output_get_sample_rate(audio_t *audio)
{
return audio ? audio->info.samples_per_sec : 0;
}
@ -706,7 +706,7 @@ static inline bool valid_timestamp_range(struct audio_line *line, uint64_t ts)
return ts >= line->base_timestamp && ts < max_ts;
}
void audio_line_output(audio_line_t line, const struct audio_data *data)
void audio_line_output(audio_line_t *line, const struct audio_data *data)
{
if (!line || !data) return;

View File

@ -31,8 +31,8 @@ extern "C" {
struct audio_output;
struct audio_line;
typedef struct audio_output *audio_t;
typedef struct audio_line *audio_line_t;
typedef struct audio_output audio_t;
typedef struct audio_line audio_line_t;
enum audio_format {
AUDIO_FORMAT_UNKNOWN,
@ -169,28 +169,28 @@ static inline size_t get_audio_size(enum audio_format format,
#define AUDIO_OUTPUT_INVALIDPARAM -1
#define AUDIO_OUTPUT_FAIL -2
EXPORT int audio_output_open(audio_t *audio, struct audio_output_info *info);
EXPORT void audio_output_close(audio_t audio);
EXPORT int audio_output_open(audio_t **audio, struct audio_output_info *info);
EXPORT void audio_output_close(audio_t *audio);
EXPORT bool audio_output_connect(audio_t video,
EXPORT bool audio_output_connect(audio_t *video,
const struct audio_convert_info *conversion,
void (*callback)(void *param, struct audio_data *data),
void *param);
EXPORT void audio_output_disconnect(audio_t video,
EXPORT void audio_output_disconnect(audio_t *video,
void (*callback)(void *param, struct audio_data *data),
void *param);
EXPORT bool audio_output_active(audio_t audio);
EXPORT bool audio_output_active(audio_t *audio);
EXPORT size_t audio_output_get_block_size(audio_t audio);
EXPORT size_t audio_output_get_planes(audio_t audio);
EXPORT size_t audio_output_get_channels(audio_t audio);
EXPORT uint32_t audio_output_get_sample_rate(audio_t audio);
EXPORT const struct audio_output_info *audio_output_get_info(audio_t audio);
EXPORT size_t audio_output_get_block_size(audio_t *audio);
EXPORT size_t audio_output_get_planes(audio_t *audio);
EXPORT size_t audio_output_get_channels(audio_t *audio);
EXPORT uint32_t audio_output_get_sample_rate(audio_t *audio);
EXPORT const struct audio_output_info *audio_output_get_info(audio_t *audio);
EXPORT audio_line_t audio_output_create_line(audio_t audio, const char *name);
EXPORT void audio_line_destroy(audio_line_t line);
EXPORT void audio_line_output(audio_line_t line, const struct audio_data *data);
EXPORT audio_line_t *audio_output_create_line(audio_t *audio, const char *name);
EXPORT void audio_line_destroy(audio_line_t *line);
EXPORT void audio_line_output(audio_line_t *line, const struct audio_data *data);
#ifdef __cplusplus

View File

@ -77,7 +77,7 @@ static inline uint64_t convert_speaker_layout(enum speaker_layout layout)
return 0;
}
audio_resampler_t audio_resampler_create(const struct resample_info *dst,
audio_resampler_t *audio_resampler_create(const struct resample_info *dst,
const struct resample_info *src)
{
struct audio_resampler *rs = bzalloc(sizeof(struct audio_resampler));
@ -116,7 +116,7 @@ audio_resampler_t audio_resampler_create(const struct resample_info *dst,
return rs;
}
void audio_resampler_destroy(audio_resampler_t rs)
void audio_resampler_destroy(audio_resampler_t *rs)
{
if (rs) {
if (rs->context)
@ -128,7 +128,7 @@ void audio_resampler_destroy(audio_resampler_t rs)
}
}
bool audio_resampler_resample(audio_resampler_t rs,
bool audio_resampler_resample(audio_resampler_t *rs,
uint8_t *output[], uint32_t *out_frames, uint64_t *ts_offset,
const uint8_t *const input[], uint32_t in_frames)
{

View File

@ -25,7 +25,7 @@ extern "C" {
#endif
struct audio_resampler;
typedef struct audio_resampler *audio_resampler_t;
typedef struct audio_resampler audio_resampler_t;
struct resample_info {
uint32_t samples_per_sec;
@ -33,11 +33,11 @@ struct resample_info {
enum speaker_layout speakers;
};
EXPORT audio_resampler_t audio_resampler_create(const struct resample_info *dst,
EXPORT audio_resampler_t *audio_resampler_create(const struct resample_info *dst,
const struct resample_info *src);
EXPORT void audio_resampler_destroy(audio_resampler_t resampler);
EXPORT void audio_resampler_destroy(audio_resampler_t *resampler);
EXPORT bool audio_resampler_resample(audio_resampler_t resampler,
EXPORT bool audio_resampler_resample(audio_resampler_t *resampler,
uint8_t *output[], uint32_t *out_frames, uint64_t *ts_offset,
const uint8_t *const input[], uint32_t in_frames);

View File

@ -30,7 +30,7 @@
struct video_input {
struct video_scale_info conversion;
video_scaler_t scaler;
video_scaler_t *scaler;
struct video_frame frame[MAX_CONVERT_BUFFERS];
int cur_frame;
@ -50,13 +50,13 @@ struct video_output {
pthread_t thread;
pthread_mutex_t data_mutex;
os_event_t stop_event;
os_event_t *stop_event;
struct video_data cur_frame;
struct video_data next_frame;
bool new_frame;
os_event_t update_event;
os_event_t *update_event;
uint64_t frame_time;
volatile uint64_t cur_video_time;
uint32_t skipped_frames;
@ -181,7 +181,7 @@ static inline bool valid_video_params(struct video_output_info *info)
info->fps_num != 0;
}
int video_output_open(video_t *video, struct video_output_info *info)
int video_output_open(video_t **video, struct video_output_info *info)
{
struct video_output *out;
@ -217,7 +217,7 @@ fail:
return VIDEO_OUTPUT_FAIL;
}
void video_output_close(video_t video)
void video_output_close(video_t *video)
{
if (!video)
return;
@ -235,7 +235,7 @@ void video_output_close(video_t video)
bfree(video);
}
static size_t video_get_input_idx(video_t video,
static size_t video_get_input_idx(video_t *video,
void (*callback)(void *param, struct video_data *frame),
void *param)
{
@ -284,7 +284,7 @@ static inline bool video_input_init(struct video_input *input,
return true;
}
bool video_output_connect(video_t video,
bool video_output_connect(video_t *video,
const struct video_scale_info *conversion,
void (*callback)(void *param, struct video_data *frame),
void *param)
@ -326,7 +326,7 @@ bool video_output_connect(video_t video,
return success;
}
void video_output_disconnect(video_t video,
void video_output_disconnect(video_t *video,
void (*callback)(void *param, struct video_data *frame),
void *param)
{
@ -344,18 +344,18 @@ void video_output_disconnect(video_t video,
pthread_mutex_unlock(&video->input_mutex);
}
bool video_output_active(video_t video)
bool video_output_active(video_t *video)
{
if (!video) return false;
return video->inputs.num != 0;
}
const struct video_output_info *video_output_get_info(video_t video)
const struct video_output_info *video_output_get_info(video_t *video)
{
return video ? &video->info : NULL;
}
void video_output_swap_frame(video_t video, struct video_data *frame)
void video_output_swap_frame(video_t *video, struct video_data *frame)
{
if (!video) return;
@ -365,7 +365,7 @@ void video_output_swap_frame(video_t video, struct video_data *frame)
pthread_mutex_unlock(&video->data_mutex);
}
bool video_output_wait(video_t video)
bool video_output_wait(video_t *video)
{
if (!video) return false;
@ -373,17 +373,17 @@ bool video_output_wait(video_t video)
return os_event_try(video->stop_event) == EAGAIN;
}
uint64_t video_output_get_frame_time(video_t video)
uint64_t video_output_get_frame_time(video_t *video)
{
return video ? video->frame_time : 0;
}
uint64_t video_output_get_time(video_t video)
uint64_t video_output_get_time(video_t *video)
{
return video ? video->cur_video_time : 0;
}
void video_output_stop(video_t video)
void video_output_stop(video_t *video)
{
void *thread_ret;
@ -398,22 +398,22 @@ void video_output_stop(video_t video)
}
}
enum video_format video_output_get_format(video_t video)
enum video_format video_output_get_format(video_t *video)
{
return video ? video->info.format : VIDEO_FORMAT_NONE;
}
uint32_t video_output_get_width(video_t video)
uint32_t video_output_get_width(video_t *video)
{
return video ? video->info.width : 0;
}
uint32_t video_output_get_height(video_t video)
uint32_t video_output_get_height(video_t *video)
{
return video ? video->info.height : 0;
}
double video_output_get_frame_rate(video_t video)
double video_output_get_frame_rate(video_t *video)
{
if (!video)
return 0.0;
@ -421,12 +421,12 @@ double video_output_get_frame_rate(video_t video)
return (double)video->info.fps_num / (double)video->info.fps_den;
}
uint32_t video_output_get_skipped_frames(video_t video)
uint32_t video_output_get_skipped_frames(video_t *video)
{
return video->skipped_frames;
}
uint32_t video_output_get_total_frames(video_t video)
uint32_t video_output_get_total_frames(video_t *video)
{
return video->total_frames;
}

View File

@ -26,7 +26,7 @@ extern "C" {
/* Base video output component. Use this to create a video output track. */
struct video_output;
typedef struct video_output *video_t;
typedef struct video_output video_t;
enum video_format {
VIDEO_FORMAT_NONE,
@ -119,33 +119,33 @@ EXPORT bool video_format_get_parameters(enum video_colorspace color_space,
#define VIDEO_OUTPUT_INVALIDPARAM -1
#define VIDEO_OUTPUT_FAIL -2
EXPORT int video_output_open(video_t *video, struct video_output_info *info);
EXPORT void video_output_close(video_t video);
EXPORT int video_output_open(video_t **video, struct video_output_info *info);
EXPORT void video_output_close(video_t *video);
EXPORT bool video_output_connect(video_t video,
EXPORT bool video_output_connect(video_t *video,
const struct video_scale_info *conversion,
void (*callback)(void *param, struct video_data *frame),
void *param);
EXPORT void video_output_disconnect(video_t video,
EXPORT void video_output_disconnect(video_t *video,
void (*callback)(void *param, struct video_data *frame),
void *param);
EXPORT bool video_output_active(video_t video);
EXPORT bool video_output_active(video_t *video);
EXPORT const struct video_output_info *video_output_get_info(video_t video);
EXPORT void video_output_swap_frame(video_t video, struct video_data *frame);
EXPORT bool video_output_wait(video_t video);
EXPORT uint64_t video_output_get_frame_time(video_t video);
EXPORT uint64_t video_output_get_time(video_t video);
EXPORT void video_output_stop(video_t video);
EXPORT const struct video_output_info *video_output_get_info(video_t *video);
EXPORT void video_output_swap_frame(video_t *video, struct video_data *frame);
EXPORT bool video_output_wait(video_t *video);
EXPORT uint64_t video_output_get_frame_time(video_t *video);
EXPORT uint64_t video_output_get_time(video_t *video);
EXPORT void video_output_stop(video_t *video);
EXPORT enum video_format video_output_get_format(video_t video);
EXPORT uint32_t video_output_get_width(video_t video);
EXPORT uint32_t video_output_get_height(video_t video);
EXPORT double video_output_get_frame_rate(video_t video);
EXPORT enum video_format video_output_get_format(video_t *video);
EXPORT uint32_t video_output_get_width(video_t *video);
EXPORT uint32_t video_output_get_height(video_t *video);
EXPORT double video_output_get_frame_rate(video_t *video);
EXPORT uint32_t video_output_get_skipped_frames(video_t video);
EXPORT uint32_t video_output_get_total_frames(video_t video);
EXPORT uint32_t video_output_get_skipped_frames(video_t *video);
EXPORT uint32_t video_output_get_total_frames(video_t *video);
#ifdef __cplusplus

View File

@ -80,7 +80,7 @@ static inline int get_ffmpeg_range_type(enum video_range_type type)
#define FIXED_1_0 (1<<16)
int video_scaler_create(video_scaler_t *scaler_out,
int video_scaler_create(video_scaler_t **scaler_out,
const struct video_scale_info *dst,
const struct video_scale_info *src,
enum video_scale_type type)
@ -132,7 +132,7 @@ fail:
return VIDEO_SCALER_FAILED;
}
void video_scaler_destroy(video_scaler_t scaler)
void video_scaler_destroy(video_scaler_t *scaler)
{
if (scaler) {
sws_freeContext(scaler->swscale);
@ -140,7 +140,7 @@ void video_scaler_destroy(video_scaler_t scaler)
}
}
bool video_scaler_scale(video_scaler_t scaler,
bool video_scaler_scale(video_scaler_t *scaler,
uint8_t *output[], const uint32_t out_linesize[],
const uint8_t *const input[], const uint32_t in_linesize[])
{

View File

@ -25,19 +25,19 @@ extern "C" {
#endif
struct video_scaler;
typedef struct video_scaler *video_scaler_t;
typedef struct video_scaler video_scaler_t;
#define VIDEO_SCALER_SUCCESS 0
#define VIDEO_SCALER_BAD_CONVERSION -1
#define VIDEO_SCALER_FAILED -2
EXPORT int video_scaler_create(video_scaler_t *scaler,
EXPORT int video_scaler_create(video_scaler_t **scaler,
const struct video_scale_info *dst,
const struct video_scale_info *src,
enum video_scale_type type);
EXPORT void video_scaler_destroy(video_scaler_t scaler);
EXPORT void video_scaler_destroy(video_scaler_t *scaler);
EXPORT bool video_scaler_scale(video_scaler_t scaler,
EXPORT bool video_scaler_scale(video_scaler_t *scaler,
uint8_t *output[], const uint32_t out_linesize[],
const uint8_t *const input[], const uint32_t in_linesize[]);

File diff suppressed because it is too large Load Diff

View File

@ -38,9 +38,9 @@ struct quat;
struct obs_data;
struct obs_data_item;
struct obs_data_array;
typedef struct obs_data *obs_data_t;
typedef struct obs_data_item *obs_data_item_t;
typedef struct obs_data_array *obs_data_array_t;
typedef struct obs_data obs_data_t;
typedef struct obs_data_item obs_data_item_t;
typedef struct obs_data_array obs_data_array_t;
enum obs_data_type {
OBS_DATA_NULL,
@ -60,248 +60,248 @@ enum obs_data_number_type {
/* ------------------------------------------------------------------------- */
/* Main usage functions */
EXPORT obs_data_t obs_data_create();
EXPORT obs_data_t obs_data_create_from_json(const char *json_string);
EXPORT void obs_data_addref(obs_data_t data);
EXPORT void obs_data_release(obs_data_t data);
EXPORT obs_data_t *obs_data_create();
EXPORT obs_data_t *obs_data_create_from_json(const char *json_string);
EXPORT void obs_data_addref(obs_data_t *data);
EXPORT void obs_data_release(obs_data_t *data);
EXPORT const char *obs_data_get_json(obs_data_t data);
EXPORT const char *obs_data_get_json(obs_data_t *data);
EXPORT void obs_data_apply(obs_data_t target, obs_data_t apply_data);
EXPORT void obs_data_apply(obs_data_t *target, obs_data_t *apply_data);
EXPORT void obs_data_erase(obs_data_t data, const char *name);
EXPORT void obs_data_erase(obs_data_t *data, const char *name);
/* Set functions */
EXPORT void obs_data_set_string(obs_data_t data, const char *name,
EXPORT void obs_data_set_string(obs_data_t *data, const char *name,
const char *val);
EXPORT void obs_data_set_int(obs_data_t data, const char *name,
EXPORT void obs_data_set_int(obs_data_t *data, const char *name,
long long val);
EXPORT void obs_data_set_double(obs_data_t data, const char *name, double val);
EXPORT void obs_data_set_bool(obs_data_t data, const char *name, bool val);
EXPORT void obs_data_set_obj(obs_data_t data, const char *name, obs_data_t obj);
EXPORT void obs_data_set_array(obs_data_t data, const char *name,
obs_data_array_t array);
EXPORT void obs_data_set_double(obs_data_t *data, const char *name, double val);
EXPORT void obs_data_set_bool(obs_data_t *data, const char *name, bool val);
EXPORT void obs_data_set_obj(obs_data_t *data, const char *name, obs_data_t *obj);
EXPORT void obs_data_set_array(obs_data_t *data, const char *name,
obs_data_array_t *array);
/*
* Default value functions.
*/
EXPORT void obs_data_set_default_string(obs_data_t data, const char *name,
EXPORT void obs_data_set_default_string(obs_data_t *data, const char *name,
const char *val);
EXPORT void obs_data_set_default_int(obs_data_t data, const char *name,
EXPORT void obs_data_set_default_int(obs_data_t *data, const char *name,
long long val);
EXPORT void obs_data_set_default_double(obs_data_t data, const char *name,
EXPORT void obs_data_set_default_double(obs_data_t *data, const char *name,
double val);
EXPORT void obs_data_set_default_bool(obs_data_t data, const char *name,
EXPORT void obs_data_set_default_bool(obs_data_t *data, const char *name,
bool val);
EXPORT void obs_data_set_default_obj(obs_data_t data, const char *name,
obs_data_t obj);
EXPORT void obs_data_set_default_obj(obs_data_t *data, const char *name,
obs_data_t *obj);
/*
* Application overrides
* Use these to communicate the actual values of settings in case the user
* settings aren't appropriate
*/
EXPORT void obs_data_set_autoselect_string(obs_data_t data, const char *name,
EXPORT void obs_data_set_autoselect_string(obs_data_t *data, const char *name,
const char *val);
EXPORT void obs_data_set_autoselect_int(obs_data_t data, const char *name,
EXPORT void obs_data_set_autoselect_int(obs_data_t *data, const char *name,
long long val);
EXPORT void obs_data_set_autoselect_double(obs_data_t data, const char *name,
EXPORT void obs_data_set_autoselect_double(obs_data_t *data, const char *name,
double val);
EXPORT void obs_data_set_autoselect_bool(obs_data_t data, const char *name,
EXPORT void obs_data_set_autoselect_bool(obs_data_t *data, const char *name,
bool val);
EXPORT void obs_data_set_autoselect_obj(obs_data_t data, const char *name,
obs_data_t obj);
EXPORT void obs_data_set_autoselect_obj(obs_data_t *data, const char *name,
obs_data_t *obj);
/*
* Get functions
*/
EXPORT const char *obs_data_get_string(obs_data_t data, const char *name);
EXPORT long long obs_data_get_int(obs_data_t data, const char *name);
EXPORT double obs_data_get_double(obs_data_t data, const char *name);
EXPORT bool obs_data_get_bool(obs_data_t data, const char *name);
EXPORT obs_data_t obs_data_get_obj(obs_data_t data, const char *name);
EXPORT obs_data_array_t obs_data_get_array(obs_data_t data, const char *name);
EXPORT const char *obs_data_get_string(obs_data_t *data, const char *name);
EXPORT long long obs_data_get_int(obs_data_t *data, const char *name);
EXPORT double obs_data_get_double(obs_data_t *data, const char *name);
EXPORT bool obs_data_get_bool(obs_data_t *data, const char *name);
EXPORT obs_data_t *obs_data_get_obj(obs_data_t *data, const char *name);
EXPORT obs_data_array_t *obs_data_get_array(obs_data_t *data, const char *name);
EXPORT const char *obs_data_get_default_string(obs_data_t data,
EXPORT const char *obs_data_get_default_string(obs_data_t *data,
const char *name);
EXPORT long long obs_data_get_default_int(obs_data_t data, const char *name);
EXPORT double obs_data_get_default_double(obs_data_t data, const char *name);
EXPORT bool obs_data_get_default_bool(obs_data_t data, const char *name);
EXPORT obs_data_t obs_data_get_default_obj(obs_data_t data, const char *name);
EXPORT obs_data_array_t obs_data_get_default_array(obs_data_t data,
EXPORT long long obs_data_get_default_int(obs_data_t *data, const char *name);
EXPORT double obs_data_get_default_double(obs_data_t *data, const char *name);
EXPORT bool obs_data_get_default_bool(obs_data_t *data, const char *name);
EXPORT obs_data_t *obs_data_get_default_obj(obs_data_t *data, const char *name);
EXPORT obs_data_array_t *obs_data_get_default_array(obs_data_t *data,
const char *name);
EXPORT const char *obs_data_get_autoselect_string(obs_data_t data,
EXPORT const char *obs_data_get_autoselect_string(obs_data_t *data,
const char *name);
EXPORT long long obs_data_get_autoselect_int(obs_data_t data, const char *name);
EXPORT double obs_data_get_autoselect_double(obs_data_t data, const char *name);
EXPORT bool obs_data_get_autoselect_bool(obs_data_t data, const char *name);
EXPORT obs_data_t obs_data_get_autoselect_obj(obs_data_t data,
EXPORT long long obs_data_get_autoselect_int(obs_data_t *data, const char *name);
EXPORT double obs_data_get_autoselect_double(obs_data_t *data, const char *name);
EXPORT bool obs_data_get_autoselect_bool(obs_data_t *data, const char *name);
EXPORT obs_data_t *obs_data_get_autoselect_obj(obs_data_t *data,
const char *name);
EXPORT obs_data_array_t obs_data_get_autoselect_array(obs_data_t data,
EXPORT obs_data_array_t *obs_data_get_autoselect_array(obs_data_t *data,
const char *name);
/* Array functions */
EXPORT obs_data_array_t obs_data_array_create();
EXPORT void obs_data_array_addref(obs_data_array_t array);
EXPORT void obs_data_array_release(obs_data_array_t array);
EXPORT obs_data_array_t *obs_data_array_create();
EXPORT void obs_data_array_addref(obs_data_array_t *array);
EXPORT void obs_data_array_release(obs_data_array_t *array);
EXPORT size_t obs_data_array_count(obs_data_array_t array);
EXPORT obs_data_t obs_data_array_item(obs_data_array_t array, size_t idx);
EXPORT size_t obs_data_array_push_back(obs_data_array_t array, obs_data_t obj);
EXPORT void obs_data_array_insert(obs_data_array_t array, size_t idx,
obs_data_t obj);
EXPORT void obs_data_array_erase(obs_data_array_t array, size_t idx);
EXPORT size_t obs_data_array_count(obs_data_array_t *array);
EXPORT obs_data_t *obs_data_array_item(obs_data_array_t *array, size_t idx);
EXPORT size_t obs_data_array_push_back(obs_data_array_t *array, obs_data_t *obj);
EXPORT void obs_data_array_insert(obs_data_array_t *array, size_t idx,
obs_data_t *obj);
EXPORT void obs_data_array_erase(obs_data_array_t *array, size_t idx);
/* ------------------------------------------------------------------------- */
/* Item status inspection */
EXPORT bool obs_data_has_user_value(obs_data_t data, const char *name);
EXPORT bool obs_data_has_default_value(obs_data_t data, const char *name);
EXPORT bool obs_data_has_autoselect_value(obs_data_t data, const char *name);
EXPORT bool obs_data_has_user_value(obs_data_t *data, const char *name);
EXPORT bool obs_data_has_default_value(obs_data_t *data, const char *name);
EXPORT bool obs_data_has_autoselect_value(obs_data_t *data, const char *name);
EXPORT bool obs_data_item_has_user_value(obs_data_item_t data);
EXPORT bool obs_data_item_has_default_value(obs_data_item_t data);
EXPORT bool obs_data_item_has_autoselect_value(obs_data_item_t data);
EXPORT bool obs_data_item_has_user_value(obs_data_item_t *data);
EXPORT bool obs_data_item_has_default_value(obs_data_item_t *data);
EXPORT bool obs_data_item_has_autoselect_value(obs_data_item_t *data);
/* ------------------------------------------------------------------------- */
/* Clearing data values */
EXPORT void obs_data_unset_user_value(obs_data_t data, const char *name);
EXPORT void obs_data_unset_default_value(obs_data_t data, const char *name);
EXPORT void obs_data_unset_autoselect_value(obs_data_t data, const char *name);
EXPORT void obs_data_unset_user_value(obs_data_t *data, const char *name);
EXPORT void obs_data_unset_default_value(obs_data_t *data, const char *name);
EXPORT void obs_data_unset_autoselect_value(obs_data_t *data, const char *name);
EXPORT void obs_data_item_unset_user_value(obs_data_item_t data);
EXPORT void obs_data_item_unset_default_value(obs_data_item_t data);
EXPORT void obs_data_item_unset_autoselect_value(obs_data_item_t data);
EXPORT void obs_data_item_unset_user_value(obs_data_item_t *data);
EXPORT void obs_data_item_unset_default_value(obs_data_item_t *data);
EXPORT void obs_data_item_unset_autoselect_value(obs_data_item_t *data);
/* ------------------------------------------------------------------------- */
/* Item iteration */
EXPORT obs_data_item_t obs_data_first(obs_data_t data);
EXPORT obs_data_item_t obs_data_item_byname(obs_data_t data, const char *name);
EXPORT bool obs_data_item_next(obs_data_item_t *item);
EXPORT void obs_data_item_release(obs_data_item_t *item);
EXPORT void obs_data_item_remove(obs_data_item_t *item);
EXPORT obs_data_item_t *obs_data_first(obs_data_t *data);
EXPORT obs_data_item_t *obs_data_item_byname(obs_data_t *data, const char *name);
EXPORT bool obs_data_item_next(obs_data_item_t **item);
EXPORT void obs_data_item_release(obs_data_item_t **item);
EXPORT void obs_data_item_remove(obs_data_item_t **item);
/* Gets Item type */
EXPORT enum obs_data_type obs_data_item_gettype(obs_data_item_t item);
EXPORT enum obs_data_number_type obs_data_item_numtype(obs_data_item_t item);
EXPORT enum obs_data_type obs_data_item_gettype(obs_data_item_t *item);
EXPORT enum obs_data_number_type obs_data_item_numtype(obs_data_item_t *item);
/* Item set functions */
EXPORT void obs_data_item_set_string(obs_data_item_t *item, const char *val);
EXPORT void obs_data_item_set_int(obs_data_item_t *item, long long val);
EXPORT void obs_data_item_set_double(obs_data_item_t *item, double val);
EXPORT void obs_data_item_set_bool(obs_data_item_t *item, bool val);
EXPORT void obs_data_item_set_obj(obs_data_item_t *item, obs_data_t val);
EXPORT void obs_data_item_set_array(obs_data_item_t *item,
obs_data_array_t val);
EXPORT void obs_data_item_set_string(obs_data_item_t **item, const char *val);
EXPORT void obs_data_item_set_int(obs_data_item_t **item, long long val);
EXPORT void obs_data_item_set_double(obs_data_item_t **item, double val);
EXPORT void obs_data_item_set_bool(obs_data_item_t **item, bool val);
EXPORT void obs_data_item_set_obj(obs_data_item_t **item, obs_data_t *val);
EXPORT void obs_data_item_set_array(obs_data_item_t **item,
obs_data_array_t *val);
EXPORT void obs_data_item_set_default_string(obs_data_item_t *item,
EXPORT void obs_data_item_set_default_string(obs_data_item_t **item,
const char *val);
EXPORT void obs_data_item_set_default_int(obs_data_item_t *item, long long val);
EXPORT void obs_data_item_set_default_double(obs_data_item_t *item, double val);
EXPORT void obs_data_item_set_default_bool(obs_data_item_t *item, bool val);
EXPORT void obs_data_item_set_default_obj(obs_data_item_t *item,
obs_data_t val);
EXPORT void obs_data_item_set_default_array(obs_data_item_t *item,
obs_data_array_t val);
EXPORT void obs_data_item_set_default_int(obs_data_item_t **item, long long val);
EXPORT void obs_data_item_set_default_double(obs_data_item_t **item, double val);
EXPORT void obs_data_item_set_default_bool(obs_data_item_t **item, bool val);
EXPORT void obs_data_item_set_default_obj(obs_data_item_t **item,
obs_data_t *val);
EXPORT void obs_data_item_set_default_array(obs_data_item_t **item,
obs_data_array_t *val);
EXPORT void obs_data_item_set_autoselect_string(obs_data_item_t *item,
EXPORT void obs_data_item_set_autoselect_string(obs_data_item_t **item,
const char *val);
EXPORT void obs_data_item_set_autoselect_int(obs_data_item_t *item,
EXPORT void obs_data_item_set_autoselect_int(obs_data_item_t **item,
long long val);
EXPORT void obs_data_item_set_autoselect_double(obs_data_item_t *item,
EXPORT void obs_data_item_set_autoselect_double(obs_data_item_t **item,
double val);
EXPORT void obs_data_item_set_autoselect_bool(obs_data_item_t *item, bool val);
EXPORT void obs_data_item_set_autoselect_obj(obs_data_item_t *item,
obs_data_t val);
EXPORT void obs_data_item_set_autoselect_array(obs_data_item_t *item,
obs_data_array_t val);
EXPORT void obs_data_item_set_autoselect_bool(obs_data_item_t **item, bool val);
EXPORT void obs_data_item_set_autoselect_obj(obs_data_item_t **item,
obs_data_t *val);
EXPORT void obs_data_item_set_autoselect_array(obs_data_item_t **item,
obs_data_array_t *val);
/* Item get functions */
EXPORT const char *obs_data_item_get_string(obs_data_item_t item);
EXPORT long long obs_data_item_get_int(obs_data_item_t item);
EXPORT double obs_data_item_get_double(obs_data_item_t item);
EXPORT bool obs_data_item_get_bool(obs_data_item_t item);
EXPORT obs_data_t obs_data_item_get_obj(obs_data_item_t item);
EXPORT obs_data_array_t obs_data_item_get_array(obs_data_item_t item);
EXPORT const char *obs_data_item_get_string(obs_data_item_t *item);
EXPORT long long obs_data_item_get_int(obs_data_item_t *item);
EXPORT double obs_data_item_get_double(obs_data_item_t *item);
EXPORT bool obs_data_item_get_bool(obs_data_item_t *item);
EXPORT obs_data_t *obs_data_item_get_obj(obs_data_item_t *item);
EXPORT obs_data_array_t *obs_data_item_get_array(obs_data_item_t *item);
EXPORT const char *obs_data_item_get_default_string(obs_data_item_t item);
EXPORT long long obs_data_item_get_default_int(obs_data_item_t item);
EXPORT double obs_data_item_get_default_double(obs_data_item_t item);
EXPORT bool obs_data_item_get_default_bool(obs_data_item_t item);
EXPORT obs_data_t obs_data_item_get_default_obj(obs_data_item_t item);
EXPORT obs_data_array_t obs_data_item_get_default_array(obs_data_item_t item);
EXPORT const char *obs_data_item_get_default_string(obs_data_item_t *item);
EXPORT long long obs_data_item_get_default_int(obs_data_item_t *item);
EXPORT double obs_data_item_get_default_double(obs_data_item_t *item);
EXPORT bool obs_data_item_get_default_bool(obs_data_item_t *item);
EXPORT obs_data_t *obs_data_item_get_default_obj(obs_data_item_t *item);
EXPORT obs_data_array_t *obs_data_item_get_default_array(obs_data_item_t *item);
EXPORT const char *obs_data_item_get_autoselect_string(obs_data_item_t item);
EXPORT long long obs_data_item_get_autoselect_int(obs_data_item_t item);
EXPORT double obs_data_item_get_autoselect_double(obs_data_item_t item);
EXPORT bool obs_data_item_get_autoselect_bool(obs_data_item_t item);
EXPORT obs_data_t obs_data_item_get_autoselect_obj(obs_data_item_t item);
EXPORT obs_data_array_t obs_data_item_get_autoselect_array(
obs_data_item_t item);
EXPORT const char *obs_data_item_get_autoselect_string(obs_data_item_t *item);
EXPORT long long obs_data_item_get_autoselect_int(obs_data_item_t *item);
EXPORT double obs_data_item_get_autoselect_double(obs_data_item_t *item);
EXPORT bool obs_data_item_get_autoselect_bool(obs_data_item_t *item);
EXPORT obs_data_t *obs_data_item_get_autoselect_obj(obs_data_item_t *item);
EXPORT obs_data_array_t *obs_data_item_get_autoselect_array(
obs_data_item_t *item);
/* ------------------------------------------------------------------------- */
/* Helper functions for certain structures */
EXPORT void obs_data_set_vec2(obs_data_t data, const char *name,
EXPORT void obs_data_set_vec2(obs_data_t *data, const char *name,
const struct vec2 *val);
EXPORT void obs_data_set_vec3(obs_data_t data, const char *name,
EXPORT void obs_data_set_vec3(obs_data_t *data, const char *name,
const struct vec3 *val);
EXPORT void obs_data_set_vec4(obs_data_t data, const char *name,
EXPORT void obs_data_set_vec4(obs_data_t *data, const char *name,
const struct vec4 *val);
EXPORT void obs_data_set_quat(obs_data_t data, const char *name,
EXPORT void obs_data_set_quat(obs_data_t *data, const char *name,
const struct quat *val);
EXPORT void obs_data_set_default_vec2(obs_data_t data, const char *name,
EXPORT void obs_data_set_default_vec2(obs_data_t *data, const char *name,
const struct vec2 *val);
EXPORT void obs_data_set_default_vec3(obs_data_t data, const char *name,
EXPORT void obs_data_set_default_vec3(obs_data_t *data, const char *name,
const struct vec3 *val);
EXPORT void obs_data_set_default_vec4(obs_data_t data, const char *name,
EXPORT void obs_data_set_default_vec4(obs_data_t *data, const char *name,
const struct vec4 *val);
EXPORT void obs_data_set_default_quat(obs_data_t data, const char *name,
EXPORT void obs_data_set_default_quat(obs_data_t *data, const char *name,
const struct quat *val);
EXPORT void obs_data_set_autoselect_vec2(obs_data_t data, const char *name,
EXPORT void obs_data_set_autoselect_vec2(obs_data_t *data, const char *name,
const struct vec2 *val);
EXPORT void obs_data_set_autoselect_vec3(obs_data_t data, const char *name,
EXPORT void obs_data_set_autoselect_vec3(obs_data_t *data, const char *name,
const struct vec3 *val);
EXPORT void obs_data_set_autoselect_vec4(obs_data_t data, const char *name,
EXPORT void obs_data_set_autoselect_vec4(obs_data_t *data, const char *name,
const struct vec4 *val);
EXPORT void obs_data_set_autoselect_quat(obs_data_t data, const char *name,
EXPORT void obs_data_set_autoselect_quat(obs_data_t *data, const char *name,
const struct quat *val);
EXPORT void obs_data_get_vec2(obs_data_t data, const char *name,
EXPORT void obs_data_get_vec2(obs_data_t *data, const char *name,
struct vec2 *val);
EXPORT void obs_data_get_vec3(obs_data_t data, const char *name,
EXPORT void obs_data_get_vec3(obs_data_t *data, const char *name,
struct vec3 *val);
EXPORT void obs_data_get_vec4(obs_data_t data, const char *name,
EXPORT void obs_data_get_vec4(obs_data_t *data, const char *name,
struct vec4 *val);
EXPORT void obs_data_get_quat(obs_data_t data, const char *name,
EXPORT void obs_data_get_quat(obs_data_t *data, const char *name,
struct quat *val);
EXPORT void obs_data_get_default_vec2(obs_data_t data, const char *name,
EXPORT void obs_data_get_default_vec2(obs_data_t *data, const char *name,
struct vec2 *val);
EXPORT void obs_data_get_default_vec3(obs_data_t data, const char *name,
EXPORT void obs_data_get_default_vec3(obs_data_t *data, const char *name,
struct vec3 *val);
EXPORT void obs_data_get_default_vec4(obs_data_t data, const char *name,
EXPORT void obs_data_get_default_vec4(obs_data_t *data, const char *name,
struct vec4 *val);
EXPORT void obs_data_get_default_quat(obs_data_t data, const char *name,
EXPORT void obs_data_get_default_quat(obs_data_t *data, const char *name,
struct quat *val);
EXPORT void obs_data_get_autoselect_vec2(obs_data_t data, const char *name,
EXPORT void obs_data_get_autoselect_vec2(obs_data_t *data, const char *name,
struct vec2 *val);
EXPORT void obs_data_get_autoselect_vec3(obs_data_t data, const char *name,
EXPORT void obs_data_get_autoselect_vec3(obs_data_t *data, const char *name,
struct vec3 *val);
EXPORT void obs_data_get_autoselect_vec4(obs_data_t data, const char *name,
EXPORT void obs_data_get_autoselect_vec4(obs_data_t *data, const char *name,
struct vec4 *val);
EXPORT void obs_data_get_autoselect_quat(obs_data_t data, const char *name,
EXPORT void obs_data_get_autoselect_quat(obs_data_t *data, const char *name,
struct quat *val);
/* ------------------------------------------------------------------------- */
/* OBS-specific functions */
static inline obs_data_t obs_data_newref(obs_data_t data)
static inline obs_data_t *obs_data_newref(obs_data_t *data)
{
if (data)
obs_data_addref(data);

View File

@ -44,7 +44,7 @@ bool obs_display_init(struct obs_display *display,
return true;
}
obs_display_t obs_display_create(struct gs_init_data *graphics_data)
obs_display_t *obs_display_create(struct gs_init_data *graphics_data)
{
struct obs_display *display = bzalloc(sizeof(struct obs_display));
@ -71,7 +71,7 @@ obs_display_t obs_display_create(struct gs_init_data *graphics_data)
return display;
}
void obs_display_free(obs_display_t display)
void obs_display_free(obs_display_t *display)
{
pthread_mutex_destroy(&display->draw_callbacks_mutex);
da_free(display->draw_callbacks);
@ -82,7 +82,7 @@ void obs_display_free(obs_display_t display)
}
}
void obs_display_destroy(obs_display_t display)
void obs_display_destroy(obs_display_t *display)
{
if (display) {
pthread_mutex_lock(&obs->data.displays_mutex);
@ -99,7 +99,7 @@ void obs_display_destroy(obs_display_t display)
}
}
void obs_display_resize(obs_display_t display, uint32_t cx, uint32_t cy)
void obs_display_resize(obs_display_t *display, uint32_t cx, uint32_t cy)
{
if (!display) return;
@ -112,7 +112,7 @@ void obs_display_resize(obs_display_t display, uint32_t cx, uint32_t cy)
pthread_mutex_unlock(&display->draw_callbacks_mutex);
}
void obs_display_add_draw_callback(obs_display_t display,
void obs_display_add_draw_callback(obs_display_t *display,
void (*draw)(void *param, uint32_t cx, uint32_t cy),
void *param)
{
@ -125,7 +125,7 @@ void obs_display_add_draw_callback(obs_display_t display,
pthread_mutex_unlock(&display->draw_callbacks_mutex);
}
void obs_display_remove_draw_callback(obs_display_t display,
void obs_display_remove_draw_callback(obs_display_t *display,
void (*draw)(void *param, uint32_t cx, uint32_t cy),
void *param)
{

View File

@ -37,7 +37,7 @@ const char *obs_encoder_get_display_name(const char *id)
}
static bool init_encoder(struct obs_encoder *encoder, const char *name,
obs_data_t settings)
obs_data_t *settings)
{
pthread_mutex_init_value(&encoder->callbacks_mutex);
pthread_mutex_init_value(&encoder->outputs_mutex);
@ -57,7 +57,7 @@ static bool init_encoder(struct obs_encoder *encoder, const char *name,
static struct obs_encoder *create_encoder(const char *id,
enum obs_encoder_type type, const char *name,
obs_data_t settings)
obs_data_t *settings)
{
struct obs_encoder *encoder;
struct obs_encoder_info *ei = find_encoder(id);
@ -83,15 +83,15 @@ static struct obs_encoder *create_encoder(const char *id,
return encoder;
}
obs_encoder_t obs_video_encoder_create(const char *id, const char *name,
obs_data_t settings)
obs_encoder_t *obs_video_encoder_create(const char *id, const char *name,
obs_data_t *settings)
{
if (!name || !id) return NULL;
return create_encoder(id, OBS_ENCODER_VIDEO, name, settings);
}
obs_encoder_t obs_audio_encoder_create(const char *id, const char *name,
obs_data_t settings)
obs_encoder_t *obs_audio_encoder_create(const char *id, const char *name,
obs_data_t *settings)
{
if (!name || !id) return NULL;
return create_encoder(id, OBS_ENCODER_AUDIO, name, settings);
@ -193,7 +193,7 @@ static inline void free_audio_buffers(struct obs_encoder *encoder)
}
}
static void obs_encoder_actually_destroy(obs_encoder_t encoder)
static void obs_encoder_actually_destroy(obs_encoder_t *encoder)
{
if (encoder) {
pthread_mutex_lock(&encoder->outputs_mutex);
@ -220,7 +220,7 @@ static void obs_encoder_actually_destroy(obs_encoder_t encoder)
/* does not actually destroy the encoder until all connections to it have been
* removed. (full reference counting really would have been superfluous) */
void obs_encoder_destroy(obs_encoder_t encoder)
void obs_encoder_destroy(obs_encoder_t *encoder)
{
if (encoder) {
bool destroy;
@ -238,31 +238,31 @@ void obs_encoder_destroy(obs_encoder_t encoder)
}
}
const char *obs_encoder_get_name(obs_encoder_t encoder)
const char *obs_encoder_get_name(obs_encoder_t *encoder)
{
return encoder ? encoder->context.name : NULL;
}
static inline obs_data_t get_defaults(const struct obs_encoder_info *info)
static inline obs_data_t *get_defaults(const struct obs_encoder_info *info)
{
obs_data_t settings = obs_data_create();
obs_data_t *settings = obs_data_create();
if (info->get_defaults)
info->get_defaults(settings);
return settings;
}
obs_data_t obs_encoder_defaults(const char *id)
obs_data_t *obs_encoder_defaults(const char *id)
{
const struct obs_encoder_info *info = find_encoder(id);
return (info) ? get_defaults(info) : NULL;
}
obs_properties_t obs_get_encoder_properties(const char *id)
obs_properties_t *obs_get_encoder_properties(const char *id)
{
const struct obs_encoder_info *ei = find_encoder(id);
if (ei && ei->get_properties) {
obs_data_t defaults = get_defaults(ei);
obs_properties_t properties;
obs_data_t *defaults = get_defaults(ei);
obs_properties_t *properties;
properties = ei->get_properties();
obs_properties_apply_settings(properties, defaults);
@ -272,10 +272,10 @@ obs_properties_t obs_get_encoder_properties(const char *id)
return NULL;
}
obs_properties_t obs_encoder_properties(obs_encoder_t encoder)
obs_properties_t *obs_encoder_properties(obs_encoder_t *encoder)
{
if (encoder && encoder->info.get_properties) {
obs_properties_t props;
obs_properties_t *props;
props = encoder->info.get_properties();
obs_properties_apply_settings(props, encoder->context.settings);
return props;
@ -283,7 +283,7 @@ obs_properties_t obs_encoder_properties(obs_encoder_t encoder)
return NULL;
}
void obs_encoder_update(obs_encoder_t encoder, obs_data_t settings)
void obs_encoder_update(obs_encoder_t *encoder, obs_data_t *settings)
{
if (!encoder) return;
@ -294,7 +294,7 @@ void obs_encoder_update(obs_encoder_t encoder, obs_data_t settings)
encoder->context.settings);
}
bool obs_encoder_get_extra_data(obs_encoder_t encoder, uint8_t **extra_data,
bool obs_encoder_get_extra_data(obs_encoder_t *encoder, uint8_t **extra_data,
size_t *size)
{
if (encoder && encoder->info.get_extra_data && encoder->context.data)
@ -304,7 +304,7 @@ bool obs_encoder_get_extra_data(obs_encoder_t encoder, uint8_t **extra_data,
return false;
}
obs_data_t obs_encoder_get_settings(obs_encoder_t encoder)
obs_data_t *obs_encoder_get_settings(obs_encoder_t *encoder)
{
if (!encoder) return NULL;
@ -336,7 +336,7 @@ static void intitialize_audio_encoder(struct obs_encoder *encoder)
reset_audio_buffers(encoder);
}
bool obs_encoder_initialize(obs_encoder_t encoder)
bool obs_encoder_initialize(obs_encoder_t *encoder)
{
if (!encoder) return false;
@ -375,7 +375,7 @@ static inline size_t get_callback_idx(
return DARRAY_INVALID;
}
void obs_encoder_start(obs_encoder_t encoder,
void obs_encoder_start(obs_encoder_t *encoder,
void (*new_packet)(void *param, struct encoder_packet *packet),
void *param)
{
@ -400,7 +400,7 @@ void obs_encoder_start(obs_encoder_t encoder,
}
}
void obs_encoder_stop(obs_encoder_t encoder,
void obs_encoder_stop(obs_encoder_t *encoder,
void (*new_packet)(void *param, struct encoder_packet *packet),
void *param)
{
@ -427,12 +427,12 @@ void obs_encoder_stop(obs_encoder_t encoder,
}
}
const char *obs_encoder_get_codec(obs_encoder_t encoder)
const char *obs_encoder_get_codec(obs_encoder_t *encoder)
{
return encoder ? encoder->info.codec : NULL;
}
void obs_encoder_set_scaled_size(obs_encoder_t encoder, uint32_t width,
void obs_encoder_set_scaled_size(obs_encoder_t *encoder, uint32_t width,
uint32_t height)
{
if (!encoder || encoder->info.type != OBS_ENCODER_VIDEO)
@ -449,7 +449,7 @@ void obs_encoder_set_scaled_size(obs_encoder_t encoder, uint32_t width,
encoder->scaled_height = height;
}
uint32_t obs_encoder_get_width(obs_encoder_t encoder)
uint32_t obs_encoder_get_width(obs_encoder_t *encoder)
{
if (!encoder || !encoder->media ||
encoder->info.type != OBS_ENCODER_VIDEO)
@ -460,7 +460,7 @@ uint32_t obs_encoder_get_width(obs_encoder_t encoder)
video_output_get_width(encoder->media);
}
uint32_t obs_encoder_get_height(obs_encoder_t encoder)
uint32_t obs_encoder_get_height(obs_encoder_t *encoder)
{
if (!encoder || !encoder->media ||
encoder->info.type != OBS_ENCODER_VIDEO)
@ -471,7 +471,7 @@ uint32_t obs_encoder_get_height(obs_encoder_t encoder)
video_output_get_height(encoder->media);
}
void obs_encoder_set_video(obs_encoder_t encoder, video_t video)
void obs_encoder_set_video(obs_encoder_t *encoder, video_t *video)
{
const struct video_output_info *voi;
@ -485,7 +485,7 @@ void obs_encoder_set_video(obs_encoder_t encoder, video_t video)
encoder->timebase_den = voi->fps_num;
}
void obs_encoder_set_audio(obs_encoder_t encoder, audio_t audio)
void obs_encoder_set_audio(obs_encoder_t *encoder, audio_t *audio)
{
if (!audio || !encoder || encoder->info.type != OBS_ENCODER_AUDIO)
return;
@ -495,19 +495,19 @@ void obs_encoder_set_audio(obs_encoder_t encoder, audio_t audio)
encoder->timebase_den = audio_output_get_sample_rate(audio);
}
video_t obs_encoder_video(obs_encoder_t encoder)
video_t *obs_encoder_video(obs_encoder_t *encoder)
{
return (encoder && encoder->info.type == OBS_ENCODER_VIDEO) ?
encoder->media : NULL;
}
audio_t obs_encoder_audio(obs_encoder_t encoder)
audio_t *obs_encoder_audio(obs_encoder_t *encoder)
{
return (encoder && encoder->info.type == OBS_ENCODER_AUDIO) ?
encoder->media : NULL;
}
bool obs_encoder_active(obs_encoder_t encoder)
bool obs_encoder_active(obs_encoder_t *encoder)
{
return encoder ? encoder->active : false;
}

View File

@ -114,7 +114,7 @@ struct obs_encoder_info {
* @return Data associated with this encoder context, or
* NULL if initialization failed.
*/
void *(*create)(obs_data_t settings, obs_encoder_t encoder);
void *(*create)(obs_data_t *settings, obs_encoder_t *encoder);
/**
* Destroys the encoder data
@ -149,14 +149,14 @@ struct obs_encoder_info {
*
* @param[out] settings Data to assign default settings to
*/
void (*get_defaults)(obs_data_t settings);
void (*get_defaults)(obs_data_t *settings);
/**
* Gets the property information of this encoder
*
* @return The properties data
*/
obs_properties_t (*get_properties)(void);
obs_properties_t *(*get_properties)(void);
/**
* Updates the settings for this encoder (usually used for things like
@ -166,7 +166,7 @@ struct obs_encoder_info {
* @param settings New settings for this encoder
* @return true if successful, false otherwise
*/
bool (*update)(void *data, obs_data_t settings);
bool (*update)(void *data, obs_data_t *settings);
/**
* Returns extra data associated with this encoder (usually header)

View File

@ -62,7 +62,7 @@ struct obs_module {
void (*set_locale)(const char *locale);
void (*free_locale)(void);
uint32_t (*ver)(void);
void (*set_pointer)(obs_module_t module);
void (*set_pointer)(obs_module_t *module);
const char *(*name)(void);
const char *(*description)(void);
const char *(*author)(void);
@ -100,7 +100,7 @@ static inline bool check_path(const char *data, const char *path,
struct obs_view {
pthread_mutex_t channels_mutex;
obs_source_t channels[MAX_CHANNELS];
obs_source_t *channels[MAX_CHANNELS];
};
extern bool obs_view_init(struct obs_view *view);
@ -113,7 +113,7 @@ extern void obs_view_free(struct obs_view *view);
struct obs_display {
bool size_changed;
uint32_t cx, cy;
gs_swapchain_t swap;
gs_swapchain_t *swap;
pthread_mutex_t draw_callbacks_mutex;
DARRAY(struct draw_callback) draw_callbacks;
@ -130,23 +130,23 @@ extern void obs_display_free(struct obs_display *display);
/* core */
struct obs_core_video {
graphics_t graphics;
gs_stagesurf_t copy_surfaces[NUM_TEXTURES];
gs_texture_t render_textures[NUM_TEXTURES];
gs_texture_t output_textures[NUM_TEXTURES];
gs_texture_t convert_textures[NUM_TEXTURES];
graphics_t *graphics;
gs_stagesurf_t *copy_surfaces[NUM_TEXTURES];
gs_texture_t *render_textures[NUM_TEXTURES];
gs_texture_t *output_textures[NUM_TEXTURES];
gs_texture_t *convert_textures[NUM_TEXTURES];
bool textures_rendered[NUM_TEXTURES];
bool textures_output[NUM_TEXTURES];
bool textures_copied[NUM_TEXTURES];
bool textures_converted[NUM_TEXTURES];
struct obs_source_frame convert_frames[NUM_TEXTURES];
gs_effect_t default_effect;
gs_effect_t solid_effect;
gs_effect_t conversion_effect;
gs_stagesurf_t mapped_surface;
gs_effect_t *default_effect;
gs_effect_t *solid_effect;
gs_effect_t *conversion_effect;
gs_stagesurf_t *mapped_surface;
int cur_texture;
video_t video;
video_t *video;
pthread_t video_thread;
bool thread_initialized;
@ -167,7 +167,7 @@ struct obs_core_video {
struct obs_core_audio {
/* TODO: sound output subsystem */
audio_t audio;
audio_t *audio;
float user_volume;
float present_volume;
@ -210,8 +210,8 @@ struct obs_core {
DARRAY(struct obs_modal_ui) modal_ui_callbacks;
DARRAY(struct obs_modeless_ui) modeless_ui_callbacks;
signal_handler_t signals;
proc_handler_t procs;
signal_handler_t *signals;
proc_handler_t *procs;
char *locale;
@ -233,9 +233,9 @@ extern void *obs_video_thread(void *param);
struct obs_context_data {
char *name;
void *data;
obs_data_t settings;
signal_handler_t signals;
proc_handler_t procs;
obs_data_t *settings;
signal_handler_t *signals;
proc_handler_t *procs;
DARRAY(char*) rename_cache;
pthread_mutex_t rename_cache_mutex;
@ -247,7 +247,7 @@ struct obs_context_data {
extern bool obs_context_data_init(
struct obs_context_data *context,
obs_data_t settings,
obs_data_t *settings,
const char *name);
extern void obs_context_data_free(struct obs_context_data *context);
@ -298,8 +298,8 @@ struct obs_source {
/* audio */
bool audio_failed;
struct resample_info sample_info;
audio_resampler_t resampler;
audio_line_t audio_line;
audio_resampler_t *resampler;
audio_line_t *audio_line;
pthread_mutex_t audio_mutex;
struct obs_audio_data audio_data;
size_t audio_storage_size;
@ -321,8 +321,8 @@ struct obs_source {
float transition_volume;
/* async video data */
gs_texture_t async_texture;
gs_texrender_t async_convert_texrender;
gs_texture_t *async_texture;
gs_texrender_t *async_convert_texrender;
bool async_gpu_conversion;
enum video_format async_format;
enum gs_color_format async_texture_format;
@ -344,14 +344,14 @@ struct obs_source {
struct obs_source *filter_target;
DARRAY(struct obs_source*) filters;
pthread_mutex_t filter_mutex;
gs_texrender_t filter_texrender;
gs_texrender_t *filter_texrender;
bool rendering_filter;
};
extern const struct obs_source_info *find_source(struct darray *list,
const char *id);
extern bool obs_source_init_context(struct obs_source *source,
obs_data_t settings, const char *name);
obs_data_t *settings, const char *name);
extern bool obs_source_init(struct obs_source *source,
const struct obs_source_info *info);
@ -362,9 +362,9 @@ enum view_type {
AUX_VIEW
};
extern void obs_source_activate(obs_source_t source, enum view_type type);
extern void obs_source_deactivate(obs_source_t source, enum view_type type);
extern void obs_source_video_tick(obs_source_t source, float seconds);
extern void obs_source_activate(obs_source_t *source, enum view_type type);
extern void obs_source_deactivate(obs_source_t *source, enum view_type type);
extern void obs_source_video_tick(obs_source_t *source, float seconds);
/* ------------------------------------------------------------------------- */
@ -389,7 +389,7 @@ struct obs_output {
int reconnect_retries;
bool reconnecting;
pthread_t reconnect_thread;
os_event_t reconnect_stop_event;
os_event_t *reconnect_stop_event;
volatile bool reconnect_thread_active;
uint32_t starting_frame_count;
@ -398,11 +398,11 @@ struct obs_output {
int total_frames;
bool active;
video_t video;
audio_t audio;
obs_encoder_t video_encoder;
obs_encoder_t audio_encoder;
obs_service_t service;
video_t *video;
audio_t *audio;
obs_encoder_t *video_encoder;
obs_encoder_t *audio_encoder;
obs_service_t *service;
uint32_t scaled_width;
uint32_t scaled_height;
@ -462,11 +462,11 @@ struct obs_encoder {
uint64_t start_ts;
pthread_mutex_t outputs_mutex;
DARRAY(obs_output_t) outputs;
DARRAY(obs_output_t*) outputs;
bool destroy_on_stop;
/* stores the video/audio media output pointer. video_t or audio_t */
/* stores the video/audio media output pointer. video_t *or audio_t **/
void *media;
pthread_mutex_t callbacks_mutex;
@ -475,12 +475,12 @@ struct obs_encoder {
extern struct obs_encoder_info *find_encoder(const char *id);
extern bool obs_encoder_initialize(obs_encoder_t encoder);
extern bool obs_encoder_initialize(obs_encoder_t *encoder);
extern void obs_encoder_start(obs_encoder_t encoder,
extern void obs_encoder_start(obs_encoder_t *encoder,
void (*new_packet)(void *param, struct encoder_packet *packet),
void *param);
extern void obs_encoder_stop(obs_encoder_t encoder,
extern void obs_encoder_stop(obs_encoder_t *encoder,
void (*new_packet)(void *param, struct encoder_packet *packet),
void *param);

View File

@ -56,7 +56,7 @@ static int load_module_exports(struct obs_module *mod, const char *path)
return MODULE_SUCCESS;
}
int obs_open_module(obs_module_t *module, const char *path,
int obs_open_module(obs_module_t **module, const char *path,
const char *data_path)
{
struct obs_module mod = {0};
@ -91,7 +91,7 @@ int obs_open_module(obs_module_t *module, const char *path,
return MODULE_SUCCESS;
}
bool obs_init_module(obs_module_t module)
bool obs_init_module(obs_module_t *module)
{
if (!module || !obs)
return false;
@ -106,37 +106,37 @@ bool obs_init_module(obs_module_t module)
return module->loaded;
}
const char *obs_get_module_file_name(obs_module_t module)
const char *obs_get_module_file_name(obs_module_t *module)
{
return module ? module->file : NULL;
}
const char *obs_get_module_name(obs_module_t module)
const char *obs_get_module_name(obs_module_t *module)
{
return (module && module->name) ? module->name() : NULL;
}
const char *obs_get_module_author(obs_module_t module)
const char *obs_get_module_author(obs_module_t *module)
{
return (module && module->author) ? module->author() : NULL;
}
const char *obs_get_module_description(obs_module_t module)
const char *obs_get_module_description(obs_module_t *module)
{
return (module && module->description) ? module->description() : NULL;
}
const char *obs_get_module_binary_path(obs_module_t module)
const char *obs_get_module_binary_path(obs_module_t *module)
{
return module ? module->bin_path : NULL;
}
const char *obs_get_module_data_path(obs_module_t module)
const char *obs_get_module_data_path(obs_module_t *module)
{
return module ? module->data_path : NULL;
}
char *obs_find_module_file(obs_module_t module, const char *file)
char *obs_find_module_file(obs_module_t *module, const char *file)
{
struct dstr output = {0};
@ -166,7 +166,7 @@ void obs_add_module_path(const char *bin, const char *data)
static void load_all_callback(void *param, const struct obs_module_info *info)
{
obs_module_t module;
obs_module_t *module;
int code = obs_open_module(&module, info->bin_path, info->data_path);
if (code != MODULE_SUCCESS) {
@ -287,7 +287,7 @@ static void find_modules_in_path(struct obs_module_path *omp,
struct dstr search_path = {0};
char *module_start;
bool search_directories = false;
os_glob_t gi;
os_glob_t *gi;
dstr_copy(&search_path, omp->bin);
@ -365,11 +365,11 @@ void free_module(struct obs_module *mod)
bfree(mod);
}
lookup_t obs_module_load_locale(obs_module_t module, const char *default_locale,
const char *locale)
lookup_t *obs_module_load_locale(obs_module_t *module,
const char *default_locale, const char *locale)
{
struct dstr str = {0};
lookup_t lookup = NULL;
lookup_t *lookup = NULL;
if (!module || !default_locale || !locale) {
blog(LOG_WARNING, "obs_module_load_locale: Invalid parameters");

View File

@ -35,13 +35,13 @@
/** Required: Declares a libobs module. */
#define OBS_DECLARE_MODULE() \
static obs_module_t obs_module_pointer; \
MODULE_EXPORT void obs_module_set_pointer(obs_module_t module); \
void obs_module_set_pointer(obs_module_t module) \
static obs_module_t *obs_module_pointer; \
MODULE_EXPORT void obs_module_set_pointer(obs_module_t *module); \
void obs_module_set_pointer(obs_module_t *module) \
{ \
obs_module_pointer = module; \
} \
obs_module_t obs_current_module(void) {return obs_module_pointer;} \
obs_module_t *obs_current_module(void) {return obs_module_pointer;} \
MODULE_EXPORT uint32_t obs_module_ver(void); \
uint32_t obs_module_ver(void) {return LIBOBS_API_VER;}
@ -66,7 +66,7 @@ MODULE_EXPORT void obs_module_free_locale(void);
/** Optional: Use this macro in a module to use default locale handling. */
#define OBS_MODULE_USE_DEFAULT_LOCALE(module_name, default_locale) \
lookup_t obs_module_lookup = NULL; \
lookup_t *obs_module_lookup = NULL; \
const char *obs_module_text(const char *val) \
{ \
const char *out = val; \
@ -89,7 +89,7 @@ MODULE_EXPORT void obs_module_free_locale(void);
MODULE_EXTERN const char *obs_module_text(const char *lookup_string);
/** Helper function that returns the current module */
MODULE_EXTERN obs_module_t obs_current_module(void);
MODULE_EXTERN obs_module_t *obs_current_module(void);
/**
* Returns the location to a module data file associated with the current

View File

@ -47,7 +47,7 @@ static const char *output_signals[] = {
};
static bool init_output_handlers(struct obs_output *output, const char *name,
obs_data_t settings)
obs_data_t *settings)
{
if (!obs_context_data_init(&output->context, settings, name))
return false;
@ -56,8 +56,8 @@ static bool init_output_handlers(struct obs_output *output, const char *name,
return true;
}
obs_output_t obs_output_create(const char *id, const char *name,
obs_data_t settings)
obs_output_t *obs_output_create(const char *id, const char *name,
obs_data_t *settings)
{
const struct obs_output_info *info = find_output(id);
struct obs_output *output;
@ -114,7 +114,7 @@ static inline void free_packets(struct obs_output *output)
da_free(output->interleaved_packets);
}
void obs_output_destroy(obs_output_t output)
void obs_output_destroy(obs_output_t *output)
{
if (output) {
obs_context_data_remove(&output->context);
@ -147,12 +147,12 @@ void obs_output_destroy(obs_output_t output)
}
}
const char *obs_output_get_name(obs_output_t output)
const char *obs_output_get_name(obs_output_t *output)
{
return output ? output->context.name : NULL;
}
bool obs_output_start(obs_output_t output)
bool obs_output_start(obs_output_t *output)
{
bool success;
@ -192,7 +192,7 @@ static void log_frame_info(struct obs_output *output)
skipped, percentage_skipped);
}
void obs_output_stop(obs_output_t output)
void obs_output_stop(obs_output_t *output)
{
if (output) {
os_event_signal(output->reconnect_stop_event);
@ -207,32 +207,32 @@ void obs_output_stop(obs_output_t output)
}
}
bool obs_output_active(obs_output_t output)
bool obs_output_active(obs_output_t *output)
{
return (output != NULL) ?
(output->active || output->reconnecting) : false;
}
static inline obs_data_t get_defaults(const struct obs_output_info *info)
static inline obs_data_t *get_defaults(const struct obs_output_info *info)
{
obs_data_t settings = obs_data_create();
obs_data_t *settings = obs_data_create();
if (info->get_defaults)
info->get_defaults(settings);
return settings;
}
obs_data_t obs_output_defaults(const char *id)
obs_data_t *obs_output_defaults(const char *id)
{
const struct obs_output_info *info = find_output(id);
return (info) ? get_defaults(info) : NULL;
}
obs_properties_t obs_get_output_properties(const char *id)
obs_properties_t *obs_get_output_properties(const char *id)
{
const struct obs_output_info *info = find_output(id);
if (info && info->get_properties) {
obs_data_t defaults = get_defaults(info);
obs_properties_t properties;
obs_data_t *defaults = get_defaults(info);
obs_properties_t *properties;
properties = info->get_properties();
obs_properties_apply_settings(properties, defaults);
@ -242,10 +242,10 @@ obs_properties_t obs_get_output_properties(const char *id)
return NULL;
}
obs_properties_t obs_output_properties(obs_output_t output)
obs_properties_t *obs_output_properties(obs_output_t *output)
{
if (output && output->info.get_properties) {
obs_properties_t props;
obs_properties_t *props;
props = output->info.get_properties();
obs_properties_apply_settings(props, output->context.settings);
return props;
@ -254,7 +254,7 @@ obs_properties_t obs_output_properties(obs_output_t output)
return NULL;
}
void obs_output_update(obs_output_t output, obs_data_t settings)
void obs_output_update(obs_output_t *output, obs_data_t *settings)
{
if (!output) return;
@ -265,7 +265,7 @@ void obs_output_update(obs_output_t output, obs_data_t settings)
output->context.settings);
}
obs_data_t obs_output_get_settings(obs_output_t output)
obs_data_t *obs_output_get_settings(obs_output_t *output)
{
if (!output)
return NULL;
@ -274,28 +274,28 @@ obs_data_t obs_output_get_settings(obs_output_t output)
return output->context.settings;
}
bool obs_output_canpause(obs_output_t output)
bool obs_output_canpause(obs_output_t *output)
{
return output ? (output->info.pause != NULL) : false;
}
void obs_output_pause(obs_output_t output)
void obs_output_pause(obs_output_t *output)
{
if (output && output->info.pause)
output->info.pause(output->context.data);
}
signal_handler_t obs_output_get_signal_handler(obs_output_t output)
signal_handler_t *obs_output_get_signal_handler(obs_output_t *output)
{
return output ? output->context.signals : NULL;
}
proc_handler_t obs_output_get_proc_handler(obs_output_t output)
proc_handler_t *obs_output_get_proc_handler(obs_output_t *output)
{
return output ? output->context.procs : NULL;
}
void obs_output_set_media(obs_output_t output, video_t video, audio_t audio)
void obs_output_set_media(obs_output_t *output, video_t *video, audio_t *audio)
{
if (!output)
return;
@ -304,12 +304,12 @@ void obs_output_set_media(obs_output_t output, video_t video, audio_t audio)
output->audio = audio;
}
video_t obs_output_video(obs_output_t output)
video_t *obs_output_video(obs_output_t *output)
{
return output ? output->video : NULL;
}
audio_t obs_output_audio(obs_output_t output)
audio_t *obs_output_audio(obs_output_t *output)
{
return output ? output->audio : NULL;
}
@ -325,7 +325,7 @@ void obs_output_remove_encoder(struct obs_output *output,
output->audio_encoder = NULL;
}
void obs_output_set_video_encoder(obs_output_t output, obs_encoder_t encoder)
void obs_output_set_video_encoder(obs_output_t *output, obs_encoder_t *encoder)
{
if (!output) return;
if (output->video_encoder == encoder) return;
@ -341,7 +341,7 @@ void obs_output_set_video_encoder(obs_output_t output, obs_encoder_t encoder)
output->scaled_width, output->scaled_height);
}
void obs_output_set_audio_encoder(obs_output_t output, obs_encoder_t encoder)
void obs_output_set_audio_encoder(obs_output_t *output, obs_encoder_t *encoder)
{
if (!output) return;
if (output->audio_encoder == encoder) return;
@ -352,17 +352,17 @@ void obs_output_set_audio_encoder(obs_output_t output, obs_encoder_t encoder)
output->audio_encoder = encoder;
}
obs_encoder_t obs_output_get_video_encoder(obs_output_t output)
obs_encoder_t *obs_output_get_video_encoder(obs_output_t *output)
{
return output ? output->video_encoder : NULL;
}
obs_encoder_t obs_output_get_audio_encoder(obs_output_t output)
obs_encoder_t *obs_output_get_audio_encoder(obs_output_t *output)
{
return output ? output->audio_encoder : NULL;
}
void obs_output_set_service(obs_output_t output, obs_service_t service)
void obs_output_set_service(obs_output_t *output, obs_service_t *service)
{
if (!output || output->active || !service || service->active) return;
@ -373,12 +373,12 @@ void obs_output_set_service(obs_output_t output, obs_service_t service)
service->output = output;
}
obs_service_t obs_output_get_service(obs_output_t output)
obs_service_t *obs_output_get_service(obs_output_t *output)
{
return output ? output->service : NULL;
}
void obs_output_set_reconnect_settings(obs_output_t output,
void obs_output_set_reconnect_settings(obs_output_t *output,
int retry_count, int retry_sec)
{
if (!output) return;
@ -387,7 +387,7 @@ void obs_output_set_reconnect_settings(obs_output_t output,
output->reconnect_retry_sec = retry_sec;
}
uint64_t obs_output_get_total_bytes(obs_output_t output)
uint64_t obs_output_get_total_bytes(obs_output_t *output)
{
if (!output || !output->info.get_total_bytes)
return 0;
@ -395,7 +395,7 @@ uint64_t obs_output_get_total_bytes(obs_output_t output)
return output->info.get_total_bytes(output->context.data);
}
int obs_output_get_frames_dropped(obs_output_t output)
int obs_output_get_frames_dropped(obs_output_t *output)
{
if (!output || !output->info.get_dropped_frames)
return 0;
@ -403,12 +403,12 @@ int obs_output_get_frames_dropped(obs_output_t output)
return output->info.get_dropped_frames(output->context.data);
}
int obs_output_get_total_frames(obs_output_t output)
int obs_output_get_total_frames(obs_output_t *output)
{
return output ? output->total_frames : 0;
}
void obs_output_set_preferred_size(obs_output_t output, uint32_t width,
void obs_output_set_preferred_size(obs_output_t *output, uint32_t width,
uint32_t height)
{
if (!output || (output->info.flags & OBS_OUTPUT_VIDEO) == 0)
@ -431,7 +431,7 @@ void obs_output_set_preferred_size(obs_output_t output, uint32_t width,
}
}
uint32_t obs_output_get_width(obs_output_t output)
uint32_t obs_output_get_width(obs_output_t *output)
{
if (!output || (output->info.flags & OBS_OUTPUT_VIDEO) == 0)
return 0;
@ -444,7 +444,7 @@ uint32_t obs_output_get_width(obs_output_t output)
video_output_get_width(output->video);
}
uint32_t obs_output_get_height(obs_output_t output)
uint32_t obs_output_get_height(obs_output_t *output)
{
if (!output || (output->info.flags & OBS_OUTPUT_VIDEO) == 0)
return 0;
@ -457,7 +457,7 @@ uint32_t obs_output_get_height(obs_output_t output)
video_output_get_height(output->video);
}
void obs_output_set_video_conversion(obs_output_t output,
void obs_output_set_video_conversion(obs_output_t *output,
const struct video_scale_info *conversion)
{
if (!output || !conversion) return;
@ -466,7 +466,7 @@ void obs_output_set_video_conversion(obs_output_t output,
output->video_conversion_set = true;
}
void obs_output_set_audio_conversion(obs_output_t output,
void obs_output_set_audio_conversion(obs_output_t *output,
const struct audio_convert_info *conversion)
{
if (!output || !conversion) return;
@ -760,7 +760,7 @@ static inline void convert_flags(struct obs_output *output, uint32_t flags,
*has_service = (flags & OBS_OUTPUT_SERVICE) != 0;
}
bool obs_output_can_begin_data_capture(obs_output_t output, uint32_t flags)
bool obs_output_can_begin_data_capture(obs_output_t *output, uint32_t flags)
{
bool encoded, has_video, has_audio, has_service;
@ -774,7 +774,7 @@ bool obs_output_can_begin_data_capture(obs_output_t output, uint32_t flags)
has_service);
}
bool obs_output_initialize_encoders(obs_output_t output, uint32_t flags)
bool obs_output_initialize_encoders(obs_output_t *output, uint32_t flags)
{
bool encoded, has_video, has_audio, has_service;
@ -803,7 +803,7 @@ bool obs_output_initialize_encoders(obs_output_t output, uint32_t flags)
return true;
}
bool obs_output_begin_data_capture(obs_output_t output, uint32_t flags)
bool obs_output_begin_data_capture(obs_output_t *output, uint32_t flags)
{
bool encoded, has_video, has_audio, has_service;
@ -836,7 +836,7 @@ bool obs_output_begin_data_capture(obs_output_t output, uint32_t flags)
return true;
}
void obs_output_end_data_capture(obs_output_t output)
void obs_output_end_data_capture(obs_output_t *output)
{
bool encoded, has_video, has_audio, has_service;
void (*encoded_callback)(void *data, struct encoder_packet *packet);
@ -925,7 +925,7 @@ static void output_reconnect(struct obs_output *output)
}
}
void obs_output_signal_stop(obs_output_t output, int code)
void obs_output_signal_stop(obs_output_t *output, int code)
{
if (!output)
return;

View File

@ -33,7 +33,7 @@ struct obs_output_info {
const char *(*get_name)(void);
void *(*create)(obs_data_t settings, obs_output_t output);
void *(*create)(obs_data_t *settings, obs_output_t *output);
void (*destroy)(void *data);
bool (*start)(void *data);
@ -45,11 +45,11 @@ struct obs_output_info {
void (*encoded_packet)(void *data, struct encoder_packet *packet);
/* optional */
void (*update)(void *data, obs_data_t settings);
void (*update)(void *data, obs_data_t *settings);
void (*get_defaults)(obs_data_t settings);
void (*get_defaults)(obs_data_t *settings);
obs_properties_t (*get_properties)(void);
obs_properties_t *(*get_properties)(void);
void (*pause)(void *data);

View File

@ -110,7 +110,7 @@ struct obs_properties {
struct obs_property **last;
};
obs_properties_t obs_properties_create(void)
obs_properties_t *obs_properties_create(void)
{
struct obs_properties *props;
props = bzalloc(sizeof(struct obs_properties));
@ -118,7 +118,7 @@ obs_properties_t obs_properties_create(void)
return props;
}
void obs_properties_set_param(obs_properties_t props,
void obs_properties_set_param(obs_properties_t *props,
void *param, void (*destroy)(void *param))
{
if (!props)
@ -131,12 +131,12 @@ void obs_properties_set_param(obs_properties_t props,
props->destroy = destroy;
}
void *obs_properties_get_param(obs_properties_t props)
void *obs_properties_get_param(obs_properties_t *props)
{
return props ? props->param : NULL;
}
obs_properties_t obs_properties_create_param(void *param,
obs_properties_t *obs_properties_create_param(void *param,
void (*destroy)(void *param))
{
struct obs_properties *props = obs_properties_create();
@ -154,7 +154,7 @@ static void obs_property_destroy(struct obs_property *property)
bfree(property);
}
void obs_properties_destroy(obs_properties_t props)
void obs_properties_destroy(obs_properties_t *props)
{
if (props) {
struct obs_property *p = props->first_property;
@ -172,12 +172,12 @@ void obs_properties_destroy(obs_properties_t props)
}
}
obs_property_t obs_properties_first(obs_properties_t props)
obs_property_t *obs_properties_first(obs_properties_t *props)
{
return (props != NULL) ? props->first_property : NULL;
}
obs_property_t obs_properties_get(obs_properties_t props, const char *name)
obs_property_t *obs_properties_get(obs_properties_t *props, const char *name)
{
struct obs_property *property;
@ -195,7 +195,7 @@ obs_property_t obs_properties_get(obs_properties_t props, const char *name)
return NULL;
}
void obs_properties_apply_settings(obs_properties_t props, obs_data_t settings)
void obs_properties_apply_settings(obs_properties_t *props, obs_data_t *settings)
{
struct obs_property *p = props->first_property;
@ -282,15 +282,15 @@ static inline void *get_type_data(struct obs_property *prop,
return get_property_data(prop);
}
obs_property_t obs_properties_add_bool(obs_properties_t props, const char *name,
const char *desc)
obs_property_t *obs_properties_add_bool(obs_properties_t *props,
const char *name, const char *desc)
{
if (!props || has_prop(props, name)) return NULL;
return new_prop(props, name, desc, OBS_PROPERTY_BOOL);
}
obs_property_t obs_properties_add_int(obs_properties_t props, const char *name,
const char *desc, int min, int max, int step)
obs_property_t *obs_properties_add_int(obs_properties_t *props,
const char *name, const char *desc, int min, int max, int step)
{
if (!props || has_prop(props, name)) return NULL;
@ -302,7 +302,7 @@ obs_property_t obs_properties_add_int(obs_properties_t props, const char *name,
return p;
}
obs_property_t obs_properties_add_float(obs_properties_t props,
obs_property_t *obs_properties_add_float(obs_properties_t *props,
const char *name, const char *desc,
double min, double max, double step)
{
@ -317,8 +317,8 @@ obs_property_t obs_properties_add_float(obs_properties_t props,
return p;
}
obs_property_t obs_properties_add_text(obs_properties_t props, const char *name,
const char *desc, enum obs_text_type type)
obs_property_t *obs_properties_add_text(obs_properties_t *props,
const char *name, const char *desc, enum obs_text_type type)
{
if (!props || has_prop(props, name)) return NULL;
@ -328,9 +328,9 @@ obs_property_t obs_properties_add_text(obs_properties_t props, const char *name,
return p;
}
obs_property_t obs_properties_add_path(obs_properties_t props, const char *name,
const char *desc, enum obs_path_type type, const char *filter,
const char *default_path)
obs_property_t *obs_properties_add_path(obs_properties_t *props,
const char *name, const char *desc, enum obs_path_type type,
const char *filter, const char *default_path)
{
if (!props || has_prop(props, name)) return NULL;
@ -345,7 +345,7 @@ obs_property_t obs_properties_add_path(obs_properties_t props, const char *name,
return p;
}
obs_property_t obs_properties_add_list(obs_properties_t props,
obs_property_t *obs_properties_add_list(obs_properties_t *props,
const char *name, const char *desc,
enum obs_combo_type type,
enum obs_combo_format format)
@ -367,14 +367,14 @@ obs_property_t obs_properties_add_list(obs_properties_t props,
return p;
}
obs_property_t obs_properties_add_color(obs_properties_t props,
obs_property_t *obs_properties_add_color(obs_properties_t *props,
const char *name, const char *desc)
{
if (!props || has_prop(props, name)) return NULL;
return new_prop(props, name, desc, OBS_PROPERTY_COLOR);
}
obs_property_t obs_properties_add_button(obs_properties_t props,
obs_property_t *obs_properties_add_button(obs_properties_t *props,
const char *name, const char *text,
obs_property_clicked_t callback)
{
@ -387,7 +387,7 @@ obs_property_t obs_properties_add_button(obs_properties_t props,
return p;
}
obs_property_t obs_properties_add_font(obs_properties_t props,
obs_property_t *obs_properties_add_font(obs_properties_t *props,
const char *name, const char *desc)
{
if (!props || has_prop(props, name)) return NULL;
@ -416,7 +416,7 @@ static inline struct list_data *get_list_fmt_data(struct obs_property *p,
/* ------------------------------------------------------------------------- */
bool obs_property_next(obs_property_t *p)
bool obs_property_next(obs_property_t **p)
{
if (!p || !*p)
return false;
@ -425,20 +425,20 @@ bool obs_property_next(obs_property_t *p)
return *p != NULL;
}
void obs_property_set_modified_callback(obs_property_t p,
void obs_property_set_modified_callback(obs_property_t *p,
obs_property_modified_t modified)
{
if (p) p->modified = modified;
}
bool obs_property_modified(obs_property_t p, obs_data_t settings)
bool obs_property_modified(obs_property_t *p, obs_data_t *settings)
{
if (p && p->modified)
return p->modified(p->parent, p, settings);
return false;
}
bool obs_property_button_clicked(obs_property_t p, void *obj)
bool obs_property_button_clicked(obs_property_t *p, void *obj)
{
struct obs_context_data *context = obj;
if (p) {
@ -451,114 +451,114 @@ bool obs_property_button_clicked(obs_property_t p, void *obj)
return false;
}
void obs_property_set_visible(obs_property_t p, bool visible)
void obs_property_set_visible(obs_property_t *p, bool visible)
{
if (p) p->visible = visible;
}
void obs_property_set_enabled(obs_property_t p, bool enabled)
void obs_property_set_enabled(obs_property_t *p, bool enabled)
{
if (p) p->enabled = enabled;
}
const char *obs_property_name(obs_property_t p)
const char *obs_property_name(obs_property_t *p)
{
return p ? p->name : NULL;
}
const char *obs_property_description(obs_property_t p)
const char *obs_property_description(obs_property_t *p)
{
return p ? p->desc : NULL;
}
enum obs_property_type obs_property_get_type(obs_property_t p)
enum obs_property_type obs_property_get_type(obs_property_t *p)
{
return p ? p->type : OBS_PROPERTY_INVALID;
}
bool obs_property_enabled(obs_property_t p)
bool obs_property_enabled(obs_property_t *p)
{
return p ? p->enabled : false;
}
bool obs_property_visible(obs_property_t p)
bool obs_property_visible(obs_property_t *p)
{
return p ? p->visible : false;
}
int obs_property_int_min(obs_property_t p)
int obs_property_int_min(obs_property_t *p)
{
struct int_data *data = get_type_data(p, OBS_PROPERTY_INT);
return data ? data->min : 0;
}
int obs_property_int_max(obs_property_t p)
int obs_property_int_max(obs_property_t *p)
{
struct int_data *data = get_type_data(p, OBS_PROPERTY_INT);
return data ? data->max : 0;
}
int obs_property_int_step(obs_property_t p)
int obs_property_int_step(obs_property_t *p)
{
struct int_data *data = get_type_data(p, OBS_PROPERTY_INT);
return data ? data->step : 0;
}
double obs_property_float_min(obs_property_t p)
double obs_property_float_min(obs_property_t *p)
{
struct float_data *data = get_type_data(p, OBS_PROPERTY_FLOAT);
return data ? data->min : 0;
}
double obs_property_float_max(obs_property_t p)
double obs_property_float_max(obs_property_t *p)
{
struct float_data *data = get_type_data(p, OBS_PROPERTY_FLOAT);
return data ? data->max : 0;
}
double obs_property_float_step(obs_property_t p)
double obs_property_float_step(obs_property_t *p)
{
struct float_data *data = get_type_data(p, OBS_PROPERTY_FLOAT);
return data ? data->step : 0;
}
enum obs_text_type obs_proprety_text_type(obs_property_t p)
enum obs_text_type obs_proprety_text_type(obs_property_t *p)
{
struct text_data *data = get_type_data(p, OBS_PROPERTY_TEXT);
return data ? data->type : OBS_TEXT_DEFAULT;
}
enum obs_path_type obs_property_path_type(obs_property_t p)
enum obs_path_type obs_property_path_type(obs_property_t *p)
{
struct path_data *data = get_type_data(p, OBS_PROPERTY_PATH);
return data ? data->type : OBS_PATH_DIRECTORY;
}
const char *obs_property_path_filter(obs_property_t p)
const char *obs_property_path_filter(obs_property_t *p)
{
struct path_data *data = get_type_data(p, OBS_PROPERTY_PATH);
return data ? data->filter : NULL;
}
const char *obs_property_path_default_path(obs_property_t p)
const char *obs_property_path_default_path(obs_property_t *p)
{
struct path_data *data = get_type_data(p, OBS_PROPERTY_PATH);
return data ? data->default_path : NULL;
}
enum obs_combo_type obs_property_list_type(obs_property_t p)
enum obs_combo_type obs_property_list_type(obs_property_t *p)
{
struct list_data *data = get_list_data(p);
return data ? data->type : OBS_COMBO_TYPE_INVALID;
}
enum obs_combo_format obs_property_list_format(obs_property_t p)
enum obs_combo_format obs_property_list_format(obs_property_t *p)
{
struct list_data *data = get_list_data(p);
return data ? data->format : OBS_COMBO_FORMAT_INVALID;
}
void obs_property_list_clear(obs_property_t p)
void obs_property_list_clear(obs_property_t *p)
{
struct list_data *data = get_list_data(p);
if (data)
@ -581,7 +581,7 @@ static size_t add_item(struct list_data *data, const char *name,
return da_push_back(data->items, &item);
}
size_t obs_property_list_add_string(obs_property_t p,
size_t obs_property_list_add_string(obs_property_t *p,
const char *name, const char *val)
{
struct list_data *data = get_list_data(p);
@ -590,7 +590,7 @@ size_t obs_property_list_add_string(obs_property_t p,
return 0;
}
size_t obs_property_list_add_int(obs_property_t p,
size_t obs_property_list_add_int(obs_property_t *p,
const char *name, long long val)
{
struct list_data *data = get_list_data(p);
@ -599,7 +599,7 @@ size_t obs_property_list_add_int(obs_property_t p,
return 0;
}
size_t obs_property_list_add_float(obs_property_t p,
size_t obs_property_list_add_float(obs_property_t *p,
const char *name, double val)
{
struct list_data *data = get_list_data(p);
@ -608,7 +608,7 @@ size_t obs_property_list_add_float(obs_property_t p,
return 0;
}
void obs_property_list_item_remove(obs_property_t p, size_t idx)
void obs_property_list_item_remove(obs_property_t *p, size_t idx)
{
struct list_data *data = get_list_data(p);
if (data && idx < data->items.num) {
@ -617,20 +617,21 @@ void obs_property_list_item_remove(obs_property_t p, size_t idx)
}
}
size_t obs_property_list_item_count(obs_property_t p)
size_t obs_property_list_item_count(obs_property_t *p)
{
struct list_data *data = get_list_data(p);
return data ? data->items.num : 0;
}
bool obs_property_list_item_disabled(obs_property_t p, size_t idx)
bool obs_property_list_item_disabled(obs_property_t *p, size_t idx)
{
struct list_data *data = get_list_data(p);
return (data && idx < data->items.num) ?
data->items.array[idx].disabled : false;
}
void obs_property_list_item_disable(obs_property_t p, size_t idx, bool disabled)
void obs_property_list_item_disable(obs_property_t *p, size_t idx,
bool disabled)
{
struct list_data *data = get_list_data(p);
if (!data || idx >= data->items.num)
@ -638,28 +639,28 @@ void obs_property_list_item_disable(obs_property_t p, size_t idx, bool disabled)
data->items.array[idx].disabled = disabled;
}
const char *obs_property_list_item_name(obs_property_t p, size_t idx)
const char *obs_property_list_item_name(obs_property_t *p, size_t idx)
{
struct list_data *data = get_list_data(p);
return (data && idx < data->items.num) ?
data->items.array[idx].name : NULL;
}
const char *obs_property_list_item_string(obs_property_t p, size_t idx)
const char *obs_property_list_item_string(obs_property_t *p, size_t idx)
{
struct list_data *data = get_list_fmt_data(p, OBS_COMBO_FORMAT_STRING);
return (data && idx < data->items.num) ?
data->items.array[idx].str : "";
}
long long obs_property_list_item_int(obs_property_t p, size_t idx)
long long obs_property_list_item_int(obs_property_t *p, size_t idx)
{
struct list_data *data = get_list_fmt_data(p, OBS_COMBO_FORMAT_INT);
return (data && idx < data->items.num) ?
data->items.array[idx].ll : 0;
}
double obs_property_list_item_float(obs_property_t p, size_t idx)
double obs_property_list_item_float(obs_property_t *p, size_t idx)
{
struct list_data *data = get_list_fmt_data(p, OBS_COMBO_FORMAT_FLOAT);
return (data && idx < data->items.num) ?

View File

@ -68,28 +68,28 @@ enum obs_text_type {
struct obs_properties;
struct obs_property;
typedef struct obs_properties *obs_properties_t;
typedef struct obs_property *obs_property_t;
typedef struct obs_properties obs_properties_t;
typedef struct obs_property obs_property_t;
/* ------------------------------------------------------------------------- */
EXPORT obs_properties_t obs_properties_create(void);
EXPORT obs_properties_t obs_properties_create_param(void *param,
EXPORT obs_properties_t *obs_properties_create(void);
EXPORT obs_properties_t *obs_properties_create_param(void *param,
void (*destroy)(void *param));
EXPORT void obs_properties_destroy(obs_properties_t props);
EXPORT void obs_properties_destroy(obs_properties_t *props);
EXPORT void obs_properties_set_param(obs_properties_t props,
EXPORT void obs_properties_set_param(obs_properties_t *props,
void *param, void (*destroy)(void *param));
EXPORT void *obs_properties_get_param(obs_properties_t props);
EXPORT void *obs_properties_get_param(obs_properties_t *props);
EXPORT obs_property_t obs_properties_first(obs_properties_t props);
EXPORT obs_property_t *obs_properties_first(obs_properties_t *props);
EXPORT obs_property_t obs_properties_get(obs_properties_t props,
EXPORT obs_property_t *obs_properties_get(obs_properties_t *props,
const char *property);
/* used internally by libobs */
extern void obs_properties_apply_settings(obs_properties_t props,
obs_data_t settings);
extern void obs_properties_apply_settings(obs_properties_t *props,
obs_data_t *settings);
/* ------------------------------------------------------------------------- */
@ -98,21 +98,21 @@ extern void obs_properties_apply_settings(obs_properties_t props,
* need to be refreshed due to changes to the property layout, return true,
* otherwise return false.
*/
typedef bool (*obs_property_clicked_t)(obs_properties_t props,
obs_property_t property, void *data);
typedef bool (*obs_property_clicked_t)(obs_properties_t *props,
obs_property_t *property, void *data);
EXPORT obs_property_t obs_properties_add_bool(obs_properties_t props,
EXPORT obs_property_t *obs_properties_add_bool(obs_properties_t *props,
const char *name, const char *description);
EXPORT obs_property_t obs_properties_add_int(obs_properties_t props,
EXPORT obs_property_t *obs_properties_add_int(obs_properties_t *props,
const char *name, const char *description,
int min, int max, int step);
EXPORT obs_property_t obs_properties_add_float(obs_properties_t props,
EXPORT obs_property_t *obs_properties_add_float(obs_properties_t *props,
const char *name, const char *description,
double min, double max, double step);
EXPORT obs_property_t obs_properties_add_text(obs_properties_t props,
EXPORT obs_property_t *obs_properties_add_text(obs_properties_t *props,
const char *name, const char *description,
enum obs_text_type type);
@ -132,19 +132,19 @@ EXPORT obs_property_t obs_properties_add_text(obs_properties_t props,
* double semi-colens. If multiple file types in a
* filter, separate with space.
*/
EXPORT obs_property_t obs_properties_add_path(obs_properties_t props,
EXPORT obs_property_t *obs_properties_add_path(obs_properties_t *props,
const char *name, const char *description,
enum obs_path_type type, const char *filter,
const char *default_path);
EXPORT obs_property_t obs_properties_add_list(obs_properties_t props,
EXPORT obs_property_t *obs_properties_add_list(obs_properties_t *props,
const char *name, const char *description,
enum obs_combo_type type, enum obs_combo_format format);
EXPORT obs_property_t obs_properties_add_color(obs_properties_t props,
EXPORT obs_property_t *obs_properties_add_color(obs_properties_t *props,
const char *name, const char *description);
EXPORT obs_property_t obs_properties_add_button(obs_properties_t props,
EXPORT obs_property_t *obs_properties_add_button(obs_properties_t *props,
const char *name, const char *text,
obs_property_clicked_t callback);
@ -157,7 +157,7 @@ EXPORT obs_property_t obs_properties_add_button(obs_properties_t props,
* size: size integer
* flags: font flags integer (OBS_FONT_* defined above)
*/
EXPORT obs_property_t obs_properties_add_font(obs_properties_t props,
EXPORT obs_property_t *obs_properties_add_font(obs_properties_t *props,
const char *name, const char *description);
/* ------------------------------------------------------------------------- */
@ -167,59 +167,59 @@ EXPORT obs_property_t obs_properties_add_font(obs_properties_t props,
* need to be refreshed due to changes to the property layout, return true,
* otherwise return false.
*/
typedef bool (*obs_property_modified_t)(obs_properties_t props,
obs_property_t property, obs_data_t settings);
typedef bool (*obs_property_modified_t)(obs_properties_t *props,
obs_property_t *property, obs_data_t *settings);
EXPORT void obs_property_set_modified_callback(obs_property_t p,
EXPORT void obs_property_set_modified_callback(obs_property_t *p,
obs_property_modified_t modified);
EXPORT bool obs_property_modified(obs_property_t p, obs_data_t settings);
EXPORT bool obs_property_button_clicked(obs_property_t p, void *obj);
EXPORT bool obs_property_modified(obs_property_t *p, obs_data_t *settings);
EXPORT bool obs_property_button_clicked(obs_property_t *p, void *obj);
EXPORT void obs_property_set_visible(obs_property_t p, bool visible);
EXPORT void obs_property_set_enabled(obs_property_t p, bool enabled);
EXPORT void obs_property_set_visible(obs_property_t *p, bool visible);
EXPORT void obs_property_set_enabled(obs_property_t *p, bool enabled);
EXPORT const char * obs_property_name(obs_property_t p);
EXPORT const char * obs_property_description(obs_property_t p);
EXPORT enum obs_property_type obs_property_get_type(obs_property_t p);
EXPORT bool obs_property_enabled(obs_property_t p);
EXPORT bool obs_property_visible(obs_property_t p);
EXPORT const char * obs_property_name(obs_property_t *p);
EXPORT const char * obs_property_description(obs_property_t *p);
EXPORT enum obs_property_type obs_property_get_type(obs_property_t *p);
EXPORT bool obs_property_enabled(obs_property_t *p);
EXPORT bool obs_property_visible(obs_property_t *p);
EXPORT bool obs_property_next(obs_property_t *p);
EXPORT bool obs_property_next(obs_property_t **p);
EXPORT int obs_property_int_min(obs_property_t p);
EXPORT int obs_property_int_max(obs_property_t p);
EXPORT int obs_property_int_step(obs_property_t p);
EXPORT double obs_property_float_min(obs_property_t p);
EXPORT double obs_property_float_max(obs_property_t p);
EXPORT double obs_property_float_step(obs_property_t p);
EXPORT enum obs_text_type obs_proprety_text_type(obs_property_t p);
EXPORT enum obs_path_type obs_property_path_type(obs_property_t p);
EXPORT const char * obs_property_path_filter(obs_property_t p);
EXPORT const char * obs_property_path_default_path(obs_property_t p);
EXPORT enum obs_combo_type obs_property_list_type(obs_property_t p);
EXPORT enum obs_combo_format obs_property_list_format(obs_property_t p);
EXPORT int obs_property_int_min(obs_property_t *p);
EXPORT int obs_property_int_max(obs_property_t *p);
EXPORT int obs_property_int_step(obs_property_t *p);
EXPORT double obs_property_float_min(obs_property_t *p);
EXPORT double obs_property_float_max(obs_property_t *p);
EXPORT double obs_property_float_step(obs_property_t *p);
EXPORT enum obs_text_type obs_proprety_text_type(obs_property_t *p);
EXPORT enum obs_path_type obs_property_path_type(obs_property_t *p);
EXPORT const char * obs_property_path_filter(obs_property_t *p);
EXPORT const char * obs_property_path_default_path(obs_property_t *p);
EXPORT enum obs_combo_type obs_property_list_type(obs_property_t *p);
EXPORT enum obs_combo_format obs_property_list_format(obs_property_t *p);
EXPORT void obs_property_list_clear(obs_property_t p);
EXPORT void obs_property_list_clear(obs_property_t *p);
EXPORT size_t obs_property_list_add_string(obs_property_t p,
EXPORT size_t obs_property_list_add_string(obs_property_t *p,
const char *name, const char *val);
EXPORT size_t obs_property_list_add_int(obs_property_t p,
EXPORT size_t obs_property_list_add_int(obs_property_t *p,
const char *name, long long val);
EXPORT size_t obs_property_list_add_float(obs_property_t p,
EXPORT size_t obs_property_list_add_float(obs_property_t *p,
const char *name, double val);
EXPORT void obs_property_list_item_disable(obs_property_t p, size_t idx,
EXPORT void obs_property_list_item_disable(obs_property_t *p, size_t idx,
bool disabled);
EXPORT bool obs_property_list_item_disabled(obs_property_t p, size_t idx);
EXPORT bool obs_property_list_item_disabled(obs_property_t *p, size_t idx);
EXPORT void obs_property_list_item_remove(obs_property_t p, size_t idx);
EXPORT void obs_property_list_item_remove(obs_property_t *p, size_t idx);
EXPORT size_t obs_property_list_item_count(obs_property_t p);
EXPORT const char *obs_property_list_item_name(obs_property_t p, size_t idx);
EXPORT const char *obs_property_list_item_string(obs_property_t p, size_t idx);
EXPORT long long obs_property_list_item_int(obs_property_t p, size_t idx);
EXPORT double obs_property_list_item_float(obs_property_t p, size_t idx);
EXPORT size_t obs_property_list_item_count(obs_property_t *p);
EXPORT const char *obs_property_list_item_name(obs_property_t *p, size_t idx);
EXPORT const char *obs_property_list_item_string(obs_property_t *p, size_t idx);
EXPORT long long obs_property_list_item_int(obs_property_t *p, size_t idx);
EXPORT double obs_property_list_item_float(obs_property_t *p, size_t idx);
#ifdef __cplusplus
}

View File

@ -49,7 +49,7 @@ static const char *scene_getname(void)
return "Scene";
}
static void *scene_create(obs_data_t settings, struct obs_source *source)
static void *scene_create(obs_data_t *settings, struct obs_source *source)
{
pthread_mutexattr_t attr;
struct obs_scene *scene = bmalloc(sizeof(struct obs_scene));
@ -297,7 +297,7 @@ static inline bool source_size_changed(struct obs_scene_item *item)
return item->last_width != width || item->last_height != height;
}
static void scene_video_render(void *data, gs_effect_t effect)
static void scene_video_render(void *data, gs_effect_t *effect)
{
struct obs_scene *scene = data;
struct obs_scene_item *item;
@ -331,10 +331,10 @@ static void scene_video_render(void *data, gs_effect_t effect)
UNUSED_PARAMETER(effect);
}
static void scene_load_item(struct obs_scene *scene, obs_data_t item_data)
static void scene_load_item(struct obs_scene *scene, obs_data_t *item_data)
{
const char *name = obs_data_get_string(item_data, "name");
obs_source_t source = obs_get_source_by_name(name);
obs_source_t *source = obs_get_source_by_name(name);
struct obs_scene_item *item;
if (!source) {
@ -366,9 +366,9 @@ static void scene_load_item(struct obs_scene *scene, obs_data_t item_data)
update_item_transform(item);
}
static void scene_load(void *scene, obs_data_t settings)
static void scene_load(void *scene, obs_data_t *settings)
{
obs_data_array_t items = obs_data_get_array(settings, "items");
obs_data_array_t *items = obs_data_get_array(settings, "items");
size_t count, i;
remove_all_items(scene);
@ -378,7 +378,7 @@ static void scene_load(void *scene, obs_data_t settings)
count = obs_data_array_count(items);
for (i = 0; i < count; i++) {
obs_data_t item_data = obs_data_array_item(items, i);
obs_data_t *item_data = obs_data_array_item(items, i);
scene_load_item(scene, item_data);
obs_data_release(item_data);
}
@ -386,9 +386,10 @@ static void scene_load(void *scene, obs_data_t settings)
obs_data_array_release(items);
}
static void scene_save_item(obs_data_array_t array, struct obs_scene_item *item)
static void scene_save_item(obs_data_array_t *array,
struct obs_scene_item *item)
{
obs_data_t item_data = obs_data_create();
obs_data_t *item_data = obs_data_create();
const char *name = obs_source_get_name(item->source);
obs_data_set_string(item_data, "name", name);
@ -405,10 +406,10 @@ static void scene_save_item(obs_data_array_t array, struct obs_scene_item *item)
obs_data_release(item_data);
}
static void scene_save(void *data, obs_data_t settings)
static void scene_save(void *data, obs_data_t *settings)
{
struct obs_scene *scene = data;
obs_data_array_t array = obs_data_array_create();
obs_data_array_t *array = obs_data_array_create();
struct obs_scene_item *item;
pthread_mutex_lock(&scene->mutex);
@ -453,31 +454,31 @@ const struct obs_source_info scene_info =
.enum_sources = scene_enum_sources
};
obs_scene_t obs_scene_create(const char *name)
obs_scene_t *obs_scene_create(const char *name)
{
struct obs_source *source =
obs_source_create(OBS_SOURCE_TYPE_INPUT, "scene", name, NULL);
return source->context.data;
}
void obs_scene_addref(obs_scene_t scene)
void obs_scene_addref(obs_scene_t *scene)
{
if (scene)
obs_source_addref(scene->source);
}
void obs_scene_release(obs_scene_t scene)
void obs_scene_release(obs_scene_t *scene)
{
if (scene)
obs_source_release(scene->source);
}
obs_source_t obs_scene_get_source(obs_scene_t scene)
obs_source_t *obs_scene_get_source(obs_scene_t *scene)
{
return scene ? scene->source : NULL;
}
obs_scene_t obs_scene_from_source(obs_source_t source)
obs_scene_t *obs_scene_from_source(obs_source_t *source)
{
if (!source || source->info.id != scene_info.id)
return NULL;
@ -485,7 +486,7 @@ obs_scene_t obs_scene_from_source(obs_source_t source)
return source->context.data;
}
obs_sceneitem_t obs_scene_find_source(obs_scene_t scene, const char *name)
obs_sceneitem_t *obs_scene_find_source(obs_scene_t *scene, const char *name)
{
struct obs_scene_item *item;
@ -507,8 +508,8 @@ obs_sceneitem_t obs_scene_find_source(obs_scene_t scene, const char *name)
return item;
}
void obs_scene_enum_items(obs_scene_t scene,
bool (*callback)(obs_scene_t, obs_sceneitem_t, void*),
void obs_scene_enum_items(obs_scene_t *scene,
bool (*callback)(obs_scene_t*, obs_sceneitem_t*, void*),
void *param)
{
struct obs_scene_item *item;
@ -537,7 +538,7 @@ void obs_scene_enum_items(obs_scene_t scene,
pthread_mutex_unlock(&scene->mutex);
}
obs_sceneitem_t obs_scene_add(obs_scene_t scene, obs_source_t source)
obs_sceneitem_t *obs_scene_add(obs_scene_t *scene, obs_source_t *source)
{
struct obs_scene_item *last;
struct obs_scene_item *item;
@ -588,7 +589,7 @@ obs_sceneitem_t obs_scene_add(obs_scene_t scene, obs_source_t source)
return item;
}
static void obs_sceneitem_destroy(obs_sceneitem_t item)
static void obs_sceneitem_destroy(obs_sceneitem_t *item)
{
if (item) {
if (item->source)
@ -597,13 +598,13 @@ static void obs_sceneitem_destroy(obs_sceneitem_t item)
}
}
void obs_sceneitem_addref(obs_sceneitem_t item)
void obs_sceneitem_addref(obs_sceneitem_t *item)
{
if (item)
os_atomic_inc_long(&item->ref);
}
void obs_sceneitem_release(obs_sceneitem_t item)
void obs_sceneitem_release(obs_sceneitem_t *item)
{
if (!item)
return;
@ -612,9 +613,9 @@ void obs_sceneitem_release(obs_sceneitem_t item)
obs_sceneitem_destroy(item);
}
void obs_sceneitem_remove(obs_sceneitem_t item)
void obs_sceneitem_remove(obs_sceneitem_t *item)
{
obs_scene_t scene;
obs_scene_t *scene;
if (!item)
return;
@ -644,17 +645,17 @@ void obs_sceneitem_remove(obs_sceneitem_t item)
obs_sceneitem_release(item);
}
obs_scene_t obs_sceneitem_get_scene(obs_sceneitem_t item)
obs_scene_t *obs_sceneitem_get_scene(obs_sceneitem_t *item)
{
return item ? item->parent : NULL;
}
obs_source_t obs_sceneitem_get_source(obs_sceneitem_t item)
obs_source_t *obs_sceneitem_get_source(obs_sceneitem_t *item)
{
return item ? item->source : NULL;
}
void obs_sceneitem_select(obs_sceneitem_t item, bool select)
void obs_sceneitem_select(obs_sceneitem_t *item, bool select)
{
struct calldata params = {0};
const char *command = select ? "item_select" : "item_deselect";
@ -672,12 +673,12 @@ void obs_sceneitem_select(obs_sceneitem_t item, bool select)
calldata_free(&params);
}
bool obs_sceneitem_selected(obs_sceneitem_t item)
bool obs_sceneitem_selected(obs_sceneitem_t *item)
{
return item ? item->selected : false;
}
void obs_sceneitem_set_pos(obs_sceneitem_t item, const struct vec2 *pos)
void obs_sceneitem_set_pos(obs_sceneitem_t *item, const struct vec2 *pos)
{
if (item) {
vec2_copy(&item->pos, pos);
@ -685,7 +686,7 @@ void obs_sceneitem_set_pos(obs_sceneitem_t item, const struct vec2 *pos)
}
}
void obs_sceneitem_set_rot(obs_sceneitem_t item, float rot)
void obs_sceneitem_set_rot(obs_sceneitem_t *item, float rot)
{
if (item) {
item->rot = rot;
@ -693,7 +694,7 @@ void obs_sceneitem_set_rot(obs_sceneitem_t item, float rot)
}
}
void obs_sceneitem_set_scale(obs_sceneitem_t item, const struct vec2 *scale)
void obs_sceneitem_set_scale(obs_sceneitem_t *item, const struct vec2 *scale)
{
if (item) {
vec2_copy(&item->scale, scale);
@ -701,7 +702,7 @@ void obs_sceneitem_set_scale(obs_sceneitem_t item, const struct vec2 *scale)
}
}
void obs_sceneitem_set_alignment(obs_sceneitem_t item, uint32_t alignment)
void obs_sceneitem_set_alignment(obs_sceneitem_t *item, uint32_t alignment)
{
if (item) {
item->align = alignment;
@ -731,7 +732,7 @@ static inline void signal_move_dir(struct obs_scene_item *item,
calldata_free(&params);
}
void obs_sceneitem_set_order(obs_sceneitem_t item,
void obs_sceneitem_set_order(obs_sceneitem_t *item,
enum obs_order_movement movement)
{
if (!item) return;
@ -774,7 +775,7 @@ void obs_sceneitem_set_order(obs_sceneitem_t item,
obs_scene_release(scene);
}
void obs_sceneitem_set_bounds_type(obs_sceneitem_t item,
void obs_sceneitem_set_bounds_type(obs_sceneitem_t *item,
enum obs_bounds_type type)
{
if (item) {
@ -783,7 +784,7 @@ void obs_sceneitem_set_bounds_type(obs_sceneitem_t item,
}
}
void obs_sceneitem_set_bounds_alignment(obs_sceneitem_t item,
void obs_sceneitem_set_bounds_alignment(obs_sceneitem_t *item,
uint32_t alignment)
{
if (item) {
@ -792,7 +793,7 @@ void obs_sceneitem_set_bounds_alignment(obs_sceneitem_t item,
}
}
void obs_sceneitem_set_bounds(obs_sceneitem_t item, const struct vec2 *bounds)
void obs_sceneitem_set_bounds(obs_sceneitem_t *item, const struct vec2 *bounds)
{
if (item) {
item->bounds = *bounds;
@ -800,45 +801,45 @@ void obs_sceneitem_set_bounds(obs_sceneitem_t item, const struct vec2 *bounds)
}
}
void obs_sceneitem_get_pos(obs_sceneitem_t item, struct vec2 *pos)
void obs_sceneitem_get_pos(obs_sceneitem_t *item, struct vec2 *pos)
{
if (item)
vec2_copy(pos, &item->pos);
}
float obs_sceneitem_get_rot(obs_sceneitem_t item)
float obs_sceneitem_get_rot(obs_sceneitem_t *item)
{
return item ? item->rot : 0.0f;
}
void obs_sceneitem_get_scale(obs_sceneitem_t item, struct vec2 *scale)
void obs_sceneitem_get_scale(obs_sceneitem_t *item, struct vec2 *scale)
{
if (item)
vec2_copy(scale, &item->scale);
}
uint32_t obs_sceneitem_get_alignment(obs_sceneitem_t item)
uint32_t obs_sceneitem_get_alignment(obs_sceneitem_t *item)
{
return item ? item->align : 0;
}
enum obs_bounds_type obs_sceneitem_get_bounds_type(obs_sceneitem_t item)
enum obs_bounds_type obs_sceneitem_get_bounds_type(obs_sceneitem_t *item)
{
return item ? item->bounds_type : OBS_BOUNDS_NONE;
}
uint32_t obs_sceneitem_get_bounds_alignment(obs_sceneitem_t item)
uint32_t obs_sceneitem_get_bounds_alignment(obs_sceneitem_t *item)
{
return item ? item->bounds_align : 0;
}
void obs_sceneitem_get_bounds(obs_sceneitem_t item, struct vec2 *bounds)
void obs_sceneitem_get_bounds(obs_sceneitem_t *item, struct vec2 *bounds)
{
if (item)
*bounds = item->bounds;
}
void obs_sceneitem_get_info(obs_sceneitem_t item,
void obs_sceneitem_get_info(obs_sceneitem_t *item,
struct obs_transform_info *info)
{
if (item && info) {
@ -852,7 +853,7 @@ void obs_sceneitem_get_info(obs_sceneitem_t item,
}
}
void obs_sceneitem_set_info(obs_sceneitem_t item,
void obs_sceneitem_set_info(obs_sceneitem_t *item,
const struct obs_transform_info *info)
{
if (item && info) {
@ -867,14 +868,14 @@ void obs_sceneitem_set_info(obs_sceneitem_t item,
}
}
void obs_sceneitem_get_draw_transform(obs_sceneitem_t item,
void obs_sceneitem_get_draw_transform(obs_sceneitem_t *item,
struct matrix4 *transform)
{
if (item)
matrix4_copy(transform, &item->draw_transform);
}
void obs_sceneitem_get_box_transform(obs_sceneitem_t item,
void obs_sceneitem_get_box_transform(obs_sceneitem_t *item,
struct matrix4 *transform)
{
if (item)

View File

@ -33,8 +33,8 @@ const char *obs_service_get_display_name(const char *id)
return (info != NULL) ? info->get_name() : NULL;
}
obs_service_t obs_service_create(const char *id, const char *name,
obs_data_t settings)
obs_service_t *obs_service_create(const char *id, const char *name,
obs_data_t *settings)
{
const struct obs_service_info *info = find_service(id);
struct obs_service *service;
@ -82,7 +82,7 @@ static void actually_destroy_service(struct obs_service *service)
bfree(service);
}
void obs_service_destroy(obs_service_t service)
void obs_service_destroy(obs_service_t *service)
{
if (service) {
obs_context_data_remove(&service->context);
@ -96,31 +96,31 @@ void obs_service_destroy(obs_service_t service)
}
}
const char *obs_service_get_name(obs_service_t service)
const char *obs_service_get_name(obs_service_t *service)
{
return service ? service->context.name : NULL;
}
static inline obs_data_t get_defaults(const struct obs_service_info *info)
static inline obs_data_t *get_defaults(const struct obs_service_info *info)
{
obs_data_t settings = obs_data_create();
obs_data_t *settings = obs_data_create();
if (info->get_defaults)
info->get_defaults(settings);
return settings;
}
obs_data_t obs_service_defaults(const char *id)
obs_data_t *obs_service_defaults(const char *id)
{
const struct obs_service_info *info = find_service(id);
return (info) ? get_defaults(info) : NULL;
}
obs_properties_t obs_get_service_properties(const char *id)
obs_properties_t *obs_get_service_properties(const char *id)
{
const struct obs_service_info *info = find_service(id);
if (info && info->get_properties) {
obs_data_t defaults = get_defaults(info);
obs_properties_t properties;
obs_data_t *defaults = get_defaults(info);
obs_properties_t *properties;
properties = info->get_properties();
obs_properties_apply_settings(properties, defaults);
@ -130,10 +130,10 @@ obs_properties_t obs_get_service_properties(const char *id)
return NULL;
}
obs_properties_t obs_service_properties(obs_service_t service)
obs_properties_t *obs_service_properties(obs_service_t *service)
{
if (service && service->info.get_properties) {
obs_properties_t props;
obs_properties_t *props;
props = service->info.get_properties();
obs_properties_apply_settings(props, service->context.settings);
return props;
@ -142,12 +142,12 @@ obs_properties_t obs_service_properties(obs_service_t service)
return NULL;
}
const char *obs_service_gettype(obs_service_t service)
const char *obs_service_gettype(obs_service_t *service)
{
return service ? service->info.id : NULL;
}
void obs_service_update(obs_service_t service, obs_data_t settings)
void obs_service_update(obs_service_t *service, obs_data_t *settings)
{
if (!service) return;
@ -158,7 +158,7 @@ void obs_service_update(obs_service_t service, obs_data_t settings)
service->context.settings);
}
obs_data_t obs_service_get_settings(obs_service_t service)
obs_data_t *obs_service_get_settings(obs_service_t *service)
{
if (!service)
return NULL;
@ -167,35 +167,35 @@ obs_data_t obs_service_get_settings(obs_service_t service)
return service->context.settings;
}
signal_handler_t obs_service_get_signal_handler(obs_service_t service)
signal_handler_t *obs_service_get_signal_handler(obs_service_t *service)
{
return service ? service->context.signals : NULL;
}
proc_handler_t obs_service_get_proc_handler(obs_service_t service)
proc_handler_t *obs_service_get_proc_handler(obs_service_t *service)
{
return service ? service->context.procs : NULL;
}
const char *obs_service_get_url(obs_service_t service)
const char *obs_service_get_url(obs_service_t *service)
{
if (!service || !service->info.get_url) return NULL;
return service->info.get_url(service->context.data);
}
const char *obs_service_get_key(obs_service_t service)
const char *obs_service_get_key(obs_service_t *service)
{
if (!service || !service->info.get_key) return NULL;
return service->info.get_key(service->context.data);
}
const char *obs_service_get_username(obs_service_t service)
const char *obs_service_get_username(obs_service_t *service)
{
if (!service || !service->info.get_username) return NULL;
return service->info.get_username(service->context.data);
}
const char *obs_service_get_password(obs_service_t service)
const char *obs_service_get_password(obs_service_t *service)
{
if (!service || !service->info.get_password) return NULL;
return service->info.get_password(service->context.data);

View File

@ -22,18 +22,18 @@ struct obs_service_info {
const char *id;
const char *(*get_name)(void);
void *(*create)(obs_data_t settings, obs_service_t service);
void *(*create)(obs_data_t *settings, obs_service_t *service);
void (*destroy)(void *data);
/* optional */
void (*activate)(void *data, obs_data_t settings);
void (*activate)(void *data, obs_data_t *settings);
void (*deactivate)(void *data);
void (*update)(void *data, obs_data_t settings);
void (*update)(void *data, obs_data_t *settings);
void (*get_defaults)(obs_data_t settings);
void (*get_defaults)(obs_data_t *settings);
obs_properties_t (*get_properties)(void);
obs_properties_t *(*get_properties)(void);
/**
* Called when getting ready to start up an output, before the encoders
@ -44,7 +44,7 @@ struct obs_service_info {
* @eturn true to allow the output to start up,
* false to prevent output from starting up
*/
bool (*initialize)(void *data, obs_output_t output);
bool (*initialize)(void *data, obs_output_t *output);
const char *(*get_url)(void *data);
const char *(*get_key)(void *data);

View File

@ -86,7 +86,7 @@ static const char *source_signals[] = {
};
bool obs_source_init_context(struct obs_source *source,
obs_data_t settings, const char *name)
obs_data_t *settings, const char *name)
{
if (!obs_context_data_init(&source->context, settings, name))
return false;
@ -152,8 +152,8 @@ static inline void obs_source_dosignal(struct obs_source *source,
calldata_free(&data);
}
obs_source_t obs_source_create(enum obs_source_type type, const char *id,
const char *name, obs_data_t settings)
obs_source_t *obs_source_create(enum obs_source_type type, const char *id,
const char *name, obs_data_t *settings)
{
struct obs_source *source = bzalloc(sizeof(struct obs_source));
@ -266,13 +266,13 @@ void obs_source_destroy(struct obs_source *source)
bfree(source);
}
void obs_source_addref(obs_source_t source)
void obs_source_addref(obs_source_t *source)
{
if (source)
os_atomic_inc_long(&source->refs);
}
void obs_source_release(obs_source_t source)
void obs_source_release(obs_source_t *source)
{
if (!source)
return;
@ -281,7 +281,7 @@ void obs_source_release(obs_source_t source)
obs_source_destroy(source);
}
void obs_source_remove(obs_source_t source)
void obs_source_remove(obs_source_t *source)
{
struct obs_core_data *data = &obs->data;
size_t id;
@ -313,32 +313,32 @@ void obs_source_remove(obs_source_t source)
obs_source_release(source);
}
bool obs_source_removed(obs_source_t source)
bool obs_source_removed(obs_source_t *source)
{
return source ? source->removed : true;
}
static inline obs_data_t get_defaults(const struct obs_source_info *info)
static inline obs_data_t *get_defaults(const struct obs_source_info *info)
{
obs_data_t settings = obs_data_create();
obs_data_t *settings = obs_data_create();
if (info->get_defaults)
info->get_defaults(settings);
return settings;
}
obs_data_t obs_source_settings(enum obs_source_type type, const char *id)
obs_data_t *obs_source_settings(enum obs_source_type type, const char *id)
{
const struct obs_source_info *info = get_source_info(type, id);
return (info) ? get_defaults(info) : NULL;
}
obs_properties_t obs_get_source_properties(enum obs_source_type type,
obs_properties_t *obs_get_source_properties(enum obs_source_type type,
const char *id)
{
const struct obs_source_info *info = get_source_info(type, id);
if (info && info->get_properties) {
obs_data_t defaults = get_defaults(info);
obs_properties_t properties;
obs_data_t *defaults = get_defaults(info);
obs_properties_t *properties;
properties = info->get_properties();
obs_properties_apply_settings(properties, defaults);
@ -348,10 +348,10 @@ obs_properties_t obs_get_source_properties(enum obs_source_type type,
return NULL;
}
obs_properties_t obs_source_properties(obs_source_t source)
obs_properties_t *obs_source_properties(obs_source_t *source)
{
if (source_valid(source) && source->info.get_properties) {
obs_properties_t props;
obs_properties_t *props;
props = source->info.get_properties();
obs_properties_apply_settings(props, source->context.settings);
return props;
@ -360,12 +360,12 @@ obs_properties_t obs_source_properties(obs_source_t source)
return NULL;
}
uint32_t obs_source_get_output_flags(obs_source_t source)
uint32_t obs_source_get_output_flags(obs_source_t *source)
{
return source ? source->info.output_flags : 0;
}
static void obs_source_deferred_update(obs_source_t source)
static void obs_source_deferred_update(obs_source_t *source)
{
if (source->context.data && source->info.update)
source->info.update(source->context.data,
@ -374,7 +374,7 @@ static void obs_source_deferred_update(obs_source_t source)
source->defer_update = false;
}
void obs_source_update(obs_source_t source, obs_data_t settings)
void obs_source_update(obs_source_t *source, obs_data_t *settings)
{
if (!source) return;
@ -389,7 +389,7 @@ void obs_source_update(obs_source_t source, obs_data_t settings)
}
}
void obs_source_send_mouse_click(obs_source_t source,
void obs_source_send_mouse_click(obs_source_t *source,
const struct obs_mouse_event *event,
int32_t type, bool mouse_up,
uint32_t click_count)
@ -405,7 +405,7 @@ void obs_source_send_mouse_click(obs_source_t source,
}
}
void obs_source_send_mouse_move(obs_source_t source,
void obs_source_send_mouse_move(obs_source_t *source,
const struct obs_mouse_event *event, bool mouse_leave)
{
if (!source)
@ -419,7 +419,7 @@ void obs_source_send_mouse_move(obs_source_t source,
}
}
void obs_source_send_mouse_wheel(obs_source_t source,
void obs_source_send_mouse_wheel(obs_source_t *source,
const struct obs_mouse_event *event, int x_delta, int y_delta)
{
if (!source)
@ -433,7 +433,7 @@ void obs_source_send_mouse_wheel(obs_source_t source,
}
}
void obs_source_send_focus(obs_source_t source, bool focus)
void obs_source_send_focus(obs_source_t *source, bool focus)
{
if (!source)
return;
@ -445,7 +445,7 @@ void obs_source_send_focus(obs_source_t source, bool focus)
}
}
void obs_source_send_key_click(obs_source_t source,
void obs_source_send_key_click(obs_source_t *source,
const struct obs_key_event *event, bool key_up)
{
if (!source)
@ -459,35 +459,36 @@ void obs_source_send_key_click(obs_source_t source,
}
}
static void activate_source(obs_source_t source)
static void activate_source(obs_source_t *source)
{
if (source->context.data && source->info.activate)
source->info.activate(source->context.data);
obs_source_dosignal(source, "source_activate", "activate");
}
static void deactivate_source(obs_source_t source)
static void deactivate_source(obs_source_t *source)
{
if (source->context.data && source->info.deactivate)
source->info.deactivate(source->context.data);
obs_source_dosignal(source, "source_deactivate", "deactivate");
}
static void show_source(obs_source_t source)
static void show_source(obs_source_t *source)
{
if (source->context.data && source->info.show)
source->info.show(source->context.data);
obs_source_dosignal(source, "source_show", "show");
}
static void hide_source(obs_source_t source)
static void hide_source(obs_source_t *source)
{
if (source->context.data && source->info.hide)
source->info.hide(source->context.data);
obs_source_dosignal(source, "source_hide", "hide");
}
static void activate_tree(obs_source_t parent, obs_source_t child, void *param)
static void activate_tree(obs_source_t *parent, obs_source_t *child,
void *param)
{
if (os_atomic_inc_long(&child->activate_refs) == 1)
activate_source(child);
@ -496,7 +497,7 @@ static void activate_tree(obs_source_t parent, obs_source_t child, void *param)
UNUSED_PARAMETER(param);
}
static void deactivate_tree(obs_source_t parent, obs_source_t child,
static void deactivate_tree(obs_source_t *parent, obs_source_t *child,
void *param)
{
if (os_atomic_dec_long(&child->activate_refs) == 0)
@ -506,7 +507,7 @@ static void deactivate_tree(obs_source_t parent, obs_source_t child,
UNUSED_PARAMETER(param);
}
static void show_tree(obs_source_t parent, obs_source_t child, void *param)
static void show_tree(obs_source_t *parent, obs_source_t *child, void *param)
{
if (os_atomic_inc_long(&child->show_refs) == 1)
show_source(child);
@ -515,7 +516,7 @@ static void show_tree(obs_source_t parent, obs_source_t child, void *param)
UNUSED_PARAMETER(param);
}
static void hide_tree(obs_source_t parent, obs_source_t child, void *param)
static void hide_tree(obs_source_t *parent, obs_source_t *child, void *param)
{
if (os_atomic_dec_long(&child->show_refs) == 0)
hide_source(child);
@ -524,7 +525,7 @@ static void hide_tree(obs_source_t parent, obs_source_t child, void *param)
UNUSED_PARAMETER(param);
}
void obs_source_activate(obs_source_t source, enum view_type type)
void obs_source_activate(obs_source_t *source, enum view_type type)
{
if (!source) return;
@ -542,7 +543,7 @@ void obs_source_activate(obs_source_t source, enum view_type type)
}
}
void obs_source_deactivate(obs_source_t source, enum view_type type)
void obs_source_deactivate(obs_source_t *source, enum view_type type)
{
if (!source) return;
@ -560,7 +561,7 @@ void obs_source_deactivate(obs_source_t source, enum view_type type)
}
}
void obs_source_video_tick(obs_source_t source, float seconds)
void obs_source_video_tick(obs_source_t *source, float seconds)
{
if (!source) return;
@ -592,13 +593,13 @@ static inline uint64_t conv_frames_to_time(size_t frames)
/* maximum time that timestamp can jump in nanoseconds */
#define MAX_TIMESTAMP_JUMP 2000000000ULL
static inline void reset_audio_timing(obs_source_t source, uint64_t timetamp)
static inline void reset_audio_timing(obs_source_t *source, uint64_t timetamp)
{
source->timing_set = true;
source->timing_adjust = os_gettime_ns() - timetamp;
}
static inline void handle_ts_jump(obs_source_t source, uint64_t expected,
static inline void handle_ts_jump(obs_source_t *source, uint64_t expected,
uint64_t ts, uint64_t diff)
{
blog(LOG_DEBUG, "Timestamp for source '%s' jumped by '%"PRIu64"', "
@ -626,7 +627,7 @@ static void calc_volume_levels(struct obs_source *source, float *array,
float max_val = 0.0f;
float rms_val = 0.0f;
audio_t audio = obs_get_audio();
audio_t *audio = obs_get_audio();
const uint32_t sample_rate = audio_output_get_sample_rate(audio);
const size_t channels = audio_output_get_channels(audio);
const size_t count = frames * channels;
@ -669,7 +670,7 @@ static void calc_volume_levels(struct obs_source *source, float *array,
}
/* TODO update peak/etc later */
static void obs_source_update_volume_level(obs_source_t source,
static void obs_source_update_volume_level(obs_source_t *source,
struct audio_data *in)
{
if (source && in) {
@ -692,7 +693,7 @@ static void obs_source_update_volume_level(obs_source_t source,
}
}
static void source_output_audio_line(obs_source_t source,
static void source_output_audio_line(obs_source_t *source,
const struct audio_data *data)
{
struct audio_data in = *data;
@ -870,7 +871,7 @@ static inline bool set_async_texture_size(struct obs_source *source,
return true;
}
static void upload_raw_frame(gs_texture_t tex,
static void upload_raw_frame(gs_texture_t *tex,
const struct obs_source_frame *frame)
{
switch (get_convert_type(frame->format)) {
@ -924,17 +925,17 @@ static const char *select_conversion_technique(enum video_format format)
return NULL;
}
static inline void set_eparam(gs_effect_t effect, const char *name, float val)
static inline void set_eparam(gs_effect_t *effect, const char *name, float val)
{
gs_eparam_t param = gs_effect_get_param_by_name(effect, name);
gs_eparam_t *param = gs_effect_get_param_by_name(effect, name);
gs_effect_set_float(param, val);
}
static bool update_async_texrender(struct obs_source *source,
const struct obs_source_frame *frame)
{
gs_texture_t tex = source->async_texture;
gs_texrender_t texrender = source->async_convert_texrender;
gs_texture_t *tex = source->async_texture;
gs_texrender_t *texrender = source->async_convert_texrender;
gs_texrender_reset(texrender);
@ -946,8 +947,8 @@ static bool update_async_texrender(struct obs_source *source,
float convert_width = (float)source->async_convert_width;
float convert_height = (float)source->async_convert_height;
gs_effect_t conv = obs->video.conversion_effect;
gs_technique_t tech = gs_effect_get_technique(conv,
gs_effect_t *conv = obs->video.conversion_effect;
gs_technique_t *tech = gs_effect_get_technique(conv,
select_conversion_technique(frame->format));
if (!gs_texrender_begin(texrender, cx, cy))
@ -991,8 +992,8 @@ static bool update_async_texrender(struct obs_source *source,
static bool update_async_texture(struct obs_source *source,
const struct obs_source_frame *frame)
{
gs_texture_t tex = source->async_texture;
gs_texrender_t texrender = source->async_convert_texrender;
gs_texture_t *tex = source->async_texture;
gs_texrender_t *texrender = source->async_convert_texrender;
enum convert_type type = get_convert_type(frame->format);
uint8_t *ptr;
uint32_t linesize;
@ -1042,11 +1043,11 @@ static bool update_async_texture(struct obs_source *source,
}
static inline void obs_source_draw_texture(struct obs_source *source,
gs_effect_t effect, float *color_matrix,
gs_effect_t *effect, float *color_matrix,
float const *color_range_min, float const *color_range_max)
{
gs_texture_t tex = source->async_texture;
gs_eparam_t param;
gs_texture_t *tex = source->async_texture;
gs_eparam_t *param;
if (source->async_convert_texrender)
tex = gs_texrender_get_texture(source->async_convert_texrender);
@ -1076,12 +1077,12 @@ static inline void obs_source_draw_texture(struct obs_source *source,
static void obs_source_draw_async_texture(struct obs_source *source)
{
gs_effect_t effect = gs_get_effect();
gs_effect_t *effect = gs_get_effect();
bool yuv = format_is_yuv(source->async_format);
bool limited_range = yuv && !source->async_full_range;
const char *type = yuv ? "DrawMatrix" : "Draw";
bool def_draw = (!effect);
gs_technique_t tech = NULL;
gs_technique_t *tech = NULL;
if (def_draw) {
effect = obs_get_default_effect();
@ -1101,7 +1102,7 @@ static void obs_source_draw_async_texture(struct obs_source *source)
}
}
static void obs_source_render_async_video(obs_source_t source)
static void obs_source_render_async_video(obs_source_t *source)
{
if (!source->async_rendered) {
struct obs_source_frame *frame = obs_source_get_frame(source);
@ -1121,19 +1122,19 @@ static void obs_source_render_async_video(obs_source_t source)
obs_source_draw_async_texture(source);
}
static inline void obs_source_render_filters(obs_source_t source)
static inline void obs_source_render_filters(obs_source_t *source)
{
source->rendering_filter = true;
obs_source_video_render(source->filters.array[0]);
source->rendering_filter = false;
}
static inline void obs_source_default_render(obs_source_t source,
static inline void obs_source_default_render(obs_source_t *source,
bool color_matrix)
{
gs_effect_t effect = obs->video.default_effect;
gs_effect_t *effect = obs->video.default_effect;
const char *tech_name = color_matrix ? "DrawMatrix" : "Draw";
gs_technique_t tech = gs_effect_get_technique(effect, tech_name);
gs_technique_t *tech = gs_effect_get_technique(effect, tech_name);
size_t passes, i;
passes = gs_technique_begin(tech);
@ -1146,7 +1147,7 @@ static inline void obs_source_default_render(obs_source_t source,
gs_technique_end(tech);
}
static inline void obs_source_main_render(obs_source_t source)
static inline void obs_source_main_render(obs_source_t *source)
{
uint32_t flags = source->info.output_flags;
bool color_matrix = (flags & OBS_SOURCE_COLOR_MATRIX) != 0;
@ -1162,7 +1163,7 @@ static inline void obs_source_main_render(obs_source_t source)
custom_draw ? NULL : gs_get_effect());
}
void obs_source_video_render(obs_source_t source)
void obs_source_video_render(obs_source_t *source)
{
if (!source_valid(source)) return;
@ -1179,7 +1180,7 @@ void obs_source_video_render(obs_source_t source)
obs_source_render_async_video(source);
}
uint32_t obs_source_get_width(obs_source_t source)
uint32_t obs_source_get_width(obs_source_t *source)
{
if (!source_valid(source)) return 0;
@ -1188,7 +1189,7 @@ uint32_t obs_source_get_width(obs_source_t source)
return source->async_width;
}
uint32_t obs_source_get_height(obs_source_t source)
uint32_t obs_source_get_height(obs_source_t *source)
{
if (!source_valid(source)) return 0;
@ -1197,17 +1198,17 @@ uint32_t obs_source_get_height(obs_source_t source)
return source->async_height;
}
obs_source_t obs_filter_get_parent(obs_source_t filter)
obs_source_t *obs_filter_get_parent(obs_source_t *filter)
{
return filter ? filter->filter_parent : NULL;
}
obs_source_t obs_filter_get_target(obs_source_t filter)
obs_source_t *obs_filter_get_target(obs_source_t *filter)
{
return filter ? filter->filter_target : NULL;
}
void obs_source_filter_add(obs_source_t source, obs_source_t filter)
void obs_source_filter_add(obs_source_t *source, obs_source_t *filter)
{
if (!source || !filter)
return;
@ -1221,7 +1222,7 @@ void obs_source_filter_add(obs_source_t source, obs_source_t filter)
}
if (source->filters.num) {
obs_source_t *back = da_end(source->filters);
obs_source_t **back = da_end(source->filters);
(*back)->filter_target = filter;
}
@ -1233,7 +1234,7 @@ void obs_source_filter_add(obs_source_t source, obs_source_t filter)
filter->filter_target = source;
}
void obs_source_filter_remove(obs_source_t source, obs_source_t filter)
void obs_source_filter_remove(obs_source_t *source, obs_source_t *filter)
{
size_t idx;
@ -1247,7 +1248,7 @@ void obs_source_filter_remove(obs_source_t source, obs_source_t filter)
return;
if (idx > 0) {
obs_source_t prev = source->filters.array[idx-1];
obs_source_t *prev = source->filters.array[idx-1];
prev->filter_target = filter->filter_target;
}
@ -1259,7 +1260,7 @@ void obs_source_filter_remove(obs_source_t source, obs_source_t filter)
filter->filter_target = NULL;
}
void obs_source_filter_set_order(obs_source_t source, obs_source_t filter,
void obs_source_filter_set_order(obs_source_t *source, obs_source_t *filter,
enum obs_order_movement movement)
{
size_t idx, i;
@ -1294,13 +1295,13 @@ void obs_source_filter_set_order(obs_source_t source, obs_source_t filter,
/* reorder filter targets, not the nicest way of dealing with things */
for (i = 0; i < source->filters.num; i++) {
obs_source_t next_filter = (i == source->filters.num-1) ?
obs_source_t *next_filter = (i == source->filters.num-1) ?
source : source->filters.array[idx+1];
source->filters.array[i]->filter_target = next_filter;
}
}
obs_data_t obs_source_get_settings(obs_source_t source)
obs_data_t *obs_source_get_settings(obs_source_t *source)
{
if (!source) return NULL;
@ -1308,7 +1309,7 @@ obs_data_t obs_source_get_settings(obs_source_t source)
return source->context.settings;
}
static inline struct obs_source_frame *filter_async_video(obs_source_t source,
static inline struct obs_source_frame *filter_async_video(obs_source_t *source,
struct obs_source_frame *in)
{
size_t i;
@ -1396,7 +1397,7 @@ static inline struct obs_source_frame *cache_video(
return new_frame;
}
static bool ready_async_frame(obs_source_t source, uint64_t sys_time);
static bool ready_async_frame(obs_source_t *source, uint64_t sys_time);
static inline void cycle_frames(struct obs_source *source)
{
@ -1404,7 +1405,7 @@ static inline void cycle_frames(struct obs_source *source)
ready_async_frame(source, os_gettime_ns());
}
void obs_source_output_video(obs_source_t source,
void obs_source_output_video(obs_source_t *source,
const struct obs_source_frame *frame)
{
if (!source || !frame)
@ -1424,7 +1425,7 @@ void obs_source_output_video(obs_source_t source,
}
}
static inline struct obs_audio_data *filter_async_audio(obs_source_t source,
static inline struct obs_audio_data *filter_async_audio(obs_source_t *source,
struct obs_audio_data *in)
{
size_t i;
@ -1442,7 +1443,7 @@ static inline struct obs_audio_data *filter_async_audio(obs_source_t source,
return in;
}
static inline void reset_resampler(obs_source_t source,
static inline void reset_resampler(obs_source_t *source,
const struct obs_source_audio *audio)
{
const struct audio_output_info *obs_info;
@ -1474,7 +1475,7 @@ static inline void reset_resampler(obs_source_t source,
blog(LOG_ERROR, "creation of resampler failed");
}
static inline void copy_audio_data(obs_source_t source,
static inline void copy_audio_data(obs_source_t *source,
const uint8_t *const data[], uint32_t frames, uint64_t ts)
{
size_t planes = audio_output_get_planes(obs->audio.audio);
@ -1500,7 +1501,7 @@ static inline void copy_audio_data(obs_source_t source,
}
/* resamples/remixes new audio to the designated main audio output format */
static void process_audio(obs_source_t source,
static void process_audio(obs_source_t *source,
const struct obs_source_audio *audio)
{
if (source->sample_info.samples_per_sec != audio->samples_per_sec ||
@ -1530,7 +1531,7 @@ static void process_audio(obs_source_t source,
}
}
void obs_source_output_audio(obs_source_t source,
void obs_source_output_audio(obs_source_t *source,
const struct obs_source_audio *audio)
{
uint32_t flags;
@ -1569,7 +1570,7 @@ void obs_source_output_audio(obs_source_t source,
pthread_mutex_unlock(&source->filter_mutex);
}
static inline bool frame_out_of_bounds(obs_source_t source, uint64_t ts)
static inline bool frame_out_of_bounds(obs_source_t *source, uint64_t ts)
{
if (ts < source->last_frame_ts)
return ((source->last_frame_ts - ts) > MAX_TIMESTAMP_JUMP);
@ -1579,7 +1580,7 @@ static inline bool frame_out_of_bounds(obs_source_t source, uint64_t ts)
/* #define DEBUG_ASYNC_FRAMES 1 */
static bool ready_async_frame(obs_source_t source, uint64_t sys_time)
static bool ready_async_frame(obs_source_t *source, uint64_t sys_time)
{
struct obs_source_frame *next_frame = source->video_frames.array[0];
struct obs_source_frame *frame = NULL;
@ -1657,7 +1658,7 @@ static bool ready_async_frame(obs_source_t source, uint64_t sys_time)
return frame != NULL;
}
static inline struct obs_source_frame *get_closest_frame(obs_source_t source,
static inline struct obs_source_frame *get_closest_frame(obs_source_t *source,
uint64_t sys_time)
{
if (ready_async_frame(source, sys_time)) {
@ -1675,7 +1676,7 @@ static inline struct obs_source_frame *get_closest_frame(obs_source_t source,
* the frame with the closest timing to ensure sync. Also ensures that timing
* with audio is synchronized.
*/
struct obs_source_frame *obs_source_get_frame(obs_source_t source)
struct obs_source_frame *obs_source_get_frame(obs_source_t *source)
{
struct obs_source_frame *frame = NULL;
uint64_t sys_time;
@ -1716,7 +1717,7 @@ unlock:
return frame;
}
void obs_source_release_frame(obs_source_t source,
void obs_source_release_frame(obs_source_t *source,
struct obs_source_frame *frame)
{
if (source && frame) {
@ -1725,12 +1726,12 @@ void obs_source_release_frame(obs_source_t source,
}
}
const char *obs_source_get_name(obs_source_t source)
const char *obs_source_get_name(obs_source_t *source)
{
return source ? source->context.name : NULL;
}
void obs_source_set_name(obs_source_t source, const char *name)
void obs_source_set_name(obs_source_t *source, const char *name)
{
if (!source) return;
@ -1750,21 +1751,21 @@ void obs_source_set_name(obs_source_t source, const char *name)
}
}
enum obs_source_type obs_source_get_type(obs_source_t source)
enum obs_source_type obs_source_get_type(obs_source_t *source)
{
return source ? source->info.type : OBS_SOURCE_TYPE_INPUT;
}
const char *obs_source_get_id(obs_source_t source)
const char *obs_source_get_id(obs_source_t *source)
{
return source ? source->info.id : NULL;
}
static inline void render_filter_bypass(obs_source_t target, gs_effect_t effect,
bool use_matrix)
static inline void render_filter_bypass(obs_source_t *target,
gs_effect_t *effect, bool use_matrix)
{
const char *tech_name = use_matrix ? "DrawMatrix" : "Draw";
gs_technique_t tech = gs_effect_get_technique(effect, tech_name);
gs_technique_t *tech = gs_effect_get_technique(effect, tech_name);
size_t passes, i;
passes = gs_technique_begin(tech);
@ -1776,12 +1777,12 @@ static inline void render_filter_bypass(obs_source_t target, gs_effect_t effect,
gs_technique_end(tech);
}
static inline void render_filter_tex(gs_texture_t tex, gs_effect_t effect,
static inline void render_filter_tex(gs_texture_t *tex, gs_effect_t *effect,
uint32_t width, uint32_t height, bool use_matrix)
{
const char *tech_name = use_matrix ? "DrawMatrix" : "Draw";
gs_technique_t tech = gs_effect_get_technique(effect, tech_name);
gs_eparam_t image = gs_effect_get_param_by_name(effect, "image");
gs_technique_t *tech = gs_effect_get_technique(effect, tech_name);
gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image");
size_t passes, i;
gs_effect_set_texture(image, tex);
@ -1795,11 +1796,11 @@ static inline void render_filter_tex(gs_texture_t tex, gs_effect_t effect,
gs_technique_end(tech);
}
void obs_source_process_filter(obs_source_t filter, gs_effect_t effect,
void obs_source_process_filter(obs_source_t *filter, gs_effect_t *effect,
uint32_t width, uint32_t height, enum gs_color_format format,
enum obs_allow_direct_render allow_direct)
{
obs_source_t target, parent;
obs_source_t *target, *parent;
uint32_t target_flags, parent_flags;
int cx, cy;
bool use_matrix, expects_def, can_directly;
@ -1844,17 +1845,17 @@ void obs_source_process_filter(obs_source_t filter, gs_effect_t effect,
effect, width, height, use_matrix);
}
signal_handler_t obs_source_get_signal_handler(obs_source_t source)
signal_handler_t *obs_source_get_signal_handler(obs_source_t *source)
{
return source ? source->context.signals : NULL;
}
proc_handler_t obs_source_get_proc_handler(obs_source_t source)
proc_handler_t *obs_source_get_proc_handler(obs_source_t *source)
{
return source ? source->context.procs : NULL;
}
void obs_source_set_volume(obs_source_t source, float volume)
void obs_source_set_volume(obs_source_t *source, float volume)
{
if (source) {
struct calldata data = {0};
@ -1871,7 +1872,7 @@ void obs_source_set_volume(obs_source_t source, float volume)
}
}
static void set_tree_preset_vol(obs_source_t parent, obs_source_t child,
static void set_tree_preset_vol(obs_source_t *parent, obs_source_t *child,
void *param)
{
float *vol = param;
@ -1880,7 +1881,7 @@ static void set_tree_preset_vol(obs_source_t parent, obs_source_t child,
UNUSED_PARAMETER(parent);
}
void obs_source_set_present_volume(obs_source_t source, float volume)
void obs_source_set_present_volume(obs_source_t *source, float volume)
{
if (source) {
source->present_volume = volume;
@ -1894,23 +1895,23 @@ void obs_source_set_present_volume(obs_source_t source, float volume)
}
}
float obs_source_get_volume(obs_source_t source)
float obs_source_get_volume(obs_source_t *source)
{
return source ? source->user_volume : 0.0f;
}
float obs_source_get_present_volume(obs_source_t source)
float obs_source_get_present_volume(obs_source_t *source)
{
return source ? source->present_volume : 0.0f;
}
void obs_source_set_sync_offset(obs_source_t source, int64_t offset)
void obs_source_set_sync_offset(obs_source_t *source, int64_t offset)
{
if (source)
source->sync_offset = offset;
}
int64_t obs_source_get_sync_offset(obs_source_t source)
int64_t obs_source_get_sync_offset(obs_source_t *source)
{
return source ? source->sync_offset : 0;
}
@ -1920,7 +1921,7 @@ struct source_enum_data {
void *param;
};
static void enum_source_tree_callback(obs_source_t parent, obs_source_t child,
static void enum_source_tree_callback(obs_source_t *parent, obs_source_t *child,
void *param)
{
struct source_enum_data *data = param;
@ -1938,7 +1939,7 @@ static void enum_source_tree_callback(obs_source_t parent, obs_source_t child,
data->enum_callback(parent, child, data->param);
}
void obs_source_enum_sources(obs_source_t source,
void obs_source_enum_sources(obs_source_t *source,
obs_source_enum_proc_t enum_callback,
void *param)
{
@ -1956,7 +1957,7 @@ void obs_source_enum_sources(obs_source_t source,
obs_source_release(source);
}
void obs_source_enum_tree(obs_source_t source,
void obs_source_enum_tree(obs_source_t *source,
obs_source_enum_proc_t enum_callback,
void *param)
{
@ -1978,7 +1979,7 @@ void obs_source_enum_tree(obs_source_t source,
obs_source_release(source);
}
void obs_source_add_child(obs_source_t parent, obs_source_t child)
void obs_source_add_child(obs_source_t *parent, obs_source_t *child)
{
if (!parent || !child) return;
@ -1989,7 +1990,7 @@ void obs_source_add_child(obs_source_t parent, obs_source_t child)
}
}
void obs_source_remove_child(obs_source_t parent, obs_source_t child)
void obs_source_remove_child(obs_source_t *parent, obs_source_t *child)
{
if (!parent || !child) return;
@ -2000,7 +2001,7 @@ void obs_source_remove_child(obs_source_t parent, obs_source_t child)
}
}
static void reset_transition_vol(obs_source_t parent, obs_source_t child,
static void reset_transition_vol(obs_source_t *parent, obs_source_t *child,
void *param)
{
child->transition_volume = 0.0f;
@ -2009,7 +2010,7 @@ static void reset_transition_vol(obs_source_t parent, obs_source_t child,
UNUSED_PARAMETER(param);
}
static void add_transition_vol(obs_source_t parent, obs_source_t child,
static void add_transition_vol(obs_source_t *parent, obs_source_t *child,
void *param)
{
float *vol = param;
@ -2018,7 +2019,7 @@ static void add_transition_vol(obs_source_t parent, obs_source_t child,
UNUSED_PARAMETER(parent);
}
static void apply_transition_vol(obs_source_t parent, obs_source_t child,
static void apply_transition_vol(obs_source_t *parent, obs_source_t *child,
void *param)
{
child->present_volume = child->transition_volume;
@ -2027,13 +2028,13 @@ static void apply_transition_vol(obs_source_t parent, obs_source_t child,
UNUSED_PARAMETER(param);
}
void obs_transition_begin_frame(obs_source_t transition)
void obs_transition_begin_frame(obs_source_t *transition)
{
if (!transition) return;
obs_source_enum_tree(transition, reset_transition_vol, NULL);
}
void obs_source_set_transition_vol(obs_source_t source, float vol)
void obs_source_set_transition_vol(obs_source_t *source, float vol)
{
if (!source) return;
@ -2041,19 +2042,19 @@ void obs_source_set_transition_vol(obs_source_t source, float vol)
obs_source_enum_tree(source, add_transition_vol, &vol);
}
void obs_transition_end_frame(obs_source_t transition)
void obs_transition_end_frame(obs_source_t *transition)
{
if (!transition) return;
obs_source_enum_tree(transition, apply_transition_vol, NULL);
}
void obs_source_save(obs_source_t source)
void obs_source_save(obs_source_t *source)
{
if (!source_valid(source) || !source->info.save) return;
source->info.save(source->context.data, source->context.settings);
}
void obs_source_load(obs_source_t source)
void obs_source_load(obs_source_t *source)
{
if (!source_valid(source) || !source->info.load) return;
source->info.load(source->context.data, source->context.settings);

View File

@ -98,8 +98,8 @@ enum obs_source_type {
/** @} */
typedef void (*obs_source_enum_proc_t)(obs_source_t parent, obs_source_t child,
void *param);
typedef void (*obs_source_enum_proc_t)(obs_source_t *parent,
obs_source_t *child, void *param);
/**
* Source definition structure
@ -137,7 +137,7 @@ struct obs_source_info {
* @param source Source that this data is assoicated with
* @return The data associated with this source
*/
void *(*create)(obs_data_t settings, obs_source_t source);
void *(*create)(obs_data_t *settings, obs_source_t *source);
/**
* Destroys the private data for the source
@ -163,14 +163,14 @@ struct obs_source_info {
*
* @param[out] settings Data to assign default settings to
*/
void (*get_defaults)(obs_data_t settings);
void (*get_defaults)(obs_data_t *settings);
/**
* Gets the property information of this source
*
* @return The properties data
*/
obs_properties_t (*get_properties)(void);
obs_properties_t *(*get_properties)(void);
/**
* Updates the settings for this source
@ -178,7 +178,7 @@ struct obs_source_info {
* @param data Source data
* @param settings New settings for this source
*/
void (*update)(void *data, obs_data_t settings);
void (*update)(void *data, obs_data_t *settings);
/** Called when the source has been activated in the main view */
void (*activate)(void *data);
@ -230,7 +230,7 @@ struct obs_source_info {
* be NULL, and the source is expected to process with
* an effect manually.
*/
void (*video_render)(void *data, gs_effect_t effect);
void (*video_render)(void *data, gs_effect_t *effect);
/**
* Called to filter raw async video data.
@ -280,7 +280,7 @@ struct obs_source_info {
* @param data Source data
* @param settings Settings
*/
void (*save)(void *data, obs_data_t settings);
void (*save)(void *data, obs_data_t *settings);
/**
* Called when loading a source from saved data. This should be called
@ -290,7 +290,7 @@ struct obs_source_info {
* @param data Source data
* @param settings Settings
*/
void (*load)(void *data, obs_data_t settings);
void (*load)(void *data, obs_data_t *settings);
/**
* Called when interacting with a source and a mouse-down or mouse-up

View File

@ -113,16 +113,16 @@ static inline void render_main_texture(struct obs_core_video *video,
static inline void render_output_texture(struct obs_core_video *video,
int cur_texture, int prev_texture)
{
gs_texture_t texture = video->render_textures[prev_texture];
gs_texture_t target = video->output_textures[cur_texture];
gs_texture_t *texture = video->render_textures[prev_texture];
gs_texture_t *target = video->output_textures[cur_texture];
uint32_t width = gs_texture_get_width(target);
uint32_t height = gs_texture_get_height(target);
/* TODO: replace with actual downscalers or unpackers */
gs_effect_t effect = video->default_effect;
gs_technique_t tech = gs_effect_get_technique(effect, "DrawMatrix");
gs_eparam_t image = gs_effect_get_param_by_name(effect, "image");
gs_eparam_t matrix = gs_effect_get_param_by_name(effect,
gs_effect_t *effect = video->default_effect;
gs_technique_t *tech = gs_effect_get_technique(effect, "DrawMatrix");
gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image");
gs_eparam_t *matrix = gs_effect_get_param_by_name(effect,
"color_matrix");
size_t passes, i;
@ -155,24 +155,24 @@ static inline void render_output_texture(struct obs_core_video *video,
video->textures_output[cur_texture] = true;
}
static inline void set_eparam(gs_effect_t effect, const char *name, float val)
static inline void set_eparam(gs_effect_t *effect, const char *name, float val)
{
gs_eparam_t param = gs_effect_get_param_by_name(effect, name);
gs_eparam_t *param = gs_effect_get_param_by_name(effect, name);
gs_effect_set_float(param, val);
}
static void render_convert_texture(struct obs_core_video *video,
int cur_texture, int prev_texture)
{
gs_texture_t texture = video->output_textures[prev_texture];
gs_texture_t target = video->convert_textures[cur_texture];
gs_texture_t *texture = video->output_textures[prev_texture];
gs_texture_t *target = video->convert_textures[cur_texture];
float fwidth = (float)video->output_width;
float fheight = (float)video->output_height;
size_t passes, i;
gs_effect_t effect = video->conversion_effect;
gs_eparam_t image = gs_effect_get_param_by_name(effect, "image");
gs_technique_t tech = gs_effect_get_technique(effect,
gs_effect_t *effect = video->conversion_effect;
gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image");
gs_technique_t *tech = gs_effect_get_technique(effect,
video->conversion_tech);
if (!video->textures_output[prev_texture])
@ -210,9 +210,9 @@ static void render_convert_texture(struct obs_core_video *video,
static inline void stage_output_texture(struct obs_core_video *video,
int cur_texture, int prev_texture)
{
gs_texture_t texture;
gs_texture_t *texture;
bool texture_ready;
gs_stagesurf_t copy = video->copy_surfaces[cur_texture];
gs_stagesurf_t *copy = video->copy_surfaces[cur_texture];
if (video->gpu_conversion) {
texture = video->convert_textures[prev_texture];
@ -256,7 +256,7 @@ static inline void render_video(struct obs_core_video *video, int cur_texture,
static inline bool download_frame(struct obs_core_video *video,
int prev_texture, struct video_data *frame)
{
gs_stagesurf_t surface = video->copy_surfaces[prev_texture];
gs_stagesurf_t *surface = video->copy_surfaces[prev_texture];
if (!video->textures_copied[prev_texture])
return false;

View File

@ -32,7 +32,7 @@ bool obs_view_init(struct obs_view *view)
return true;
}
obs_view_t obs_view_create(void)
obs_view_t *obs_view_create(void)
{
struct obs_view *view = bzalloc(sizeof(struct obs_view));
@ -55,7 +55,7 @@ void obs_view_free(struct obs_view *view)
pthread_mutex_destroy(&view->channels_mutex);
}
void obs_view_destroy(obs_view_t view)
void obs_view_destroy(obs_view_t *view)
{
if (view) {
obs_view_free(view);
@ -63,9 +63,9 @@ void obs_view_destroy(obs_view_t view)
}
}
obs_source_t obs_view_get_source(obs_view_t view, uint32_t channel)
obs_source_t *obs_view_get_source(obs_view_t *view, uint32_t channel)
{
obs_source_t source;
obs_source_t *source;
assert(channel < MAX_CHANNELS);
if (!view) return NULL;
@ -82,8 +82,8 @@ obs_source_t obs_view_get_source(obs_view_t view, uint32_t channel)
return source;
}
void obs_view_set_source(obs_view_t view, uint32_t channel,
obs_source_t source)
void obs_view_set_source(obs_view_t *view, uint32_t channel,
obs_source_t *source)
{
struct obs_source *prev_source;
@ -110,7 +110,7 @@ void obs_view_set_source(obs_view_t view, uint32_t channel,
}
}
void obs_view_render(obs_view_t view)
void obs_view_render(obs_view_t *view)
{
if (!view) return;

View File

@ -805,12 +805,12 @@ void obs_leave_graphics(void)
gs_leave_context();
}
audio_t obs_get_audio(void)
audio_t *obs_get_audio(void)
{
return (obs != NULL) ? obs->audio.audio : NULL;
}
video_t obs_get_video(void)
video_t *obs_get_video(void)
{
return (obs != NULL) ? obs->video.video : NULL;
}
@ -875,7 +875,7 @@ void *obs_create_ui(const char *name, const char *task, const char *target,
return callback ? callback->create(data, ui_data) : NULL;
}
bool obs_add_source(obs_source_t source)
bool obs_add_source(obs_source_t *source)
{
struct calldata params = {0};
@ -894,13 +894,13 @@ bool obs_add_source(obs_source_t source)
return true;
}
obs_source_t obs_get_output_source(uint32_t channel)
obs_source_t *obs_get_output_source(uint32_t channel)
{
if (!obs) return NULL;
return obs_view_get_source(&obs->data.main_view, channel);
}
void obs_set_output_source(uint32_t channel, obs_source_t source)
void obs_set_output_source(uint32_t channel, obs_source_t *source)
{
assert(channel < MAX_CHANNELS);
@ -937,7 +937,7 @@ void obs_set_output_source(uint32_t channel, obs_source_t source)
}
}
void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t), void *param)
void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t*), void *param)
{
if (!obs) return;
@ -975,28 +975,28 @@ static inline void obs_enum(void *pstart, pthread_mutex_t *mutex, void *proc,
pthread_mutex_unlock(mutex);
}
void obs_enum_outputs(bool (*enum_proc)(void*, obs_output_t), void *param)
void obs_enum_outputs(bool (*enum_proc)(void*, obs_output_t*), void *param)
{
if (!obs) return;
obs_enum(&obs->data.first_output, &obs->data.outputs_mutex,
enum_proc, param);
}
void obs_enum_encoders(bool (*enum_proc)(void*, obs_encoder_t), void *param)
void obs_enum_encoders(bool (*enum_proc)(void*, obs_encoder_t*), void *param)
{
if (!obs) return;
obs_enum(&obs->data.first_encoder, &obs->data.encoders_mutex,
enum_proc, param);
}
void obs_enum_services(bool (*enum_proc)(void*, obs_service_t), void *param)
void obs_enum_services(bool (*enum_proc)(void*, obs_service_t*), void *param)
{
if (!obs) return;
obs_enum(&obs->data.first_service, &obs->data.services_mutex,
enum_proc, param);
}
obs_source_t obs_get_source_by_name(const char *name)
obs_source_t *obs_get_source_by_name(const char *name)
{
struct obs_core_data *data = &obs->data;
struct obs_source *source = NULL;
@ -1038,46 +1038,46 @@ static inline void *get_context_by_name(void *vfirst, const char *name,
return context;
}
obs_output_t obs_get_output_by_name(const char *name)
obs_output_t *obs_get_output_by_name(const char *name)
{
if (!obs) return NULL;
return get_context_by_name(&obs->data.first_output, name,
&obs->data.outputs_mutex);
}
obs_encoder_t obs_get_encoder_by_name(const char *name)
obs_encoder_t *obs_get_encoder_by_name(const char *name)
{
if (!obs) return NULL;
return get_context_by_name(&obs->data.first_encoder, name,
&obs->data.encoders_mutex);
}
obs_service_t obs_get_service_by_name(const char *name)
obs_service_t *obs_get_service_by_name(const char *name)
{
if (!obs) return NULL;
return get_context_by_name(&obs->data.first_service, name,
&obs->data.services_mutex);
}
gs_effect_t obs_get_default_effect(void)
gs_effect_t *obs_get_default_effect(void)
{
if (!obs) return NULL;
return obs->video.default_effect;
}
gs_effect_t obs_get_solid_effect(void)
gs_effect_t *obs_get_solid_effect(void)
{
if (!obs) return NULL;
return obs->video.solid_effect;
}
signal_handler_t obs_get_signal_handler(void)
signal_handler_t *obs_get_signal_handler(void)
{
if (!obs) return NULL;
return obs->signals;
}
proc_handler_t obs_get_proc_handler(void)
proc_handler_t *obs_get_proc_handler(void)
{
if (!obs) return NULL;
return obs->procs;
@ -1143,12 +1143,12 @@ float obs_get_present_volume(void)
return obs ? obs->audio.present_volume : 0.0f;
}
obs_source_t obs_load_source(obs_data_t source_data)
obs_source_t *obs_load_source(obs_data_t *source_data)
{
obs_source_t source;
obs_source_t *source;
const char *name = obs_data_get_string(source_data, "name");
const char *id = obs_data_get_string(source_data, "id");
obs_data_t settings = obs_data_get_obj(source_data, "settings");
obs_data_t *settings = obs_data_get_obj(source_data, "settings");
double volume;
source = obs_source_create(OBS_SOURCE_TYPE_INPUT, id, name, settings);
@ -1162,7 +1162,7 @@ obs_source_t obs_load_source(obs_data_t source_data)
return source;
}
void obs_load_sources(obs_data_array_t array)
void obs_load_sources(obs_data_array_t *array)
{
size_t count;
size_t i;
@ -1174,8 +1174,8 @@ void obs_load_sources(obs_data_array_t array)
pthread_mutex_lock(&obs->data.user_sources_mutex);
for (i = 0; i < count; i++) {
obs_data_t source_data = obs_data_array_item(array, i);
obs_source_t source = obs_load_source(source_data);
obs_data_t *source_data = obs_data_array_item(array, i);
obs_source_t *source = obs_load_source(source_data);
obs_add_source(source);
@ -1190,10 +1190,10 @@ void obs_load_sources(obs_data_array_t array)
pthread_mutex_unlock(&obs->data.user_sources_mutex);
}
obs_data_t obs_save_source(obs_source_t source)
obs_data_t *obs_save_source(obs_source_t *source)
{
obs_data_t source_data = obs_data_create();
obs_data_t settings = obs_source_get_settings(source);
obs_data_t *source_data = obs_data_create();
obs_data_t *settings = obs_source_get_settings(source);
float volume = obs_source_get_volume(source);
const char *name = obs_source_get_name(source);
const char *id = obs_source_get_id(source);
@ -1210,9 +1210,9 @@ obs_data_t obs_save_source(obs_source_t source)
return source_data;
}
obs_data_array_t obs_save_sources(void)
obs_data_array_t *obs_save_sources(void)
{
obs_data_array_t array;
obs_data_array_t *array;
size_t i;
if (!obs) return NULL;
@ -1222,8 +1222,8 @@ obs_data_array_t obs_save_sources(void)
pthread_mutex_lock(&obs->data.user_sources_mutex);
for (i = 0; i < obs->data.user_sources.num; i++) {
obs_source_t source = obs->data.user_sources.array[i];
obs_data_t source_data = obs_save_source(source);
obs_source_t *source = obs->data.user_sources.array[i];
obs_data_t *source_data = obs_save_source(source);
obs_data_array_push_back(array, source_data);
obs_data_release(source_data);
@ -1250,7 +1250,7 @@ static inline char *dup_name(const char *name)
static inline bool obs_context_data_init_wrap(
struct obs_context_data *context,
obs_data_t settings,
obs_data_t *settings,
const char *name)
{
assert(context);
@ -1275,7 +1275,7 @@ static inline bool obs_context_data_init_wrap(
bool obs_context_data_init(
struct obs_context_data *context,
obs_data_t settings,
obs_data_t *settings,
const char *name)
{
if (obs_context_data_init_wrap(context, settings, name)) {

View File

@ -48,15 +48,15 @@ struct obs_encoder;
struct obs_service;
struct obs_module;
typedef struct obs_display *obs_display_t;
typedef struct obs_view *obs_view_t;
typedef struct obs_source *obs_source_t;
typedef struct obs_scene *obs_scene_t;
typedef struct obs_scene_item *obs_sceneitem_t;
typedef struct obs_output *obs_output_t;
typedef struct obs_encoder *obs_encoder_t;
typedef struct obs_service *obs_service_t;
typedef struct obs_module *obs_module_t;
typedef struct obs_display obs_display_t;
typedef struct obs_view obs_view_t;
typedef struct obs_source obs_source_t;
typedef struct obs_scene obs_scene_t;
typedef struct obs_scene_item obs_sceneitem_t;
typedef struct obs_output obs_output_t;
typedef struct obs_encoder obs_encoder_t;
typedef struct obs_service obs_service_t;
typedef struct obs_module obs_module_t;
#include "obs-source.h"
#include "obs-encoder.h"
@ -280,7 +280,7 @@ EXPORT bool obs_get_audio_info(struct audio_output_info *ai);
* MODULE_MISSING_EXPORTS if required exports are missing
* MODULE_INCOMPATIBLE_VER if incompatible version
*/
EXPORT int obs_open_module(obs_module_t *module, const char *path,
EXPORT int obs_open_module(obs_module_t **module, const char *path,
const char *data_path);
/**
@ -288,25 +288,25 @@ EXPORT int obs_open_module(obs_module_t *module, const char *path,
* module is alrady loaded, then this function does nothing and returns
* successful.
*/
EXPORT bool obs_init_module(obs_module_t module);
EXPORT bool obs_init_module(obs_module_t *module);
/** Returns the module file name */
EXPORT const char *obs_get_module_file_name(obs_module_t module);
EXPORT const char *obs_get_module_file_name(obs_module_t *module);
/** Returns the module full name */
EXPORT const char *obs_get_module_name(obs_module_t module);
EXPORT const char *obs_get_module_name(obs_module_t *module);
/** Returns the module author(s) */
EXPORT const char *obs_get_module_author(obs_module_t module);
EXPORT const char *obs_get_module_author(obs_module_t *module);
/** Returns the module description */
EXPORT const char *obs_get_module_description(obs_module_t module);
EXPORT const char *obs_get_module_description(obs_module_t *module);
/** Returns the module binary path */
EXPORT const char *obs_get_module_binary_path(obs_module_t module);
EXPORT const char *obs_get_module_binary_path(obs_module_t *module);
/** Returns the module data path */
EXPORT const char *obs_get_module_data_path(obs_module_t module);
EXPORT const char *obs_get_module_data_path(obs_module_t *module);
/**
* Adds a module search path to be used with obs_find_modules. If the search
@ -332,13 +332,13 @@ typedef void (*obs_find_module_callback_t)(void *param,
/** Finds all modules within the search paths added by obs_add_module_path. */
EXPORT void obs_find_modules(obs_find_module_callback_t callback, void *param);
typedef void (*obs_enum_module_callback_t)(void *param, obs_module_t module);
typedef void (*obs_enum_module_callback_t)(void *param, obs_module_t *module);
/** Enumerates all loaded modules */
EXPORT void obs_enum_modules(obs_enum_module_callback_t callback, void *param);
/** Helper function for using default module locale */
EXPORT lookup_t obs_module_load_locale(obs_module_t module,
EXPORT lookup_t *obs_module_load_locale(obs_module_t *module,
const char *default_locale, const char *locale);
/**
@ -352,7 +352,7 @@ EXPORT lookup_t obs_module_load_locale(obs_module_t module,
* @param file The file to locate
* @return Path string, or NULL if not found. Use bfree to free string.
*/
EXPORT char *obs_find_module_file(obs_module_t module, const char *file);
EXPORT char *obs_find_module_file(obs_module_t *module, const char *file);
/**
* Enumerates all available inputs source types.
@ -394,10 +394,10 @@ EXPORT void obs_enter_graphics(void);
EXPORT void obs_leave_graphics(void);
/** Gets the main audio output handler for this OBS context */
EXPORT audio_t obs_get_audio(void);
EXPORT audio_t *obs_get_audio(void);
/** Gets the main video output handler for this OBS context */
EXPORT video_t obs_get_video(void);
EXPORT video_t *obs_get_video(void);
/**
* Adds a source to the user source list and increments the reference counter
@ -407,16 +407,16 @@ EXPORT video_t obs_get_video(void);
* Typically when a transition is active, it is not meant to be accessible by
* users, so there's no reason for a user to see such a source.
*/
EXPORT bool obs_add_source(obs_source_t source);
EXPORT bool obs_add_source(obs_source_t *source);
/** Sets the primary output source for a channel. */
EXPORT void obs_set_output_source(uint32_t channel, obs_source_t source);
EXPORT void obs_set_output_source(uint32_t channel, obs_source_t *source);
/**
* Gets the primary output source for a channel and increments the reference
* counter for that source. Use obs_source_release to release.
*/
EXPORT obs_source_t obs_get_output_source(uint32_t channel);
EXPORT obs_source_t *obs_get_output_source(uint32_t channel);
/**
* Enumerates user sources
@ -424,19 +424,19 @@ EXPORT obs_source_t obs_get_output_source(uint32_t channel);
* Callback function returns true to continue enumeration, or false to end
* enumeration.
*/
EXPORT void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t),
EXPORT void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t*),
void *param);
/** Enumerates outputs */
EXPORT void obs_enum_outputs(bool (*enum_proc)(void*, obs_output_t),
EXPORT void obs_enum_outputs(bool (*enum_proc)(void*, obs_output_t*),
void *param);
/** Enumerates encoders */
EXPORT void obs_enum_encoders(bool (*enum_proc)(void*, obs_encoder_t),
EXPORT void obs_enum_encoders(bool (*enum_proc)(void*, obs_encoder_t*),
void *param);
/** Enumerates encoders */
EXPORT void obs_enum_services(bool (*enum_proc)(void*, obs_service_t),
EXPORT void obs_enum_services(bool (*enum_proc)(void*, obs_service_t*),
void *param);
/**
@ -445,28 +445,28 @@ EXPORT void obs_enum_services(bool (*enum_proc)(void*, obs_service_t),
* Increments the source reference counter, use obs_source_release to
* release it when complete.
*/
EXPORT obs_source_t obs_get_source_by_name(const char *name);
EXPORT obs_source_t *obs_get_source_by_name(const char *name);
/** Gets an output by its name. */
EXPORT obs_output_t obs_get_output_by_name(const char *name);
EXPORT obs_output_t *obs_get_output_by_name(const char *name);
/** Gets an encoder by its name. */
EXPORT obs_encoder_t obs_get_encoder_by_name(const char *name);
EXPORT obs_encoder_t *obs_get_encoder_by_name(const char *name);
/** Gets an service by its name. */
EXPORT obs_service_t obs_get_service_by_name(const char *name);
EXPORT obs_service_t *obs_get_service_by_name(const char *name);
/** Returns the default effect for generic RGB/YUV drawing */
EXPORT gs_effect_t obs_get_default_effect(void);
EXPORT gs_effect_t *obs_get_default_effect(void);
/** Returns the solid effect for drawing solid colors */
EXPORT gs_effect_t obs_get_solid_effect(void);
EXPORT gs_effect_t *obs_get_solid_effect(void);
/** Returns the primary obs signal handler */
EXPORT signal_handler_t obs_get_signal_handler(void);
EXPORT signal_handler_t *obs_get_signal_handler(void);
/** Returns the primary obs procedure handler */
EXPORT proc_handler_t obs_get_proc_handler(void);
EXPORT proc_handler_t *obs_get_proc_handler(void);
/** Adds a draw callback to the main render context */
EXPORT void obs_add_draw_callback(
@ -497,16 +497,16 @@ EXPORT float obs_get_master_volume(void);
EXPORT float obs_get_present_volume(void);
/** Saves a source to settings data */
EXPORT obs_data_t obs_save_source(obs_source_t source);
EXPORT obs_data_t *obs_save_source(obs_source_t *source);
/** Loads a source from settings data */
EXPORT obs_source_t obs_load_source(obs_data_t data);
EXPORT obs_source_t *obs_load_source(obs_data_t *data);
/** Loads sources from a data array */
EXPORT void obs_load_sources(obs_data_array_t array);
EXPORT void obs_load_sources(obs_data_array_t *array);
/** Saves sources to a data array */
EXPORT obs_data_array_t obs_save_sources(void);
EXPORT obs_data_array_t *obs_save_sources(void);
/* ------------------------------------------------------------------------- */
@ -518,21 +518,21 @@ EXPORT obs_data_array_t obs_save_sources(void);
* A view can be used for things like separate previews, or drawing
* sources separately.
*/
EXPORT obs_view_t obs_view_create(void);
EXPORT obs_view_t *obs_view_create(void);
/** Destroys this view context */
EXPORT void obs_view_destroy(obs_view_t view);
EXPORT void obs_view_destroy(obs_view_t *view);
/** Sets the source to be used for this view context. */
EXPORT void obs_view_set_source(obs_view_t view, uint32_t channel,
obs_source_t source);
EXPORT void obs_view_set_source(obs_view_t *view, uint32_t channel,
obs_source_t *source);
/** Gets the source currently in use for this view context */
EXPORT obs_source_t obs_view_get_source(obs_view_t view,
EXPORT obs_source_t *obs_view_get_source(obs_view_t *view,
uint32_t channel);
/** Renders the sources of this view context */
EXPORT void obs_view_render(obs_view_t view);
EXPORT void obs_view_render(obs_view_t *view);
/* ------------------------------------------------------------------------- */
@ -545,13 +545,14 @@ EXPORT void obs_view_render(obs_view_t view);
* @param graphics_data The swap chain initialization data.
* @return The new display context, or NULL if failed.
*/
EXPORT obs_display_t obs_display_create(struct gs_init_data *graphics_data);
EXPORT obs_display_t *obs_display_create(struct gs_init_data *graphics_data);
/** Destroys a display context */
EXPORT void obs_display_destroy(obs_display_t display);
EXPORT void obs_display_destroy(obs_display_t *display);
/** Changes the size of this display */
EXPORT void obs_display_resize(obs_display_t display, uint32_t cx, uint32_t cy);
EXPORT void obs_display_resize(obs_display_t *display, uint32_t cx,
uint32_t cy);
/**
* Adds a draw callback for this display context
@ -561,12 +562,12 @@ EXPORT void obs_display_resize(obs_display_t display, uint32_t cx, uint32_t cy);
* updates.
* @param param The user data to be associated with this draw callback.
*/
EXPORT void obs_display_add_draw_callback(obs_display_t display,
EXPORT void obs_display_add_draw_callback(obs_display_t *display,
void (*draw)(void *param, uint32_t cx, uint32_t cy),
void *param);
/** Removes a draw callback for this display context */
EXPORT void obs_display_remove_draw_callback(obs_display_t display,
EXPORT void obs_display_remove_draw_callback(obs_display_t *display,
void (*draw)(void *param, uint32_t cx, uint32_t cy),
void *param);
@ -584,120 +585,121 @@ EXPORT const char *obs_source_get_display_name(enum obs_source_type type,
* The "source" context is used for anything related to presenting
* or modifying video/audio. Use obs_source_release to release it.
*/
EXPORT obs_source_t obs_source_create(enum obs_source_type type,
const char *id, const char *name, obs_data_t settings);
EXPORT obs_source_t *obs_source_create(enum obs_source_type type,
const char *id, const char *name, obs_data_t *settings);
/**
* Adds/releases a reference to a source. When the last reference is
* released, the source is destroyed.
*/
EXPORT void obs_source_addref(obs_source_t source);
EXPORT void obs_source_release(obs_source_t source);
EXPORT void obs_source_addref(obs_source_t *source);
EXPORT void obs_source_release(obs_source_t *source);
/** Notifies all references that the source should be released */
EXPORT void obs_source_remove(obs_source_t source);
EXPORT void obs_source_remove(obs_source_t *source);
/** Returns true if the source should be released */
EXPORT bool obs_source_removed(obs_source_t source);
EXPORT bool obs_source_removed(obs_source_t *source);
/**
* Retrieves flags that specify what type of data the source presents/modifies.
*/
EXPORT uint32_t obs_source_get_output_flags(obs_source_t source);
EXPORT uint32_t obs_source_get_output_flags(obs_source_t *source);
/** Gets the default settings for a source type */
EXPORT obs_data_t obs_get_source_defaults(enum obs_source_type type,
EXPORT obs_data_t *obs_get_source_defaults(enum obs_source_type type,
const char *id);
/** Returns the property list, if any. Free with obs_properties_destroy */
EXPORT obs_properties_t obs_get_source_properties(enum obs_source_type type,
EXPORT obs_properties_t *obs_get_source_properties(enum obs_source_type type,
const char *id);
/**
* Returns the properties list for a specific existing source. Free with
* obs_properties_destroy
*/
EXPORT obs_properties_t obs_source_properties(obs_source_t source);
EXPORT obs_properties_t *obs_source_properties(obs_source_t *source);
/** Updates settings for this source */
EXPORT void obs_source_update(obs_source_t source, obs_data_t settings);
EXPORT void obs_source_update(obs_source_t *source, obs_data_t *settings);
/** Renders a video source. */
EXPORT void obs_source_video_render(obs_source_t source);
EXPORT void obs_source_video_render(obs_source_t *source);
/** Gets the width of a source (if it has video) */
EXPORT uint32_t obs_source_get_width(obs_source_t source);
EXPORT uint32_t obs_source_get_width(obs_source_t *source);
/** Gets the height of a source (if it has video) */
EXPORT uint32_t obs_source_get_height(obs_source_t source);
EXPORT uint32_t obs_source_get_height(obs_source_t *source);
/** If the source is a filter, returns the parent source of the filter */
EXPORT obs_source_t obs_filter_get_parent(obs_source_t filter);
EXPORT obs_source_t *obs_filter_get_parent(obs_source_t *filter);
/** If the source is a filter, returns the target source of the filter */
EXPORT obs_source_t obs_filter_get_target(obs_source_t filter);
EXPORT obs_source_t *obs_filter_get_target(obs_source_t *filter);
/** Adds a filter to the source (which is used whenever the source is used) */
EXPORT void obs_source_filter_add(obs_source_t source, obs_source_t filter);
EXPORT void obs_source_filter_add(obs_source_t *source, obs_source_t *filter);
/** Removes a filter from the source */
EXPORT void obs_source_filter_remove(obs_source_t source, obs_source_t filter);
EXPORT void obs_source_filter_remove(obs_source_t *source,
obs_source_t *filter);
/** Modifies the order of a specific filter */
EXPORT void obs_source_filter_set_order(obs_source_t source,
obs_source_t filter, enum obs_order_movement movement);
EXPORT void obs_source_filter_set_order(obs_source_t *source,
obs_source_t *filter, enum obs_order_movement movement);
/** Gets the settings string for a source */
EXPORT obs_data_t obs_source_get_settings(obs_source_t source);
EXPORT obs_data_t *obs_source_get_settings(obs_source_t *source);
/** Gets the name of a source */
EXPORT const char *obs_source_get_name(obs_source_t source);
EXPORT const char *obs_source_get_name(obs_source_t *source);
/** Sets the name of a source */
EXPORT void obs_source_set_name(obs_source_t source, const char *name);
EXPORT void obs_source_set_name(obs_source_t *source, const char *name);
/** Gets the source type */
EXPORT enum obs_source_type obs_source_get_type(obs_source_t source);
EXPORT enum obs_source_type obs_source_get_type(obs_source_t *source);
/** Gets the source identifier */
EXPORT const char *obs_source_get_id(obs_source_t source);
EXPORT const char *obs_source_get_id(obs_source_t *source);
/** Returns the signal handler for a source */
EXPORT signal_handler_t obs_source_get_signal_handler(obs_source_t source);
EXPORT signal_handler_t *obs_source_get_signal_handler(obs_source_t *source);
/** Returns the procedure handler for a source */
EXPORT proc_handler_t obs_source_get_proc_handler(obs_source_t source);
EXPORT proc_handler_t *obs_source_get_proc_handler(obs_source_t *source);
/** Sets the user volume for a source that has audio output */
EXPORT void obs_source_set_volume(obs_source_t source, float volume);
EXPORT void obs_source_set_volume(obs_source_t *source, float volume);
/** Sets the presentation volume for a source */
EXPORT void obs_source_set_present_volume(obs_source_t source, float volume);
EXPORT void obs_source_set_present_volume(obs_source_t *source, float volume);
/** Gets the user volume for a source that has audio output */
EXPORT float obs_source_get_volume(obs_source_t source);
EXPORT float obs_source_get_volume(obs_source_t *source);
/** Gets the presentation volume for a source */
EXPORT float obs_source_get_present_volume(obs_source_t source);
EXPORT float obs_source_get_present_volume(obs_source_t *source);
/** Sets the audio sync offset (in nanoseconds) for a source */
EXPORT void obs_source_set_sync_offset(obs_source_t source, int64_t offset);
EXPORT void obs_source_set_sync_offset(obs_source_t *source, int64_t offset);
/** Gets the audio sync offset (in nanoseconds) for a source */
EXPORT int64_t obs_source_get_sync_offset(obs_source_t source);
EXPORT int64_t obs_source_get_sync_offset(obs_source_t *source);
/** Enumerates child sources used by this source */
EXPORT void obs_source_enum_sources(obs_source_t source,
EXPORT void obs_source_enum_sources(obs_source_t *source,
obs_source_enum_proc_t enum_callback,
void *param);
/** Enumerates the entire child source tree used by this source */
EXPORT void obs_source_enum_tree(obs_source_t source,
EXPORT void obs_source_enum_tree(obs_source_t *source,
obs_source_enum_proc_t enum_callback,
void *param);
/** Returns true if active, false if not */
EXPORT bool obs_source_active(obs_source_t source);
EXPORT bool obs_source_active(obs_source_t *source);
/**
* Sometimes sources need to be told when to save their settings so they
@ -705,7 +707,7 @@ EXPORT bool obs_source_active(obs_source_t source);
* call the source's 'save' callback if any, which will save its current
* data to its settings.
*/
EXPORT void obs_source_save(obs_source_t source);
EXPORT void obs_source_save(obs_source_t *source);
/**
* Sometimes sources need to be told when they are loading their settings
@ -713,28 +715,28 @@ EXPORT void obs_source_save(obs_source_t source);
* it's meant to be used after the source has been created and loaded from
* somewhere (such as a saved file).
*/
EXPORT void obs_source_load(obs_source_t source);
EXPORT void obs_source_load(obs_source_t *source);
/* ------------------------------------------------------------------------- */
/* Functions used by sources */
/** Outputs asynchronous video data */
EXPORT void obs_source_output_video(obs_source_t source,
EXPORT void obs_source_output_video(obs_source_t *source,
const struct obs_source_frame *frame);
/** Outputs audio data (always asynchronous) */
EXPORT void obs_source_output_audio(obs_source_t source,
EXPORT void obs_source_output_audio(obs_source_t *source,
const struct obs_source_audio *audio);
/** Gets the current async video frame */
EXPORT struct obs_source_frame *obs_source_get_frame(obs_source_t source);
EXPORT struct obs_source_frame *obs_source_get_frame(obs_source_t *source);
/** Releases the current async video frame */
EXPORT void obs_source_release_frame(obs_source_t source,
EXPORT void obs_source_release_frame(obs_source_t *source,
struct obs_source_frame *frame);
/** Default RGB filter handler for generic effect filters */
EXPORT void obs_source_process_filter(obs_source_t filter, gs_effect_t effect,
EXPORT void obs_source_process_filter(obs_source_t *filter, gs_effect_t *effect,
uint32_t width, uint32_t height, enum gs_color_format format,
enum obs_allow_direct_render allow_direct);
@ -743,47 +745,47 @@ EXPORT void obs_source_process_filter(obs_source_t filter, gs_effect_t effect,
* when the child is added. This ensures that the source is properly activated
* if the parent is active.
*/
EXPORT void obs_source_add_child(obs_source_t parent, obs_source_t child);
EXPORT void obs_source_add_child(obs_source_t *parent, obs_source_t *child);
/**
* Removes a child source. Must be called by parent sources on child sources
* when the child is removed. This ensures that the source is properly
* deactivated if the parent is active.
*/
EXPORT void obs_source_remove_child(obs_source_t parent, obs_source_t child);
EXPORT void obs_source_remove_child(obs_source_t *parent, obs_source_t *child);
/** Sends a mouse down/up event to a source */
EXPORT void obs_source_send_mouse_click(obs_source_t source,
EXPORT void obs_source_send_mouse_click(obs_source_t *source,
const struct obs_mouse_event *event,
int32_t type, bool mouse_up,
uint32_t click_count);
/** Sends a mouse move event to a source. */
EXPORT void obs_source_send_mouse_move(obs_source_t source,
EXPORT void obs_source_send_mouse_move(obs_source_t *source,
const struct obs_mouse_event *event, bool mouse_leave);
/** Sends a mouse wheel event to a source */
EXPORT void obs_source_send_mouse_wheel(obs_source_t source,
EXPORT void obs_source_send_mouse_wheel(obs_source_t *source,
const struct obs_mouse_event *event, int x_delta, int y_delta);
/** Sends a got-focus or lost-focus event to a source */
EXPORT void obs_source_send_focus(obs_source_t source, bool focus);
EXPORT void obs_source_send_focus(obs_source_t *source, bool focus);
/** Sends a key up/down event to a source */
EXPORT void obs_source_send_key_click(obs_source_t source,
EXPORT void obs_source_send_key_click(obs_source_t *source,
const struct obs_key_event *event, bool key_up);
/** Begins transition frame. Sets all transitioning volume values to 0.0f. */
EXPORT void obs_transition_begin_frame(obs_source_t transition);
EXPORT void obs_transition_begin_frame(obs_source_t *transition);
/**
* Adds a transitioning volume value to a source that's being transitioned.
* This value is applied to all the sources within the the source.
*/
EXPORT void obs_source_set_transition_vol(obs_source_t source, float vol);
EXPORT void obs_source_set_transition_vol(obs_source_t *source, float vol);
/** Ends transition frame and applies new presentation volumes to all sources */
EXPORT void obs_transition_end_frame(obs_source_t transition);
EXPORT void obs_transition_end_frame(obs_source_t *transition);
/* ------------------------------------------------------------------------- */
@ -795,78 +797,80 @@ EXPORT void obs_transition_end_frame(obs_source_t transition);
* A scene is a source which is a container of other sources with specific
* display oriantations. Scenes can also be used like any other source.
*/
EXPORT obs_scene_t obs_scene_create(const char *name);
EXPORT obs_scene_t *obs_scene_create(const char *name);
EXPORT void obs_scene_addref(obs_scene_t scene);
EXPORT void obs_scene_release(obs_scene_t scene);
EXPORT void obs_scene_addref(obs_scene_t *scene);
EXPORT void obs_scene_release(obs_scene_t *scene);
/** Gets the scene's source context */
EXPORT obs_source_t obs_scene_get_source(obs_scene_t scene);
EXPORT obs_source_t *obs_scene_get_source(obs_scene_t *scene);
/** Gets the scene from its source, or NULL if not a scene */
EXPORT obs_scene_t obs_scene_from_source(obs_source_t source);
EXPORT obs_scene_t *obs_scene_from_source(obs_source_t *source);
/** Determines whether a source is within a scene */
EXPORT obs_sceneitem_t obs_scene_find_source(obs_scene_t scene,
EXPORT obs_sceneitem_t *obs_scene_find_source(obs_scene_t *scene,
const char *name);
/** Enumerates sources within a scene */
EXPORT void obs_scene_enum_items(obs_scene_t scene,
bool (*callback)(obs_scene_t, obs_sceneitem_t, void*),
EXPORT void obs_scene_enum_items(obs_scene_t *scene,
bool (*callback)(obs_scene_t*, obs_sceneitem_t*, void*),
void *param);
/** Adds/creates a new scene item for a source */
EXPORT obs_sceneitem_t obs_scene_add(obs_scene_t scene, obs_source_t source);
EXPORT obs_sceneitem_t *obs_scene_add(obs_scene_t *scene, obs_source_t *source);
EXPORT void obs_sceneitem_addref(obs_sceneitem_t item);
EXPORT void obs_sceneitem_release(obs_sceneitem_t item);
EXPORT void obs_sceneitem_addref(obs_sceneitem_t *item);
EXPORT void obs_sceneitem_release(obs_sceneitem_t *item);
/** Removes a scene item. */
EXPORT void obs_sceneitem_remove(obs_sceneitem_t item);
EXPORT void obs_sceneitem_remove(obs_sceneitem_t *item);
/** Gets the scene parent associated with the scene item. */
EXPORT obs_scene_t obs_sceneitem_get_scene(obs_sceneitem_t item);
EXPORT obs_scene_t *obs_sceneitem_get_scene(obs_sceneitem_t *item);
/** Gets the source of a scene item. */
EXPORT obs_source_t obs_sceneitem_get_source(obs_sceneitem_t item);
EXPORT obs_source_t *obs_sceneitem_get_source(obs_sceneitem_t *item);
EXPORT void obs_sceneitem_select(obs_sceneitem_t item, bool select);
EXPORT bool obs_sceneitem_selected(obs_sceneitem_t item);
EXPORT void obs_sceneitem_select(obs_sceneitem_t *item, bool select);
EXPORT bool obs_sceneitem_selected(obs_sceneitem_t *item);
/* Functions for gettings/setting specific orientation of a scene item */
EXPORT void obs_sceneitem_set_pos(obs_sceneitem_t item, const struct vec2 *pos);
EXPORT void obs_sceneitem_set_rot(obs_sceneitem_t item, float rot_deg);
EXPORT void obs_sceneitem_set_scale(obs_sceneitem_t item,
EXPORT void obs_sceneitem_set_pos(obs_sceneitem_t *item, const struct vec2 *pos);
EXPORT void obs_sceneitem_set_rot(obs_sceneitem_t *item, float rot_deg);
EXPORT void obs_sceneitem_set_scale(obs_sceneitem_t *item,
const struct vec2 *scale);
EXPORT void obs_sceneitem_set_alignment(obs_sceneitem_t item,
EXPORT void obs_sceneitem_set_alignment(obs_sceneitem_t *item,
uint32_t alignment);
EXPORT void obs_sceneitem_set_order(obs_sceneitem_t item,
EXPORT void obs_sceneitem_set_order(obs_sceneitem_t *item,
enum obs_order_movement movement);
EXPORT void obs_sceneitem_set_bounds_type(obs_sceneitem_t item,
EXPORT void obs_sceneitem_set_bounds_type(obs_sceneitem_t *item,
enum obs_bounds_type type);
EXPORT void obs_sceneitem_set_bounds_alignment(obs_sceneitem_t item,
EXPORT void obs_sceneitem_set_bounds_alignment(obs_sceneitem_t *item,
uint32_t alignment);
EXPORT void obs_sceneitem_set_bounds(obs_sceneitem_t item,
EXPORT void obs_sceneitem_set_bounds(obs_sceneitem_t *item,
const struct vec2 *bounds);
EXPORT void obs_sceneitem_get_pos(obs_sceneitem_t item, struct vec2 *pos);
EXPORT float obs_sceneitem_get_rot(obs_sceneitem_t item);
EXPORT void obs_sceneitem_get_scale(obs_sceneitem_t item, struct vec2 *scale);
EXPORT uint32_t obs_sceneitem_get_alignment(obs_sceneitem_t item);
EXPORT void obs_sceneitem_get_pos(obs_sceneitem_t *item, struct vec2 *pos);
EXPORT float obs_sceneitem_get_rot(obs_sceneitem_t *item);
EXPORT void obs_sceneitem_get_scale(obs_sceneitem_t *item, struct vec2 *scale);
EXPORT uint32_t obs_sceneitem_get_alignment(obs_sceneitem_t *item);
EXPORT enum obs_bounds_type obs_sceneitem_get_bounds_type(obs_sceneitem_t item);
EXPORT uint32_t obs_sceneitem_get_bounds_alignment(obs_sceneitem_t item);
EXPORT void obs_sceneitem_get_bounds(obs_sceneitem_t item, struct vec2 *bounds);
EXPORT enum obs_bounds_type obs_sceneitem_get_bounds_type(
obs_sceneitem_t *item);
EXPORT uint32_t obs_sceneitem_get_bounds_alignment(obs_sceneitem_t *item);
EXPORT void obs_sceneitem_get_bounds(obs_sceneitem_t *item,
struct vec2 *bounds);
EXPORT void obs_sceneitem_get_info(obs_sceneitem_t item,
EXPORT void obs_sceneitem_get_info(obs_sceneitem_t *item,
struct obs_transform_info *info);
EXPORT void obs_sceneitem_set_info(obs_sceneitem_t item,
EXPORT void obs_sceneitem_set_info(obs_sceneitem_t *item,
const struct obs_transform_info *info);
EXPORT void obs_sceneitem_get_draw_transform(obs_sceneitem_t item,
EXPORT void obs_sceneitem_get_draw_transform(obs_sceneitem_t *item,
struct matrix4 *transform);
EXPORT void obs_sceneitem_get_box_transform(obs_sceneitem_t item,
EXPORT void obs_sceneitem_get_box_transform(obs_sceneitem_t *item,
struct matrix4 *transform);
@ -881,105 +885,106 @@ EXPORT const char *obs_output_get_display_name(const char *id);
* Outputs allow outputting to file, outputting to network, outputting to
* directshow, or other custom outputs.
*/
EXPORT obs_output_t obs_output_create(const char *id, const char *name,
obs_data_t settings);
EXPORT void obs_output_destroy(obs_output_t output);
EXPORT obs_output_t *obs_output_create(const char *id, const char *name,
obs_data_t *settings);
EXPORT void obs_output_destroy(obs_output_t *output);
EXPORT const char *obs_output_get_name(obs_output_t output);
EXPORT const char *obs_output_get_name(obs_output_t *output);
/** Starts the output. */
EXPORT bool obs_output_start(obs_output_t output);
EXPORT bool obs_output_start(obs_output_t *output);
/** Stops the output. */
EXPORT void obs_output_stop(obs_output_t output);
EXPORT void obs_output_stop(obs_output_t *output);
/** Returns whether the output is active */
EXPORT bool obs_output_active(obs_output_t output);
EXPORT bool obs_output_active(obs_output_t *output);
/** Gets the default settings for an output type */
EXPORT obs_data_t obs_output_defaults(const char *id);
EXPORT obs_data_t *obs_output_defaults(const char *id);
/** Returns the property list, if any. Free with obs_properties_destroy */
EXPORT obs_properties_t obs_get_output_properties(const char *id);
EXPORT obs_properties_t *obs_get_output_properties(const char *id);
/**
* Returns the property list of an existing output, if any. Free with
* obs_properties_destroy
*/
EXPORT obs_properties_t obs_output_properties(obs_output_t output);
EXPORT obs_properties_t *obs_output_properties(obs_output_t *output);
/** Updates the settings for this output context */
EXPORT void obs_output_update(obs_output_t output, obs_data_t settings);
EXPORT void obs_output_update(obs_output_t *output, obs_data_t *settings);
/** Specifies whether the output can be paused */
EXPORT bool obs_output_canpause(obs_output_t output);
EXPORT bool obs_output_canpause(obs_output_t *output);
/** Pauses the output (if the functionality is allowed by the output */
EXPORT void obs_output_pause(obs_output_t output);
EXPORT void obs_output_pause(obs_output_t *output);
/* Gets the current output settings string */
EXPORT obs_data_t obs_output_get_settings(obs_output_t output);
EXPORT obs_data_t *obs_output_get_settings(obs_output_t *output);
/** Returns the signal handler for an output */
EXPORT signal_handler_t obs_output_get_signal_handler(obs_output_t output);
EXPORT signal_handler_t *obs_output_get_signal_handler(obs_output_t *output);
/** Returns the procedure handler for an output */
EXPORT proc_handler_t obs_output_get_proc_handler(obs_output_t output);
EXPORT proc_handler_t *obs_output_get_proc_handler(obs_output_t *output);
/**
* Sets the current video media context associated with this output,
* required for non-encoded outputs
*/
EXPORT void obs_output_set_video(obs_output_t output, video_t video);
EXPORT void obs_output_set_video(obs_output_t *output, video_t *video);
/**
* Sets the current audio/video media contexts associated with this output,
* required for non-encoded outputs. Can be null.
*/
EXPORT void obs_output_set_media(obs_output_t output,
video_t video, audio_t audio);
EXPORT void obs_output_set_media(obs_output_t *output,
video_t *video, audio_t *audio);
/** Returns the video media context associated with this output */
EXPORT video_t obs_output_video(obs_output_t output);
EXPORT video_t *obs_output_video(obs_output_t *output);
/** Returns the audio media context associated with this output */
EXPORT audio_t obs_output_audio(obs_output_t output);
EXPORT audio_t *obs_output_audio(obs_output_t *output);
/**
* Sets the current video encoder associated with this output,
* required for encoded outputs
*/
EXPORT void obs_output_set_video_encoder(obs_output_t output,
obs_encoder_t encoder);
EXPORT void obs_output_set_video_encoder(obs_output_t *output,
obs_encoder_t *encoder);
/**
* Sets the current audio encoder associated with this output,
* required for encoded outputs
*/
EXPORT void obs_output_set_audio_encoder(obs_output_t output,
obs_encoder_t encoder);
EXPORT void obs_output_set_audio_encoder(obs_output_t *output,
obs_encoder_t *encoder);
/** Returns the current video encoder associated with this output */
EXPORT obs_encoder_t obs_output_get_video_encoder(obs_output_t output);
EXPORT obs_encoder_t *obs_output_get_video_encoder(obs_output_t *output);
/** Returns the current audio encoder associated with this output */
EXPORT obs_encoder_t obs_output_get_audio_encoder(obs_output_t output);
EXPORT obs_encoder_t *obs_output_get_audio_encoder(obs_output_t *output);
/** Sets the current service associated with this output. */
EXPORT void obs_output_set_service(obs_output_t output, obs_service_t service);
EXPORT void obs_output_set_service(obs_output_t *output,
obs_service_t *service);
/** Gets the current service associated with this output. */
EXPORT obs_service_t obs_output_get_service(obs_output_t output);
EXPORT obs_service_t *obs_output_get_service(obs_output_t *output);
/**
* Sets the reconnect settings. Set retry_count to 0 to disable reconnecting.
*/
EXPORT void obs_output_set_reconnect_settings(obs_output_t output,
EXPORT void obs_output_set_reconnect_settings(obs_output_t *output,
int retry_count, int retry_sec);
EXPORT uint64_t obs_output_get_total_bytes(obs_output_t output);
EXPORT int obs_output_get_frames_dropped(obs_output_t output);
EXPORT int obs_output_get_total_frames(obs_output_t output);
EXPORT uint64_t obs_output_get_total_bytes(obs_output_t *output);
EXPORT int obs_output_get_frames_dropped(obs_output_t *output);
EXPORT int obs_output_get_total_frames(obs_output_t *output);
/**
* Sets the preferred scaled resolution for this output. Set width and height
@ -989,32 +994,33 @@ EXPORT int obs_output_get_total_frames(obs_output_t output);
* the encoder before the stream is started. If the encoder is already active,
* then this function will trigger a warning and do nothing.
*/
EXPORT void obs_output_set_preferred_size(obs_output_t output, uint32_t width,
EXPORT void obs_output_set_preferred_size(obs_output_t *output, uint32_t width,
uint32_t height);
/** For video outputs, returns the width of the encoded image */
EXPORT uint32_t obs_output_get_width(obs_output_t output);
EXPORT uint32_t obs_output_get_width(obs_output_t *output);
/** For video outputs, returns the height of the encoded image */
EXPORT uint32_t obs_output_get_height(obs_output_t output);
EXPORT uint32_t obs_output_get_height(obs_output_t *output);
/* ------------------------------------------------------------------------- */
/* Functions used by outputs */
/** Optionally sets the video conversion info. Used only for raw output */
EXPORT void obs_output_set_video_conversion(obs_output_t output,
EXPORT void obs_output_set_video_conversion(obs_output_t *output,
const struct video_scale_info *conversion);
/** Optionally sets the audio conversion info. Used only for raw output */
EXPORT void obs_output_set_audio_conversion(obs_output_t output,
EXPORT void obs_output_set_audio_conversion(obs_output_t *output,
const struct audio_convert_info *conversion);
/** Returns whether data capture can begin with the specified flags */
EXPORT bool obs_output_can_begin_data_capture(obs_output_t output,
EXPORT bool obs_output_can_begin_data_capture(obs_output_t *output,
uint32_t flags);
/** Initializes encoders (if any) */
EXPORT bool obs_output_initialize_encoders(obs_output_t output, uint32_t flags);
EXPORT bool obs_output_initialize_encoders(obs_output_t *output,
uint32_t flags);
/**
* Begins data capture from media/encoders.
@ -1028,10 +1034,10 @@ EXPORT bool obs_output_initialize_encoders(obs_output_t output, uint32_t flags);
* and video.
* @return true if successful, false otherwise.
*/
EXPORT bool obs_output_begin_data_capture(obs_output_t output, uint32_t flags);
EXPORT bool obs_output_begin_data_capture(obs_output_t *output, uint32_t flags);
/** Ends data capture from media/encoders */
EXPORT void obs_output_end_data_capture(obs_output_t output);
EXPORT void obs_output_end_data_capture(obs_output_t *output);
/**
* Signals that the output has stopped itself.
@ -1039,7 +1045,7 @@ EXPORT void obs_output_end_data_capture(obs_output_t output);
* @param output Output context
* @param code Error code (or OBS_OUTPUT_SUCCESS if not an error)
*/
EXPORT void obs_output_signal_stop(obs_output_t output, int code);
EXPORT void obs_output_signal_stop(obs_output_t *output, int code);
/* ------------------------------------------------------------------------- */
@ -1055,8 +1061,8 @@ EXPORT const char *obs_encoder_getdisplayname(const char *id);
* @param settings Settings
* @return The video encoder context, or NULL if failed or not found.
*/
EXPORT obs_encoder_t obs_video_encoder_create(const char *id, const char *name,
obs_data_t settings);
EXPORT obs_encoder_t *obs_video_encoder_create(const char *id, const char *name,
obs_data_t *settings);
/**
* Creates an audio encoder context
@ -1066,76 +1072,76 @@ EXPORT obs_encoder_t obs_video_encoder_create(const char *id, const char *name,
* @param settings Settings
* @return The video encoder context, or NULL if failed or not found.
*/
EXPORT obs_encoder_t obs_audio_encoder_create(const char *id, const char *name,
obs_data_t settings);
EXPORT obs_encoder_t *obs_audio_encoder_create(const char *id, const char *name,
obs_data_t *settings);
/** Destroys an encoder context */
EXPORT void obs_encoder_destroy(obs_encoder_t encoder);
EXPORT void obs_encoder_destroy(obs_encoder_t *encoder);
EXPORT const char *obs_encoder_get_name(obs_encoder_t encoder);
EXPORT const char *obs_encoder_get_name(obs_encoder_t *encoder);
/** Returns the codec of the encoder */
EXPORT const char *obs_encoder_get_codec(obs_encoder_t encoder);
EXPORT const char *obs_encoder_get_codec(obs_encoder_t *encoder);
/**
* Sets the scaled resolution for a video encoder. Set width and height to 0
* to disable scaling. If the encoder is active, this function will trigger
* a warning, and do nothing.
*/
EXPORT void obs_encoder_set_scaled_size(obs_encoder_t encoder, uint32_t width,
EXPORT void obs_encoder_set_scaled_size(obs_encoder_t *encoder, uint32_t width,
uint32_t height);
/** For video encoders, returns the width of the encoded image */
EXPORT uint32_t obs_encoder_get_width(obs_encoder_t encoder);
EXPORT uint32_t obs_encoder_get_width(obs_encoder_t *encoder);
/** For video encoders, returns the height of the encoded image */
EXPORT uint32_t obs_encoder_get_height(obs_encoder_t encoder);
EXPORT uint32_t obs_encoder_get_height(obs_encoder_t *encoder);
/** Gets the default settings for an encoder type */
EXPORT obs_data_t obs_encoder_defaults(const char *id);
EXPORT obs_data_t *obs_encoder_defaults(const char *id);
/** Returns the property list, if any. Free with obs_properties_destroy */
EXPORT obs_properties_t obs_get_encoder_properties(const char *id);
EXPORT obs_properties_t *obs_get_encoder_properties(const char *id);
/**
* Returns the property list of an existing encoder, if any. Free with
* obs_properties_destroy
*/
EXPORT obs_properties_t obs_encoder_properties(obs_encoder_t encoder);
EXPORT obs_properties_t *obs_encoder_properties(obs_encoder_t *encoder);
/**
* Updates the settings of the encoder context. Usually used for changing
* bitrate while active
*/
EXPORT void obs_encoder_update(obs_encoder_t encoder, obs_data_t settings);
EXPORT void obs_encoder_update(obs_encoder_t *encoder, obs_data_t *settings);
/** Gets extra data (headers) associated with this context */
EXPORT bool obs_encoder_get_extra_data(obs_encoder_t encoder,
EXPORT bool obs_encoder_get_extra_data(obs_encoder_t *encoder,
uint8_t **extra_data, size_t *size);
/** Returns the current settings for this encoder */
EXPORT obs_data_t obs_encoder_get_settings(obs_encoder_t encoder);
EXPORT obs_data_t *obs_encoder_get_settings(obs_encoder_t *encoder);
/** Sets the video output context to be used with this encoder */
EXPORT void obs_encoder_set_video(obs_encoder_t encoder, video_t video);
EXPORT void obs_encoder_set_video(obs_encoder_t *encoder, video_t *video);
/** Sets the audio output context to be used with this encoder */
EXPORT void obs_encoder_set_audio(obs_encoder_t encoder, audio_t audio);
EXPORT void obs_encoder_set_audio(obs_encoder_t *encoder, audio_t *audio);
/**
* Returns the video output context used with this encoder, or NULL if not
* a video context
*/
EXPORT video_t obs_encoder_video(obs_encoder_t encoder);
EXPORT video_t *obs_encoder_video(obs_encoder_t *encoder);
/**
* Returns the audio output context used with this encoder, or NULL if not
* a audio context
*/
EXPORT audio_t obs_encoder_audio(obs_encoder_t encoder);
EXPORT audio_t *obs_encoder_audio(obs_encoder_t *encoder);
/** Returns true if encoder is active, false otherwise */
EXPORT bool obs_encoder_active(obs_encoder_t encoder);
EXPORT bool obs_encoder_active(obs_encoder_t *encoder);
/** Duplicates an encoder packet */
EXPORT void obs_duplicate_encoder_packet(struct encoder_packet *dst,
@ -1149,44 +1155,44 @@ EXPORT void obs_free_encoder_packet(struct encoder_packet *packet);
EXPORT const char *obs_service_get_display_name(const char *id);
EXPORT obs_service_t obs_service_create(const char *id, const char *name,
obs_data_t settings);
EXPORT void obs_service_destroy(obs_service_t service);
EXPORT obs_service_t *obs_service_create(const char *id, const char *name,
obs_data_t *settings);
EXPORT void obs_service_destroy(obs_service_t *service);
EXPORT const char *obs_service_get_name(obs_service_t service);
EXPORT const char *obs_service_get_name(obs_service_t *service);
/** Gets the default settings for a service */
EXPORT obs_data_t obs_service_defaults(const char *id);
EXPORT obs_data_t *obs_service_defaults(const char *id);
/** Returns the property list, if any. Free with obs_properties_destroy */
EXPORT obs_properties_t obs_get_service_properties(const char *id);
EXPORT obs_properties_t *obs_get_service_properties(const char *id);
/**
* Returns the property list of an existing service context, if any. Free with
* obs_properties_destroy
*/
EXPORT obs_properties_t obs_service_properties(obs_service_t service);
EXPORT obs_properties_t *obs_service_properties(obs_service_t *service);
/** Gets the service type */
EXPORT const char *obs_service_gettype(obs_service_t service);
EXPORT const char *obs_service_gettype(obs_service_t *service);
/** Updates the settings of the service context */
EXPORT void obs_service_update(obs_service_t service, obs_data_t settings);
EXPORT void obs_service_update(obs_service_t *service, obs_data_t *settings);
/** Returns the current settings for this service */
EXPORT obs_data_t obs_service_get_settings(obs_service_t service);
EXPORT obs_data_t *obs_service_get_settings(obs_service_t *service);
/** Returns the URL for this service context */
EXPORT const char *obs_service_get_url(obs_service_t service);
EXPORT const char *obs_service_get_url(obs_service_t *service);
/** Returns the stream key (if any) for this service context */
EXPORT const char *obs_service_get_key(obs_service_t service);
EXPORT const char *obs_service_get_key(obs_service_t *service);
/** Returns the username (if any) for this service context */
EXPORT const char *obs_service_get_username(obs_service_t service);
EXPORT const char *obs_service_get_username(obs_service_t *service);
/** Returns the password (if any) for this service context */
EXPORT const char *obs_service_get_password(obs_service_t service);
EXPORT const char *obs_service_get_password(obs_service_t *service);
/* ------------------------------------------------------------------------- */

View File

@ -62,12 +62,12 @@ public:
inline bool operator!=(T p) const {return val != p;}
};
using OBSSource = OBSRef<obs_source_t, obs_source_addref, obs_source_release>;
using OBSScene = OBSRef<obs_scene_t, obs_scene_addref, obs_scene_release>;
using OBSSceneItem = OBSRef<obs_sceneitem_t, obs_sceneitem_addref,
using OBSSource = OBSRef<obs_source_t*, obs_source_addref, obs_source_release>;
using OBSScene = OBSRef<obs_scene_t*, obs_scene_addref, obs_scene_release>;
using OBSSceneItem = OBSRef<obs_sceneitem_t*, obs_sceneitem_addref,
obs_sceneitem_release>;
using OBSData = OBSRef<obs_data_t, obs_data_addref, obs_data_release>;
using OBSDataArray = OBSRef<obs_data_array_t, obs_data_array_addref,
using OBSData = OBSRef<obs_data_t*, obs_data_addref, obs_data_release>;
using OBSDataArray = OBSRef<obs_data_array_t*, obs_data_array_addref,
obs_data_array_release>;
/* objects that are not meant to be instanced */
@ -94,14 +94,14 @@ public:
inline bool operator!=(T p) const {return obj != p;}
};
using OBSDisplay = OBSObj<obs_display_t, obs_display_destroy>;
using OBSEncoder = OBSObj<obs_encoder_t, obs_encoder_destroy>;
using OBSView = OBSObj<obs_view_t, obs_view_destroy>;
using OBSOutput = OBSObj<obs_output_t, obs_output_destroy>;
using OBSDisplay = OBSObj<obs_display_t*, obs_display_destroy>;
using OBSEncoder = OBSObj<obs_encoder_t*, obs_encoder_destroy>;
using OBSView = OBSObj<obs_view_t*, obs_view_destroy>;
using OBSOutput = OBSObj<obs_output_t*, obs_output_destroy>;
/* signal handler connection */
class OBSSignal {
signal_handler_t handler;
signal_handler_t *handler;
const char *signal;
signal_callback_t callback;
void *param;
@ -114,7 +114,7 @@ public:
param (nullptr)
{}
inline OBSSignal(signal_handler_t handler_,
inline OBSSignal(signal_handler_t *handler_,
const char *signal_,
signal_callback_t callback_,
void *param_)
@ -137,7 +137,7 @@ public:
inline ~OBSSignal() {Disconnect();}
inline void Connect(signal_handler_t handler_,
inline void Connect(signal_handler_t *handler_,
const char *signal_,
signal_callback_t callback_,
void *param_)

View File

@ -58,7 +58,7 @@ struct config_data {
struct darray defaults; /* struct config_section */
};
config_t config_create(const char *file)
config_t *config_create(const char *file)
{
struct config_data *config;
FILE *f;
@ -224,7 +224,7 @@ complete:
return CONFIG_SUCCESS;
}
int config_open(config_t *config, const char *file,
int config_open(config_t **config, const char *file,
enum config_open_type open_type)
{
int errorcode;
@ -249,7 +249,7 @@ int config_open(config_t *config, const char *file,
return errorcode;
}
int config_open_defaults(config_t config, const char *file)
int config_open_defaults(config_t *config, const char *file)
{
if (!config)
return CONFIG_ERROR;
@ -257,7 +257,7 @@ int config_open_defaults(config_t config, const char *file)
return config_parse(&config->defaults, file, false);
}
int config_save(config_t config)
int config_save(config_t *config)
{
FILE *f;
struct dstr str;
@ -306,7 +306,7 @@ int config_save(config_t config)
return CONFIG_SUCCESS;
}
void config_close(config_t config)
void config_close(config_t *config)
{
struct config_section *defaults, *sections;
size_t i;
@ -327,12 +327,12 @@ void config_close(config_t config)
bfree(config);
}
size_t config_num_sections(config_t config)
size_t config_num_sections(config_t *config)
{
return config->sections.num;
}
const char *config_get_section(config_t config, size_t idx)
const char *config_get_section(config_t *config, size_t idx)
{
struct config_section *section;
@ -408,7 +408,7 @@ static void config_set_item(struct darray *sections, const char *section,
item->value = value;
}
void config_set_string(config_t config, const char *section,
void config_set_string(config_t *config, const char *section,
const char *name, const char *value)
{
if (!value)
@ -416,7 +416,7 @@ void config_set_string(config_t config, const char *section,
config_set_item(&config->sections, section, name, bstrdup(value));
}
void config_set_int(config_t config, const char *section,
void config_set_int(config_t *config, const char *section,
const char *name, int64_t value)
{
struct dstr str;
@ -425,7 +425,7 @@ void config_set_int(config_t config, const char *section,
config_set_item(&config->sections, section, name, str.array);
}
void config_set_uint(config_t config, const char *section,
void config_set_uint(config_t *config, const char *section,
const char *name, uint64_t value)
{
struct dstr str;
@ -434,14 +434,14 @@ void config_set_uint(config_t config, const char *section,
config_set_item(&config->sections, section, name, str.array);
}
void config_set_bool(config_t config, const char *section,
void config_set_bool(config_t *config, const char *section,
const char *name, bool value)
{
char *str = bstrdup(value ? "true" : "false");
config_set_item(&config->sections, section, name, str);
}
void config_set_double(config_t config, const char *section,
void config_set_double(config_t *config, const char *section,
const char *name, double value)
{
struct dstr str;
@ -450,7 +450,7 @@ void config_set_double(config_t config, const char *section,
config_set_item(&config->sections, section, name, str.array);
}
void config_set_default_string(config_t config, const char *section,
void config_set_default_string(config_t *config, const char *section,
const char *name, const char *value)
{
if (!value)
@ -458,7 +458,7 @@ void config_set_default_string(config_t config, const char *section,
config_set_item(&config->defaults, section, name, bstrdup(value));
}
void config_set_default_int(config_t config, const char *section,
void config_set_default_int(config_t *config, const char *section,
const char *name, int64_t value)
{
struct dstr str;
@ -467,7 +467,7 @@ void config_set_default_int(config_t config, const char *section,
config_set_item(&config->defaults, section, name, str.array);
}
void config_set_default_uint(config_t config, const char *section,
void config_set_default_uint(config_t *config, const char *section,
const char *name, uint64_t value)
{
struct dstr str;
@ -476,14 +476,14 @@ void config_set_default_uint(config_t config, const char *section,
config_set_item(&config->defaults, section, name, str.array);
}
void config_set_default_bool(config_t config, const char *section,
void config_set_default_bool(config_t *config, const char *section,
const char *name, bool value)
{
char *str = bstrdup(value ? "true" : "false");
config_set_item(&config->defaults, section, name, str);
}
void config_set_default_double(config_t config, const char *section,
void config_set_default_double(config_t *config, const char *section,
const char *name, double value)
{
struct dstr str;
@ -492,7 +492,7 @@ void config_set_default_double(config_t config, const char *section,
config_set_item(&config->defaults, section, name, str.array);
}
const char *config_get_string(config_t config, const char *section,
const char *config_get_string(config_t *config, const char *section,
const char *name)
{
struct config_item *item = config_find_item(&config->sections,
@ -505,7 +505,7 @@ const char *config_get_string(config_t config, const char *section,
return item->value;
}
int64_t config_get_int(config_t config, const char *section,
int64_t config_get_int(config_t *config, const char *section,
const char *name)
{
const char *value = config_get_string(config, section, name);
@ -515,7 +515,7 @@ int64_t config_get_int(config_t config, const char *section,
return 0;
}
uint64_t config_get_uint(config_t config, const char *section,
uint64_t config_get_uint(config_t *config, const char *section,
const char *name)
{
const char *value = config_get_string(config, section, name);
@ -525,7 +525,7 @@ uint64_t config_get_uint(config_t config, const char *section,
return 0;
}
bool config_get_bool(config_t config, const char *section,
bool config_get_bool(config_t *config, const char *section,
const char *name)
{
const char *value = config_get_string(config, section, name);
@ -536,7 +536,7 @@ bool config_get_bool(config_t config, const char *section,
return false;
}
double config_get_double(config_t config, const char *section,
double config_get_double(config_t *config, const char *section,
const char *name)
{
const char *value = config_get_string(config, section, name);
@ -546,7 +546,7 @@ double config_get_double(config_t config, const char *section,
return 0.0;
}
const char *config_get_default_string(config_t config, const char *section,
const char *config_get_default_string(config_t *config, const char *section,
const char *name)
{
struct config_item *item;
@ -558,7 +558,7 @@ const char *config_get_default_string(config_t config, const char *section,
return item->value;
}
int64_t config_get_default_int(config_t config, const char *section,
int64_t config_get_default_int(config_t *config, const char *section,
const char *name)
{
const char *value = config_get_default_string(config, section, name);
@ -568,7 +568,7 @@ int64_t config_get_default_int(config_t config, const char *section,
return 0;
}
uint64_t config_get_default_uint(config_t config, const char *section,
uint64_t config_get_default_uint(config_t *config, const char *section,
const char *name)
{
const char *value = config_get_default_string(config, section, name);
@ -578,7 +578,7 @@ uint64_t config_get_default_uint(config_t config, const char *section,
return 0;
}
bool config_get_default_bool(config_t config, const char *section,
bool config_get_default_bool(config_t *config, const char *section,
const char *name)
{
const char *value = config_get_default_string(config, section, name);
@ -589,7 +589,7 @@ bool config_get_default_bool(config_t config, const char *section,
return false;
}
double config_get_default_double(config_t config, const char *section,
double config_get_default_double(config_t *config, const char *section,
const char *name)
{
const char *value = config_get_default_string(config, section, name);
@ -599,13 +599,13 @@ double config_get_default_double(config_t config, const char *section,
return 0.0;
}
bool config_has_user_value(config_t config, const char *section,
bool config_has_user_value(config_t *config, const char *section,
const char *name)
{
return config_find_item(&config->sections, section, name) != NULL;
}
bool config_has_default_value(config_t config, const char *section,
bool config_has_default_value(config_t *config, const char *section,
const char *name)
{
return config_find_item(&config->defaults, section, name) != NULL;

View File

@ -30,7 +30,7 @@ extern "C" {
#endif
struct config_data;
typedef struct config_data *config_t;
typedef struct config_data config_t;
#define CONFIG_SUCCESS 0
#define CONFIG_FILENOTFOUND -1
@ -41,35 +41,35 @@ enum config_open_type {
CONFIG_OPEN_ALWAYS,
};
EXPORT config_t config_create(const char *file);
EXPORT int config_open(config_t *config, const char *file,
EXPORT config_t *config_create(const char *file);
EXPORT int config_open(config_t **config, const char *file,
enum config_open_type open_type);
EXPORT int config_save(config_t config);
EXPORT void config_close(config_t config);
EXPORT int config_save(config_t *config);
EXPORT void config_close(config_t *config);
EXPORT size_t config_num_sections(config_t config);
EXPORT const char *config_get_section(config_t config, size_t idx);
EXPORT size_t config_num_sections(config_t *config);
EXPORT const char *config_get_section(config_t *config, size_t idx);
EXPORT void config_set_string(config_t config, const char *section,
EXPORT void config_set_string(config_t *config, const char *section,
const char *name, const char *value);
EXPORT void config_set_int(config_t config, const char *section,
EXPORT void config_set_int(config_t *config, const char *section,
const char *name, int64_t value);
EXPORT void config_set_uint(config_t config, const char *section,
EXPORT void config_set_uint(config_t *config, const char *section,
const char *name, uint64_t value);
EXPORT void config_set_bool(config_t config, const char *section,
EXPORT void config_set_bool(config_t *config, const char *section,
const char *name, bool value);
EXPORT void config_set_double(config_t config, const char *section,
EXPORT void config_set_double(config_t *config, const char *section,
const char *name, double value);
EXPORT const char *config_get_string(config_t config, const char *section,
EXPORT const char *config_get_string(config_t *config, const char *section,
const char *name);
EXPORT int64_t config_get_int(config_t config, const char *section,
EXPORT int64_t config_get_int(config_t *config, const char *section,
const char *name);
EXPORT uint64_t config_get_uint(config_t config, const char *section,
EXPORT uint64_t config_get_uint(config_t *config, const char *section,
const char *name);
EXPORT bool config_get_bool(config_t config, const char *section,
EXPORT bool config_get_bool(config_t *config, const char *section,
const char *name);
EXPORT double config_get_double(config_t config, const char *section,
EXPORT double config_get_double(config_t *config, const char *section,
const char *name);
/*
@ -86,35 +86,35 @@ EXPORT double config_get_double(config_t config, const char *section,
* functions (recommended for most cases), or you can initialize it via a file
* with config_open_defaults.
*/
EXPORT int config_open_defaults(config_t config, const char *file);
EXPORT int config_open_defaults(config_t *config, const char *file);
EXPORT void config_set_default_string(config_t config, const char *section,
EXPORT void config_set_default_string(config_t *config, const char *section,
const char *name, const char *value);
EXPORT void config_set_default_int(config_t config, const char *section,
EXPORT void config_set_default_int(config_t *config, const char *section,
const char *name, int64_t value);
EXPORT void config_set_default_uint(config_t config, const char *section,
EXPORT void config_set_default_uint(config_t *config, const char *section,
const char *name, uint64_t value);
EXPORT void config_set_default_bool(config_t config, const char *section,
EXPORT void config_set_default_bool(config_t *config, const char *section,
const char *name, bool value);
EXPORT void config_set_default_double(config_t config, const char *section,
EXPORT void config_set_default_double(config_t *config, const char *section,
const char *name, double value);
/* These functions allow you to get the current default values rather than get
* the actual values. Probably almost never really needed */
EXPORT const char *config_get_default_string(config_t config,
EXPORT const char *config_get_default_string(config_t *config,
const char *section, const char *name);
EXPORT int64_t config_get_default_int(config_t config, const char *section,
EXPORT int64_t config_get_default_int(config_t *config, const char *section,
const char *name);
EXPORT uint64_t config_get_default_uint(config_t config, const char *section,
EXPORT uint64_t config_get_default_uint(config_t *config, const char *section,
const char *name);
EXPORT bool config_get_default_bool(config_t config, const char *section,
EXPORT bool config_get_default_bool(config_t *config, const char *section,
const char *name);
EXPORT double config_get_default_double(config_t config, const char *section,
EXPORT double config_get_default_double(config_t *config, const char *section,
const char *name);
EXPORT bool config_has_user_value(config_t config, const char *section,
EXPORT bool config_has_user_value(config_t *config, const char *section,
const char *name);
EXPORT bool config_has_default_value(config_t config, const char *section,
EXPORT bool config_has_default_value(config_t *config, const char *section,
const char *name);
#ifdef __cplusplus

View File

@ -146,7 +146,7 @@ static bool get_time_info(int64_t *cpu_time, int64_t *sys_time)
return true;
}
os_cpu_usage_info_t os_cpu_usage_info_start(void)
os_cpu_usage_info_t *os_cpu_usage_info_start(void)
{
struct os_cpu_usage_info *info = bmalloc(sizeof(*info));
@ -159,7 +159,7 @@ os_cpu_usage_info_t os_cpu_usage_info_start(void)
return info;
}
double os_cpu_usage_info_query(os_cpu_usage_info_t info)
double os_cpu_usage_info_query(os_cpu_usage_info_t *info)
{
int64_t sys_time, cpu_time;
int64_t sys_time_delta, cpu_time_delta;
@ -180,13 +180,13 @@ double os_cpu_usage_info_query(os_cpu_usage_info_t info)
(double)info->core_count;
}
void os_cpu_usage_info_destroy(os_cpu_usage_info_t info)
void os_cpu_usage_info_destroy(os_cpu_usage_info_t *info)
{
if (info)
bfree(info);
}
os_performance_token_t os_request_high_performance(const char *reason)
os_performance_token_t *os_request_high_performance(const char *reason)
{
@autoreleasepool {
NSProcessInfo *pi = [NSProcessInfo processInfo];
@ -202,7 +202,7 @@ os_performance_token_t os_request_high_performance(const char *reason)
}
}
void os_end_high_performance(os_performance_token_t token)
void os_end_high_performance(os_performance_token_t *token)
{
@autoreleasepool {
NSProcessInfo *pi = [NSProcessInfo processInfo];

View File

@ -70,7 +70,7 @@ struct os_cpu_usage_info {
int core_count;
};
os_cpu_usage_info_t os_cpu_usage_info_start(void)
os_cpu_usage_info_t *os_cpu_usage_info_start(void)
{
struct os_cpu_usage_info *info = bmalloc(sizeof(*info));
struct tms time_sample;
@ -82,7 +82,7 @@ os_cpu_usage_info_t os_cpu_usage_info_start(void)
return info;
}
double os_cpu_usage_info_query(os_cpu_usage_info_t info)
double os_cpu_usage_info_query(os_cpu_usage_info_t *info)
{
struct tms time_sample;
clock_t cur_cpu_time;
@ -109,7 +109,7 @@ double os_cpu_usage_info_query(os_cpu_usage_info_t info)
return percent * 100.0;
}
void os_cpu_usage_info_destroy(os_cpu_usage_info_t info)
void os_cpu_usage_info_destroy(os_cpu_usage_info_t *info)
{
if (info)
bfree(info);
@ -181,7 +181,7 @@ struct os_dir {
struct os_dirent out;
};
os_dir_t os_opendir(const char *path)
os_dir_t *os_opendir(const char *path)
{
struct os_dir *dir;
DIR *dir_val;
@ -206,7 +206,7 @@ static inline bool is_dir(const char *path)
return false;
}
struct os_dirent *os_readdir(os_dir_t dir)
struct os_dirent *os_readdir(os_dir_t *dir)
{
struct dstr file_path = {0};
@ -229,7 +229,7 @@ struct os_dirent *os_readdir(os_dir_t dir)
return &dir->out;
}
void os_closedir(os_dir_t dir)
void os_closedir(os_dir_t *dir)
{
if (dir) {
closedir(dir->dir);
@ -242,7 +242,7 @@ struct posix_glob_info {
glob_t gl;
};
int os_glob(const char *pattern, int flags, os_glob_t *pglob)
int os_glob(const char *pattern, int flags, os_glob_t **pglob)
{
struct posix_glob_info pgi;
int ret = glob(pattern, 0, NULL, &pgi.gl);
@ -271,7 +271,7 @@ int os_glob(const char *pattern, int flags, os_glob_t *pglob)
return ret;
}
void os_globfree(os_glob_t pglob)
void os_globfree(os_glob_t *pglob)
{
if (pglob) {
struct posix_glob_info *pgi = (struct posix_glob_info*)pglob;
@ -296,13 +296,13 @@ int os_mkdir(const char *path)
}
#if !defined(__APPLE__)
os_performance_token_t os_request_high_performance(const char *reason)
os_performance_token_t *os_request_high_performance(const char *reason)
{
UNUSED_PARAMETER(reason);
return NULL;
}
void os_end_high_performance(os_performance_token_t token)
void os_end_high_performance(os_performance_token_t *token)
{
UNUSED_PARAMETER(token);
}

View File

@ -97,7 +97,7 @@ struct os_cpu_usage_info {
DWORD core_count;
};
os_cpu_usage_info_t os_cpu_usage_info_start(void)
os_cpu_usage_info_t *os_cpu_usage_info_start(void)
{
struct os_cpu_usage_info *info = bzalloc(sizeof(*info));
SYSTEM_INFO si;
@ -112,7 +112,7 @@ os_cpu_usage_info_t os_cpu_usage_info_start(void)
return info;
}
double os_cpu_usage_info_query(os_cpu_usage_info_t info)
double os_cpu_usage_info_query(os_cpu_usage_info_t *info)
{
union time_data cur_time, cur_sys_time, cur_user_time;
FILETIME dummy;
@ -137,7 +137,7 @@ double os_cpu_usage_info_query(os_cpu_usage_info_t info)
return percent * 100.0;
}
void os_cpu_usage_info_destroy(os_cpu_usage_info_t info)
void os_cpu_usage_info_destroy(os_cpu_usage_info_t *info)
{
if (info)
bfree(info);
@ -231,7 +231,7 @@ struct os_dir {
struct os_dirent out;
};
os_dir_t os_opendir(const char *path)
os_dir_t *os_opendir(const char *path)
{
struct dstr path_str = {0};
struct os_dir *dir = NULL;
@ -264,7 +264,7 @@ static inline bool is_dir(WIN32_FIND_DATA *wfd)
return !!(wfd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
}
struct os_dirent *os_readdir(os_dir_t dir)
struct os_dirent *os_readdir(os_dir_t *dir)
{
if (!dir)
return NULL;
@ -284,7 +284,7 @@ struct os_dirent *os_readdir(os_dir_t dir)
return &dir->out;
}
void os_closedir(os_dir_t dir)
void os_closedir(os_dir_t *dir)
{
if (dir) {
FindClose(dir->handle);
@ -314,13 +314,13 @@ static void make_globent(struct os_globent *ent, WIN32_FIND_DATA *wfd,
dstr_free(&name);
}
int os_glob(const char *pattern, int flags, os_glob_t *pglob)
int os_glob(const char *pattern, int flags, os_glob_t **pglob)
{
DARRAY(struct os_globent) files;
HANDLE handle;
WIN32_FIND_DATA wfd;
int ret = -1;
os_glob_t out = NULL;
os_glob_t *out = NULL;
wchar_t *w_path;
da_init(files);
@ -353,7 +353,7 @@ int os_glob(const char *pattern, int flags, os_glob_t *pglob)
return ret;
}
void os_globfree(os_glob_t pglob)
void os_globfree(os_glob_t *pglob)
{
if (pglob) {
for (size_t i = 0; i < pglob->gl_pathc; i++)
@ -433,13 +433,13 @@ BOOL WINAPI DllMain(HINSTANCE hinst_dll, DWORD reason, LPVOID reserved)
return true;
}
os_performance_token_t os_request_high_performance(const char *reason)
os_performance_token_t *os_request_high_performance(const char *reason)
{
UNUSED_PARAMETER(reason);
return NULL;
}
void os_end_high_performance(os_performance_token_t token)
void os_end_high_performance(os_performance_token_t *token)
{
UNUSED_PARAMETER(token);
}

View File

@ -70,15 +70,15 @@ EXPORT void *os_dlsym(void *module, const char *func);
EXPORT void os_dlclose(void *module);
struct os_cpu_usage_info;
typedef struct os_cpu_usage_info *os_cpu_usage_info_t;
typedef struct os_cpu_usage_info os_cpu_usage_info_t;
EXPORT os_cpu_usage_info_t os_cpu_usage_info_start(void);
EXPORT double os_cpu_usage_info_query(os_cpu_usage_info_t info);
EXPORT void os_cpu_usage_info_destroy(os_cpu_usage_info_t info);
EXPORT os_cpu_usage_info_t *os_cpu_usage_info_start(void);
EXPORT double os_cpu_usage_info_query(os_cpu_usage_info_t *info);
EXPORT void os_cpu_usage_info_destroy(os_cpu_usage_info_t *info);
typedef const void *os_performance_token_t;
EXPORT os_performance_token_t os_request_high_performance(const char *reason);
EXPORT void os_end_high_performance(os_performance_token_t);
typedef const void os_performance_token_t;
EXPORT os_performance_token_t *os_request_high_performance(const char *reason);
EXPORT void os_end_high_performance(os_performance_token_t *);
/**
* Sleeps to a specific time (in nanoseconds). Doesn't have to be super
@ -95,16 +95,16 @@ EXPORT char *os_get_config_path(const char *name);
EXPORT bool os_file_exists(const char *path);
struct os_dir;
typedef struct os_dir *os_dir_t;
typedef struct os_dir os_dir_t;
struct os_dirent {
char d_name[256];
bool directory;
};
EXPORT os_dir_t os_opendir(const char *path);
EXPORT struct os_dirent *os_readdir(os_dir_t dir);
EXPORT void os_closedir(os_dir_t dir);
EXPORT os_dir_t *os_opendir(const char *path);
EXPORT struct os_dirent *os_readdir(os_dir_t *dir);
EXPORT void os_closedir(os_dir_t *dir);
struct os_globent {
char *path;
@ -116,12 +116,12 @@ struct os_glob_info {
struct os_globent *gl_pathv;
};
typedef struct os_glob_info *os_glob_t;
typedef struct os_glob_info os_glob_t;
/* currently no flags available */
EXPORT int os_glob(const char *pattern, int flags, os_glob_t *pglob);
EXPORT void os_globfree(os_glob_t pglob);
EXPORT int os_glob(const char *pattern, int flags, os_glob_t **pglob);
EXPORT void os_globfree(os_glob_t *pglob);
EXPORT int os_unlink(const char *path);

View File

@ -358,7 +358,7 @@ static inline bool lookup_getstring(const char *lookup_val,
/* ------------------------------------------------------------------------- */
lookup_t text_lookup_create(const char *path)
lookup_t *text_lookup_create(const char *path)
{
struct text_lookup *lookup = bzalloc(sizeof(struct text_lookup));
@ -370,7 +370,7 @@ lookup_t text_lookup_create(const char *path)
return lookup;
}
bool text_lookup_add(lookup_t lookup, const char *path)
bool text_lookup_add(lookup_t *lookup, const char *path)
{
struct dstr file_str;
char *temp = NULL;
@ -397,7 +397,7 @@ bool text_lookup_add(lookup_t lookup, const char *path)
return true;
}
void text_lookup_destroy(lookup_t lookup)
void text_lookup_destroy(lookup_t *lookup)
{
if (lookup) {
dstr_free(&lookup->language);
@ -407,7 +407,7 @@ void text_lookup_destroy(lookup_t lookup)
}
}
bool text_lookup_getstr(lookup_t lookup, const char *lookup_val,
bool text_lookup_getstr(lookup_t *lookup, const char *lookup_val,
const char **out)
{
if (lookup)

View File

@ -32,13 +32,13 @@ extern "C" {
/* opaque typdef */
struct text_lookup;
typedef struct text_lookup *lookup_t;
typedef struct text_lookup lookup_t;
/* functions */
EXPORT lookup_t text_lookup_create(const char *path);
EXPORT bool text_lookup_add(lookup_t lookup, const char *path);
EXPORT void text_lookup_destroy(lookup_t lookup);
EXPORT bool text_lookup_getstr(lookup_t lookup, const char *lookup_val,
EXPORT lookup_t *text_lookup_create(const char *path);
EXPORT bool text_lookup_add(lookup_t *lookup, const char *path);
EXPORT void text_lookup_destroy(lookup_t *lookup);
EXPORT bool text_lookup_getstr(lookup_t *lookup, const char *lookup_val,
const char **out);
#ifdef __cplusplus

View File

@ -33,7 +33,7 @@ struct os_event_data {
bool manual;
};
int os_event_init(os_event_t *event, enum os_event_type type)
int os_event_init(os_event_t **event, enum os_event_type type)
{
int code = 0;
@ -57,7 +57,7 @@ int os_event_init(os_event_t *event, enum os_event_type type)
return 0;
}
void os_event_destroy(os_event_t event)
void os_event_destroy(os_event_t *event)
{
if (event) {
pthread_mutex_destroy(&event->mutex);
@ -66,7 +66,7 @@ void os_event_destroy(os_event_t event)
}
}
int os_event_wait(os_event_t event)
int os_event_wait(os_event_t *event)
{
int code = 0;
pthread_mutex_lock(&event->mutex);
@ -93,7 +93,7 @@ static inline void add_ms_to_ts(struct timespec *ts,
}
}
int os_event_timedwait(os_event_t event, unsigned long milliseconds)
int os_event_timedwait(os_event_t *event, unsigned long milliseconds)
{
int code = 0;
pthread_mutex_lock(&event->mutex);
@ -121,7 +121,7 @@ int os_event_timedwait(os_event_t event, unsigned long milliseconds)
return code;
}
int os_event_try(os_event_t event)
int os_event_try(os_event_t *event)
{
int ret = EAGAIN;
@ -136,7 +136,7 @@ int os_event_try(os_event_t event)
return ret;
}
int os_event_signal(os_event_t event)
int os_event_signal(os_event_t *event)
{
int code = 0;
@ -148,7 +148,7 @@ int os_event_signal(os_event_t event)
return code;
}
void os_event_reset(os_event_t event)
void os_event_reset(os_event_t *event)
{
pthread_mutex_lock(&event->mutex);
event->signalled = false;
@ -162,7 +162,7 @@ struct os_sem_data {
task_t task;
};
int os_sem_init(os_sem_t *sem, int value)
int os_sem_init(os_sem_t **sem, int value)
{
semaphore_t new_sem;
task_t task = mach_task_self();
@ -179,7 +179,7 @@ int os_sem_init(os_sem_t *sem, int value)
return 0;
}
void os_sem_destroy(os_sem_t sem)
void os_sem_destroy(os_sem_t *sem)
{
if (sem) {
semaphore_destroy(sem->task, sem->sem);
@ -187,13 +187,13 @@ void os_sem_destroy(os_sem_t sem)
}
}
int os_sem_post(os_sem_t sem)
int os_sem_post(os_sem_t *sem)
{
if (!sem) return -1;
return (semaphore_signal(sem->sem) == KERN_SUCCESS) ? 0 : -1;
}
int os_sem_wait(os_sem_t sem)
int os_sem_wait(os_sem_t *sem)
{
if (!sem) return -1;
return (semaphore_wait(sem->sem) == KERN_SUCCESS) ? 0 : -1;
@ -205,7 +205,7 @@ struct os_sem_data {
sem_t sem;
};
int os_sem_init(os_sem_t *sem, int value)
int os_sem_init(os_sem_t **sem, int value)
{
sem_t new_sem;
int ret = sem_init(&new_sem, 0, value);
@ -217,7 +217,7 @@ int os_sem_init(os_sem_t *sem, int value)
return 0;
}
void os_sem_destroy(os_sem_t sem)
void os_sem_destroy(os_sem_t *sem)
{
if (sem) {
sem_destroy(&sem->sem);
@ -225,13 +225,13 @@ void os_sem_destroy(os_sem_t sem)
}
}
int os_sem_post(os_sem_t sem)
int os_sem_post(os_sem_t *sem)
{
if (!sem) return -1;
return sem_post(&sem->sem);
}
int os_sem_wait(os_sem_t sem)
int os_sem_wait(os_sem_t *sem)
{
if (!sem) return -1;
return sem_wait(&sem->sem);

View File

@ -28,7 +28,7 @@ struct os_sem_data {
HANDLE handle;
};
int os_event_init(os_event_t *event, enum os_event_type type)
int os_event_init(os_event_t **event, enum os_event_type type)
{
HANDLE handle;
struct os_event_data *data;
@ -44,7 +44,7 @@ int os_event_init(os_event_t *event, enum os_event_type type)
return 0;
}
void os_event_destroy(os_event_t event)
void os_event_destroy(os_event_t *event)
{
if (event) {
CloseHandle(event->handle);
@ -52,7 +52,7 @@ void os_event_destroy(os_event_t event)
}
}
int os_event_wait(os_event_t event)
int os_event_wait(os_event_t *event)
{
DWORD code;
@ -66,7 +66,7 @@ int os_event_wait(os_event_t event)
return 0;
}
int os_event_timedwait(os_event_t event, unsigned long milliseconds)
int os_event_timedwait(os_event_t *event, unsigned long milliseconds)
{
DWORD code;
@ -82,7 +82,7 @@ int os_event_timedwait(os_event_t event, unsigned long milliseconds)
return 0;
}
int os_event_try(os_event_t event)
int os_event_try(os_event_t *event)
{
DWORD code;
@ -98,7 +98,7 @@ int os_event_try(os_event_t event)
return 0;
}
int os_event_signal(os_event_t event)
int os_event_signal(os_event_t *event)
{
if (!event)
return EINVAL;
@ -109,7 +109,7 @@ int os_event_signal(os_event_t event)
return 0;
}
void os_event_reset(os_event_t event)
void os_event_reset(os_event_t *event)
{
if (!event)
return;
@ -117,7 +117,7 @@ void os_event_reset(os_event_t event)
ResetEvent(event->handle);
}
int os_sem_init(os_sem_t *sem, int value)
int os_sem_init(os_sem_t **sem, int value)
{
HANDLE handle = CreateSemaphore(NULL, (LONG)value, 0x7FFFFFFF, NULL);
if (!handle)
@ -128,7 +128,7 @@ int os_sem_init(os_sem_t *sem, int value)
return 0;
}
void os_sem_destroy(os_sem_t sem)
void os_sem_destroy(os_sem_t *sem)
{
if (sem) {
CloseHandle(sem->handle);
@ -136,13 +136,13 @@ void os_sem_destroy(os_sem_t sem)
}
}
int os_sem_post(os_sem_t sem)
int os_sem_post(os_sem_t *sem)
{
if (!sem) return -1;
return ReleaseSemaphore(sem->handle, 1, NULL) ? 0 : -1;
}
int os_sem_wait(os_sem_t sem)
int os_sem_wait(os_sem_t *sem)
{
DWORD ret;

View File

@ -54,21 +54,21 @@ enum os_event_type {
struct os_event_data;
struct os_sem_data;
typedef struct os_event_data *os_event_t;
typedef struct os_sem_data *os_sem_t;
typedef struct os_event_data os_event_t;
typedef struct os_sem_data os_sem_t;
EXPORT int os_event_init(os_event_t *event, enum os_event_type type);
EXPORT void os_event_destroy(os_event_t event);
EXPORT int os_event_wait(os_event_t event);
EXPORT int os_event_timedwait(os_event_t event, unsigned long milliseconds);
EXPORT int os_event_try(os_event_t event);
EXPORT int os_event_signal(os_event_t event);
EXPORT void os_event_reset(os_event_t event);
EXPORT int os_event_init(os_event_t **event, enum os_event_type type);
EXPORT void os_event_destroy(os_event_t *event);
EXPORT int os_event_wait(os_event_t *event);
EXPORT int os_event_timedwait(os_event_t *event, unsigned long milliseconds);
EXPORT int os_event_try(os_event_t *event);
EXPORT int os_event_signal(os_event_t *event);
EXPORT void os_event_reset(os_event_t *event);
EXPORT int os_sem_init(os_sem_t *sem, int value);
EXPORT void os_sem_destroy(os_sem_t sem);
EXPORT int os_sem_post(os_sem_t sem);
EXPORT int os_sem_wait(os_sem_t sem);
EXPORT int os_sem_init(os_sem_t **sem, int value);
EXPORT void os_sem_destroy(os_sem_t *sem);
EXPORT int os_sem_post(os_sem_t *sem);
EXPORT int os_sem_wait(os_sem_t *sem);
EXPORT long os_atomic_inc_long(volatile long *val);
EXPORT long os_atomic_dec_long(volatile long *val);

View File

@ -49,7 +49,7 @@ public:
};
class ConfigFile {
config_t config;
config_t *config;
ConfigFile(ConfigFile const&) = delete;
ConfigFile &operator=(ConfigFile const&) = delete;
@ -89,32 +89,32 @@ public:
config = NULL;
}
inline operator config_t() const {return config;}
inline operator config_t*() const {return config;}
};
class TextLookup {
lookup_t lookup;
lookup_t *lookup;
TextLookup(TextLookup const&) = delete;
TextLookup &operator=(TextLookup const&) = delete;
public:
inline TextLookup(lookup_t lookup=nullptr) : lookup(lookup) {}
inline TextLookup(lookup_t *lookup=nullptr) : lookup(lookup) {}
inline TextLookup(TextLookup &&other) : lookup(other.lookup)
{
other.lookup = nullptr;
}
inline ~TextLookup() {text_lookup_destroy(lookup);}
inline TextLookup& operator=(lookup_t val)
inline TextLookup& operator=(lookup_t *val)
{
text_lookup_destroy(lookup);
lookup = val;
return *this;
}
inline operator lookup_t() const {return lookup;}
inline operator lookup_t*() const {return lookup;}
inline const char *GetString(const char *lookupVal) const
{

View File

@ -415,7 +415,7 @@ static void delete_oldest_log(void)
unsigned int maxLogs = (unsigned int)config_get_uint(
App()->GlobalConfig(), "General", "MaxLogs");
os_dir_t dir = os_opendir(logDir);
os_dir_t *dir = os_opendir(logDir);
if (dir) {
unsigned int count = 0;
@ -450,7 +450,7 @@ static void get_last_log(void)
{
BPtr<char> logDir(os_get_config_path("obs-studio/logs"));
struct os_dirent *entry;
os_dir_t dir = os_opendir(logDir);
os_dir_t *dir = os_opendir(logDir);
uint64_t highest_ts = 0;
if (dir) {

View File

@ -71,14 +71,14 @@ public:
inline QMainWindow *GetMainWindow() const {return mainWindow.data();}
inline config_t GlobalConfig() const {return globalConfig;}
inline config_t *GlobalConfig() const {return globalConfig;}
inline const char *GetLocale() const
{
return locale.c_str();
}
inline lookup_t GetTextLookup() const {return textLookup;}
inline lookup_t *GetTextLookup() const {return textLookup;}
inline const char *GetString(const char *lookupVal) const
{
@ -98,7 +98,7 @@ public:
inline OBSApp *App() {return static_cast<OBSApp*>(qApp);}
inline config_t GetGlobalConfig() {return App()->GlobalConfig();}
inline config_t *GetGlobalConfig() {return App()->GlobalConfig();}
std::vector<std::pair<std::string, std::string>> GetLocaleNames();
inline const char *Str(const char *lookup) {return App()->GetString(lookup);}

View File

@ -58,7 +58,7 @@ void OBSPropertiesView::RefreshProperties()
layout->setSizeConstraint(QLayout::SetMaximumSize);
layout->setLabelAlignment(Qt::AlignRight);
obs_property_t property = obs_properties_first(properties);
obs_property_t *property = obs_properties_first(properties);
while (property) {
AddProperty(property, layout);
@ -77,7 +77,7 @@ void OBSPropertiesView::RefreshProperties()
}
OBSPropertiesView::OBSPropertiesView(OBSData settings_,
obs_properties_t properties_, void *obj_,
obs_properties_t *properties_, void *obj_,
PropertiesUpdateCallback callback_, int minSize_)
: QScrollArea (nullptr),
widget (nullptr),
@ -98,7 +98,7 @@ void OBSPropertiesView::resizeEvent(QResizeEvent *event)
UNUSED_PARAMETER(event);
}
QWidget *OBSPropertiesView::NewWidget(obs_property_t prop, QWidget *widget,
QWidget *OBSPropertiesView::NewWidget(obs_property_t *prop, QWidget *widget,
const char *signal)
{
WidgetInfo *info = new WidgetInfo(this, prop, widget);
@ -107,7 +107,7 @@ QWidget *OBSPropertiesView::NewWidget(obs_property_t prop, QWidget *widget,
return widget;
}
QWidget *OBSPropertiesView::AddCheckbox(obs_property_t prop)
QWidget *OBSPropertiesView::AddCheckbox(obs_property_t *prop)
{
const char *name = obs_property_name(prop);
const char *desc = obs_property_description(prop);
@ -118,7 +118,7 @@ QWidget *OBSPropertiesView::AddCheckbox(obs_property_t prop)
return NewWidget(prop, checkbox, SIGNAL(stateChanged(int)));
}
QWidget *OBSPropertiesView::AddText(obs_property_t prop)
QWidget *OBSPropertiesView::AddText(obs_property_t *prop)
{
const char *name = obs_property_name(prop);
const char *val = obs_data_get_string(settings, name);
@ -139,7 +139,7 @@ QWidget *OBSPropertiesView::AddText(obs_property_t prop)
return NewWidget(prop, edit, SIGNAL(textEdited(const QString &)));
}
void OBSPropertiesView::AddPath(obs_property_t prop, QFormLayout *layout,
void OBSPropertiesView::AddPath(obs_property_t *prop, QFormLayout *layout,
QLabel **label)
{
const char *name = obs_property_name(prop);
@ -162,7 +162,7 @@ void OBSPropertiesView::AddPath(obs_property_t prop, QFormLayout *layout,
layout->addRow(*label, subLayout);
}
QWidget *OBSPropertiesView::AddInt(obs_property_t prop)
QWidget *OBSPropertiesView::AddInt(obs_property_t *prop)
{
const char *name = obs_property_name(prop);
int val = (int)obs_data_get_int(settings, name);
@ -176,7 +176,7 @@ QWidget *OBSPropertiesView::AddInt(obs_property_t prop)
return NewWidget(prop, spin, SIGNAL(valueChanged(int)));
}
QWidget *OBSPropertiesView::AddFloat(obs_property_t prop)
QWidget *OBSPropertiesView::AddFloat(obs_property_t *prop)
{
const char *name = obs_property_name(prop);
double val = obs_data_get_double(settings, name);
@ -190,7 +190,7 @@ QWidget *OBSPropertiesView::AddFloat(obs_property_t prop)
return NewWidget(prop, spin, SIGNAL(valueChanged(double)));
}
static void AddComboItem(QComboBox *combo, obs_property_t prop,
static void AddComboItem(QComboBox *combo, obs_property_t *prop,
obs_combo_format format, size_t idx)
{
const char *name = obs_property_list_item_name(prop, idx);
@ -226,10 +226,10 @@ static void AddComboItem(QComboBox *combo, obs_property_t prop,
item->setFlags(Qt::NoItemFlags);
}
template <long long get_int(obs_data_t, const char*),
double get_double(obs_data_t, const char*),
const char *get_string(obs_data_t, const char*)>
static string from_obs_data(obs_data_t data, const char *name,
template <long long get_int(obs_data_t*, const char*),
double get_double(obs_data_t*, const char*),
const char *get_string(obs_data_t*, const char*)>
static string from_obs_data(obs_data_t *data, const char *name,
obs_combo_format format)
{
switch (format) {
@ -244,14 +244,14 @@ static string from_obs_data(obs_data_t data, const char *name,
}
}
static string from_obs_data(obs_data_t data, const char *name,
static string from_obs_data(obs_data_t *data, const char *name,
obs_combo_format format)
{
return from_obs_data<obs_data_get_int, obs_data_get_double,
obs_data_get_string>(data, name, format);
}
static string from_obs_data_autoselect(obs_data_t data, const char *name,
static string from_obs_data_autoselect(obs_data_t *data, const char *name,
obs_combo_format format)
{
return from_obs_data<obs_data_get_autoselect_int,
@ -259,7 +259,7 @@ static string from_obs_data_autoselect(obs_data_t data, const char *name,
obs_data_get_autoselect_string>(data, name, format);
}
QWidget *OBSPropertiesView::AddList(obs_property_t prop, bool &warning)
QWidget *OBSPropertiesView::AddList(obs_property_t *prop, bool &warning)
{
const char *name = obs_property_name(prop);
QComboBox *combo = new QComboBox();
@ -321,7 +321,7 @@ QWidget *OBSPropertiesView::AddList(obs_property_t prop, bool &warning)
return combo;
}
QWidget *OBSPropertiesView::AddButton(obs_property_t prop)
QWidget *OBSPropertiesView::AddButton(obs_property_t *prop)
{
const char *desc = obs_property_description(prop);
@ -330,7 +330,7 @@ QWidget *OBSPropertiesView::AddButton(obs_property_t prop)
return NewWidget(prop, button, SIGNAL(clicked()));
}
void OBSPropertiesView::AddColor(obs_property_t prop, QFormLayout *layout,
void OBSPropertiesView::AddColor(obs_property_t *prop, QFormLayout *layout,
QLabel *&label)
{
QPushButton *button = new QPushButton;
@ -361,7 +361,7 @@ void OBSPropertiesView::AddColor(obs_property_t prop, QFormLayout *layout,
layout->addRow(label, subLayout);
}
static void MakeQFont(obs_data_t font_obj, QFont &font)
static void MakeQFont(obs_data_t *font_obj, QFont &font)
{
const char *face = obs_data_get_string(font_obj, "face");
const char *style = obs_data_get_string(font_obj, "style");
@ -382,11 +382,11 @@ static void MakeQFont(obs_data_t font_obj, QFont &font)
if (flags & OBS_FONT_STRIKEOUT) font.setStrikeOut(true);
}
void OBSPropertiesView::AddFont(obs_property_t prop, QFormLayout *layout,
void OBSPropertiesView::AddFont(obs_property_t *prop, QFormLayout *layout,
QLabel *&label)
{
const char *name = obs_property_name(prop);
obs_data_t font_obj = obs_data_get_obj(settings, name);
obs_data_t *font_obj = obs_data_get_obj(settings, name);
const char *face = obs_data_get_string(font_obj, "face");
const char *style = obs_data_get_string(font_obj, "style");
QPushButton *button = new QPushButton;
@ -419,7 +419,7 @@ void OBSPropertiesView::AddFont(obs_property_t prop, QFormLayout *layout,
obs_data_release(font_obj);
}
void OBSPropertiesView::AddProperty(obs_property_t property,
void OBSPropertiesView::AddProperty(obs_property_t *property,
QFormLayout *layout)
{
const char *name = obs_property_name(property);
@ -619,7 +619,7 @@ bool WidgetInfo::ColorChanged(const char *setting)
bool WidgetInfo::FontChanged(const char *setting)
{
obs_data_t font_obj = obs_data_get_obj(view->settings, setting);
obs_data_t *font_obj = obs_data_get_obj(view->settings, setting);
bool success;
uint32_t flags;
QFont font;

View File

@ -9,7 +9,7 @@ class QFormLayout;
class OBSPropertiesView;
class QLabel;
typedef void (*PropertiesUpdateCallback)(void *obj, obs_data_t settings);
typedef void (*PropertiesUpdateCallback)(void *obj, obs_data_t *settings);
/* ------------------------------------------------------------------------- */
@ -18,7 +18,7 @@ class WidgetInfo : public QObject {
private:
OBSPropertiesView *view;
obs_property_t property;
obs_property_t *property;
QWidget *widget;
void BoolChanged(const char *setting);
@ -32,7 +32,7 @@ private:
void ButtonClicked();
public:
inline WidgetInfo(OBSPropertiesView *view_, obs_property_t prop,
inline WidgetInfo(OBSPropertiesView *view_, obs_property_t *prop,
QWidget *widget_)
: view(view_), property(prop), widget(widget_)
{}
@ -50,7 +50,7 @@ class OBSPropertiesView : public QScrollArea {
private:
QWidget *widget;
obs_properties_t properties;
obs_properties_t *properties;
OBSData settings;
void *obj;
PropertiesUpdateCallback callback;
@ -59,20 +59,20 @@ private:
std::string lastFocused;
QWidget *lastWidget;
QWidget *NewWidget(obs_property_t prop, QWidget *widget,
QWidget *NewWidget(obs_property_t *prop, QWidget *widget,
const char *signal);
QWidget *AddCheckbox(obs_property_t prop);
QWidget *AddText(obs_property_t prop);
void AddPath(obs_property_t prop, QFormLayout *layout, QLabel **label);
QWidget *AddInt(obs_property_t prop);
QWidget *AddFloat(obs_property_t prop);
QWidget *AddList(obs_property_t prop, bool &warning);
QWidget *AddButton(obs_property_t prop);
void AddColor(obs_property_t prop, QFormLayout *layout, QLabel *&label);
void AddFont(obs_property_t prop, QFormLayout *layout, QLabel *&label);
QWidget *AddCheckbox(obs_property_t *prop);
QWidget *AddText(obs_property_t *prop);
void AddPath(obs_property_t *prop, QFormLayout *layout, QLabel **label);
QWidget *AddInt(obs_property_t *prop);
QWidget *AddFloat(obs_property_t *prop);
QWidget *AddList(obs_property_t *prop, bool &warning);
QWidget *AddButton(obs_property_t *prop);
void AddColor(obs_property_t *prop, QFormLayout *layout, QLabel *&label);
void AddFont(obs_property_t *prop, QFormLayout *layout, QLabel *&label);
void AddProperty(obs_property_t property, QFormLayout *layout);
void AddProperty(obs_property_t *property, QFormLayout *layout);
void resizeEvent(QResizeEvent *event) override;
@ -84,7 +84,7 @@ signals:
public:
OBSPropertiesView(OBSData settings,
obs_properties_t properties,
obs_properties_t *properties,
void *obj, PropertiesUpdateCallback callback,
int minSize = 0);

View File

@ -37,7 +37,7 @@ static inline float DBToLinear(float db_full)
return (DBToLog(db) - VOL_MIN_LOG) / (VOL_MAX_LOG - VOL_MIN_LOG);
}
void VolControl::OBSVolumeChanged(void *data, calldata_t calldata)
void VolControl::OBSVolumeChanged(void *data, calldata_t *calldata)
{
VolControl *volControl = static_cast<VolControl*>(data);
int vol = (int)(calldata_float(calldata, "volume") * 100.0f + 0.5f);
@ -45,7 +45,7 @@ void VolControl::OBSVolumeChanged(void *data, calldata_t calldata)
QMetaObject::invokeMethod(volControl, "VolumeChanged", Q_ARG(int, vol));
}
void VolControl::OBSVolumeLevel(void *data, calldata_t calldata)
void VolControl::OBSVolumeLevel(void *data, calldata_t *calldata)
{
VolControl *volControl = static_cast<VolControl*>(data);
float peak = calldata_float(calldata, "level");

View File

@ -37,8 +37,8 @@ private:
float levelTotal;
float levelCount;
static void OBSVolumeChanged(void *param, calldata_t calldata);
static void OBSVolumeLevel(void *data, calldata_t calldata);
static void OBSVolumeChanged(void *param, calldata_t *calldata);
static void OBSVolumeLevel(void *data, calldata_t *calldata);
private slots:
void VolumeChanged(int vol);
@ -49,7 +49,7 @@ public:
VolControl(OBSSource source);
~VolControl();
inline obs_source_t GetSource() const {return source;}
inline obs_source_t *GetSource() const {return source;}
QString GetName() const;
void SetName(const QString &newName);

View File

@ -107,7 +107,7 @@ OBSEventFilter *OBSBasicInteraction::BuildEventFilter()
});
}
void OBSBasicInteraction::SourceRemoved(void *data, calldata_t params)
void OBSBasicInteraction::SourceRemoved(void *data, calldata_t *params)
{
QMetaObject::invokeMethod(static_cast<OBSBasicInteraction*>(data),
"close");

View File

@ -44,7 +44,7 @@ private:
OBSSignal removedSignal;
std::unique_ptr<OBSEventFilter> eventFilter;
static void SourceRemoved(void *data, calldata_t params);
static void SourceRemoved(void *data, calldata_t *params);
static void DrawPreview(void *data, uint32_t cx, uint32_t cy);
bool GetSourceRelativeXY(int mouseX, int mouseY, int &x, int &y);

View File

@ -120,13 +120,13 @@ OBSBasic::OBSBasic(QWidget *parent)
#endif
}
static void SaveAudioDevice(const char *name, int channel, obs_data_t parent)
static void SaveAudioDevice(const char *name, int channel, obs_data_t *parent)
{
obs_source_t source = obs_get_output_source(channel);
obs_source_t *source = obs_get_output_source(channel);
if (!source)
return;
obs_data_t data = obs_save_source(source);
obs_data_t *data = obs_save_source(source);
obs_data_set_obj(parent, name, data);
@ -134,11 +134,11 @@ static void SaveAudioDevice(const char *name, int channel, obs_data_t parent)
obs_source_release(source);
}
static obs_data_t GenerateSaveData()
static obs_data_t *GenerateSaveData()
{
obs_data_t saveData = obs_data_create();
obs_data_array_t sourcesArray = obs_save_sources();
obs_source_t currentScene = obs_get_output_source(0);
obs_data_t *saveData = obs_data_create();
obs_data_array_t *sourcesArray = obs_save_sources();
obs_source_t *currentScene = obs_get_output_source(0);
const char *sceneName = obs_source_get_name(currentScene);
SaveAudioDevice(DESKTOP_AUDIO_1, 1, saveData);
@ -169,7 +169,7 @@ void OBSBasic::ClearVolumeControls()
void OBSBasic::Save(const char *file)
{
obs_data_t saveData = GenerateSaveData();
obs_data_t *saveData = GenerateSaveData();
const char *jsonData = obs_data_get_json(saveData);
/* TODO maybe a message box here? */
@ -179,13 +179,13 @@ void OBSBasic::Save(const char *file)
obs_data_release(saveData);
}
static void LoadAudioDevice(const char *name, int channel, obs_data_t parent)
static void LoadAudioDevice(const char *name, int channel, obs_data_t *parent)
{
obs_data_t data = obs_data_get_obj(parent, name);
obs_data_t *data = obs_data_get_obj(parent, name);
if (!data)
return;
obs_source_t source = obs_load_source(data);
obs_source_t *source = obs_load_source(data);
if (source) {
obs_set_output_source(channel, source);
obs_source_release(source);
@ -196,8 +196,8 @@ static void LoadAudioDevice(const char *name, int channel, obs_data_t parent)
void OBSBasic::CreateDefaultScene()
{
obs_scene_t scene = obs_scene_create(Str("Basic.Scene"));
obs_source_t source = obs_scene_get_source(scene);
obs_scene_t *scene = obs_scene_create(Str("Basic.Scene"));
obs_source_t *source = obs_scene_get_source(scene);
obs_add_source(source);
@ -229,11 +229,11 @@ void OBSBasic::Load(const char *file)
return;
}
obs_data_t data = obs_data_create_from_json(jsonData);
obs_data_array_t sources = obs_data_get_array(data, "sources");
obs_data_t *data = obs_data_create_from_json(jsonData);
obs_data_array_t *sources = obs_data_get_array(data, "sources");
const char *sceneName = obs_data_get_string(data,
"current_scene");
obs_source_t curScene;
obs_source_t *curScene;
LoadAudioDevice(DESKTOP_AUDIO_1, 1, data);
LoadAudioDevice(DESKTOP_AUDIO_2, 2, data);
@ -254,14 +254,14 @@ void OBSBasic::Load(const char *file)
static inline bool HasAudioDevices(const char *source_id)
{
const char *output_id = source_id;
obs_properties_t props = obs_get_source_properties(
obs_properties_t *props = obs_get_source_properties(
OBS_SOURCE_TYPE_INPUT, output_id);
size_t count = 0;
if (!props)
return false;
obs_property_t devices = obs_properties_get(props, "device_id");
obs_property_t *devices = obs_properties_get(props, "device_id");
if (devices)
count = obs_property_list_item_count(devices);
@ -270,21 +270,21 @@ static inline bool HasAudioDevices(const char *source_id)
return count != 0;
}
static void OBSStartStreaming(void *data, calldata_t params)
static void OBSStartStreaming(void *data, calldata_t *params)
{
UNUSED_PARAMETER(params);
QMetaObject::invokeMethod(static_cast<OBSBasic*>(data),
"StreamingStart");
}
static void OBSStopStreaming(void *data, calldata_t params)
static void OBSStopStreaming(void *data, calldata_t *params)
{
int code = (int)calldata_int(params, "code");
QMetaObject::invokeMethod(static_cast<OBSBasic*>(data),
"StreamingStop", Q_ARG(int, code));
}
static void OBSStartRecording(void *data, calldata_t params)
static void OBSStartRecording(void *data, calldata_t *params)
{
UNUSED_PARAMETER(params);
@ -292,7 +292,7 @@ static void OBSStartRecording(void *data, calldata_t params)
"RecordingStart");
}
static void OBSStopRecording(void *data, calldata_t params)
static void OBSStopRecording(void *data, calldata_t *params)
{
UNUSED_PARAMETER(params);
@ -311,8 +311,8 @@ void OBSBasic::SaveService()
if (!serviceJsonPath)
return;
obs_data_t data = obs_data_create();
obs_data_t settings = obs_service_get_settings(service);
obs_data_t *data = obs_data_create();
obs_data_t *settings = obs_service_get_settings(service);
obs_data_set_string(data, "type", obs_service_gettype(service));
obs_data_set_obj(data, "settings", settings);
@ -337,12 +337,12 @@ bool OBSBasic::LoadService()
if (!jsonText)
return false;
obs_data_t data = obs_data_create_from_json(jsonText);
obs_data_t *data = obs_data_create_from_json(jsonText);
obs_data_set_default_string(data, "type", "rtmp_common");
type = obs_data_get_string(data, "type");
obs_data_t settings = obs_data_get_obj(data, "settings");
obs_data_t *settings = obs_data_get_obj(data, "settings");
service = obs_service_create(type, "default_service", settings);
@ -643,7 +643,7 @@ void OBSBasic::UpdateSources(OBSScene scene)
ui->sources->clear();
obs_scene_enum_items(scene,
[] (obs_scene_t scene, obs_sceneitem_t item, void *p)
[] (obs_scene_t *scene, obs_sceneitem_t *item, void *p)
{
OBSBasic *window = static_cast<OBSBasic*>(p);
window->InsertSceneItem(item);
@ -653,9 +653,9 @@ void OBSBasic::UpdateSources(OBSScene scene)
}, this);
}
void OBSBasic::InsertSceneItem(obs_sceneitem_t item)
void OBSBasic::InsertSceneItem(obs_sceneitem_t *item)
{
obs_source_t source = obs_sceneitem_get_source(item);
obs_source_t *source = obs_sceneitem_get_source(item);
const char *name = obs_source_get_name(source);
QListWidgetItem *listItem = new QListWidgetItem(QT_UTF8(name));
@ -671,7 +671,7 @@ void OBSBasic::InsertSceneItem(obs_sceneitem_t item)
CreatePropertiesWindow(source);
}
void OBSBasic::CreateInteractionWindow(obs_source_t source)
void OBSBasic::CreateInteractionWindow(obs_source_t *source)
{
if (interaction)
interaction->close();
@ -681,7 +681,7 @@ void OBSBasic::CreateInteractionWindow(obs_source_t source)
interaction->setAttribute(Qt::WA_DeleteOnClose, true);
}
void OBSBasic::CreatePropertiesWindow(obs_source_t source)
void OBSBasic::CreatePropertiesWindow(obs_source_t *source)
{
if (properties)
properties->close();
@ -696,14 +696,14 @@ void OBSBasic::CreatePropertiesWindow(obs_source_t source)
void OBSBasic::AddScene(OBSSource source)
{
const char *name = obs_source_get_name(source);
obs_scene_t scene = obs_scene_from_source(source);
obs_scene_t *scene = obs_scene_from_source(source);
QListWidgetItem *item = new QListWidgetItem(QT_UTF8(name));
item->setFlags(item->flags() | Qt::ItemIsEditable);
item->setData(Qt::UserRole, QVariant::fromValue(OBSScene(scene)));
ui->scenes->addItem(item);
signal_handler_t handler = obs_source_get_signal_handler(source);
signal_handler_t *handler = obs_source_get_signal_handler(source);
signal_handler_connect(handler, "item_add",
OBSBasic::SceneItemAdded, this);
signal_handler_connect(handler, "item_remove",
@ -735,8 +735,8 @@ void OBSBasic::RemoveScene(OBSSource source)
void OBSBasic::AddSceneItem(OBSSceneItem item)
{
obs_scene_t scene = obs_sceneitem_get_scene(item);
obs_source_t source = obs_sceneitem_get_source(item);
obs_scene_t *scene = obs_sceneitem_get_scene(item);
obs_source_t *source = obs_sceneitem_get_source(item);
if (GetCurrentScene() == scene)
InsertSceneItem(item);
@ -746,7 +746,7 @@ void OBSBasic::AddSceneItem(OBSSceneItem item)
void OBSBasic::RemoveSceneItem(OBSSceneItem item)
{
obs_scene_t scene = obs_sceneitem_get_scene(item);
obs_scene_t *scene = obs_sceneitem_get_scene(item);
if (GetCurrentScene() == scene) {
for (int i = 0; i < ui->sources->count(); i++) {
@ -760,7 +760,7 @@ void OBSBasic::RemoveSceneItem(OBSSceneItem item)
}
}
obs_source_t source = obs_sceneitem_get_source(item);
obs_source_t *source = obs_sceneitem_get_source(item);
int scenes = sourceSceneRefs[source] - 1;
sourceSceneRefs[source] = scenes;
@ -774,7 +774,7 @@ void OBSBasic::RemoveSceneItem(OBSSceneItem item)
void OBSBasic::UpdateSceneSelection(OBSSource source)
{
if (source) {
obs_scene_t scene = obs_scene_from_source(source);
obs_scene_t *scene = obs_scene_from_source(source);
const char *name = obs_source_get_name(source);
if (!scene)
@ -869,7 +869,7 @@ void OBSBasic::DeactivateAudioSource(OBSSource source)
}
}
bool OBSBasic::QueryRemoveSource(obs_source_t source)
bool OBSBasic::QueryRemoveSource(obs_source_t *source)
{
const char *name = obs_source_get_name(source);
@ -955,8 +955,8 @@ void OBSBasic::updateFileFinished()
if (!jsonReply || !*jsonReply)
return;
obs_data_t returnData = obs_data_create_from_json(jsonReply);
obs_data_t versionData = obs_data_get_obj(returnData, VERSION_ENTRY);
obs_data_t *returnData = obs_data_create_from_json(jsonReply);
obs_data_t *versionData = obs_data_get_obj(returnData, VERSION_ENTRY);
const char *description = obs_data_get_string(returnData,
"description");
const char *download = obs_data_get_string(versionData, "download");
@ -1004,7 +1004,7 @@ void OBSBasic::RemoveSelectedScene()
{
OBSScene scene = GetCurrentScene();
if (scene) {
obs_source_t source = obs_scene_get_source(scene);
obs_source_t *source = obs_scene_get_source(scene);
if (QueryRemoveSource(source))
obs_source_remove(source);
}
@ -1014,7 +1014,7 @@ void OBSBasic::RemoveSelectedSceneItem()
{
OBSSceneItem item = GetCurrentSceneItem();
if (item) {
obs_source_t source = obs_sceneitem_get_source(item);
obs_source_t *source = obs_sceneitem_get_source(item);
if (QueryRemoveSource(source))
obs_sceneitem_remove(item);
}
@ -1022,30 +1022,30 @@ void OBSBasic::RemoveSelectedSceneItem()
/* OBS Callbacks */
void OBSBasic::SceneItemAdded(void *data, calldata_t params)
void OBSBasic::SceneItemAdded(void *data, calldata_t *params)
{
OBSBasic *window = static_cast<OBSBasic*>(data);
obs_sceneitem_t item = (obs_sceneitem_t)calldata_ptr(params, "item");
obs_sceneitem_t *item = (obs_sceneitem_t*)calldata_ptr(params, "item");
QMetaObject::invokeMethod(window, "AddSceneItem",
Q_ARG(OBSSceneItem, OBSSceneItem(item)));
}
void OBSBasic::SceneItemRemoved(void *data, calldata_t params)
void OBSBasic::SceneItemRemoved(void *data, calldata_t *params)
{
OBSBasic *window = static_cast<OBSBasic*>(data);
obs_sceneitem_t item = (obs_sceneitem_t)calldata_ptr(params, "item");
obs_sceneitem_t *item = (obs_sceneitem_t*)calldata_ptr(params, "item");
QMetaObject::invokeMethod(window, "RemoveSceneItem",
Q_ARG(OBSSceneItem, OBSSceneItem(item)));
}
void OBSBasic::SourceAdded(void *data, calldata_t params)
void OBSBasic::SourceAdded(void *data, calldata_t *params)
{
OBSBasic *window = static_cast<OBSBasic*>(data);
obs_source_t source = (obs_source_t)calldata_ptr(params, "source");
obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source");
if (obs_scene_from_source(source) != NULL)
QMetaObject::invokeMethod(window,
@ -1053,9 +1053,9 @@ void OBSBasic::SourceAdded(void *data, calldata_t params)
Q_ARG(OBSSource, OBSSource(source)));
}
void OBSBasic::SourceRemoved(void *data, calldata_t params)
void OBSBasic::SourceRemoved(void *data, calldata_t *params)
{
obs_source_t source = (obs_source_t)calldata_ptr(params, "source");
obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source");
if (obs_scene_from_source(source) != NULL)
QMetaObject::invokeMethod(static_cast<OBSBasic*>(data),
@ -1063,9 +1063,9 @@ void OBSBasic::SourceRemoved(void *data, calldata_t params)
Q_ARG(OBSSource, OBSSource(source)));
}
void OBSBasic::SourceActivated(void *data, calldata_t params)
void OBSBasic::SourceActivated(void *data, calldata_t *params)
{
obs_source_t source = (obs_source_t)calldata_ptr(params, "source");
obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source");
uint32_t flags = obs_source_get_output_flags(source);
if (flags & OBS_SOURCE_AUDIO)
@ -1074,9 +1074,9 @@ void OBSBasic::SourceActivated(void *data, calldata_t params)
Q_ARG(OBSSource, OBSSource(source)));
}
void OBSBasic::SourceDeactivated(void *data, calldata_t params)
void OBSBasic::SourceDeactivated(void *data, calldata_t *params)
{
obs_source_t source = (obs_source_t)calldata_ptr(params, "source");
obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source");
uint32_t flags = obs_source_get_output_flags(source);
if (flags & OBS_SOURCE_AUDIO)
@ -1085,7 +1085,7 @@ void OBSBasic::SourceDeactivated(void *data, calldata_t params)
Q_ARG(OBSSource, OBSSource(source)));
}
void OBSBasic::SourceRenamed(void *data, calldata_t params)
void OBSBasic::SourceRenamed(void *data, calldata_t *params)
{
const char *newName = calldata_string(params, "new_name");
const char *prevName = calldata_string(params, "prev_name");
@ -1096,9 +1096,9 @@ void OBSBasic::SourceRenamed(void *data, calldata_t params)
Q_ARG(QString, QT_UTF8(prevName)));
}
void OBSBasic::ChannelChanged(void *data, calldata_t params)
void OBSBasic::ChannelChanged(void *data, calldata_t *params)
{
obs_source_t source = (obs_source_t)calldata_ptr(params, "source");
obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source");
uint32_t channel = (uint32_t)calldata_int(params, "channel");
if (channel == 0)
@ -1112,9 +1112,9 @@ void OBSBasic::DrawBackdrop(float cx, float cy)
if (!box)
return;
gs_effect_t solid = obs_get_solid_effect();
gs_eparam_t color = gs_effect_get_param_by_name(solid, "color");
gs_technique_t tech = gs_effect_get_technique(solid, "Solid");
gs_effect_t *solid = obs_get_solid_effect();
gs_eparam_t *color = gs_effect_get_param_by_name(solid, "color");
gs_technique_t *tech = gs_effect_get_technique(solid, "Solid");
vec4 colorVal;
vec4_set(&colorVal, 0.0f, 0.0f, 0.0f, 1.0f);
@ -1183,36 +1183,36 @@ void OBSBasic::RenderMain(void *data, uint32_t cx, uint32_t cy)
UNUSED_PARAMETER(cy);
}
void OBSBasic::SceneItemMoveUp(void *data, calldata_t params)
void OBSBasic::SceneItemMoveUp(void *data, calldata_t *params)
{
OBSSceneItem item = (obs_sceneitem_t)calldata_ptr(params, "item");
OBSSceneItem item = (obs_sceneitem_t*)calldata_ptr(params, "item");
QMetaObject::invokeMethod(static_cast<OBSBasic*>(data),
"MoveSceneItem",
Q_ARG(OBSSceneItem, OBSSceneItem(item)),
Q_ARG(obs_order_movement, OBS_ORDER_MOVE_UP));
}
void OBSBasic::SceneItemMoveDown(void *data, calldata_t params)
void OBSBasic::SceneItemMoveDown(void *data, calldata_t *params)
{
OBSSceneItem item = (obs_sceneitem_t)calldata_ptr(params, "item");
OBSSceneItem item = (obs_sceneitem_t*)calldata_ptr(params, "item");
QMetaObject::invokeMethod(static_cast<OBSBasic*>(data),
"MoveSceneItem",
Q_ARG(OBSSceneItem, OBSSceneItem(item)),
Q_ARG(obs_order_movement, OBS_ORDER_MOVE_DOWN));
}
void OBSBasic::SceneItemMoveTop(void *data, calldata_t params)
void OBSBasic::SceneItemMoveTop(void *data, calldata_t *params)
{
OBSSceneItem item = (obs_sceneitem_t)calldata_ptr(params, "item");
OBSSceneItem item = (obs_sceneitem_t*)calldata_ptr(params, "item");
QMetaObject::invokeMethod(static_cast<OBSBasic*>(data),
"MoveSceneItem",
Q_ARG(OBSSceneItem, OBSSceneItem(item)),
Q_ARG(obs_order_movement, OBS_ORDER_MOVE_TOP));
}
void OBSBasic::SceneItemMoveBottom(void *data, calldata_t params)
void OBSBasic::SceneItemMoveBottom(void *data, calldata_t *params)
{
OBSSceneItem item = (obs_sceneitem_t)calldata_ptr(params, "item");
OBSSceneItem item = (obs_sceneitem_t*)calldata_ptr(params, "item");
QMetaObject::invokeMethod(static_cast<OBSBasic*>(data),
"MoveSceneItem",
Q_ARG(OBSSceneItem, OBSSceneItem(item)),
@ -1221,14 +1221,14 @@ void OBSBasic::SceneItemMoveBottom(void *data, calldata_t params)
/* Main class functions */
obs_service_t OBSBasic::GetService()
obs_service_t *OBSBasic::GetService()
{
if (!service)
service = obs_service_create("rtmp_common", NULL, NULL);
return service;
}
void OBSBasic::SetService(obs_service_t newService)
void OBSBasic::SetService(obs_service_t *newService)
{
if (newService) {
if (service)
@ -1335,8 +1335,8 @@ void OBSBasic::ResetAudioDevice(const char *sourceId, const char *deviceName,
{
const char *deviceId = config_get_string(basicConfig, "Audio",
deviceName);
obs_source_t source;
obs_data_t settings;
obs_source_t *source;
obs_data_t *settings;
bool same = false;
source = obs_get_output_source(channel);
@ -1354,7 +1354,7 @@ void OBSBasic::ResetAudioDevice(const char *sourceId, const char *deviceName,
obs_set_output_source(channel, nullptr);
if (!same && strcmp(deviceId, "disabled") != 0) {
obs_data_t settings = obs_data_create();
obs_data_t *settings = obs_data_create();
obs_data_set_string(settings, "device_id", deviceId);
source = obs_source_create(OBS_SOURCE_TYPE_INPUT,
sourceId, deviceDesc, settings);
@ -1469,13 +1469,13 @@ void OBSBasic::on_action_Settings_triggered()
void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current,
QListWidgetItem *prev)
{
obs_source_t source = NULL;
obs_source_t *source = NULL;
if (sceneChanging)
return;
if (current) {
obs_scene_t scene;
obs_scene_t *scene;
scene = current->data(Qt::UserRole).value<OBSScene>();
source = obs_scene_get_source(scene);
@ -1514,7 +1514,7 @@ void OBSBasic::on_actionAddScene_triggered()
int i = 1;
QString placeHolderText = format.arg(i);
obs_source_t source = nullptr;
obs_source_t *source = nullptr;
while ((source = obs_get_source_by_name(QT_TO_UTF8(placeHolderText)))) {
obs_source_release(source);
placeHolderText = format.arg(++i);
@ -1535,7 +1535,7 @@ void OBSBasic::on_actionAddScene_triggered()
return;
}
obs_source_t source = obs_get_source_by_name(name.c_str());
obs_source_t *source = obs_get_source_by_name(name.c_str());
if (source) {
QMessageBox::information(this,
QTStr("NameExists.Title"),
@ -1546,7 +1546,7 @@ void OBSBasic::on_actionAddScene_triggered()
return;
}
obs_scene_t scene = obs_scene_create(name.c_str());
obs_scene_t *scene = obs_scene_create(name.c_str());
source = obs_scene_get_source(scene);
obs_add_source(source);
obs_scene_release(scene);
@ -1558,7 +1558,7 @@ void OBSBasic::on_actionAddScene_triggered()
void OBSBasic::on_actionRemoveScene_triggered()
{
OBSScene scene = GetCurrentScene();
obs_source_t source = obs_scene_get_source(scene);
obs_source_t *source = obs_scene_get_source(scene);
if (source && QueryRemoveSource(source))
obs_source_remove(source);
@ -1582,10 +1582,10 @@ void OBSBasic::on_actionSceneDown_triggered()
void OBSBasic::on_sources_currentItemChanged(QListWidgetItem *current,
QListWidgetItem *prev)
{
auto select_one = [] (obs_scene_t scene, obs_sceneitem_t item,
auto select_one = [] (obs_scene_t *scene, obs_sceneitem_t *item,
void *param)
{
obs_sceneitem_t selectedItem =
obs_sceneitem_t *selectedItem =
*reinterpret_cast<OBSSceneItem*>(param);
obs_sceneitem_select(item, (selectedItem == item));
@ -1597,7 +1597,7 @@ void OBSBasic::on_sources_currentItemChanged(QListWidgetItem *current,
return;
OBSSceneItem item = current->data(Qt::UserRole).value<OBSSceneItem>();
obs_source_t source = obs_sceneitem_get_source(item);
obs_source_t *source = obs_sceneitem_get_source(item);
if ((obs_source_get_output_flags(source) & OBS_SOURCE_VIDEO) == 0)
return;
@ -1625,7 +1625,7 @@ void OBSBasic::on_sources_customContextMenuRequested(const QPoint &pos)
popup.addSeparator();
OBSSceneItem sceneItem = GetSceneItem(item);
obs_source_t source = obs_sceneitem_get_source(sceneItem);
obs_source_t *source = obs_sceneitem_get_source(sceneItem);
QAction *action;
popup.addAction(QTStr("Rename"), this,
@ -1722,7 +1722,7 @@ void OBSBasic::on_actionAddSource_triggered()
void OBSBasic::on_actionRemoveSource_triggered()
{
OBSSceneItem item = GetCurrentSceneItem();
obs_source_t source = obs_sceneitem_get_source(item);
obs_source_t *source = obs_sceneitem_get_source(item);
if (source && QueryRemoveSource(source))
obs_sceneitem_remove(item);
@ -1809,7 +1809,7 @@ void OBSBasic::UploadLog(const char *file)
ui->menuLogFiles->setEnabled(false);
auto data_deleter = [](obs_data_t d) { obs_data_release(d); };
auto data_deleter = [](obs_data_t *d) { obs_data_release(d); };
using data_t = unique_ptr<struct obs_data, decltype(data_deleter)>;
data_t content{obs_data_create(), data_deleter};
@ -1886,7 +1886,7 @@ void OBSBasic::logUploadFinished()
if (!jsonReply || !*jsonReply)
return;
obs_data_t returnData = obs_data_create_from_json(jsonReply);
obs_data_t *returnData = obs_data_create_from_json(jsonReply);
QString logURL = obs_data_get_string(returnData, "html_url");
obs_data_release(returnData);
@ -1897,10 +1897,10 @@ void OBSBasic::logUploadFinished()
}
static void RenameListItem(OBSBasic *parent, QListWidget *listWidget,
obs_source_t source, const string &name)
obs_source_t *source, const string &name)
{
const char *prevName = obs_source_get_name(source);
obs_source_t foundSource = obs_get_source_by_name(name.c_str());
obs_source_t *foundSource = obs_get_source_by_name(name.c_str());
QListWidgetItem *listItem = listWidget->currentItem();
if (foundSource || name.compare(prevName) == 0 || name.empty()) {
@ -1933,7 +1933,7 @@ void OBSBasic::SceneNameEdited(QWidget *editor,
if (!scene)
return;
obs_source_t source = obs_scene_get_source(scene);
obs_source_t *source = obs_scene_get_source(scene);
RenameListItem(this, ui->scenes, source, text);
UNUSED_PARAMETER(endHint);
@ -1949,7 +1949,7 @@ void OBSBasic::SceneItemNameEdited(QWidget *editor,
if (!item)
return;
obs_source_t source = obs_sceneitem_get_source(item);
obs_source_t *source = obs_sceneitem_get_source(item);
RenameListItem(this, ui->sources, source, text);
UNUSED_PARAMETER(endHint);
@ -2017,8 +2017,8 @@ void OBSBasic::RecordingStop()
void OBSBasic::SetupEncoders()
{
if (activeRefs == 0) {
obs_data_t x264Settings = obs_data_create();
obs_data_t aacSettings = obs_data_create();
obs_data_t *x264Settings = obs_data_create();
obs_data_t *aacSettings = obs_data_create();
int videoBitrate = config_get_uint(basicConfig, "SimpleOutput",
"VBitrate");
@ -2101,7 +2101,7 @@ void OBSBasic::on_recordButton_clicked()
const char *path = config_get_string(basicConfig,
"SimpleOutput", "FilePath");
os_dir_t dir = path ? os_opendir(path) : nullptr;
os_dir_t *dir = path ? os_opendir(path) : nullptr;
if (!dir) {
QMessageBox::information(this,
@ -2126,7 +2126,7 @@ void OBSBasic::on_recordButton_clicked()
obs_output_set_video_encoder(fileOutput, x264);
obs_output_set_audio_encoder(fileOutput, aac);
obs_data_t settings = obs_data_create();
obs_data_t *settings = obs_data_create();
obs_data_set_string(settings, "path", strPath.c_str());
obs_output_update(fileOutput, settings);
@ -2211,7 +2211,7 @@ void OBSBasic::GetConfigFPS(uint32_t &num, uint32_t &den) const
GetFPSCommon(num, den);
}
config_t OBSBasic::Config() const
config_t *OBSBasic::Config() const
{
return basicConfig;
}
@ -2228,7 +2228,7 @@ void OBSBasic::on_actionEditTransform_triggered()
void OBSBasic::on_actionResetTransform_triggered()
{
auto func = [] (obs_scene_t scene, obs_sceneitem_t item, void *param)
auto func = [] (obs_scene_t *scene, obs_sceneitem_t *item, void *param)
{
if (!obs_sceneitem_selected(item))
return true;
@ -2251,7 +2251,7 @@ void OBSBasic::on_actionResetTransform_triggered()
obs_scene_enum_items(GetCurrentScene(), func, nullptr);
}
static void GetItemBox(obs_sceneitem_t item, vec3 &tl, vec3 &br)
static void GetItemBox(obs_sceneitem_t *item, vec3 &tl, vec3 &br)
{
matrix4 boxTransform;
obs_sceneitem_get_box_transform(item, &boxTransform);
@ -2274,14 +2274,14 @@ static void GetItemBox(obs_sceneitem_t item, vec3 &tl, vec3 &br)
GetMinPos(1.0f, 1.0f);
}
static vec3 GetItemTL(obs_sceneitem_t item)
static vec3 GetItemTL(obs_sceneitem_t *item)
{
vec3 tl, br;
GetItemBox(item, tl, br);
return tl;
}
static void SetItemTL(obs_sceneitem_t item, const vec3 &tl)
static void SetItemTL(obs_sceneitem_t *item, const vec3 &tl)
{
vec3 newTL;
vec2 pos;
@ -2293,7 +2293,7 @@ static void SetItemTL(obs_sceneitem_t item, const vec3 &tl)
obs_sceneitem_set_pos(item, &pos);
}
static bool RotateSelectedSources(obs_scene_t scene, obs_sceneitem_t item,
static bool RotateSelectedSources(obs_scene_t *scene, obs_sceneitem_t *item,
void *param)
{
if (!obs_sceneitem_selected(item))
@ -2333,7 +2333,7 @@ void OBSBasic::on_actionRotate180_triggered()
obs_scene_enum_items(GetCurrentScene(), RotateSelectedSources, &f180);
}
static bool MultiplySelectedItemScale(obs_scene_t scene, obs_sceneitem_t item,
static bool MultiplySelectedItemScale(obs_scene_t *scene, obs_sceneitem_t *item,
void *param)
{
vec2 &mul = *reinterpret_cast<vec2*>(param);
@ -2370,7 +2370,7 @@ void OBSBasic::on_actionFlipVertical_triggered()
&scale);
}
static bool CenterAlignSelectedItems(obs_scene_t scene, obs_sceneitem_t item,
static bool CenterAlignSelectedItems(obs_scene_t *scene, obs_sceneitem_t *item,
void *param)
{
obs_bounds_type boundsType = *reinterpret_cast<obs_bounds_type*>(param);
@ -2414,7 +2414,7 @@ void OBSBasic::on_actionStretchToScreen_triggered()
void OBSBasic::on_actionCenterToScreen_triggered()
{
auto func = [] (obs_scene_t scene, obs_sceneitem_t item, void *param)
auto func = [] (obs_scene_t *scene, obs_sceneitem_t *item, void *param)
{
vec3 tl, br, itemCenter, screenCenter, offset;
obs_video_info ovi;

View File

@ -52,7 +52,7 @@ class OBSBasic : public OBSMainWindow {
friend class OBSBasicPreview;
private:
std::unordered_map<obs_source_t, int> sourceSceneRefs;
std::unordered_map<obs_source_t*, int> sourceSceneRefs;
std::vector<VolControl*> volumes;
@ -65,7 +65,7 @@ private:
QNetworkAccessManager networkManager;
QPointer<QTimer> cpuUsageTimer;
os_cpu_usage_info_t cpuUsageInfo = nullptr;
os_cpu_usage_info_t *cpuUsageInfo = nullptr;
QBuffer logUploadPostData;
QNetworkReply *logUploadReply = nullptr;
@ -75,14 +75,14 @@ private:
QNetworkReply *updateReply = nullptr;
QByteArray updateReturnData;
obs_output_t fileOutput = nullptr;
obs_output_t streamOutput = nullptr;
obs_service_t service = nullptr;
obs_encoder_t aac = nullptr;
obs_encoder_t x264 = nullptr;
obs_output_t *fileOutput = nullptr;
obs_output_t *streamOutput = nullptr;
obs_service_t *service = nullptr;
obs_encoder_t *aac = nullptr;
obs_encoder_t *x264 = nullptr;
gs_vertbuffer_t box = nullptr;
gs_vertbuffer_t circle = nullptr;
gs_vertbuffer_t *box = nullptr;
gs_vertbuffer_t *circle = nullptr;
bool sceneChanging = false;
@ -125,7 +125,7 @@ private:
OBSSceneItem GetSceneItem(QListWidgetItem *item);
OBSSceneItem GetCurrentSceneItem();
bool QueryRemoveSource(obs_source_t source);
bool QueryRemoveSource(obs_source_t *source);
void TimedCheckForUpdates();
void CheckForUpdates();
@ -137,14 +137,14 @@ private:
void GetConfigFPS(uint32_t &num, uint32_t &den) const;
void UpdateSources(OBSScene scene);
void InsertSceneItem(obs_sceneitem_t item);
void InsertSceneItem(obs_sceneitem_t *item);
void TempFileOutput(const char *path, int vBitrate, int aBitrate);
void TempStreamOutput(const char *url, const char *key,
int vBitrate, int aBitrate);
void CreateInteractionWindow(obs_source_t source);
void CreatePropertiesWindow(obs_source_t source);
void CreateInteractionWindow(obs_source_t *source);
void CreatePropertiesWindow(obs_source_t *source);
public slots:
void StreamingStart();
@ -171,20 +171,20 @@ private slots:
private:
/* OBS Callbacks */
static void SceneItemAdded(void *data, calldata_t params);
static void SceneItemRemoved(void *data, calldata_t params);
static void SourceAdded(void *data, calldata_t params);
static void SourceRemoved(void *data, calldata_t params);
static void SourceActivated(void *data, calldata_t params);
static void SourceDeactivated(void *data, calldata_t params);
static void SourceRenamed(void *data, calldata_t params);
static void ChannelChanged(void *data, calldata_t params);
static void SceneItemAdded(void *data, calldata_t *params);
static void SceneItemRemoved(void *data, calldata_t *params);
static void SourceAdded(void *data, calldata_t *params);
static void SourceRemoved(void *data, calldata_t *params);
static void SourceActivated(void *data, calldata_t *params);
static void SourceDeactivated(void *data, calldata_t *params);
static void SourceRenamed(void *data, calldata_t *params);
static void ChannelChanged(void *data, calldata_t *params);
static void RenderMain(void *data, uint32_t cx, uint32_t cy);
static void SceneItemMoveUp(void *data, calldata_t params);
static void SceneItemMoveDown(void *data, calldata_t params);
static void SceneItemMoveTop(void *data, calldata_t params);
static void SceneItemMoveBottom(void *data, calldata_t params);
static void SceneItemMoveUp(void *data, calldata_t *params);
static void SceneItemMoveDown(void *data, calldata_t *params);
static void SceneItemMoveTop(void *data, calldata_t *params);
static void SceneItemMoveBottom(void *data, calldata_t *params);
void ResizePreview(uint32_t cx, uint32_t cy);
@ -195,8 +195,8 @@ private:
public:
OBSScene GetCurrentScene();
obs_service_t GetService();
void SetService(obs_service_t service);
obs_service_t *GetService();
void SetService(obs_service_t *service);
int ResetVideo();
bool ResetAudio();
@ -299,7 +299,7 @@ public:
virtual void OBSInit() override;
virtual config_t Config() const override;
virtual config_t *Config() const override;
private:
std::unique_ptr<Ui::OBSBasic> ui;

View File

@ -49,14 +49,15 @@ struct SceneFindData {
{}
};
static bool SceneItemHasVideo(obs_sceneitem_t item)
static bool SceneItemHasVideo(obs_sceneitem_t *item)
{
obs_source_t source = obs_sceneitem_get_source(item);
obs_source_t *source = obs_sceneitem_get_source(item);
uint32_t flags = obs_source_get_output_flags(source);
return (flags & OBS_SOURCE_VIDEO) != 0;
}
static bool FindItemAtPos(obs_scene_t scene, obs_sceneitem_t item, void *param)
static bool FindItemAtPos(obs_scene_t *scene, obs_sceneitem_t *item,
void *param)
{
SceneFindData *data = reinterpret_cast<SceneFindData*>(param);
matrix4 transform;
@ -159,7 +160,7 @@ OBSSceneItem OBSBasicPreview::GetItemAtPos(const vec2 &pos, bool selectBelow)
return data.item;
}
static bool CheckItemSelected(obs_scene_t scene, obs_sceneitem_t item,
static bool CheckItemSelected(obs_scene_t *scene, obs_sceneitem_t *item,
void *param)
{
SceneFindData *data = reinterpret_cast<SceneFindData*>(param);
@ -220,7 +221,7 @@ struct HandleFindData {
{}
};
static bool FindHandleAtPos(obs_scene_t scene, obs_sceneitem_t item,
static bool FindHandleAtPos(obs_scene_t *scene, obs_sceneitem_t *item,
void *param)
{
if (!obs_sceneitem_selected(item))
@ -263,7 +264,7 @@ static bool FindHandleAtPos(obs_scene_t scene, obs_sceneitem_t item,
return true;
}
static vec2 GetItemSize(obs_sceneitem_t item)
static vec2 GetItemSize(obs_sceneitem_t *item)
{
obs_bounds_type boundsType = obs_sceneitem_get_bounds_type(item);
vec2 size;
@ -271,7 +272,7 @@ static vec2 GetItemSize(obs_sceneitem_t item)
if (boundsType != OBS_BOUNDS_NONE) {
obs_sceneitem_get_bounds(item, &size);
} else {
obs_source_t source = obs_sceneitem_get_source(item);
obs_source_t *source = obs_sceneitem_get_source(item);
vec2 scale;
obs_sceneitem_get_scale(item, &scale);
@ -345,9 +346,10 @@ void OBSBasicPreview::mousePressEvent(QMouseEvent *event)
vec2_zero(&lastMoveOffset);
}
static bool select_one(obs_scene_t scene, obs_sceneitem_t item, void *param)
static bool select_one(obs_scene_t *scene, obs_sceneitem_t *item, void *param)
{
obs_sceneitem_t selectedItem = reinterpret_cast<obs_sceneitem_t>(param);
obs_sceneitem_t *selectedItem =
reinterpret_cast<obs_sceneitem_t*>(param);
obs_sceneitem_select(item, (selectedItem == item));
UNUSED_PARAMETER(scene);
@ -361,7 +363,7 @@ void OBSBasicPreview::DoSelect(const vec2 &pos)
OBSScene scene = main->GetCurrentScene();
OBSSceneItem item = GetItemAtPos(pos, true);
obs_scene_enum_items(scene, select_one, (obs_sceneitem_t)item);
obs_scene_enum_items(scene, select_one, (obs_sceneitem_t*)item);
}
void OBSBasicPreview::DoCtrlSelect(const vec2 &pos)
@ -403,7 +405,7 @@ struct SelectedItemBounds {
vec3 tl, br;
};
static bool AddItemBounds(obs_scene_t scene, obs_sceneitem_t item,
static bool AddItemBounds(obs_scene_t *scene, obs_sceneitem_t *item,
void *param)
{
SelectedItemBounds *data = reinterpret_cast<SelectedItemBounds*>(param);
@ -454,7 +456,7 @@ void OBSBasicPreview::SnapItemMovement(vec2 &offset)
offset.y += snapOffset.y;
}
static bool move_items(obs_scene_t scene, obs_sceneitem_t item, void *param)
static bool move_items(obs_scene_t *scene, obs_sceneitem_t *item, void *param)
{
vec2 *offset = reinterpret_cast<vec2*>(param);
@ -613,7 +615,7 @@ void OBSBasicPreview::StretchItem(const vec2 &pos)
if (!(modifiers & Qt::ControlModifier))
SnapStretchingToScreen(tl, br);
obs_source_t source = obs_sceneitem_get_source(stretchItem);
obs_source_t *source = obs_sceneitem_get_source(stretchItem);
vec2 baseSize;
vec2_set(&baseSize,
@ -687,8 +689,8 @@ static void DrawCircleAtPos(float x, float y, matrix4 &matrix,
gs_matrix_pop();
}
bool OBSBasicPreview::DrawSelectedItem(obs_scene_t scene, obs_sceneitem_t item,
void *param)
bool OBSBasicPreview::DrawSelectedItem(obs_scene_t *scene,
obs_sceneitem_t *item, void *param)
{
if (!obs_sceneitem_selected(item))
return true;
@ -727,8 +729,8 @@ void OBSBasicPreview::DrawSceneEditing()
{
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
gs_effect_t solid = obs_get_solid_effect();
gs_technique_t tech = gs_effect_get_technique(solid, "Solid");
gs_effect_t *solid = obs_get_solid_effect();
gs_technique_t *tech = gs_effect_get_technique(solid, "Solid");
vec4 color;
vec4_set(&color, 1.0f, 0.0f, 0.0f, 1.0f);

View File

@ -43,7 +43,7 @@ private:
bool mouseOverItems = false;
static vec2 GetMouseEventPos(QMouseEvent *event);
static bool DrawSelectedItem(obs_scene_t scene, obs_sceneitem_t item,
static bool DrawSelectedItem(obs_scene_t *scene, obs_sceneitem_t *item,
void *param);
static OBSSceneItem GetItemAtPos(const vec2 &pos, bool selectBelow);

View File

@ -71,7 +71,7 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
setWindowTitle(QTStr("Basic.PropertiesWindow").arg(QT_UTF8(name)));
}
void OBSBasicProperties::SourceRemoved(void *data, calldata_t params)
void OBSBasicProperties::SourceRemoved(void *data, calldata_t *params)
{
QMetaObject::invokeMethod(static_cast<OBSBasicProperties*>(data),
"close");

View File

@ -41,7 +41,7 @@ private:
OBSSignal removedSignal;
OBSPropertiesView *view;
static void SourceRemoved(void *data, calldata_t params);
static void SourceRemoved(void *data, calldata_t *params);
static void DrawPreview(void *data, uint32_t cx, uint32_t cy);
private slots:

View File

@ -237,9 +237,9 @@ void OBSBasicSettings::LoadServiceTypes()
void OBSBasicSettings::LoadServiceInfo()
{
QLayout *layout = ui->streamContainer->layout();
obs_service_t service = main->GetService();
obs_data_t settings = obs_service_get_settings(service);
obs_properties_t properties = obs_service_properties(service);
obs_service_t *service = main->GetService();
obs_data_t *settings = obs_service_get_settings(service);
obs_properties_t *properties = obs_service_properties(service);
delete streamProperties;
streamProperties = new OBSPropertiesView(
@ -475,7 +475,7 @@ static inline void LoadListValue(QComboBox *widget, const char *text,
widget->addItem(QT_UTF8(text), QT_UTF8(val));
}
void OBSBasicSettings::LoadListValues(QComboBox *widget, obs_property_t prop,
void OBSBasicSettings::LoadListValues(QComboBox *widget, obs_property_t *prop,
const char *configName)
{
size_t count = obs_property_list_item_count(prop);
@ -506,13 +506,13 @@ void OBSBasicSettings::LoadAudioDevices()
const char *input_id = App()->InputAudioSource();
const char *output_id = App()->OutputAudioSource();
obs_properties_t input_props = obs_get_source_properties(
obs_properties_t *input_props = obs_get_source_properties(
OBS_SOURCE_TYPE_INPUT, input_id);
obs_properties_t output_props = obs_get_source_properties(
obs_properties_t *output_props = obs_get_source_properties(
OBS_SOURCE_TYPE_INPUT, output_id);
if (input_props) {
obs_property_t inputs = obs_properties_get(input_props,
obs_property_t *inputs = obs_properties_get(input_props,
"device_id");
LoadListValues(ui->auxAudioDevice1, inputs, "AuxDevice1");
LoadListValues(ui->auxAudioDevice2, inputs, "AuxDevice2");
@ -521,7 +521,7 @@ void OBSBasicSettings::LoadAudioDevices()
}
if (output_props) {
obs_property_t outputs = obs_properties_get(output_props,
obs_property_t *outputs = obs_properties_get(output_props,
"device_id");
LoadListValues(ui->desktopAudioDevice1, outputs,
"DesktopDevice1");
@ -738,7 +738,7 @@ void OBSBasicSettings::on_buttonBox_clicked(QAbstractButton *button)
void OBSBasicSettings::on_streamType_currentIndexChanged(int idx)
{
QString val = ui->streamType->itemData(idx).toString();
obs_service_t newService;
obs_service_t *newService;
if (loading)
return;

View File

@ -97,7 +97,7 @@ private:
void LoadSimpleOutputSettings();
/* audio */
void LoadListValues(QComboBox *widget, obs_property_t prop,
void LoadListValues(QComboBox *widget, obs_property_t *prop,
const char *configName);
void LoadAudioDevices();

View File

@ -21,7 +21,7 @@
#include "qt-wrappers.hpp"
#include "obs-app.hpp"
bool OBSBasicSourceSelect::EnumSources(void *data, obs_source_t source)
bool OBSBasicSourceSelect::EnumSources(void *data, obs_source_t *source)
{
OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data);
const char *name = obs_source_get_name(source);
@ -33,19 +33,19 @@ bool OBSBasicSourceSelect::EnumSources(void *data, obs_source_t source)
return true;
}
void OBSBasicSourceSelect::OBSSourceAdded(void *data, calldata_t calldata)
void OBSBasicSourceSelect::OBSSourceAdded(void *data, calldata_t *calldata)
{
OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data);
obs_source_t source = (obs_source_t)calldata_ptr(calldata, "source");
obs_source_t *source = (obs_source_t*)calldata_ptr(calldata, "source");
QMetaObject::invokeMethod(window, "SourceAdded",
Q_ARG(OBSSource, source));
}
void OBSBasicSourceSelect::OBSSourceRemoved(void *data, calldata_t calldata)
void OBSBasicSourceSelect::OBSSourceRemoved(void *data, calldata_t *calldata)
{
OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data);
obs_source_t source = (obs_source_t)calldata_ptr(calldata, "source");
obs_source_t *source = (obs_source_t*)calldata_ptr(calldata, "source");
QMetaObject::invokeMethod(window, "SourceRemoved",
Q_ARG(OBSSource, source));
@ -81,8 +81,8 @@ void OBSBasicSourceSelect::SourceRemoved(OBSSource source)
static void AddExisting(const char *name)
{
obs_source_t source = obs_get_output_source(0);
obs_scene_t scene = obs_scene_from_source(source);
obs_source_t *source = obs_get_output_source(0);
obs_scene_t *scene = obs_scene_from_source(source);
if (!scene)
return;
@ -97,8 +97,8 @@ static void AddExisting(const char *name)
bool AddNew(QWidget *parent, const char *id, const char *name)
{
obs_source_t source = obs_get_output_source(0);
obs_scene_t scene = obs_scene_from_source(source);
obs_source_t *source = obs_get_output_source(0);
obs_scene_t *scene = obs_scene_from_source(source);
bool success = false;
if (!source)
return false;
@ -169,7 +169,7 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *id_)
QString text{placeHolderText};
int i = 1;
obs_source_t source = nullptr;
obs_source_t *source = nullptr;
while ((source = obs_get_source_by_name(QT_TO_UTF8(text)))) {
obs_source_release(source);
text = QString("%1 %2").arg(placeHolderText).arg(i++);

Some files were not shown because too many files have changed in this diff Show More