Commit graph

24 commits

Author SHA1 Message Date
Lain 106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
PatTheMav 2bb0818fb4 libobs: Use system header notation for pthread.h include
Using a relative path for the pthread.h header by w32-pthreads breaks
compilation of plugins which include threading.h from libobs (as
w32-pthreads will exist at a different location relative to the
libobs header).

As w32-pthreads (and its include directory) is added to the libobs
target by CMake, the pthread.h header will be found even when using
system header notation.

Fixes https://github.com/obsproject/obs-studio/issues/7155
2022-08-24 05:40:37 -07:00
jpark37 b9657f6239 libobs/util: pthread_mutex_init_recursive helper
Add helper for creating a recursive mutex because it's easy to forget to
destroy the pthread_mutexattr_t.
2021-08-23 22:09:08 -07:00
jp9000 f53df7da64 clang-format: Apply formatting
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed.  Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
2019-06-23 23:49:10 -07:00
jp9000 b56c33a260 libobs/util: Add THREAD_LOCAL macro
Adds a thread local storage macro to declare thread local storage
independent of platform.
2018-01-03 17:04:02 -08:00
jp9000 38f368aa80 libobs/util: Make all atomic funcs inline and use intrinsics
Needless function calls here for what should be intrinsic calls
2016-01-23 07:17:44 -08:00
jp9000 4543cd168d libobs/util: Add long load/store atomic funcs 2015-12-28 05:49:55 -08:00
jp9000 598ae383bc libobs/util: Add atomic bool load functions 2015-11-18 12:42:14 -08:00
jp9000 a914bb24fa libobs/util: Add atomic functions for bool values 2015-11-03 15:03:39 -08:00
Palana a907d74903 util: Add os_atomic_compare_swap_long 2015-05-07 01:57:14 +02:00
jp9000 144fb925ff libobs: Add ability to set thread names 2015-01-03 02:37:20 -08: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
jp9000 81153cb16d Fix code that breaks with VC (terrible compiler)
VC2013 still does not properly support placement of variables anywhere
in the scope.  It's a garbage compiler, always will be a garbage
compiler.
2014-04-14 14:21:32 -07:00
Palana 3990c18aac Add NULL checks and assertions to fix clang static analysis problems
Also remove an unused variable from obs-encoder.c (via clang static
analysis)
2014-04-14 23:02:53 +02:00
jp9000 154e0c59e1 Use atomic functions where appropriate
Also, rename atomic functions to be consistent with the rest of the
platform/threading functions, and move atomic functions to threading*
files rather than platform* files
2014-03-16 18:26:46 -07:00
jp9000 585fd8f969 Fix audio streaming and mac semaphores
...The reason why audio didn't work was because I overwrote the bitrate
values.

As for semaphores, mac doesn't support unnamed semaphores without using
mach semaphores.  So, I just implemented a semaphore wrapper for each
OS.
2014-03-10 19:04:00 -07:00
jp9000 33dc028c7e Add mac audio capture
- Add CoreAudio device input capture for mac audio capturing.  The code
   should cover just about everything for capturing mac input device
   audio.  Because of the way mac audio is designed, users may have no
   choice but to obtain the open source soundflower software to capture
   their mac's desktop audio.  It may be necessary for us to distribute
   it with the program as well.

 - Hide event backend

 - Use win32 events for windows

 - Allow timed waits for events

 - Fix a few warnings
2014-02-26 22:43:31 -08:00
jp9000 f827ba38ef Added a sinewave audio test source
- Added a test audio sinewave test source that should just play a sine
   wave of the middle C note.  Using unsigned 8 bit mono to test
   ffmpeg's audio resampler, seems to work pretty good.

 - Fixed a boolean trap in threading.h for the event_init function, it
   now uses enum event_type, which can be EVENT_TYPE_MANUAL or
   EVENT_TYPE_AUTO, to specify whether the event is automatically reset
   or not.

 - Changed display names of test sources to something a little less
   vague.

 - Removed te whole "if timestamp is 0 just use current system time"
   when outputting source audio, if you want to use system time you
   should just use system time yourself.  Using 0 as some sort of
   "indicator" like that just makes things confusing, and prevents you
   from legitimately using 0 as a timestamp for your audio data.
2014-01-09 22:10:04 -07:00
Palana 7fa7af6c03 check for signalled event before pthread_cond_wait-ing
fixes a deadlock in obs_free_video/obs_video_thread where
video_output_stop would signal the update event before obs_video_thread
enters video_output_wait (the thread calling obs_free_video would
block on pthread_join and obs_video_thread would block on
pthread_cond_wait)
2014-01-06 02:04:32 +01:00
jp9000 e9ded173f1 add my signal/callback interface from another project, also update license of utility files to ISC 1.3 2013-12-25 22:40:33 -07:00
jp9000 93905e516b modify w32-pthreads location in source/project files 2013-10-28 06:29:12 -07:00
jp9000 ae3cecf09f make data access in the threads a bit more safe (note: probably will need some more safety measures later on) 2013-10-18 20:25:13 -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