Fixes a minor bug introduced by the windowless graphics context merge.
When setting a new base resolution, it would not recalculate the preview
size, and the preview would display the wrong size until the main window
was resized by the user. This patch makes it so that it calls the
recalculation function when the base resolution is changed to prevent
that from happening.
API Changed (obs.h):
-----------------------------------------
- Removed member variables from struct obs_video_info:
- window_width
- window_height
- window
- Removed functions:
- obs_add_draw_callback
- obs_remove_draw_callback
- obs_resize
- obs_preview_set_enabled
- obs_preview_enabled
API Changed (graphics/graphics.h)
-----------------------------------------
- Changed third parameter of gs_create from
const struct gs_init_data *data
to
uint32_t adapter
Summary
-----------------------------------------
Changing to a windowless context allows the ability to use libobs
without needing to have it depend on an open window/view, and removes
superfluous functionality that's already provided by the obs_display
functions.
Biggest benefits of windowless context:
- Make it so all window/view related code uses obs_display (which is a
major refactor/prune)
- Allows core functions to not have to be dependent upon an existing
window/view
- Allow the ability to make a fully CLI front end that doesn't depend on
a window
- Allows the ability to a hypothetical CLI from a remote
Because of the API changes, multiple modules are affected by this commit
to prevent creating broken commits: libobs, libobs-opengl, libobs-d3d11,
and the UI.
In the libobs back-end, all preview/window API functions that are not
related to obs_display have been removed, and to draw on a window/view
you must now always create an obs_display (rather than having "main"
display functions and then "secondary" display functions that use
obs_display).
For the technicalities of the graphics back-end, the gs_init function
now only takes in an adapter parameter instead of window/format/etc
information. To draw on a window/view you must now always create a swap
chain for it (note that obs_display wraps this functionality).
As for the UI, the UI has been refactored so that all dialogs/windows
that have a preview do not have to manually create OBSDisplay objects;
the OBSQTDisplay class now automatically handles all the code related to
displays. The main window preview now also relies on that same
functionality/code.
Now that we aren't dependent upon a window for our context, we can
safely move the obs context creation/destruction to obs-app.cpp, and use
the OBSContext helper class to automatically shut down obs.
(Non-compiling commit: windowless-context branch)
In the land of X11, life is suffering.
Suffering aside, X11 is capable of a hardware-accelerated windowless
context by using a GLXPbuffer in conjunction with glXMakeContextCurrent.
(Non-compiling commit: windowless-context branch)
On windows, you can just create a hidden window as the "main" opengl
window to get the equivalent of a windowless context. You might be able
to do it without a window, but honestly it's more trouble than it's
worth.
(Non-compiling commit: windowless-context branch)
On cocoa, windowless contexts appear to be no problem. You just don't
set a view or just clear the view.
(Non-compiling commit: windowless-context branch)
Now that all obs_display related code has been moved to OBSQTDisplay,
we can prune a whole bunch of boilerplate code that had to be repeated
for the displays of each window.
Affects:
- Properties
- Filters
- Interact
- Projector
(Non-compiling commit: windowless-context branch)
Gets rid of all functions/data related to setting up the main preview to
be associated with obs_reset_video and instead uses OBSQTDisplay for the
main window display (thus associating it with an obs_display object).
(Non-compiling commit: windowless-context branch)
This makes it so that OBSQTDisplay now uses/controls an obs_display
object directly (rather than having the owner have to associate an
OBSDisplay with it). It was separated before because the main window
for the basic UI would was using the "main preview" stuff before the
windowless context and had to be handled differently, so you couldn't
just associate an obs_display object with OBSQTDisplay, meaning that all
"secondary" previews such as properties/filters/etc had to handle the
obs_display alone, which caused a lot of needlessly duplicated code.
Also adds a DisplayCreated signal to allow owners to be able to add
callbacks and such on creation of the actual obs_display context.
(Non-compiling commit: windowless-context branch)
API Changed:
---------------------
Removed functions:
- obs_add_draw_callback
- obs_remove_draw_callback
- obs_resize
- obs_preview_set_enabled
- obs_preview_enabled
Removed member variables from struct obs_video_info:
- window_width
- window_height
- window
Summary:
---------------------
Changes the core libobs API to not be dependent upon a main window/view.
If you wish to draw to a window/view, use an obs_display object to
handle it.
This allows the use of libobs without requiring a window to be present
on the system. This is also prunes code that had to be needlessly
duplicated to handle the "main" window.
(Non-compiling commit: windowless-context branch)
Changes API from:
---------------------
EXPORT int gs_create(graphics_t **graphics, const char *module,
const struct gs_init_data *data);
To:
---------------------
EXPORT int gs_create(graphics_t **graphics, const char *module,
uint32_t adapter);
Summary:
---------------------
Changes the gs_create function to use an adapter parameter instead of
requiring a gs_init_data with window/color/etc information.
Intentionally breaks compilation when trying to compile the specific
merged commits within the windowless-context branch. This is meant to
be used in conjunction with a merge commit so that bisecting will never
see any non-compiling commits.
If the first guessed pts is less than the start_pts, it could
lead to a negative PTS being returned.
Change the behavior so that the first frame's pts, if zero, is
set to the start_pts. If more than one frame is less than the
start_pts, the start_pts is determined invalid and set to 0.
Valid start_pts example:
start_pts = 500
first frame (pts = 0)
pts = 500 (< start_pts)
pts -= 500 (offset by start_pts)
ret 0
second frame (pts = 700)
pts = 700 (no change, > start_pts)
pts -= 500 (offset by start_pts)
ret 200
Invalid start_pts example:
start_pts = 500
first frame (pts = 0)
pts = 500 (< start_pts)
pts -= 500 (offset by start_pts)
ret 0
second frame (pts = 300)
pts = 300 (< start_pts, start_pts set to 0)
pts -= 0 (start_pts is now 0)
ret 300
Microsoft basically deprecated GetVersion/GetVersionEx, so now you have
to query the file version of kernel32.dll in order to get the actual
windows version. Because of the steps involved in getting the windows
version are fairly complicated, this is an exported libobs helper
function that can be used to get the windows version if needed.
(Microsoft does have its own set of helper functions for this but the
API feels a bit.. awkward, and you can't actually get the real windows
version with them)