README 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. What is OBS?
  2. This project is a rewrite of what was formerly known as "Open Broadcaster
  3. Software", software originally designed for recording and streaming live
  4. video content, efficiently.
  5. Bug Tracker: https://obsproject.com/mantis/
  6. We are no longer using GitHub issues! Please use Mantis, and only report
  7. bugs and major issues. Do NOT use mantis to ask questions or request
  8. features, please keep that to the forums.
  9. Forum accounts are now linked to Mantis Bug Tracker. To use the bug
  10. tracker, simply log in to the forums and then go to the bug tracker link
  11. above.
  12. What's the goal of rewriting OBS?
  13. - Make it multiplatform. Use multiplatform libraries/functions/classes where
  14. possible to allow this. Multi-platform support was one of the primary
  15. reasons for the rewrite. This also means using a UI toolkit will be
  16. necessary for user interface. It also means allowing the use of OpenGL as
  17. well as Direct3D.
  18. - Separate the application from the core, allowing custom application of
  19. the core if desired, and easier extending of the user interface.
  20. - Simplify complex systems to not only make it easier to use, but easier to
  21. maintain.
  22. - Write a better core API, and design the entire system to be modular.
  23. - Now that we have much more experience, improve the overall design of all
  24. the subsystems/API, and minimize/eliminate design flaws. Make it so we can
  25. do all the things we've had trouble with before, such as custom outputs,
  26. multiple outputs at once, better handling of inputs, custom services.
  27. - Make a better/cleaner code base, use better coding standards, use standard
  28. libraries where possible (not just STL and C standard library, but also
  29. things like ffmpeg as well), and improve maintainability of the project as a
  30. whole.
  31. - Implement a new API-independent shader/effect system allowing better and
  32. easier shaders usage and customization without having to duplicate shader
  33. code.
  34. - Better device support. Again, I didn't know what I was getting into when
  35. I originally started writing code for devices. It evolved into a totally
  36. convoluted mess. I would have improved the existing device plugin code, but
  37. it was just all so fundamentally bad and flawed that it would have been
  38. detrimental to progression to continue working on it rather than rewrite it.
  39. What was wrong with the original OBS?
  40. The original OBS was rewritten not because it was bad, at least in terms of
  41. optimization. Optimization and graphics are things I love. However, there
  42. were some serious problems with the code and design that were deep and
  43. fundamental, which prevented myself and other developers from being able to
  44. improve/extend the application or add new features very easily.
  45. First, the design flaws:
  46. - The original OBS was completely and hopelessly hard-coded for windows,
  47. and only windows. It was just totally impossible to use it on other
  48. systems.
  49. - All the sub-systems were written before I really knew what I was getting
  50. into. When I started the project, I didn't really fully comprehend the
  51. scope of what I would need or how to properly design the project. My
  52. design and plans for the application were just to write something that
  53. would "stream games and a webcam, with things like overlays and such."
  54. This turned out fine for most casual gamers and streamers (and very
  55. successful), but left anyone wanting to do anything more advanced left
  56. massively wanting.
  57. - Subsystems and core functionalities intermingled in such a way that it
  58. was a nightmare to get proper custom functionality out of it. Things
  59. like QSV had to be meshed in with the main encoding loop, and it just
  60. made things a nightmare to deal with. Custom outputs were nigh
  61. impossible.
  62. - The API was poorly designed because most of it came after I originally
  63. wrote the application, it was more of an afterthought, and plugin API
  64. would routinely break for plugin developers due to changing C++
  65. interfaces (one of the reasons the core is now C).
  66. - API was intermeshed with the main executable. The OBSApi DLL was
  67. nothing more than basically this mutant growth upon OBS.exe that allowed
  68. plugin developers to barely write plugins, but all the important API
  69. code was actually stored in the executable. Navigation was a total mess.
  70. - The graphics subsystem, while not bad, was incomplete, and though far
  71. easier to use than bare D3D, wasn't ideal, and was hard-coded for D3D
  72. specifically.
  73. - The devices and audio code was poor, I had no idea what I was getting into
  74. when I started writing them in. I did not realize beforehand all the
  75. device-specific quirks that each device/system could have. Some devices
  76. had bad timing and quirks that I never aniticipated while writing them.
  77. I struggled with devices, and my original design for the audio subsystem
  78. for example morphed over and over into an abomination that, though works,
  79. is basically this giant duct-taped zombie monster.
  80. - Shaders were difficult to customize because they had to be duplicated if
  81. you wanted slightly different functionality that required more than just
  82. changing shader constants.
  83. - Orientation of sources was fixed, and required special code for each
  84. source to do any custom modification of rotation/position/scale/etc.
  85. This is one of those fundamental flaws that I look back on and regret, as
  86. it was a stupid idea from the beginning. I originally thought I could
  87. get more accurate source position/sizes, but it just turned out to be
  88. totally bad. Should have been matrices from the beginning just like with
  89. a regular 3D engine.
  90. Second, the coding flaws:
  91. - The coding style was inconsistent.
  92. - C++98, C-Style C++, there was no exception usage, no STL. C++ used
  93. poorly.
  94. - Not Invented Here Syndrome everywhere. Custom string functions/classes,
  95. custom templates, custom everything everywhere. To be fair, it was all
  96. hand-me-down code from the early 2000s that I had become used to, but
  97. that was no excuse -- C-standard libraries and the STL should have been
  98. used from the beginning over anything else. That doesn't mean to say
  99. that using custom stuff is always bad, but doing it to the extent I did
  100. definitely was. Made it horrible to maintain as well, required extra
  101. knowledge for plugin developers and anyone messing with the code.
  102. - Giant monolithic classes everywhere, the main OBS class was paricularly
  103. bad in this regard. This meant navigation was a nightmare, and no one
  104. really knew where to go or where to add/change things.
  105. - Giant monolithic functions everywhere. This was particularly bad
  106. because it meant that functions became harder to debug and harder to
  107. keep track of what was going on in any particular function at any given
  108. time. These large functions, though not inefficient, were delicate and
  109. easily breakable. (See OBS::MainCaptureLoop for a nightmarish example,
  110. or the listbox subclass window procedure in WindowStuff.cpp)
  111. - Very large file sizes with everything clumped up into single files (for
  112. another particularly nightmarish example, see WindowStuff.cpp)
  113. - Bad formatting. Code could go beyond 200 columns in some cases, making
  114. it very unpleasant to read with many editors. Spaces instead of tabs,
  115. K&R mixed with allman (which was admittedly my fault).
  116. New (actual) coding guidelines
  117. - For the C code (especially in the core), guidelines are pretty strict K&R,
  118. kernel style. See the linux kernel "CodingStyle" document for more
  119. information. That particular coding style guideline is for more than just
  120. style, it actually helps produce a better overall code base.
  121. - For C++ code, I still use CamelCase instead of all_lowercase just because
  122. I prefer it that way, it feels right with C++ for some reason. It also
  123. helps make it distinguishable from C code.
  124. - I've started using 8-column tabs for almost everything -- I really
  125. personally like it over 4-column tabs. I feel that 8-column tabs are very
  126. helpful in preventing large amounts of indentation. A self-imposed
  127. limitation, if you will. I also use actual tabs now, instead of spaces.
  128. Also, I feel that the K&R style looks much better/cleaner when viewed with
  129. 8-column tabs.
  130. - Preferred maximum columns: 80. I've also been doing this because in
  131. combination with 8-column tabs, it further prevents large/bad functions
  132. with high indentation. Another self-imposed limitation. Also, it makes
  133. for much cleaner viewing in certain editors that wrap (like vim).