Commit Graph

197 Commits (1effaca2261615fc607814ab4189ff1f20ad714f)

Author SHA1 Message Date
jp9000 144fb925ff libobs: Add ability to set thread names 2015-01-03 02:37:20 -08:00
jp9000 a87fe6d783 libobs: Add wstrstri function
Performs a case-insensitive search for a wide-character string within
another wide-character string.
2015-01-03 02:37:16 -08:00
jp9000 9a91bbc16c libobs: Make astrstri a bit more C-compliant
I actually kind of hate how strstr returns a non-const even though it
takes a const parameter, but I can understand why they made it that way.
They really should have split it in to two functions though, one const
and one non-const or something.  But alas, ultimately for a C programmer
who knows what they're doing it isn't a huge deal.
2015-01-03 02:37:16 -08:00
jp9000 225f597379 libobs: Add process piping functions
This adds functions for piping a command line program's stdin or stdout.
Note however that this is unidirectional only.

This will be especially useful later on when implementing MP4 output,
because MP4 output has to be piped to prevent unexpected program
termination from corrupting the file.
2014-11-27 00:07:48 -08:00
jp9000 5888085a8e Allow hex numbers to be used in config data
This allows the 0x* format of hexadecimal integers to be used as config
integers.
2014-11-17 06:47:48 -08:00
jp9000 397dda78f8 Add config_open_string function
This allows opening ini config data from a string.  Before, it was only
possible to load config from a file.
2014-11-17 06:47:48 -08:00
jp9000 661d53067a util: Fix bug with darray_erase_range
Did not multiply the element size for the memory move operation.
2014-10-22 20:32:50 -07:00
Palana 2edac33c58 libobs/util: Write 0 character when converting empty strings
Fixes log_windows_version logging garbage for build when running with
debug heap enabled (assuming osvi.szCSDVersion is an empty string)
2014-10-04 21:48:08 +02:00
jp9000 41fad2d1a4 (API Change) Use const params where applicable
This Fixes a minor flaw with the API where data had to always be mutable
to be usable by the API.

Functions that do not modify the fundamental underlying data of a
structure should be marked as constant, both for safety and to signify
that the parameter is input only and will not be modified by the
function using it.
2014-09-26 17:23:07 -07: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 1abcdd7f50 WinHandle: Do not close handle on operator &
This is not a com pointer; it should not release/close the handle when
an & operator is used, it should only return the handle value.  Clearing
is only used on assignment.
2014-09-12 20:36:32 -07:00
jp9000 45eae599ce Add -> operator to CoTaskMemPtr
This adds the ability to get members via the -> operator.
2014-09-01 13:00:22 -07:00
Palana 571dd0f166 Add platform functions to request high performance modes
Specifically, this disables App Nap and related features
on OSX 10.9+
2014-08-24 20:32:44 +02:00
jp9000 9d300685ca (API Change) Unsquish libobs/util
Changed:                      To:
-----------------------------------------------------------
dstr_isempty                  dstr_is_empty
cf_lexer_gettokens            cf_lexer_get_tokens
cf_preprocessor_gettokens     cf_preprocessor_get_tokens
2014-08-09 11:57:37 -07:00
jp9000 2f21e2a450 Remove duplicate 'strref_isempty' 2014-08-08 10:50:37 -07:00
jp9000 c5c8cba74d Fix incompatible pointer type warning
Well, needless to say I'm very happy this didn't end up exploding.  I'm
surprised GCC and clang let this through.
2014-07-27 14:33:37 -07:00
jp9000 e796aba928 Set proper output length for string conversions 2014-07-27 13:26:51 -07:00
jp9000 99d8bdcee7 Add 'glob' functions for file searching 2014-07-27 13:26:51 -07:00
BtbN cac6ad1822 Move config values from the commandline to obsconfig.h 2014-07-26 14:07:14 +02:00
jp9000 57dcf49757 Fix NULL pointer dereference with text lookups 2014-07-24 00:27:15 -07:00
jp9000 6d89dde0da Fix dstr_end bug (it's len - 1)
Somewhat of an embarassing fix.  Using 'len' will just return the null
terminator.
2014-07-23 20:16:37 -07:00
jp9000 dc42ac0012 Add dstr_end function to get the last character 2014-07-23 17:53:27 -07:00
jp9000 70559b98a0 Fix bug where bmem.h wasn't always included 2014-07-13 11:34:56 -07:00
Palana 850d92bac0 libobs: Add config_has_(user|default)_value functions
Similar to obs_data_has_(user_value|default|autoselect), these allow
library users to distinguish between user config values and default
values
2014-07-13 19:10:38 +02:00
jp9000 322f148c9c Remove duplicate include 2014-07-13 02:59:14 -07:00
jp9000 0c135d9804 Remove duplicate function declaration 2014-07-13 01:21:20 -07:00
jp9000 52c0d223fd Change dstr_init_strref to dstr_init_copy_strref 2014-07-13 01:20:53 -07:00
jp9000 f675c8029f Fix 'unused parameter' warnings on windows 2014-07-12 11:59:07 -07:00
jp9000 ad6b70e938 Add null pointer checks to platform functions
It's a sad day when I realize that I did not add any null pointer
checking to any of the functions in this file.  Discovered it while
checking all the different languages, happened when there was a missing
locale file for a certain module that hadn't had the language uploaded
yet.
2014-07-12 04:48:16 -07:00
jp9000 41f1ad32f2 Remove unused function 2014-07-05 16:16:32 -07:00
jp9000 0781d86a2b Implement CPU usage monitoring functions 2014-07-04 23:03:26 -07:00
Palana 603c87cd8f Fix b(w)strdup_n returning NULL for empty strings 2014-06-25 23:18:18 +02:00
Palana 070f6cb6a6 Add DStr move assignment operator 2014-06-25 17:00:02 +02:00
Palana 5afedb1092 Fix DStr move constructor
Previously dstr_move would try to free the uninitialized value in
DStr::str::array
2014-06-25 17:00:01 +02:00
Palana 56b3685940 Add include for ptrdiff_t 2014-06-17 17:02:28 +02:00
jp9000 44066f8e61 Fix null pointer dereference in text lookup
Fix potential null pointer dereference for when splitting a node.
2014-06-14 23:47:22 -07:00
jp9000 924709735e libobs/util: Add DStr RAII helper class
..Could also add some super nifty stuff later on too.  However, I think
using std::string whenever possible is probably for the best.
2014-05-30 02:46:08 -07:00
jp9000 dfdba6636b libobs/util: Fix string conversion functions
There was a fundamental flaw with the string type conversion functions
where the sizes were not being properly accounted for.  They were using
the 'len' value as a value for the output rather than only for the
input, which was bad because the output could have more or less
characters than the input.
2014-05-30 02:42:03 -07:00
jp9000 e18795a164 libobs/util/dstr.c: Add missing dstr_from_wcs 2014-05-30 02:40:23 -07:00
jp9000 38b610efca libobs/util/dstr.c: Don't find/replace if empty 2014-05-30 02:39:33 -07:00
jp9000 d536df30b0 Add dst_size parameter to character conv funcs
Character conversion functions did not previously ask for a maximum
buffer size for their 'dst' parameter, it's unsafe to assume some given
destination buffer may have enough size to accommodate a conversion.
2014-05-22 03:46:57 -07:00
Jim 6e6cb9f317 Merge pull request #87 from fryshorts/fixes
Use memmove instead of memcpy for potentially overlapping memory
2014-05-18 18:47:35 -07:00
jp9000 5ba8b09c9c Add help menu with log file uploading
Added github gist API uploading to the help menu to help make problems a
bit easier to debug in the future.  It's somewhat vital that this
functionality be implemented before any release in order to analyze any
given problem a user may be experiencing.
2014-05-18 17:44:10 -07:00
fryshorts 3c5e8674b5 Use memmove instead of memcpy for potentially overlapping memory
This fixes an issue reported by valgrind where overlapping memory
was copied with memcpy.
This also removes a redundant assignment where the array size was
explicitly set to zero when it was already zero.
2014-05-17 15:47:59 +02:00
jp9000 1d2e5d50a4 Add FLV file output code
This doesn't add FLV file output to the user interface yet, but we'll
get around to that eventually.  This just adds an FLV output type.

Also, removed ftello/fseeko because off_t is a really annoying data
type, and I'd rather have a firm int64_t for large sizes, so I named it
to os_fseeki64 and os_ftelli64 instead, and changed the file size
function to return an int64_t.
2014-05-16 00:18:23 -07:00
jp9000 4f9e4a27d5 libobs/util: Remove dup. code, add os_opendir
Just use platform-nix.c code for general stuff that mac is compliant
with, and put a define around everything else.  Take that code out of
platform-cocoa.m.

Added os_opendir, os_readdir, and os_closedir to be able to query
available files within a directory.
2014-05-14 17:44:32 -07:00
jp9000 4bdcbe0600 libobs/util: Add func to get current log handler 2014-05-14 17:43:23 -07:00
jp9000 03ca5919ce UI: Add popup warnings for connection failure
Also, check for null stream path/key in the RTMP output module.
2014-05-12 15:34:46 -07:00
jp9000 52746c2523 Add (temporary terrible) volume controls
- Add volume control

   These volume controls are basically nothing more than sliders.  They
   look terrible and hopefully will be as temporary as they are
   terrible.

 - Allow saving of specific non-user sources via obs_load_source and
   obs_save_source functions.

 - Save data of desktop/mic audio sources (sync data, volume data, etc),
   and load the data on startup.

 - Make it so that a scene is created by default if first time using the
   application.  On certain operating systems where supported, a default
   capture will be created.  Desktop capture on mac, particularly.  Not
   sure what to do about windows because monitor capture on windows 7 is
   completely terrible and is bad to start users off with.
2014-05-03 22:54:38 -07:00
jp9000 8830c4102f obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
   the output gets data from that service rather than via settings.
   This allows the service context to have control over how an output is
   used, and makes it so that the URL/key/etc isn't necessarily some
   static setting.

   Also, if the service is attached to an output, it will stick around
   until the output is destroyed.

 - The settings interface has been updated so that it can allow the
   usage of service plugins.  What this means is that now you can create
   a service plugin that can control aspects of the stream, and it
   allows each service to create their own user interface if they create
   a service plugin module.

 - Testing out saving of current service information.  Saves/loads from
   JSON in to obs_data_t, seems to be working quite nicely, and the
   service object information is saved/preserved on exit, and loaded
   again on startup.

 - I agonized over the settings user interface for days, and eventually
   I just decided that the only way that users weren't going to be
   fumbling over options was to split up the settings in to simple/basic
   output, pre-configured, and then advanced for advanced use (such as
   multiple outputs or services, which I'll implement later).

   This was particularly painful to really design right, I wanted more
   features and wanted to include everything in one interface but
   ultimately just realized from experience that users are just not
   technically knowledgable about it and will end up fumbling with the
   settings rather than getting things done.

   Basically, what this means is that casual users only have to enter in
   about 3 things to configure their stream:  Stream key, audio bitrate,
   and video bitrate.  I am really happy with this interface for those
   types of users, but it definitely won't be sufficient for advanced
   usage or for custom outputs, so that stuff will have to be separated.

 - Improved the JSON usage for the 'common streaming services' context,
   I realized that JSON arrays are there to ensure sorting, while
   forgetting that general items are optimized for hashing.  So
   basically I'm just using arrays now to sort items in it.
2014-04-24 02:19:03 -07:00
jp9000 8225a0697a util/darray.h: Fix astoundingly silly assert 2014-04-19 20:35:03 -07:00
Palana 4bb4b859bf Initialize returned pointer to always trigger NULL checks in callers
Also avoid allocation roundtrip if the file is empty after the BOM
2014-04-19 07:37:38 +02: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
Palana c86fa7bb30 Use libc++ inspired clock instead of the deprecated AbsoluteToNanoseconds
This also makes the clang static analyzer happy (it complained about
uninitialized fields in the AbsoluteTime struct)
2014-04-14 23:02:53 +02:00
jp9000 fa490fa8c4 Implement some basic logging for windows 2014-04-14 04:02:11 -07:00
Jim b53e2a88a3 Merge pull request #59 from BtbN/linux_fixes
Linux fixes and additions
2014-04-12 10:53:09 -07:00
jp9000 b427397aa9 RTMP output: Implement frame drop code
A little bit of history about frame dropping:

I did a large number of experiments with frame dropping in old versions
of OBS1, and it's not an easy thing to deal with.  I tried just about
everything from standard i-frame delay, to large buffers, to dumping
packets, to super-unnecessarily-complex things that just ended up
causing more problems than they was worth.

When I did my experiments, I found that the most ideal frame drop system
(in terms of reducing the amount of total data that needed to be
dropped) was in the 0.4xx days where I had a 3 second frame-drop buffer
where I could calculate the actual buffer size in bytes, and then
intellgently choose packets in that buffer to trim it down to a specific
size while minimizing the number of p-frames and i-frames dropped, and
preventing the actual impact of dropped frames on the stream.  The
downside of it was that it required too much extra latency, and far too
many people complained about it, so it was removed in favor of the
current system.

The current system I just refer to just as 'packet dumping', which when
combined with low keyframe intervals (like most services use these
days), is the next-best method from my experience.  Just dump the buffer
when you reach a threshold of buffering (which I prefer to measure with
time rather than in size), then wait for a new i-frame.  Simple,
effective, and reduces the risk of consecutive buffering, while still
having fairly low impact on the stream output due to the low keyframe
interval of services.

By the way, audio will not (and should not ever) be dropped, lest you
end up with syncing issues (among other nasty things) specific to server
implementation.
2014-04-12 04:34:15 -07:00
Timo R b312261abd Flush after logging 2014-04-12 12:45:18 +02:00
jp9000 92522d1886 Implement RTMP module (still needs drop code)
- Implement the RTMP output module.  This time around, we just use a
   simple FLV muxer, then just write to the stream with RTMP_Write.
   Easy and effective.

 - Fix the FLV muxer, the muxer now outputs proper FLV packets.

 - Output API:
   * When using encoders, automatically interleave encoded packets
     before sending it to the output.

   * Pair encoders and have them automatically wait for the other to
     start to ensure sync.

   * Change 'obs_output_signal_start_fail' to 'obs_output_signal_stop'
     because it was a bit confusing, and doing this makes a lot more
     sense for outputs that need to stop suddenly (disconnections/etc).

 - Encoder API:
   * Remove some unnecessary encoder functions from the actual API and
     make them internal.  Most of the encoder functions are handled
     automatically by outputs anyway, so there's no real need to expose
     them and end up inadvertently confusing plugin writers.

   * Have audio encoders wait for the video encoder to get a frame, then
     start at the exact data point that the first video frame starts to
     ensure the most accrate sync of video/audio possible.

   * Add a required 'frame_size' callback for audio encoders that
     returns the expected number of frames desired to encode with.  This
     way, the libobs encoder API can handle the circular buffering
     internally automatically for the encoder modules, so encoder
     writers don't have to do it themselves.

 - Fix a few bugs in the serializer interface.  It was passing the wrong
   variable for the data in a few cases.

 - If a source has video, make obs_source_update defer the actual update
   callback until the tick function is called to prevent threading
   issues.
2014-04-07 22:00:10 -07:00
jp9000 59969844a1 Add comments to config-file.h
Someone got rather confused over what the "default" functions did, so
hopefully this clears it up a bit.
2014-04-07 01:29:56 -07:00
jp9000 fd24d0de2f Use atomics for allocation counter
I was getting cases where the CPU cache was causing issues with the
allocation counter, for the longest time I thought I was doing something
wrong, but when the allocation counter went below 0, I realized it was
because I didn't use atomics for incrementing/decrementing the
allocation counter variable.  The allocation counter now always should
have the correct value.
2014-04-07 01:25:38 -07:00
BtbN 23c3dfc6be Fix log_level check 2014-04-03 23:41:07 +02:00
jp9000 d42ff7f0dd Improve serializer and add array serializer
The serializer code is meant to be used as a means of reading/writing
data from any arbitrary type of input/output.

The array output serializer makes it so we can stream data to a dynamic
array on the fly.
2014-04-01 11:27:27 -07:00
jp9000 0a86e8fb3f Add dummy GL texture flag & direct object access
- Add dummy GL texture support to allow libobs texture references to be
   created for GL without

 - Add a texture_getobj function to allow the retrieval of the
   context-specific object, such as the D3D texture pointer, or the
   OpenGL texture object handle.

 - Also cleaned up the export stuff.  I realized it was all totally
   superfluous.  Kind of a dumb moment, but nice to clean it up
   regardless.
2014-03-29 17:19:31 -07:00
jp9000 6c904650b3 Fix GNU atomic builtins
The ones that were being used returned the previous value rather than
the new value
2014-03-17 14:16:05 -07: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 bb92d582bf Add atomic increment/decrement platform funcs 2014-03-16 16:23:11 -07:00
jp9000 fd37d9e9a8 Implement encoder interface (still preliminary)
- Implement OBS encoder interface.  It was previously incomplete, but
   now is reaching some level of completion, though probably should
   still be considered preliminary.

   I had originally implemented it so that encoders only have a 'reset'
   function to reset their parameters, but I felt that having both a
   'start' and 'stop' function would be useful.

   Encoders are now assigned to a specific video/audio media output each
   rather than implicitely assigned to the main obs video/audio
   contexts.  This allows separate encoder contexts that aren't
   necessarily assigned to the main video/audio context (which is useful
   for things such as recording specific sources).  Will probably have
   to do this for regular obs outputs as well.

   When creating an encoder, you must now explicitely state whether that
   encoder is an audio or video encoder.

   Audio and video can optionally be automatically converted depending
   on what the encoder specifies.

   When something 'attaches' to an encoder, the first attachment starts
   the encoder, and the encoder automatically attaches to the media
   output context associated with it.  Subsequent attachments won't have
   the same effect, they will just start receiving the same encoder data
   when the next keyframe plays (along with SEI if any).  When detaching
   from the encoder, the last detachment will fully stop the encoder and
   detach the encoder from the media output context associated with the
   encoder.

   SEI must actually be exported separately; because new encoder
   attachments may not always be at the beginning of the stream, the
   first keyframe they get must have that SEI data in it.  If the
   encoder has SEI data, it needs only add one small function to simply
   query that SEI data, and then that data will be handled automatically
   by libobs for all subsequent encoder attachments.

 - Implement x264 encoder plugin, move x264 files to separate plugin to
   separate necessary dependencies.

 - Change video/audio frame output structures to not use const
   qualifiers to prevent issues with non-const function usage elsewhere.
   This was an issue when writing the x264 encoder, as the x264 encoder
   expects non-const frame data.

   Change stagesurf_map to return a non-const data type to prevent this
   as well.

 - Change full range parameter of video scaler to be an enum rather than
   boolean
2014-03-16 16:21:34 -07:00
jp9000 3aedfdfb73 Fix wrong linux function
Used the mac function instead by accident
2014-03-10 19:27:59 -07:00
jp9000 5e1cac68f4 Fix semaphore mac code and mac plugin
Didn't convert the event names and didn't have the right mac includes
2014-03-10 19:24:09 -07:00
jp9000 c023ef69ea Fix non-windows event code
And remember to compile on non-windows systems before committing
2014-03-10 19:08:42 -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 02a07ea0a0 Add preliminary streaming code for testing
- Add some temporary streaming code using FFmpeg.  FFmpeg itself is not
   very ideal for streaming; lack of direct control of the sockets and
   no framedrop handling means that FFmpeg is definitely not something
   you want to use without wrapper code.  I'd prefer writing my own
   network framework in this particular case just because you give away
   so much control of the network interface.  Wasted an entire day
   trying to go through FFmpeg issues.

   There's just no way FFmpeg should be used for real streaming (at
   least without being patched or submitting some sort of patch, but I'm
   sort of feeling "meh" on that idea)

   I had to end up writing multiple threads just to handle both
   connecting and writing, because av_interleaved_write_frame blocks
   every call, stalling the main encoder thread, and thus also stalling
   draw signals.

 - Add some temporary user interface for streaming settings.  This is
   just temporary for the time being.  It's in the outputs section of
   the basic-mode settings

 - Make it so that dynamic arrays do not free all their data when the
   size just happens to be reduced to 0.  This prevents constant
   reallocation when an array keeps going from 1 item to 0 items.  Also,
   it was bad to become dependent upon that functionality.  You must now
   always explicitly call "free" on it to ensure the data is free, and
   that's how it should be.  Implicit functionality can lead to
   confusion and maintainability issues.
2014-03-10 13:10:35 -07:00
jp9000 fd579fe7f4 Make audio devices save to settings
Also, revamp the settings dialog code and make it use signals and slots
a bit better.
2014-03-07 12:56:31 -07:00
jp9000 4f7ab552df Reimplement monitor capture
- Implement windows monitor capture (code is so much cleaner than in
   OBS1).  Will implement duplication capture later

 - Add GDI texture support to d3d11 graphics library

 - Fix precision issue with sleep timing, you have to call
   timeBeginPeriod otherwise windows sleep will be totally erratic.
2014-03-05 10:43:14 -07:00
jp9000 348588254c Add WASAPI audio capture
- Add WASAPI audio capture for windows, input and output

 - Check for null pointer in os_dlopen

 - Add exception-safe 'WinHandle' and 'CoTaskMemPtr' helper classes that
   will automatically call CloseHandle on handles and call CoTaskMemFree
   on certain types of memory returned from windows functions

 - Changed the wide <-> MBS/UTF8 conversion functions so that you use
   buffers (like these functions are *supposed* to behave), and changed
   the ones that allocate to a different naming scheme to be safe
2014-03-04 07:07:13 -07:00
jp9000 9c6da6f52d Split output/input audio capture sources
- Split input and output audio captures so that they're different
   sources.  This allows easier handling and enumeration of audio
   devices without having to do some sort of string processing.

   This way the user interface code can handle this a bit more easily,
   and so that it doesn't confuse users either.  This should be done for
   all audio capture sources for all operating systems.  You don't have
   to duplicate any code, you just need to create input/output wrapper
   functions to designate the audio as input or output before creation.

 - Make it detect soundflower and wavtap devices as mac "output" devices
   (even though they're actually input) for the mac output capture, and
   make it so that users can select a default output capture and
   automatically use soundflower or wavtap.

   I'm not entirely happy about having to do this, but because mac is
   designed this way, this is really the only way to handle it that
   makes it easier for users and UI code to deal with.

   Note that soundflower and wavtap are still also designated as input
   devices, so will still show up in input device enumeration.

 - Remove pragma messages because they were kind polluting the other
   compiler messages and just getting in the way.  In the future we can
   just do a grep for TODO to find them.

 - Redo list property again, this time using a safer internal array,
   rather than requiring sketchy array inputs.  Having functions handle
   everything behind the scenes is much safer.

 - Remove the reference counter debug log code, as it was included
   unintentionally in a commit.
2014-03-03 02:56:54 -07:00
jp9000 e9342143a7 Simplify and extend callback/signalling system
- Signals and dynamic callbacks now require declarations to be made
  before being used.  What this does is allows us to get information
  about the functions dynamically which can be relayed to the user and
  plugins for future extended usage (this should have big implications
  later for scripting in particular, hopefully).

- Reduced the number of types calldata uses from "everything I could
  think of" to simply integer, float, bool, pointer/object, string.
  Integer data is now stored as long long.  Floats are now stored as
  doubles (check em).

- Use a more consistent naming scheme for lexer error/warning macros.

- Fixed a rather nasty bug where switching to an existing scene would
  cause it to increment sourceSceneRefs, which would mean that it would
  never end up never properly removing the source when the user clicks
  removed (stayed in limbo, obs_source_remove never got called)
2014-03-01 05:54:55 -07:00
jp9000 e560a426c5 Give cf_parser functions better naming 2014-03-01 01:25:41 -07:00
jp9000 771eac6015 Be more consistent about log levels
LOG_ERROR should be used in places where though recoverable (or at least
something that can be handled safely), was unexpected, and may affect
the user/application.

LOG_WARNING should be used in places where it's not entirely unexpected,
is recoverable, and doesn't really affect the user/application.
2014-02-28 20:02:29 -07:00
jp9000 cc472d0713 Fix posix event mutex lock bug
The mutex must be unlocked regardless of what the return value is or it
will be locked forever if the return value isn't 0.
2014-02-27 18:01:47 -08: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 2dbbffe4a2 Make a number of key optimizations
- Changed glMapBuffer to glMapBufferRange to allow invalidation.  Using
   just glMapBuffer alone was causing some unacceptable stalls.

 - Changed dynamic buffers from GL_DYNAMIC_WRITE to GL_STREAM_WRITE
   because I had misunderstood the OpenGL specification

 - Added _OPENGL and _D3D11 builtin preprocessor macros to effects to
   allow special processing if needed

 - Added fmod support to shaders (NOTE: D3D and GL do not function
   identically with negative numbers when using this.  Positive numbers
   however function identically)

 - Created a planar conversion shader that converts from packed YUV to
   planar 420 right on the GPU without any CPU processing.  Reduces
   required GPU download size to approximately 37.5% of its normal rate
   as well.  GPU usage down by 10 entire percentage points despite the
   extra required pass.
2014-02-16 19:28:21 -07:00
jp9000 8b8217f68e Fix a some more linux/GCC specific warnings 2014-02-14 15:56:01 -07:00
jp9000 966b943d5b Remove majority of warnings
There were a *lot* of warnings, managed to remove most of them.

Also, put warning flags before C_FLAGS and CXX_FLAGS, rather than after,
as -Wall -Wextra was overwriting flags that came before it.
2014-02-14 15:13:36 -07:00
jp9000 b067440f73 Use bzalloc instead of bmalloc then memset
Reduces needless code repetition and still allows for proper memory
alignment.  Cleans up the code a bit.
2014-02-09 12:34:07 -07:00
jp9000 8aa2b01eb9 Fix __attribute__ usage
Requires two sets of parentheses, not one.  ...I think
2014-02-09 08:10:53 -07:00
jp9000 29fb9cc9f4 Fix FORCE_INLINE macro
Accidentally put the code within a _MSC_VER #ifdef, causing the macro to
not be found on non-VC compilers
2014-02-09 08:06:34 -07:00
jp9000 20fd2c82dc Fix UTF-8 signature detection
The signature detection code when reading UTF-8 files was causing the
UTF-8 strings read from file to allocate more data than they were
supposed to, causing the last 3 bytes to be garbage
2014-02-09 08:01:08 -07:00
jp9000 4be4dd735e Use force inlining of YUV conversion functions
Force inling of the 444->420 conversion functions because their CPU
usage goes up pretty heavily without it when compiling without
optimizations
2014-02-09 07:59:00 -07:00
jp9000 6c92cf5841 Implement output, improve video/audio subsystems
- Fill in the rest of the FFmpeg test output code for testing so it
   actually properly outputs data.

 - Improve the main video subsystem to be a bit more optimal and
   automatically output I420 or NV12 if needed.

 - Fix audio subsystem insertation and byte calculation.  Now it will
   seamlessly insert new audio data in to the audio stream based upon
   its timestamp value.  (Be extremely cautious when using floating
   point calculations for important things like this, and always round
   your values and check your values)

 - Use 32 byte alignment in case of future optimizations and export a
   function to get the current alignment.

 - Make os_sleepto_ns return true if slept, false if the time has
   already been passed before the call.

 - Fix sinewave output so that it actually properly calculates a middle
   C sinewave.

 - Change the use of row_bytes to linesize (also makes it a bit more
   consistent with FFmpeg's naming as well)
2014-02-09 05:51:06 -07:00
jp9000 3d6d43225f Add planar audio support, improve test output
- Add planar audio support.  FFmpeg and libav use planar audio for many
  encoders, so it was somewhat necessary to add support in libobs
  itself.

- Improve/adjust FFmpeg test output plugin.  The exports were somewhat
  messed up (making me rethink how exports should be done).  Not yet
  functional; it handles video properly, but it still does not handle
  audio properly.

- Improve planar video code.  The planar video code was not properly
  accounting for row sizes for each plane.  Specifying row sizes for
  each plane has now been added.  This will also make it more compatible
  with FFmpeg/libav.

- Fixed a bug where callbacks wouldn't create properly in audio-io and
  video-io code.

- Implement 'blogva' function to allow for va_list usage with libobs
  logging.
2014-02-07 03:03:54 -07:00
jp9000 a5372e9757 Finish the rest of the settings dialog code
- Move over the last of the original settings dialog code to QT.  It was
  actually a bit easier to write in the QT version.  wxWidgets was
  definitely not ideal for that because the pages would fully
  create/destroy every time.

- [Win32] Fix os_dlopen so that it only appends .dll if not present

- [MacOS] Fix name dialog text edit widget issue (it would be better if
  we could just use the list widget for editing labels, will have to
  look in to that in the future)

- Tweak the settings UI a bit more and make 30 FPS default

- Add a macro to convert a QString to a UTF-8 const char * string

- Rename build/plugins to build/obs-plugins

- Remove the last of the wxWidgets code
2014-01-26 15:36:15 -07:00
jp9000 93d15ef254 Fix some formatting issues and fix cmake file 2014-01-25 12:34:37 -07:00
BtbN 6a9dda87bd Restructure installation and package generation 2014-01-25 19:13:33 +01:00
BtbN 45ec80fb7d Full rewrite of all CMakeLists
CMake now works on all platforms
2014-01-24 18:56:32 +01:00
Zachary Lund 1deb27d502 Fixed os_gettime_ns to provide correct time in ns 2014-01-11 15:08:04 -06: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
jp9000 e891b3fae8 Fixed bug with circlar buffer
- Circular buffer code wasn't correctly handling the splitting of
   newly placed data segments, the code was untested and turned out to
   just be backwards.  It now copied the data to the back and front of
   the buffer properly.
2014-01-09 22:02:11 -07:00