OBS Studio - Free and open source software for live streaming and screen recording
Go to file
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
additional_install_files Improve additional_install_files for debug/release 2014-07-18 22:41:11 -07:00
cmake Merge pull request #217 from BtbN/cmake_changes 2014-07-29 11:40:49 -07:00
config update build system to autotools (finally) 2013-10-29 23:21:40 -07:00
deps Fix Jansson dependency importing 2014-07-17 18:13:25 +02:00
libobs (API Change) Improve graphics API consistency 2014-08-09 11:57:38 -07:00
libobs-d3d9 Full rewrite of all CMakeLists 2014-01-24 18:56:32 +01:00
libobs-d3d11 (API Change) Improve graphics API consistency 2014-08-09 11:57:38 -07:00
libobs-opengl (API Change) Improve graphics API consistency 2014-08-09 11:57:38 -07:00
obs (API Change) Improve graphics API consistency 2014-08-09 11:57:38 -07:00
plugins (API Change) Improve graphics API consistency 2014-08-09 11:57:38 -07:00
test (API Change) Improve graphics API consistency 2014-08-09 11:57:38 -07:00
.gitattributes Fix ffmpeg/x264 find modules according to cmake find module naming conventions 2014-05-22 13:03:47 +02:00
.gitignore Remove/fix some files in .gitignore 2014-07-18 23:19:05 -07:00
.gitmodules win-dshow: Add submodule 'libdshowcapture' 2014-05-30 03:17:25 -07:00
CMakeLists.txt Allow copying of all dependencies (windows only) 2014-07-18 22:41:22 -07:00
CONTRIBUTING Fix a few typos 2014-05-03 23:06:20 -07:00
COPYING 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
INSTALL Update INSTALL instructions for windows/mac 2014-07-18 23:19:06 -07:00
README 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

What is OBS?

  This project is a rewrite of what was formerly known as "Open Broadcaster
  Software", software originally designed for recording and streaming live
  video content, efficiently.


What's the goal of rewriting OBS?

 - Make it multiplatform.  Use multiplatform libraries/functions/classes where
   possible to allow this.  Multi-platform support was one of the primary
   reasons for the rewrite.  This also means using a UI toolkit will be
   necessary for user interface.  It also means allowing the use of OpenGL as
   well as Direct3D.

 - Separate the application from the core, allowing custom application of
   the core if desired, and easier extending of the user interface.

 - Simplify complex systems to not only make it easier to use, but easier to
   maintain.

 - Write a better core API, and design the entire system to be modular.

 - Now that we have much more experience, improve the overall design of all
   the subsystems/API, and minimize/eliminate design flaws.  Make it so we can
   do all the things we've had trouble with before, such as custom outputs,
   multiple outputs at once, better handling of inputs, custom services.

 - Make a better/cleaner code base, use better coding standards, use standard
   libraries where possible (not just STL and C standard library, but also
   things like ffmpeg as well), and improve maintainability of the project as a
   whole.

 - Implement a new API-independent shader/effect system allowing better and
   easier shaders usage and customization without having to duplicate shader
   code.

 - Better device support.  Again, I didn't know what I was getting into when
   I originally started writing code for devices.  It evolved into a totally
   convoluted mess.  I would have improved the existing device plugin code, but
   it was just all so fundamentally bad and flawed that it would have been
   detrimental to progression to continue working on it rather than rewrite it.


What was wrong with the original OBS?

  The original OBS was rewritten not because it was bad, at least in terms of
  optimization.  Optimization and graphics are things I love.  However, there
  were some serious problems with the code and design that were deep and
  fundamental, which prevented myself and other developers from being able to
  improve/extend the application or add new features very easily.

  First, the design flaws:

    - The original OBS was completely and hopelessly hard-coded for windows,
      and only windows.  It was just totally impossible to use it on other
      systems.

    - All the sub-systems were written before I really knew what I was getting
      into.  When I started the project, I didn't really fully comprehend the
      scope of what I would need or how to properly design the project.  My
      design and plans for the application were just to write something that
      would "stream games and a webcam, with things like overlays and such."
      This turned out fine for most casual gamers and streamers (and very
      successful), but left anyone wanting to do anything more advanced left
      massively wanting.

    - Subsystems and core functionalities intermingled in such a way that it
      was a nightmare to get proper custom functionality out of it.  Things
      like QSV had to be meshed in with the main encoding loop, and it just
      made things a nightmare to deal with.  Custom outputs were nigh
      impossible.

    - The API was poorly designed because most of it came after I originally
      wrote the application, it was more of an afterthought, and plugin API
      would routinely break for plugin developers due to changing C++
      interfaces (one of the reasons the core is now C).

    - API was intermeshed with the main executable.  The OBSApi DLL was
      nothing more than basically this mutant growth upon OBS.exe that allowed
      plugin developers to barely write plugins, but all the important API
      code was actually stored in the executable.  Navigation was a total mess.

    - The graphics subsystem, while not bad, was incomplete, and though far
      easier to use than bare D3D, wasn't ideal, and was hard-coded for D3D
      specifically.

    - The devices and audio code was poor, I had no idea what I was getting into
      when I started writing them in.  I did not realize beforehand all the
      device-specific quirks that each device/system could have.  Some devices
      had bad timing and quirks that I never aniticipated while writing them.
      I struggled with devices, and my original design for the audio subsystem
      for example morphed over and over into an abomination that, though works,
      is basically this giant duct-taped zombie monster.

    - Shaders were difficult to customize because they had to be duplicated if
      you wanted slightly different functionality that required more than just
      changing shader constants.

    - Oriantation of sources was fixed, and required special code for each
      source to do any custom modification of rotation/position/scale/etc.
      This is one of those fundamental flaws that I look back on and regret, as
      it was a stupid idea from the beginning.  I originally thought I could
      get more accurate source position/sizes, but it just turned out to be
      totally bad.  Should have been matrices from the beginning just like with
      a regular 3D engine.

  Second, the coding flaws:

    - The coding style was inconsistent.

    - C++98, C-Style C++, there was no exception usage, no STL.  C++ used
      poorly.

    - Not Invented Here Syndrome everywhere.  Custom string functions/classes,
      custom templates, custom everything everywhere.  To be fair, it was all
      hand-me-down code from the early 2000s that I had become used to, but
      that was no excuse -- C-standard libraries and the STL should have been
      used from the beginning over anything else.  That doesn't mean to say
      that using custom stuff is always bad, but doing it to the extent I did
      definitely was.  Made it horrible to maintain as well, required extra
      knowledge for plugin developers and anyone messing with the code.

    - Giant monolithic classes everywhere, the main OBS class was paricularly
      bad in this regard.  This meant navigation was a nightmare, and no one
      really knew where to go or where to add/change things.

    - Giant monolithic functions everywhere.  This was particularly bad
      because it meant that functions became harder to debug and harder to
      keep track of what was going on in any particular function at any given
      time.  These large functions, though not inefficient, were delicate and
      easily breakable.  (See OBS::MainCaptureLoop for a nightmarish example,
      or the listbox subclass window procedure in WindowStuff.cpp)

    - Very large file sizes with everything clumped up into single files (for
      another particularly nightmarish example, see WindowStuff.cpp)

    - Bad formatting.  Code could go beyond 200 columns in some cases, making
      it very unpleasant to read with many editors.  Spaces instead of tabs,
      K&R mixed with allman (which was admittedly my fault).


New (actual) coding guidelines

 - For the C code (especially in the core), guidelines are pretty strict K&R,
   kernel style.  See the linux kernel "CodingStyle" document for more
   information.  That particular coding style guideline is for more than just
   style, it actually helps produce a better overall code base.

 - For C++ code, I still use CamelCase instead of all_lowercase just because
   I prefer it that way, it feels right with C++ for some reason.  It also
   helps make it distinguishable from C code.

 - I've started using 8-column tabs for almost everything -- I really
   personally like it over 4-column tabs.  I feel that 8-column tabs are very
   helpful in preventing large amounts of indentation.  A self-imposed
   limitation, if you will.  I also use actual tabs now, instead of spaces.
   Also, I feel that the K&R style looks much better/cleaner when viewed with
   8-column tabs.

 - Preferred maximum columns: 80.  I've also been doing this because in
   combination with 8-column tabs, it further prevents large/bad functions
   with high indentation.  Another self-imposed limitation.  Also, it makes
   for much cleaner viewing in certain editors that wrap (like vim).