Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with obs_frontend_add_dock is deprecated error #186

Closed
swapdisk opened this issue Feb 20, 2024 · 0 comments · Fixed by GeNTooGeek/obs-ptz#1
Closed

Build fails with obs_frontend_add_dock is deprecated error #186

swapdisk opened this issue Feb 20, 2024 · 0 comments · Fixed by GeNTooGeek/obs-ptz#1

Comments

@swapdisk
Copy link

I'm seeing the error below trying to build the obs-ptz plugin with OBS Studio v30.0 on Linux. Seems to be caused by an API change with the latest release. See obsproject/obs-studio#7637.

$ make
[  3%] Automatic MOC and UIC for target obs-ptz
[  3%] Built target obs-ptz_autogen
[  7%] Building CXX object CMakeFiles/obs-ptz.dir/src/ptz-controls.cpp.o
/home/bmader/swapdisk/obs-ptz/src/ptz-controls.cpp: In function ‘void ptz_load_controls()’:
/home/bmader/swapdisk/obs-ptz/src/ptz-controls.cpp:33:30: error: ‘void* obs_frontend_add_dock(void*)’ is deprecated [-Werror=deprecated-declarations]
   33 |         obs_frontend_add_dock(tmp);
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /home/bmader/swapdisk/obs-ptz/src/ptz-device.hpp:17,
                 from /home/bmader/swapdisk/obs-ptz/src/ptz-controls.hpp:15,
                 from /home/bmader/swapdisk/obs-ptz/src/ptz-controls.cpp:23:
/usr/include/obs/obs-frontend-api.h:142:14: note: declared here
  142 | EXPORT void *obs_frontend_add_dock(void *dock);
      |              ^~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/obs-ptz.dir/build.make:128: CMakeFiles/obs-ptz.dir/src/ptz-controls.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:84: CMakeFiles/obs-ptz.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
@glikely glikely closed this as completed in 45bbfbf Mar 1, 2024
glikely added a commit that referenced this issue Mar 1, 2024
OBS Studio 30.0.0 deprecated the obs_frontend_add_dock() function and
advised plugins to use obs_frontend_add_dock_by_id() instead. However,
the new API takes the contents of the dock widget as an argument instead
of the dock widget itself, which requires rework of the widget
structure.

This commit removes the QDockWidget instance from the .ui file and
changes the PTZControls class to inheret from QWidget instead of
QDockWidget. It then reworks the instantiation to use the new API when
building against obs-studio 30.0.0 or higher. When building against
older versions it will create the needed QDockWidget before calling the
old API.

Fixes: #186
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant