0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
Commit Graph

326 Commits

Author SHA1 Message Date
Jim
ed51fd0efd Merge pull request #287 from fryshorts/doxygen
Add Doxygen configuration for creating api documentation
2014-10-29 20:41:05 -07:00
jp9000
015bc80edb Add optional source flags
This moves the 'flags' variable from the obs_source_frame structure to
the obs_source structure, and allows user flags to be set for a specific
source.  Having it set on the obs_source_frame structure didn't make
much sense.

OBS_SOURCE_UNBUFFERED makes it so that the source does not buffer its
async video output in order to try to play it on time.  In other words,
frames are played as soon as possible after being received.

Useful when you want a source to play back as quickly as possible
(webcams, certain types of capture devices)
2014-10-23 11:38:51 -07:00
jp9000
db81c59b5e Revert "Add flag to obs_source_frame for unbuffered video"
This reverts commit c3f4b0f018.

The obs_source_frame should not need to take flags to do this.  This
shouldn't be a setting associated with the frame, but rather a setting
associated with the source itself.  This was the wrong approach to
solving this particular problem.
2014-10-23 10:15:26 -07:00
jp9000
c3f4b0f018 Add flag to obs_source_frame for unbuffered video
Add 'flags' member variable to obs_source_frame structure.

The OBS_VIDEO_UNBUFFERED flags causes the video to play back as soon as
it's received (in the next frame playback), causing it to disregard the
timestamp value for the sake of video playback (however, note that the
video timestamp is still used for audio synchronization if audio is
present on the source as well).

This is partly a convenience feature, and partly a necessity for certain
plugins (such as the linux v4l plugin) where timestamp information for
the video frames can sometimes be unreliable.
2014-10-22 20:32:47 -07:00
fryshorts
f0db683d0b Some documentation improvements in obs.h
A stub for the main documentation page was created.
2014-10-19 15:00:07 +02:00
Palana
0f15cc143e Add obs_get_default_rect_effect
This provides a default effect for users of GL_TEXTURE_RECTANGLE/textures
that return true for gs_texture_is_rect
2014-10-03 20:18:01 +02:00
Palana
b99c378e33 Add 'update_properties' signal and obs_source_update_properties call
obs_source_update_properties should be called by sources when property
values change, e.g. a capture device source would use this when it
detects a new capture device (in case its properties contain a list of
available capture devices or similar)
2014-10-01 15:39:57 +02:00
jp9000
41fad2d1a4 (API Change) Use const params where applicable
This Fixes a minor flaw with the API where data had to always be mutable
to be usable by the API.

Functions that do not modify the fundamental underlying data of a
structure should be marked as constant, both for safety and to signify
that the parameter is input only and will not be modified by the
function using it.
2014-09-26 17:23:07 -07:00
jp9000
c9df41c1e2 (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.
2014-09-25 21:48:11 -07:00
kc5nra
26cf4688c2 Add interaction support to libobs 2014-09-15 17:19:37 -05:00
BtbN
895ad80759 Add api to get module data and binary paths 2014-09-04 14:03:47 -07:00
jp9000
a0f679bc40 Add API functions for output/encoder scaling
API functions added:
-----------------------------------------------
obs_output_set_preferred_size
obs_output_get_width
obs_output_get_height
obs_encoder_set_scaled_size
obs_encoder_get_width
obs_encoder_get_height

These functions allow for easier means of setting a custom resolution on
an output or encoder.

If an output uses an encoder and you set the preferred width/height
using the output, then the output will attempt to set the scaled
width/height for the encoder it's currently using.

Outputs and encoders now should use these functions to determine the
width/height of the raw frame data instead of using the video-io
functions.
2014-08-10 16:50:44 -07:00
jp9000
5780f3f177 (API Change) Improve graphics API consistency
Summary:
- Prefix all graphics subsystem names with gs_ or GS_
- Unsquish funciton names (for example _setfloat to _set_float)
- Changed create functions to be more consistent with the rest of the
  API elsewhere.  For exmaple, instead of
  gs_create_texture/gs_texture_destroy, it's now
  gs_texture_create/gs_texture_destroy
- Renamed gs_stencil_op enum to gs_stencil_op_type

From:                            To:
-----------------------------------------------------------
tvertarray                       gs_tvertarray
vb_data                          gs_vb_data
vbdata_create                    gs_vbdata_create
vbdata_destroy                   gs_vbdata_destroy
shader_param                     gs_shader_param
gs_effect                        gs_effect
effect_technique                 gs_effect_technique
effect_pass                      gs_effect_pass
effect_param                     gs_effect_param
texture_t                        gs_texture_t
stagesurf_t                      gs_stagesurf_t
zstencil_t                       gs_zstencil_t
vertbuffer_t                     gs_vertbuffer_t
indexbuffer_t                    gs_indexbuffer_t
samplerstate_t                   gs_samplerstate_t
swapchain_t                      gs_swapchain_t
texrender_t                      gs_texrender_t
shader_t                         gs_shader_t
sparam_t                         gs_sparam_t
effect_t                         gs_effect_t
technique_t                      gs_technique_t
eparam_t                         gs_eparam_t
device_t                         gs_device_t
graphics_t                       graphics_t
shader_param_type                gs_shader_param_type
SHADER_PARAM_UNKNOWN             GS_SHADER_PARAM_UNKNOWN
SHADER_PARAM_BOOL                GS_SHADER_PARAM_BOOL
SHADER_PARAM_FLOAT               GS_SHADER_PARAM_FLOAT
SHADER_PARAM_INT                 GS_SHADER_PARAM_INT
SHADER_PARAM_STRING              GS_SHADER_PARAM_STRING
SHADER_PARAM_VEC2                GS_SHADER_PARAM_VEC2
SHADER_PARAM_VEC3                GS_SHADER_PARAM_VEC3
SHADER_PARAM_VEC4                GS_SHADER_PARAM_VEC4
SHADER_PARAM_MATRIX4X4           GS_SHADER_PARAM_MATRIX4X4
SHADER_PARAM_TEXTURE             GS_SHADER_PARAM_TEXTURE
shader_param_info                gs_shader_param_info
shader_type                      gs_shader_type
SHADER_VERTEX                    GS_SHADER_VERTEX
SHADER_PIXEL                     GS_SHADER_PIXEL
shader_destroy                   gs_shader_destroy
shader_numparams                 gs_shader_get_num_params
shader_getparambyidx             gs_shader_get_param_by_idx
shader_getparambyname            gs_shader_get_param_by_name
shader_getviewprojmatrix         gs_shader_get_viewproj_matrix
shader_getworldmatrix            gs_shader_get_world_matrix
shader_getparaminfo              gs_shader_get_param_info
shader_setbool                   gs_shader_set_bool
shader_setfloat                  gs_shader_set_float
shader_setint                    gs_shader_set_int
shader_setmatrix3                gs_shader_setmatrix3
shader_setmatrix4                gs_shader_set_matrix4
shader_setvec2                   gs_shader_set_vec2
shader_setvec3                   gs_shader_set_vec3
shader_setvec4                   gs_shader_set_vec4
shader_settexture                gs_shader_set_texture
shader_setval                    gs_shader_set_val
shader_setdefault                gs_shader_set_default
effect_property_type             gs_effect_property_type
EFFECT_NONE                      GS_EFFECT_NONE
EFFECT_BOOL                      GS_EFFECT_BOOL
EFFECT_FLOAT                     GS_EFFECT_FLOAT
EFFECT_COLOR                     GS_EFFECT_COLOR
EFFECT_TEXTURE                   GS_EFFECT_TEXTURE
effect_param_info                gs_effect_param_info
effect_destroy                   gs_effect_destroy
effect_gettechnique              gs_effect_get_technique
technique_begin                  gs_technique_begin
technique_end                    gs_technique_end
technique_beginpass              gs_technique_begin_pass
technique_beginpassbyname        gs_technique_begin_pass_by_name
technique_endpass                gs_technique_end_pass
effect_numparams                 gs_effect_get_num_params
effect_getparambyidx             gs_effect_get_param_by_idx
effect_getparambyname            gs_effect_get_param_by_name
effect_updateparams              gs_effect_update_params
effect_getviewprojmatrix         gs_effect_get_viewproj_matrix
effect_getworldmatrix            gs_effect_get_world_matrix
effect_getparaminfo              gs_effect_get_param_info
effect_setbool                   gs_effect_set_bool
effect_setfloat                  gs_effect_set_float
effect_setint                    gs_effect_set_int
effect_setmatrix4                gs_effect_set_matrix4
effect_setvec2                   gs_effect_set_vec2
effect_setvec3                   gs_effect_set_vec3
effect_setvec4                   gs_effect_set_vec4
effect_settexture                gs_effect_set_texture
effect_setval                    gs_effect_set_val
effect_setdefault                gs_effect_set_default
texrender_create                 gs_texrender_create
texrender_destroy                gs_texrender_destroy
texrender_begin                  gs_texrender_begin
texrender_end                    gs_texrender_end
texrender_reset                  gs_texrender_reset
texrender_gettexture             gs_texrender_get_texture
GS_BUILDMIPMAPS                  GS_BUILD_MIPMAPS
GS_RENDERTARGET                  GS_RENDER_TARGET
gs_device_name                   gs_get_device_name
gs_device_type                   gs_get_device_type
gs_entercontext                  gs_enter_context
gs_leavecontext                  gs_leave_context
gs_getcontext                    gs_get_context
gs_renderstart                   gs_render_start
gs_renderstop                    gs_render_stop
gs_rendersave                    gs_render_save
gs_getinput                      gs_get_input
gs_geteffect                     gs_get_effect
gs_create_effect_from_file       gs_effect_create_from_file
gs_create_effect                 gs_effect_create
gs_create_vertexshader_from_file gs_vertexshader_create_from_file
gs_create_pixelshader_from_file  gs_pixelshader_create_from_file
gs_create_texture_from_file      gs_texture_create_from_file
gs_resetviewport                 gs_reset_viewport
gs_set2dmode                     gs_set_2d_mode
gs_set3dmode                     gs_set_3d_mode
gs_create_swapchain              gs_swapchain_create
gs_getsize                       gs_get_size
gs_getwidth                      gs_get_width
gs_getheight                     gs_get_height
gs_create_texture                gs_texture_create
gs_create_cubetexture            gs_cubetexture_create
gs_create_volumetexture          gs_voltexture_create
gs_create_zstencil               gs_zstencil_create
gs_create_stagesurface           gs_stagesurface_create
gs_create_samplerstate           gs_samplerstate_create
gs_create_vertexshader           gs_vertexshader_create
gs_create_pixelshader            gs_pixelshader_create
gs_create_vertexbuffer           gs_vertexbuffer_create
gs_create_indexbuffer            gs_indexbuffer_create
gs_gettexturetype                gs_get_texture_type
gs_load_defaultsamplerstate      gs_load_default_samplerstate
gs_getvertexshader               gs_get_vertex_shader
gs_getpixelshader                gs_get_pixel_shader
gs_getrendertarget               gs_get_render_target
gs_getzstenciltarget             gs_get_zstencil_target
gs_setrendertarget               gs_set_render_target
gs_setcuberendertarget           gs_set_cube_render_target
gs_beginscene                    gs_begin_scene
gs_draw                          gs_draw
gs_endscene                      gs_end_scene
gs_setcullmode                   gs_set_cull_mode
gs_getcullmode                   gs_get_cull_mode
gs_enable_depthtest              gs_enable_depth_test
gs_enable_stenciltest            gs_enable_stencil_test
gs_enable_stencilwrite           gs_enable_stencil_write
gs_blendfunction                 gs_blend_function
gs_depthfunction                 gs_depth_function
gs_stencilfunction               gs_stencil_function
gs_stencilop                     gs_stencil_op
gs_setviewport                   gs_set_viewport
gs_getviewport                   gs_get_viewport
gs_setscissorrect                gs_set_scissor_rect
gs_create_texture_from_iosurface gs_texture_create_from_iosurface
gs_create_gdi_texture            gs_texture_create_gdi
gs_is_compressed_format          gs_is_compressed_format
gs_num_total_levels              gs_get_total_levels
texture_setimage                 gs_texture_set_image
cubetexture_setimage             gs_cubetexture_set_image
swapchain_destroy                gs_swapchain_destroy
texture_destroy                  gs_texture_destroy
texture_getwidth                 gs_texture_get_width
texture_getheight                gs_texture_get_height
texture_getcolorformat           gs_texture_get_color_format
texture_map                      gs_texture_map
texture_unmap                    gs_texture_unmap
texture_isrect                   gs_texture_is_rect
texture_getobj                   gs_texture_get_obj
cubetexture_destroy              gs_cubetexture_destroy
cubetexture_getsize              gs_cubetexture_get_size
cubetexture_getcolorformat       gs_cubetexture_get_color_format
volumetexture_destroy            gs_voltexture_destroy
volumetexture_getwidth           gs_voltexture_get_width
volumetexture_getheight          gs_voltexture_get_height
volumetexture_getdepth           gs_voltexture_getdepth
volumetexture_getcolorformat     gs_voltexture_get_color_format
stagesurface_destroy             gs_stagesurface_destroy
stagesurface_getwidth            gs_stagesurface_get_width
stagesurface_getheight           gs_stagesurface_get_height
stagesurface_getcolorformat      gs_stagesurface_get_color_format
stagesurface_map                 gs_stagesurface_map
stagesurface_unmap               gs_stagesurface_unmap
zstencil_destroy                 gs_zstencil_destroy
samplerstate_destroy             gs_samplerstate_destroy
vertexbuffer_destroy             gs_vertexbuffer_destroy
vertexbuffer_flush               gs_vertexbuffer_flush
vertexbuffer_getdata             gs_vertexbuffer_get_data
indexbuffer_destroy              gs_indexbuffer_destroy
indexbuffer_flush                gs_indexbuffer_flush
indexbuffer_getdata              gs_indexbuffer_get_data
indexbuffer_numindices           gs_indexbuffer_get_num_indices
indexbuffer_gettype              gs_indexbuffer_get_type
texture_rebind_iosurface         gs_texture_rebind_iosurface
texture_get_dc                   gs_texture_get_dc
texture_release_dc               gs_texture_release_dc
2014-08-09 11:57:38 -07:00
jp9000
a3682fc8fb (API Change) Use 'get' convention in libobs (base)
Instead of having functions like obs_signal_handler() that can fail to
properly specify their actual intent in the name (does it signal a
handler, or does it return a signal handler?), always prefix functions
that are meant to get information with 'get' to make its functionality
more explicit.

Previous names:             New names:
-----------------------------------------------------------
obs_audio                   obs_get_audio
obs_video                   obs_get_video
obs_signalhandler           obs_get_signal_handler
obs_prochandler             obs_get_proc_handler
obs_source_signalhandler    obs_source_get_signal_handler
obs_source_prochandler      obs_source_get_proc_handler
obs_output_signalhandler    obs_output_get_signal_handler
obs_output_prochandler      obs_output_get_proc_handler
obs_service_signalhandler   obs_service_get_signal_handler
obs_service_prochandler     obs_service_get_proc_handler
2014-08-08 11:04:46 -07:00
jp9000
73baaa59e9 (API Change) Unsquish libobs (base) names
Previous names:             New names:
-----------------------------------------------------------
obs_view_setsource          obs_view_set_source
obs_view_getsource          obs_view_get_source
obs_source_getdisplayname   obs_source_get_display_name
obs_source_getwidth         obs_source_get_width
obs_source_getheight        obs_source_get_height
obs_filter_getparent        obs_filter_get_parent
obs_filter_gettarget        obs_filter_get_target
obs_source_filter_setorder  obs_source_filter_set_order
obs_source_getsettings      obs_source_get_settings
obs_source_getname          obs_source_get_name
obs_source_setname          obs_source_set_name
obs_source_setvolume        obs_source_set_volume
obs_source_getvolume        obs_source_get_volume
obs_scene_getsource         obs_scene_get_source
obs_scene_fromsource        obs_scene_from_source
obs_scene_findsource        obs_scene_find_source
obs_output_getdisplayname   obs_output_get_display_name
obs_output_getname          obs_output_get_name
obs_encoder_getname         obs_encoder_get_name
obs_service_getdisplayname  obs_service_get_display_name
obs_service_getname         obs_service_get_name
2014-08-08 11:04:46 -07:00
jp9000
41176eef27 (API Change) Remove obs_graphics()
API Removed:
- graphics_t obs_graphics();
Replaced With:
- void obs_enter_graphics();
- void obs_leave_graphics();

Description:
  obs_graphics() was somewhat of a pointless function.  The only time
that it was ever necessary was to pass it as a parameter to
gs_entercontext() followed by a subsequent gs_leavecontext() call after
that.  So, I felt that it made a bit more sense just to implement
obs_enter_graphics() and obs_leave_graphics() functions to do the exact
same thing without having to repeat that code.  There's really no need
to ever "hold" the graphics pointer, though I suppose that could change
in the future so having a similar function come back isn't out of the
question.

Still, this at least reduces the amount of unnecessary repeated code for
the time being.
2014-08-08 11:04:45 -07:00
jp9000
b007c6b139 (API Change) Un-squish obs_sceneitem_*
Renamed:                         To:
-----------------------------------------------------------
obs_sceneitem_getscene           obs_sceneitem_get_scene
obs_sceneitem_getsource          obs_sceneitem_get_source
obs_sceneitem_setpos             obs_sceneitem_set_pos
obs_sceneitem_setrot             obs_sceneitem_set_rot
obs_sceneitem_setscale           obs_sceneitem_set_scale
obs_sceneitem_setalignment       obs_sceneitem_set_alignment
obs_sceneitem_setorder           obs_sceneitem_set_order
obs_sceneitem_getpos             obs_sceneitem_get_pos
obs_sceneitem_getrot             obs_sceneitem_get_rot
obs_sceneitem_getscale           obs_sceneitem_get_scale
obs_sceneitem_getalignment       obs_sceneitem_get_alignment
2014-08-08 11:04:45 -07:00
jp9000
e42af67128 (API Change) Split obs_source_gettype
Changed:
- obs_source_gettype
To:
- enum obs_source_type obs_source_get_type(obs_source_t source);
- const char *obs_source_get_id(obs_source_t source);

This function was inconsistent for a number of reasons.  First, it
returns both the ID and the type of source (input/transition/filter),
which is inconsistent with the name of "get type".  Secondly, the
'squishy' naming convention which has just turned out to be bad
practice and causes inconsistencies.  So it's now replaced with two
functions that just return the type and the ID.
2014-08-08 11:04:44 -07:00
jp9000
0961af6e66 (API Change) Rename source_audio structure
Rename source_audio to obs_source_audio to make it more consistent with
the rest of the API
2014-08-08 11:04:44 -07:00
jp9000
45eec06891 (API Change) Rename filtered_audio structure
Reanmed filtered_audio to obs_audio_data, to improve the naming and
prefix with obs_ for the sake with consistency with the rest of the API
2014-08-08 11:04:44 -07:00
jp9000
4d1272e6e2 (API Change) Rename allow_direct_render enum
For the sake of consistency, changed allow_direct_render to
obs_allow_direct_render
2014-08-08 11:04:43 -07:00
jp9000
d2b4f82637 (API Change) Rename order_movement
Prefix with obs_ for the sake of consistency

Renamed enums:
- order_movement (now obs_order_movement)

Affected functions:
- obs_source_filter_setorder
- obs_sceneitem_setorder
2014-08-08 11:04:43 -07:00
jp9000
4122a5b9b5 (API Change) Rename 'source_frame' + related
For the sake of naming consistency with the rest of obs.h, prefix this
structure and associated functions with obs_.

Renamed structures:
- struct source_frame (now obs_source_frame)

Renamed functions:
- source_frame_init (now obs_source_frame_init)
- source_frame_free (now obs_source_frame_free)
- source_frame_create (now obs_source_frame_create)
- source_frame_destroy (now obs_source_frame_destroy)

Affected functions:
- obs_source_output_video
- obs_source_get_frame
- obs_source_release_frame
2014-08-08 11:04:42 -07:00
jp9000
7b402245dc (API Change) Rename obs_source_get(/release)frame
Renamed functions:
- obs_source_getframe (rename to obs_source_get_frame)
- obs_source_releaseframe (rename to obs_source_release_frame)

For the sake of consistency and helping to get rid of the "squishy
function name" issue
2014-08-08 11:04:42 -07:00
jp9000
24bd82a09c (API Change) Rename obs_sceneitem_info structure
Change obs_sceneitem_info structure to obs_transform_info - this
structure will not just be used with scene items in the future.
2014-08-08 11:04:42 -07:00
jp9000
e87ed914f8 Add API functions to get information about modules 2014-07-27 17:29:11 -07:00
jp9000
59ea3becf2 (API Change) Refactor module handling
Changed API:
- char *obs_find_plugin_file(const char *sub_path);

  Changed to: char *obs_module_file(const char *file);

  Cahnge it so you no longer need to specify a sub-path such as:
  obs_find_plugin_file("module_name/file.ext")

  Instead, now automatically handle the module data path so all you need
  to do is:
  obs_module_file("file.ext")

- int obs_load_module(const char *name);

  Changed to: int obs_open_module(obs_module_t *module,
                                  const char *path,
                                  const char *data_path);
              bool obs_init_module(obs_module_t module);

  Change the module loading API so that if the front-end chooses, it can
  load modules directly from a specified path, and associate a data
  directory with it on the spot.

  The module will not be initialized immediately; obs_init_module must
  be called on the module pointer in order to fully initialize the
  module.  This is done so a module can be disabled by the front-end if
  the it so chooses.

New API:
- void obs_add_module_path(const char *bin, const char *data);

  These functions allow you to specify new module search paths to add,
  and allow you to search through them, or optionally just load all
  modules from them.  If the string %module% is included, it will
  replace it with the module's name when that string is used as a
  lookup.  Data paths are now directly added to the module's internal
  storage structure, and when obs_find_module_file is used, it will look
  up the pointer to the obs_module structure and get its data directory
  that way.

  Example:
  obs_add_module_path("/opt/obs/my-modules/%module%/bin",
                      "/opt/obs/my-modules/%module%/data");

  This would cause it to additionally look for the binary of a
  hypthetical module named "foo" at /opt/obs/my-modules/foo/bin/foo.so
  (or libfoo.so), and then look for the data in
  /opt/obs/my-modules/foo/data.

  This gives the front-end more flexibility for handling third-party
  plugin modules, or handling all plugin modules in a custom way.

- void obs_find_modules(obs_find_module_callback_t callback, void
                        *param);

  This searches the existing paths for modules and calls the callback
  function when any are found.  Useful for plugin management and custom
  handling of the paths by the front-end if desired.

- void obs_load_all_modules(void);

  Search through the paths and both loads and initializes all modules
  automatically without custom handling.

- void obs_enum_modules(obs_enum_module_callback_t callback,
                        void *param);

  Enumerates currently opened modules.
2014-07-27 17:29:10 -07:00
jp9000
ee4a93b47b Add function to get current core version
The version macro that modules use to compile versus the actual core
version that may be in use may be different, so this is a way to compare
them to check for compatibility issues later on.
2014-07-27 13:27:02 -07:00
jp9000
778cc2b318 (API Change) obs_reset_video: Use return codes
Changed API functions:
libobs: obs_reset_video

Before, video initialization returned a boolean, but "failed" is too
little information, if it fails due to lack of device capabilities or
bad video device parameters, the front-end needs to know that.

The OBS Basic UI has also been updated to reflect this API change.
2014-07-20 18:25:57 -07:00
jp9000
1570e53364 Add obs_encoder_getname function 2014-07-13 02:58:55 -07:00
jp9000
ac760efb57 libobs: Add function for default module locale
This function is used to simplify the process when using the default
locale handling for modules.  It will automatically search in the plugin
data directory associated with the specific module specified, load the
default locale text (for example english if its default language is
english), and then it will load the set locale on top of the default
locale, which will cause text to use the default locale if the desired
locale text is not found.
2014-07-11 17:26:23 -07:00
jp9000
3d1c132989 Add statistics functions to outputs
Total bytes, total frames, and frames dropped.  Total frames is
generated automatically, but total bytes and total dropped frames are
returned via callbacks.
2014-07-06 17:36:44 -07:00
jp9000
4f2a731acf Implement reconnecting
The core itself now provides reconnection options (enabled by default, 2
second timeout between reconnects, 20 retries max until actual
disconnection occurs).  This will make things easier for both module
developers and UI developers.

Reconnecting treats the stream as though it were still active, and
signals are sent when reconnecting and upon successful reconnection.

Need to implement user interface information for reconnections.
2014-07-02 20:39:39 -07:00
jp9000
267af930ab Add obs_output_getname
This will get the user-defined name of the output (if any)
2014-07-01 16:29:38 -07:00
jp9000
0b4a259e56 Remove 'locale' parameter from all callbacks
The locale parameter was a mistake, because it puts extra needless
burden upon the module developer to have to handle this variable for
each and every single callback function.  The parameter is being removed
in favor of a single centralized module callback function that
specifically updates locale information for a module only when needed.
2014-06-25 12:36:26 -07:00
jp9000
899f053034 Add API for setting/getting current locale
This API is used to set the current locale for libobs, which it will set
for all modules when a module is loaded or specifically when the locale
is manually changed.
2014-06-25 12:36:17 -07:00
jp9000
9b23914c37 libobs: Add 'initialize' callback to services
The 'initialize' callback is used before the encoders/output start up so
it can adjust encoder settings to required values if needed.

Also added the function 'obs_encoder_active' that returns true or false
depending on whether that encoder is active or not.
2014-06-16 21:37:53 -07:00
Jim
dfabbf7936 Merge pull request #111 from antihax/cleanup
Removed unresolved EXPORT from previous revision of volume meter & modified locale not found error.
2014-06-16 18:13:20 -07:00
Danni
af1408d84f Removed unresolved EXPORT from previous revision of volume meter 2014-06-16 18:52:55 -05:00
jp9000
452e0695f4 UI: Add scene editing
So, scene editing was interesting (and by interesting I mean
excruciating).  I almost implemented 'manipulator' visuals (ala 3dsmax
for example), and used 3 modes for controlling position/rotation/size,
but in a 2D editing, it felt clunky, so I defaulted back to simply
click-and-drag for movement, and then took a similar though slightly
different looking approach for handling scaling and reszing.

I also added a number of menu item helpers related to positioning,
scaling, rotating, flipping, and resetting the transform back to
default.

There is also a new 'transform' dialog (accessible via menu) which will
allow you to manually edit every single transform variable of a scene
item directly if desired.

If a scene item does not have bounds active, pulling on the sides of a
source will cause it to resize it via base scale rather than by the
bounding box system (if the source resizes that scale will apply).  If
bounds are active, it will modify the bounding box only instead.

How a source scales when a bounding box is active depends on the type of
bounds being used.  You can set it to scale to the inner bounds, the
outer bounds, scale to bounds width only, scale to bounds height only,
and a setting to stretch to bounds (which forces a source to always draw
at the bounding box size rather than be affected by its internal size).
You can also set it to be used as a 'maximum' size, so that the source
doesn't necessarily get scaled unless it extends beyond the bounds.

Like in OBS1, objects will snap to the edges unless the control key is
pressed.  However, this will now happen even if the object is rotated or
oriented in any strange way.  Snapping will also occur when stretching
or changing the bounding box size.
2014-06-15 20:33:13 -07:00
jp9000
b23f8cc6e1 Scenes: Implement more item positioning features
There are a ridiculous number of features related to scaling and
positioning due to requests by a number of people who complained that
they hated the way that OBS1 would always resize their sources when the
source's base size changed.  There were also people who wanted more
control for how the resizing was handled, or the ability to completely
prevent resizing entirely if desired.  So I made it so that you can
optionally use a 'bounds' system, which allows you to specify different
styles of controlling resizing.

If disabled, the source will always automatically resize and only the
base scale is applied.  If enabled, you have a variety of different ways
to limit/control how it can resize within the bounds, or make it so it
can't resize at all.  You can also control alignment within that
bounding box, so you can make it so that a source always aligns to a
side or corner of the box.

I also added an alignment value which changes how the source is oriented
relative to the position of the scene item.  For example, setting
bottom-right alignment will make it so that the position of the item is
the bottom right corner of the source.  When the source resizies, it
will resize leftward and upward in that case, which solves the problem
of how a source resizes relative to a desired position.
2014-06-15 20:33:13 -07:00
jp9000
2a7f202e7e libobs: Add 'solid' effect for basic primitives 2014-06-14 23:55:10 -07:00
Jim
4eb6267372 Merge pull request #90 from antihax/master
Added simple volume meter for reference of input levels.
2014-06-03 05:15:18 -07:00
jp9000
3a850e67c3 libobs: Move API version info to obs-config.h
This way it doesn't interfere with any actual relevant commits related
to obs.h.
2014-05-21 03:58:20 -07:00
jp9000
bba6848c0c Update core to 0.2.4 2014-05-21 03:48:29 -07:00
Danni
bc542a3e75 Added simple volume meter for reference of input levels. 2014-05-20 09:26:18 -05:00
jp9000
5ba8b09c9c Add help menu with log file uploading
Added github gist API uploading to the help menu to help make problems a
bit easier to debug in the future.  It's somewhat vital that this
functionality be implemented before any release in order to analyze any
given problem a user may be experiencing.
2014-05-18 17:44:10 -07:00
jp9000
a1d01aec98 Show commit hash in version string
Also, update to 0.2.2
2014-05-15 19:11:33 -07:00
jp9000
999d8ee916 Add ability to move source up/down/etc 2014-05-15 17:40:53 -07:00
jp9000
1c54dac3ac Update libobs to use semantic versioning (0.2.0) 2014-05-04 23:04:35 -07:00
jp9000
52746c2523 Add (temporary terrible) volume controls
- Add volume control

   These volume controls are basically nothing more than sliders.  They
   look terrible and hopefully will be as temporary as they are
   terrible.

 - Allow saving of specific non-user sources via obs_load_source and
   obs_save_source functions.

 - Save data of desktop/mic audio sources (sync data, volume data, etc),
   and load the data on startup.

 - Make it so that a scene is created by default if first time using the
   application.  On certain operating systems where supported, a default
   capture will be created.  Desktop capture on mac, particularly.  Not
   sure what to do about windows because monitor capture on windows 7 is
   completely terrible and is bad to start users off with.
2014-05-03 22:54:38 -07:00
jp9000
65455c27be Add preliminary saving/loading of scene/sources
This saves scenes/sources from json on exit, and properly loads it back
up when starting up the program again, as well as the currently active
scene.

I had to add a 'load' and 'save' callback to the source interface
structure because I realizes that certain sources (such as scenes)
operate different with their saved data; scenes for example would have
to keep track of their settings information constantly, and that was
somewhat unacceptable to make it functional.

The optional 'load' callback will be called only after having loaded
setttings specifically from file/imported data, and the 'save' function
will be called only specifically when data actually needs to be saved.

I also had to adjust the obs_scene code so that it's a regular input
source type now, and I also modified it so that it doesn't have some
strange custom creation code anymore.  The obs_scene_create function is
now simply just a wrapper for obs_source_create.  You could even create
a scene with obs_source_create manually as well.
2014-04-26 23:47:50 -07:00
Palana
065379bffa Add limited range rendering for rendering YUV non-full range sources 2014-04-24 21:45:54 +02:00
jp9000
8830c4102f obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
   the output gets data from that service rather than via settings.
   This allows the service context to have control over how an output is
   used, and makes it so that the URL/key/etc isn't necessarily some
   static setting.

   Also, if the service is attached to an output, it will stick around
   until the output is destroyed.

 - The settings interface has been updated so that it can allow the
   usage of service plugins.  What this means is that now you can create
   a service plugin that can control aspects of the stream, and it
   allows each service to create their own user interface if they create
   a service plugin module.

 - Testing out saving of current service information.  Saves/loads from
   JSON in to obs_data_t, seems to be working quite nicely, and the
   service object information is saved/preserved on exit, and loaded
   again on startup.

 - I agonized over the settings user interface for days, and eventually
   I just decided that the only way that users weren't going to be
   fumbling over options was to split up the settings in to simple/basic
   output, pre-configured, and then advanced for advanced use (such as
   multiple outputs or services, which I'll implement later).

   This was particularly painful to really design right, I wanted more
   features and wanted to include everything in one interface but
   ultimately just realized from experience that users are just not
   technically knowledgable about it and will end up fumbling with the
   settings rather than getting things done.

   Basically, what this means is that casual users only have to enter in
   about 3 things to configure their stream:  Stream key, audio bitrate,
   and video bitrate.  I am really happy with this interface for those
   types of users, but it definitely won't be sufficient for advanced
   usage or for custom outputs, so that stuff will have to be separated.

 - Improved the JSON usage for the 'common streaming services' context,
   I realized that JSON arrays are there to ensure sorting, while
   forgetting that general items are optimized for hashing.  So
   basically I'm just using arrays now to sort items in it.
2014-04-24 02:19:03 -07:00
jp9000
4a6d19f206 libobs: Add services API, reduce repeated code
Add API for streaming services.  The services API simplifies the
creation of custom service features and user interface.

Custom streaming services later on will be able to do things such as:

 - Be able to use service-specific APIs via modules, allowing a more
   direct means of communicating with the service and requesting or
   setting service-specific information

 - Get URL/stream key via other means of authentication such as OAuth,
   or be able to build custom URLs for services that require that sort
   of thing.

 - Query information (such as viewer count, chat, follower
   notifications, and other information)

 - Set channel information (such as current game, current channel title,
   activating commercials)

Also, I reduce some repeated code that was used for all libobs objects.
This includes the name of the object, the private data, settings, as
well as the signal and procedure handlers.

I also switched to using linked lists for the global object lists,
rather than using an array of pointers (you could say it was..
pointless.)  ..Anyway, the linked list info is also stored in the shared
context data structure.
2014-04-19 20:38:53 -07:00
jp9000
92522d1886 Implement RTMP module (still needs drop code)
- Implement the RTMP output module.  This time around, we just use a
   simple FLV muxer, then just write to the stream with RTMP_Write.
   Easy and effective.

 - Fix the FLV muxer, the muxer now outputs proper FLV packets.

 - Output API:
   * When using encoders, automatically interleave encoded packets
     before sending it to the output.

   * Pair encoders and have them automatically wait for the other to
     start to ensure sync.

   * Change 'obs_output_signal_start_fail' to 'obs_output_signal_stop'
     because it was a bit confusing, and doing this makes a lot more
     sense for outputs that need to stop suddenly (disconnections/etc).

 - Encoder API:
   * Remove some unnecessary encoder functions from the actual API and
     make them internal.  Most of the encoder functions are handled
     automatically by outputs anyway, so there's no real need to expose
     them and end up inadvertently confusing plugin writers.

   * Have audio encoders wait for the video encoder to get a frame, then
     start at the exact data point that the first video frame starts to
     ensure the most accrate sync of video/audio possible.

   * Add a required 'frame_size' callback for audio encoders that
     returns the expected number of frames desired to encode with.  This
     way, the libobs encoder API can handle the circular buffering
     internally automatically for the encoder modules, so encoder
     writers don't have to do it themselves.

 - Fix a few bugs in the serializer interface.  It was passing the wrong
   variable for the data in a few cases.

 - If a source has video, make obs_source_update defer the actual update
   callback until the tick function is called to prevent threading
   issues.
2014-04-07 22:00:10 -07:00
jp9000
0cf9e0cfdd Add preliminary FLV/RTMP output (incomplete)
- obs-outputs module:  Add preliminary code to send out data, and add
   an FLV muxer.  This time we don't really need to build the packets
   ourselves, we can just use the FLV muxer and send it directly to
   RTMP_Write and it should automatically parse the entire stream for us
   without us having to do much manual code at all.  We'll see how it
   goes.

 - libobs:  Add AVC NAL packet parsing code

 - libobs/media-io:  Add quick helper functions for audio/video to get
   the width/height/fps/samplerate/etc rather than having to query the
   info structures each time.

 - libobs (obs-output.c):  Change 'connect' signal to 'start' and 'stop'
   signals.  'start' now specifies an error code rather than whether it
   simply failed, that way the client can actually know *why* a failure
   occurred.  Added those error codes to obs-defs.h.

 - libobs:  Add a few functions to duplicate/free encoder packets
2014-04-01 11:55:18 -07:00
jp9000
6da26a3a1c Implement encoder usage with outputs
- Make it so that encoders can be assigned to outputs.  If an encoder
   is destroyed, it will automatically remove itself from that output.
   I specifically didn't want to do reference counting because it leaves
   too much potential for unchecked references and it just felt like it
   would be more trouble than it's worth.

 - Add a 'flags' value to the output definition structure.  This lets
   the output specify if it uses video/audio, and whether the output is
   meant to be used with OBS encoders or not.

 - Remove boilerplate code for outputs.  This makes it easier to program
   outputs.  The boilerplate code involved before was mostly just
   involving connecting to the audio/video data streams directly in each
   output plugin.

   Instead of doing that, simply add plugin callback functions for
   receiving video/audio (either encoded or non-encoded, whichever it's
   set to use), and then call obs_output_begin_data_capture and
   obs_output_end_data_capture to automatically handle setting up
   connections to raw or encoded video/audio streams for the plugin.

 - Remove 'active' function from output callbacks, as it's no longer
   really needed now that the libobs output context automatically knows
   when the output is active or not.

 - Make it so that an encoder cannot be destroyed until all data
   connections to the encoder have been removed.

 - Change the 'start' and 'stop' functions in the encoder interface to
   just an 'initialize' callback, which initializes the encoder.

 - Make it so that the encoder must be initialized first before the data
   stream can be started.  The reason why initialization was separated
   from starting the encoder stream was because we need to be able to
   check that the settings used with the encoder *can* be used first.

   This problem was especially annoying if you had both video/audio
   encoding.  Before, you'd have to check the return value from
   obs_encoder_start, and if that second encoder fails, then you
   basically had to stop the first encoder again, making for
   unnecessary boilerplate code whenever starting up two encoders.
2014-03-27 21:50:15 -07:00
jp9000
d9251f9e87 Add source properties window (very preliminary)
- Add a properties window for sources so that you can now actually edit
   the settings for sources.  Also, display the source by itself in the
   window (Note: not working on mac, and possibly not working on linux).

   When changing the settings for a source, it will call
   obs_source_update on that source when you have modified any values
   automatically.

 - Add a properties 'widget', eventually I want to turn this in to a
   regular nice properties view like you'd see in the designer, but
   right now it just uses a form layout in a QScrollArea with regular
   controls to display the properties.  It's clunky but works for the
   time being.

 - Make it so that swap chains and the main graphics subsystem will
   automatically use at least one backbuffer if none was specified

 - Fix bug where displays weren't added to the main display array

 - Make it so that you can get the properties of a source via the actual
   pointer of a source/encoder/output in addition to being able to look
   up properties via identifier.

 - When registering source types, check for required functions (wasn't
   doing it before).  getheight/getwidth should not be optional if it's
   a video source as well.

 - Add an RAII OBSObj wrapper to obs.hpp for non-reference-counted
   libobs pointers

 - Add an RAII OBSSignal wrapper to obs.hpp for libobs signals to
   automatically disconnect them on destruction

 - Move the "scale and center" calculation in window-basic-main.cpp to
   its own function and in its own source file

 - Add an 'update' callback to WASAPI audio sources
2014-03-23 01:07:54 -07:00
jp9000
fd37d9e9a8 Implement encoder interface (still preliminary)
- Implement OBS encoder interface.  It was previously incomplete, but
   now is reaching some level of completion, though probably should
   still be considered preliminary.

   I had originally implemented it so that encoders only have a 'reset'
   function to reset their parameters, but I felt that having both a
   'start' and 'stop' function would be useful.

   Encoders are now assigned to a specific video/audio media output each
   rather than implicitely assigned to the main obs video/audio
   contexts.  This allows separate encoder contexts that aren't
   necessarily assigned to the main video/audio context (which is useful
   for things such as recording specific sources).  Will probably have
   to do this for regular obs outputs as well.

   When creating an encoder, you must now explicitely state whether that
   encoder is an audio or video encoder.

   Audio and video can optionally be automatically converted depending
   on what the encoder specifies.

   When something 'attaches' to an encoder, the first attachment starts
   the encoder, and the encoder automatically attaches to the media
   output context associated with it.  Subsequent attachments won't have
   the same effect, they will just start receiving the same encoder data
   when the next keyframe plays (along with SEI if any).  When detaching
   from the encoder, the last detachment will fully stop the encoder and
   detach the encoder from the media output context associated with the
   encoder.

   SEI must actually be exported separately; because new encoder
   attachments may not always be at the beginning of the stream, the
   first keyframe they get must have that SEI data in it.  If the
   encoder has SEI data, it needs only add one small function to simply
   query that SEI data, and then that data will be handled automatically
   by libobs for all subsequent encoder attachments.

 - Implement x264 encoder plugin, move x264 files to separate plugin to
   separate necessary dependencies.

 - Change video/audio frame output structures to not use const
   qualifiers to prevent issues with non-const function usage elsewhere.
   This was an issue when writing the x264 encoder, as the x264 encoder
   expects non-const frame data.

   Change stagesurf_map to return a non-const data type to prevent this
   as well.

 - Change full range parameter of video scaler to be an enum rather than
   boolean
2014-03-16 16:21:34 -07:00
jp9000
02a07ea0a0 Add preliminary streaming code for testing
- Add some temporary streaming code using FFmpeg.  FFmpeg itself is not
   very ideal for streaming; lack of direct control of the sockets and
   no framedrop handling means that FFmpeg is definitely not something
   you want to use without wrapper code.  I'd prefer writing my own
   network framework in this particular case just because you give away
   so much control of the network interface.  Wasted an entire day
   trying to go through FFmpeg issues.

   There's just no way FFmpeg should be used for real streaming (at
   least without being patched or submitting some sort of patch, but I'm
   sort of feeling "meh" on that idea)

   I had to end up writing multiple threads just to handle both
   connecting and writing, because av_interleaved_write_frame blocks
   every call, stalling the main encoder thread, and thus also stalling
   draw signals.

 - Add some temporary user interface for streaming settings.  This is
   just temporary for the time being.  It's in the outputs section of
   the basic-mode settings

 - Make it so that dynamic arrays do not free all their data when the
   size just happens to be reduced to 0.  This prevents constant
   reallocation when an array keeps going from 1 item to 0 items.  Also,
   it was bad to become dependent upon that functionality.  You must now
   always explicitly call "free" on it to ensure the data is free, and
   that's how it should be.  Implicit functionality can lead to
   confusion and maintainability issues.
2014-03-10 13:10:35 -07:00
jp9000
7d48dbb1dc Add a way to get default settings
- Implement a means of obtaining default settings for an
   input/output/encoder.  obs_source_defaults for example will return
   the default settings for a particular source type.

 - Because C++ doesn't have designated initializers, use functions in
   the WASAPI plugin to register the sources instead.
2014-03-07 06:55:21 -07:00
jp9000
be81276f03 Implement volume handling
- Remove obs_source::type because it became redundant now that the
   type is always stored in the obs_source::info variable.

 - Apply presentation volumes of 1.0 and 0.0 to sources when they
   activate/deactivate, respectively.  It also applies that presentation
   volume to all sub-sources, with exception of transition sources.
   Transition sources must apply presentation volume manually to their
   sub-sources with the new transition functions below.

 - Add a "transition_volume" variable to obs_source structure, and add
   three functions for handling volume for transitions:

   * obs_transition_begin_frame
   * obs_source_set_transition_vol
   * obs_transition_end_frame

   Because the to/from targets of a transition source might both contain
   some of the same sources, handling the transitioning of volumes for
   that specific situation becomes an issue.

   So for transitions, instead of modifying the presentation volumes
   directly for both sets of sources, we do this:

   - First, call obs_transition_begin_frame at the beginning of each
     transition frame, which will reset transition volumes for all
     sub-sources to 0.  Presentation volumes remain unchanged.

   - Call obs_source_set_transition_vol on each sub-source, which will
     then add the volume to the transition volume for each source in
     that source's tree.  Presentation volumes still remain unchanged.

   - Then you call obs_trandition_end_frame when complete, which will
     then finally set the presentation volumes to the transition
     volumes.

   For example, let's say that there's one source that's within both the
   "transitioning from" sources and "transition to" sources.  It would
   add both the fade in and fade out volumes to that source, and then
   when the frame is complete, it would set the presentation volume to
   the sum of those two values, rather than set the presentation volume
   for that same source twice which would cause weird volume jittering
   and also set the wrong values.
2014-02-21 19:41:38 -07:00
jp9000
d4f1eacc1f Implement source activation/deactivation
Now sources will be properly activated and deactivated when they are in
use or not in use.

Had to figure out a way to handle child sources, and children of
children, just ended up implementing simple functions that parents use
to signal adding/removal to help with hierarchial activation and
deactivation of child sources.

To prevent the source activate/deactivate callbacks from being called
more than once, added an activation reference counter.  The first
increment will call the activate callback, and the last decrement will
call the deactivate callback.

Added "source-activate" and "source-deactivate" signals to the main obs
signal handler, and "activate" and "deactivate" to individual source
signal handlers.

Also, fixed the main window so it properly selects a source when the
current active scene has been changed.
2014-02-20 22:04:14 -07:00
jp9000
14c95ac421 Add functions to enumerate source children/tree 2014-02-20 17:44:42 -07:00
jp9000
d6ec5438a8 Add source audio sync offset setting 2014-02-20 16:16:25 -07:00
jp9000
579f026c5b Add more volume options
Added a "master" volume for the entire audio subsystem.

Also, added a "presentation" volume for both the master volume and for
each invidiaul source.  The presentation volume is used to control
things like transitioning volumes, preventing sources from outputting
any audio when they're inactive, as well as some other uses in the
future.
2014-02-20 15:56:51 -07:00
jp9000
2dbbffe4a2 Make a number of key optimizations
- Changed glMapBuffer to glMapBufferRange to allow invalidation.  Using
   just glMapBuffer alone was causing some unacceptable stalls.

 - Changed dynamic buffers from GL_DYNAMIC_WRITE to GL_STREAM_WRITE
   because I had misunderstood the OpenGL specification

 - Added _OPENGL and _D3D11 builtin preprocessor macros to effects to
   allow special processing if needed

 - Added fmod support to shaders (NOTE: D3D and GL do not function
   identically with negative numbers when using this.  Positive numbers
   however function identically)

 - Created a planar conversion shader that converts from packed YUV to
   planar 420 right on the GPU without any CPU processing.  Reduces
   required GPU download size to approximately 37.5% of its normal rate
   as well.  GPU usage down by 10 entire percentage points despite the
   extra required pass.
2014-02-16 19:28:21 -07:00
jp9000
966b943d5b Remove majority of warnings
There were a *lot* of warnings, managed to remove most of them.

Also, put warning flags before C_FLAGS and CXX_FLAGS, rather than after,
as -Wall -Wextra was overwriting flags that came before it.
2014-02-14 15:13:36 -07:00
jp9000
4bc282f5e9 Rename obs_viewport to obs_view
I felt like the name could cause a bit of confusion with typical
graphics viewports, so I just changed it to view instead.
2014-02-13 10:21:16 -07:00
jp9000
515f44be8e Revamp rendering system to allow custom rendering
Originally, the rendering system was designed to only display sources
and such, but I realized there would be a flaw; if you wanted to render
the main viewport in a custom way, or maybe even the entire application
as a graphics-based front end, you wouldn't have been able to do that.

Displays have now been separated in to viewports and displays.  A
viewport is used to store and draw sources, a display is used to handle
draw callbacks.  You can even use displays without using viewports to
draw custom render displays containing graphics calls if you wish, but
usually they would be used in combination with source viewports at
least.

This requires a tiny bit more work to create simple source displays, but
in the end its worth it for the added flexibility and options it brings.
2014-02-13 08:58:31 -07:00
jp9000
88519f0889 Add a bit more documentation
- Add bit more documentation to some of the main headers

- Fix alignment for the size of the name string of a obs_data_item.
2014-02-13 05:27:35 -07:00
jp9000
526f8d4b61 Move enum obs_source_type to obs-source.h 2014-02-12 12:57:51 -07:00
jp9000
8e81d8be56 Revamp API and start using doxygen
The API used to be designed in such a way to where it would expect
exports for each individual source/output/encoder/etc.  You would export
functions for each and it would automatically load those functions based
on a specific naming scheme from the module.

The idea behind this was that I wanted to limit the usage of structures
in the API so only functions could be used.  It was an interesting idea
in theory, but this idea turned out to be flawed in a number of ways:

 1.) Requiring exports to create sources/outputs/encoders/etc meant that
     you could not create them by any other means, which meant that
     things like faruton's .net plugin would become difficult.

 2.) Export function declarations could not be checked, therefore if you
     created a function with the wrong parameters and parameter types,
     the compiler wouldn't know how to check for that.

 3.) Required overly complex load functions in libobs just to handle it.
     It makes much more sense to just have a load function that you call
     manually.  Complexity is the bane of all good programs.

 4.) It required that you have functions of specific names, which looked
     and felt somewhat unsightly.

So, to fix these issues, I replaced it with a more commonly used API
scheme, seen commonly in places like kernels and typical C libraries
with abstraction.  You simply create a structure that contains the
callback definitions, and you pass it to a function to register that
definition (such as obs_register_source), which you call in the
obs_module_load of the module.

It will also automatically check the structure size and ensure that it
only loads the required values if the structure happened to add new
values in an API change.

The "main" source file for each module must include obs-module.h, and
must use OBS_DECLARE_MODULE() within that source file.

Also, started writing some doxygen documentation in to the main library
headers.  Will add more detailed documentation as I go.
2014-02-12 08:04:50 -07:00
jp9000
b067440f73 Use bzalloc instead of bmalloc then memset
Reduces needless code repetition and still allows for proper memory
alignment.  Cleans up the code a bit.
2014-02-09 12:34:07 -07:00
jp9000
6c92cf5841 Implement output, improve video/audio subsystems
- Fill in the rest of the FFmpeg test output code for testing so it
   actually properly outputs data.

 - Improve the main video subsystem to be a bit more optimal and
   automatically output I420 or NV12 if needed.

 - Fix audio subsystem insertation and byte calculation.  Now it will
   seamlessly insert new audio data in to the audio stream based upon
   its timestamp value.  (Be extremely cautious when using floating
   point calculations for important things like this, and always round
   your values and check your values)

 - Use 32 byte alignment in case of future optimizations and export a
   function to get the current alignment.

 - Make os_sleepto_ns return true if slept, false if the time has
   already been passed before the call.

 - Fix sinewave output so that it actually properly calculates a middle
   C sinewave.

 - Change the use of row_bytes to linesize (also makes it a bit more
   consistent with FFmpeg's naming as well)
2014-02-09 05:51:06 -07:00
jp9000
3d6d43225f Add planar audio support, improve test output
- Add planar audio support.  FFmpeg and libav use planar audio for many
  encoders, so it was somewhat necessary to add support in libobs
  itself.

- Improve/adjust FFmpeg test output plugin.  The exports were somewhat
  messed up (making me rethink how exports should be done).  Not yet
  functional; it handles video properly, but it still does not handle
  audio properly.

- Improve planar video code.  The planar video code was not properly
  accounting for row sizes for each plane.  Specifying row sizes for
  each plane has now been added.  This will also make it more compatible
  with FFmpeg/libav.

- Fixed a bug where callbacks wouldn't create properly in audio-io and
  video-io code.

- Implement 'blogva' function to allow for va_list usage with libobs
  logging.
2014-02-07 03:03:54 -07:00
jp9000
ab4ab95790 Implement output scaling/conversion/downloading
- Implement texture scaling/conversion/downloading for the main view so
  we can finally start getting data to output.

  Also, redesign how it works a bit, it will now properly wait one full
  frame for each step in the process:  rendering the main texture,
  scaling the main texture to an output texture, staging/downloading the
  ouput texture, and then outputting that staged data.  This way, the
  GPU will have more than enough time to fully complete each step.

- Fix a bug with OpenGL plugin's texture staging function.  Was using
  glBindBuffer instead of what should have been used:  glBindTexture.

- Change the naming scheme of the variables in default.effect.  It's now
  named with the idea of just "color matrix" in mind instead of "yuv
  matrix", and instead of DrawRGBToYUV, it's now just DrawMatrix.
2014-02-05 20:36:21 -07:00
Palana
ac23df500a Remove external ref count visibility
The returned ref count was never used and the returned value doesn't
actually confer any meaning in a multithreaded environment
2014-02-03 02:34:06 +01:00
jp9000
458325fc6f Add property list callbacks
- Add property list callbacks to sources/outputs/encoders so that if
  necessary user interface can be automatically generated or perhaps a
  property list widget can be used for them.

- Change some of the property API names.  obs_property_list_t felt a bit
  awkward when actually using it, so I just renamed it to
  obs_properties_t.

- Removed the getdata/setdata nad getparam/setparam functions from
  sources/services, they will be superseded by the dynamic procedure
  call API.
2014-02-01 22:46:13 -07:00
jp9000
0d17d13116 Implement properties definition interface
Implement a properties definition interface to allow modules to export
general properties associated with objects of libobs.

The properties definition interface allows the option for automatic
settings UI generation (which will make simple plugins easier to develop
without the need for user interface), as well as allow real-time
property editing of values of things like sources/outputs/etc without
having to open property dialogs.  More property types can be added in
the future as needed as well.
2014-02-01 18:01:31 -07:00
jp9000
a12656bd91 Add module UI export capability
Add the ability to be able to call and use toolkit-specific or
program-specific user interface in modules.

User interface code can be either bundled with the module, or 'split'
out in to separate libraries (recommended).

There are three reasons why splitting is recommended:

  1.) It allows plugins to be able to create custom user interface for
      each toolkit if desired.

  2.) Often, UI will be programmed in one language (the language of the
      toolkit), and core logic may be programmed in another.  This
      allows plugins to keep the languages separated if necessary.

  3.) It prevents direct linkage of UI toolkits libraries with core
      module logic.

Splitting is not required, though is recommended if you want your plugin
to be more flexible with other user interface toolkits or programs.

Will implement a generic properties lookup next, which will be used for
automatic UI handling so that plugin UI isn't necessarily required.
2014-02-01 00:49:50 -07:00
jp9000
103ef75310 Improve thread safety for scene items
Scene items previously were removed by calling obs_sceneitem_destroy,
but this proved to be a potential race condition where two different
threads could try to destroy the same scene item at the same time.

Instead of doing that, reference counting is now used on scene items,
and an explicit obs_sceneitem_remove function is used instead for item
removal, which sets a 'removed' variable to ensure it can only be called
exactly one time.
2014-01-30 01:31:52 -07:00
jp9000
3243a9f8c5 Fix the design flaw with obs_sceneitem_destroy
The previous commit used the scene as a  parameter to check to see if
the scene item was still present within the scene before destroying, but
this was actually unnecessary because the fault was because the destroy
signal was being triggered *before* the scene's mutex locked, thus
causing a race condition.  I changed the code so that it signals after
the lock instead of before, so the scene parameter should no longer be
necessary.
2014-01-29 18:27:42 -07:00
Palana
af03444cbe Use recursive mutex for scene mutex
Fixes a deadlock when trying to remove a source from the GUI. The scene
item signal handlers would mark the source as removed which results in
the video thread also trying to run obs_sceneitem_destroy thereby
deadlocking the video thread (and the GUI thread)
2014-01-29 22:46:39 +01:00
jp9000
6c44291693 Implement settings interface for plugins
Add a fairly easy to use settings interface that can be passed to
plugins, and replaced the old character string system that was being
used before.  The new data interface allows for an easier method of
getting/altering settings for plugins, and is built to be serializable
to/from JSON.

Also, removed another wxFormBuilder file that was no longer in use.
2014-01-27 23:14:58 -07:00
jp9000
fc8851e9f4 Add preliminary ffmpeg plugin (still testing)
- Added some code for FFmpeg output that I'm still playing around with.
  Right now I'm just trying to get it to output to file and try to
  understand the FFmpeg/libav APIs.  Hopefully in the future this plugin
  can be used for any sort of output to FFmpeg.

- Fixed a cast warning in audio-io.c with size_t -> uint32_t

- Renamed the 'video_info' and 'audio_info' structures to
  'video_conver_info' and 'audio_convert_info' to better represent their
  actual purpose, and to avoid confusion with 'audio_output_info' and
  'video_output_info' structures.

- Removed a few macros from obs-def.h that were at one point going to be
  used but no longer going to be used (at least for now)
2014-01-19 03:16:41 -07:00
jp9000
8d63845dd4 Use macros to improve safety loading callbacks
Just a minor fix mostly because I noticed that I kept accidentally
forgetting to add checks to the code properly.  This is one of those
cases where macros come in useful, as macros can automate the process
and help prevent these mistakes from happening by accident.
2014-01-17 06:24:34 -07:00
jp9000
ff1afac5f8 Updated comments for outputs/encoders
Changed the comments to properly reflect the new callbacks, as I had
forgotten to update the comments for them both.

Also, changed "setbitrate" and "request_keyframe" return values to be
boolean.
2014-01-17 00:00:21 -07:00
jp9000
29b7d3621c Add preliminary output/encoder interface
- First, I redid the output interface for libobs.  I feel like it's
  going in a pretty good direction in terms of design.

  Right now, the design is so that outputs and encoders are separate.
  One or more outputs can connect to a specific encoder to receive its
  data, or the output can connect directly to raw data from libobs
  output itself, if the output doesn't want to use a designated encoder.
  Data is received via callbacks set when you connect to the encoder or
  raw output.  Multiple outputs can receive the data from a single
  encoder context if need be (such as for streaming to multiple channels
  at once, and/or recording with the same data).

  When an encoder is first connected to, it will connect to raw output,
  and start encoding.  Additional connections will receive that same
  data being encoded as well after that.  When the last encoder has
  disconnected, it will stop encoding.  If for some reason the encoder
  needs to stop, it will use the callback with NULL to signal that
  encoding has stopped.  Some of these things may be subject to change
  in the future, though it feels pretty good with this design so far.
  Will have to see how well it works out in practice versus theory.

- Second, Started adding preliminary RTMP/x264 output plugin code.

  To speed things up, I might just make a direct raw->FFmpeg output to
  create a quick output plugin that we can start using for testing all
  the subsystems.
2014-01-16 22:34:51 -07:00
jp9000
62c2b1d74e Simplify media i/o interfaces
Completely revamped the entire media i/o data and handlers.  The
original idea was to have a system that would have connecting media
inputs and outputs, but at a certain point I realized that this was an
unnecessary complexity for what we wanted to do.  (Also, it reminded me
of directshow filters, and I HATE directshow with a passion, and
wouldn't wish it upon my greatest enemy)

Now, audio/video outputs are connected to directly, with better callback
handlers, and will eventually have the ability to automatically handle
conversions such as 4:4:4 to 4:2:0 when connecting to an input that uses
them.  Doing this will allow the video/audio i/o handlers to also
prevent duplicate conversion, as well as make it easier/simple to use.

My true goal for this is to make output and encoder plugins as simple to
create as possible.  I want to be able to be able to create an output
plugin with almost no real hassle of having to worry about image
conversions, media inputs/outputs, etc.  A plugin developer shouldn't
have to handle that sort of stuff when he/she doesn't really need to.

Plugins will be able to simply create a callback via obs_video() and/or
obs_audio(), and they will automatically receive the audio/video data in
the formats requested via a simple callback, without needing to do
almost anything else at all.
2014-01-14 01:58:47 -07:00
jp9000
3838abe1f4 Implement volumes for sources
- Added a volume variable to the obs_source structure and implemented
   functions for manipulating source volume.

 - Added a volume variable to the audio_data structure so that the
   volume will be applied when mixing.
2014-01-07 11:03:15 -07:00
jp9000
a2a8a5f148 Added add/remove signals to scenes
Scenes will now signal via their source when an item has been added
or removed from them.

  "add" - Item added to the scene.
  Parameters:  "scene": Scene that the item was added to.
               "item":  Item that was added.

  "remove" - Item removed from the scene.
  Parameters:  "scene": Scene that the item was removed from.
               "item":  Item that was removed.
2014-01-04 13:47:48 -07:00
jp9000
966c091078 make scene items use linked list rather than array (containers are a bad habit), add a few functions for getting scene item information, also use a mutex to prevent race conditions when using the linked list 2014-01-01 10:22:55 -07:00
jp9000
72633e40a3 also include bmem.h in the header, minor oversight 2013-12-30 10:14:28 -07:00
jp9000
c129cc37cb update API and implement preliminary ability to add sources to scenes 2013-12-30 06:56:39 -07:00
jp9000
c4af3e2a75 change obs_scene_destroy to obs_scene_release, add ability to add scenes, fix name dialog sizing 2013-12-29 08:54:06 -07:00
jp9000
cec94b042e implement scene adding callbacks, make a few API tweaks 2013-12-28 05:33:16 -07:00
jp9000
6edcd456fe implement signal/procedure handling into libobs and individual sources 2013-12-26 23:10:15 -07:00
Palana
d97250933b fix prototype 2013-12-24 17:06:57 +01:00
jp9000
922eb7b8e8 make direct filter rendering optional (can be useful for certain cases) 2013-12-22 02:03:40 -07:00
jp9000
19c4ee995e add major optimization to filter processing, and as a nice side effect, make it easier to create new filters and sources 2013-12-22 01:30:18 -07:00
jp9000
9218627892 add obs_source functions to allow name manipulation and lookup based upon name, and a few other functions related to getting/setting source information 2013-12-20 19:35:12 -07:00
jp9000
95a7da2d4c add names to sources, use 'id' for the internal source identifier names rather than 'name' 2013-12-20 17:23:19 -07:00
jp9000
6d5ef2fb62 fixed some warnings (when on earth did I do a bad find/replace on these functions?) 2013-12-17 22:30:22 -07:00
Palana
42375302d7 fixed typo 2013-12-16 01:59:07 +01:00
jp9000
ff47b3a2dc added functions to get current audio/video output information 2013-12-06 06:38:19 -07:00
jp9000
8298fa4dc7 With the permission of my fellow contributors, I'm switching obs-studio back to GPL v2+ to prevent issues between this project and the original OBS project, and for personal reasons to avoid legal ambiguity (not political reasons, I admittedly would prefer GPL v3+) 2013-12-02 22:24:38 -07:00
jp9000
74dc470681 made it so that graphics device and associated objects are not lost every time video settings are changed 2013-11-26 22:20:11 -07:00
jp9000
93dd3cec50 made the getframe function a bit more safe and modified a few names for clarity 2013-11-22 16:18:31 -07:00
jp9000
71890e0365 removed now-redundant callback enum_children from sources 2013-11-20 21:52:20 -07:00
jp9000
f1decd08f4 adjusted the way source removal is handled to make it a bit more safe 2013-11-20 18:36:46 -07:00
jp9000
409b011a8e cleaned up main internal data structure design, changed to reference counting for sources to ensure safe destruction of source objects from all parts of the system, added some service-related stuff for testing 2013-11-20 15:00:16 -07:00
jp9000
146e9a7dbd added support for jansson, added new output files, made some adjustments to the API, fixed a UI subclass issue 2013-11-13 06:24:20 -07:00
jp9000
8847d11e8e adjust file locations to be more portable 2013-11-01 14:33:00 -07:00
jp9000
a6a6118c04 finish up most of the source audio stuff and rename some variables/structs/enum to be a bit more consistent 2013-10-31 10:28:47 -07:00
jp9000
60e6ddbf71 add audio resampling, add ffmpeg support 2013-10-30 17:07:01 -07:00
jp9000
7dada3bef4 fill out the rest of the source video frame functions, added nv12 decompression function, and cleaned up the design of the source video frame stuff 2013-10-26 14:32:06 -07:00
jp9000
a43e291577 fill in the texture_setimage function, fill in a few other functions, and change certain names to be a little more consistent 2013-10-25 10:25:28 -07:00
jp9000
8421690c33 made some slight corrections 2013-10-24 01:03:45 -07:00
jp9000
ac2c08927f added intial async audio/video code, fixed a few bugs, improved thread safety, and made a few other minor adjustments 2013-10-24 00:57:55 -07:00
jp9000
18834c6a45 some static analysis cleanup 2013-10-17 17:21:42 -07:00
jp9000
0dfc844abc woops, left some spaces by accident 2013-10-14 12:42:45 -07:00
jp9000
9570f0b8d7 change names, fix some bugs, minor GL/D3D fixes, update tests, fix effect files, output a little more debug information 2013-10-14 12:37:52 -07:00
Peter SZTANOJEV
0301b24ace modernize header guards to #pragma once 2013-10-14 13:21:15 +02:00
jp9000
f255ae1922 first commit 2013-09-30 19:37:13 -07:00