Commit Graph

614 Commits (2c3a3f4e651a879570860a4fd8bdeac77639da21)

Author SHA1 Message Date
jp9000 2c3a3f4e65 WASAPI: Change some errors messages to warnings
There shouldn't be errors if the actual source has successfully been
created, just warnings.
2014-03-07 13:04:38 -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 e8044d0868 Use only one widget for preview
Modify the obs_display API so that it always uses an orthographic
projection that is the size of the display, rather than OBS' base size.
Having it do an orthographic projection to OBS' base size was silly
because it meant that everything would be skewed if you wanted to draw
1:1 in the display.  This deoes mean that the callbacks must handle
resizing the images, but it's worth it to ensure 1:1 draw sizes.

As for the preview widget, instead of making some funky widget within
widget that resizes, it's just going to be a widget within the entire
top layout.  Also changed the preview padding color to gray.
2014-03-07 10:19:03 -07:00
jp9000 7d48dbb1dc Add a way to get default settings
- Implement a means of obtaining default settings for an
   input/output/encoder.  obs_source_defaults for example will return
   the default settings for a particular source type.

 - Because C++ doesn't have designated initializers, use functions in
   the WASAPI plugin to register the sources instead.
2014-03-07 06:55:21 -07:00
jp9000 e88ee06310 Move basic mode configuration to a separate file
Having everything in global.ini meant that if you wanted different
settings for studio mode, that it would also overwrite it for basic
mode.  This way, the settings for each mode are separate, and you can
use different settings for each mode.
2014-03-06 21:08:12 -07:00
jp9000 9fb83cc233 Fixed basic settings window (forgot linux)
The function would fail to compile on linux because the variables didn't
exist
2014-03-06 12:05:19 -07:00
jp9000 2448d0f229 Load up the lists of audio devices in settings
It will now load up a the list of audio input/output devices in the
combo boxes in audio settings.
2014-03-06 07:02:25 -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 3415960d02 WASAPI: Check the HRESULT values with FAILED
I can't believe I did !res there.  Well I suppose I can believe it, but
still.
2014-03-04 07:18:24 -07:00
jp9000 bec8a09bd9 CoreAudio: Separate enumeration code
The enumeration code being up at the top was making things quite messy,
so I split that code out to a separate set of files.
2014-03-04 07:10:33 -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 2fd57ed7f5 CoreAudio: Don't reconnect if no output devices
Somehow this code didn't get included with the last commit.
2014-03-03 05:12:58 -07:00
jp9000 91644fbf23 CoreAudio: Fail if no output device found
Also, don't have it repeat trying to reconnect if no devices are found
2014-03-03 03:21:00 -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 b4ef6cee91 Remove categories from properties
Categories added an unnecessary complexity to making properties, and
would very likely almost never be used in most cases, and were more of a
display feature.  The main issue is that it made property data more
complex to work with, and I just didn't feel comfortable with that.

Also, added a function to allow you to retrieve a porperty just by its
name.
2014-03-02 21:19:44 -07:00
jp9000 f91b4ef98e Check for duplicate names (function parser) 2014-03-02 19:44:22 -07:00
jp9000 9db52da6a1 Fix non-VS compile issues
As usual, microsoft treats all enums as integers, rather than actually
even checking the enum type.  Worthless compiler.  Just complete
garbage.
2014-03-02 07:41:55 -07:00
jp9000 1eeece5b97 Simplify and improve 'list' property
When a source/output/etc has a property of a 'list' type, there was no
way to get the names associated with its values.  That, and it only
supported lists of either text, or enums (0..[value] only).

Now, you can associate translated names with those values, and use
integer, float, or string values.  Put it all in to one function as well
to simplify its usage.

I plan on using this to help get enumerations from devices/etc for
certain types of sources.  For example, if I get the properties of an
audio source, I'd like to have a list of available devices with it as
well.
2014-03-02 06:32:47 -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 f716de1331 CoreAudio: Detect default device change
If the default device changes, set the reconnect interval to 200
milliseconds so it pretty much immediately tries to reinitialize the
audio with the newly selected default device.  Otherwise, use 2000
millisecond intervals, and assume disconnection.

Also, reduced FFmpeg logging to just regular FFmpeg information rather
than everything FFmpeg logs.
2014-02-28 21:46:22 -07:00
jp9000 429195aa6f Fix a warning and an error
Happened because I compiled on windows and it only compiled
windows-specific code.
2014-02-28 20:11:10 -07:00
jp9000 94a2d20712 Be just a bit more consistent.
See, it can sometimes be a bit confusing.  These functions should
definitely not fail under normal circumstances, and these errors may
affect the user and/or application in some way.
2014-02-28 20:07:56 -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 4e10eeda09 Wrap FFmpeg operations in mutexes, switch to MP4
I can't believe I wasn't doing this.  This is why file output was
getting corrupted.  Audio and video send in data from separate threads.
I should be embarassed for not having considered that.

Key lesson:  Increase threading paranoia levels.  Apparently my
threading paranoid levels are lackluster.
2014-02-28 03:50:30 -07:00
jp9000 d5b0121e79 MP4s definitely seem to not be working right
I'm not entirely sure what's going on with my FFmpeg code, but it's
definitely not generating the proper footers for MP4 files, despite the
fact that the footer function succeeds.  Going to use AVIs for the time
being still.
2014-02-27 23:46:47 -07:00
jp9000 0292e79a77 Merge branch 'master' of https://github.com/jp9000/obs-studio 2014-02-27 23:14:52 -07:00
jp9000 f9809847cd Use MP4s when not on windows
Also, make it use 'veryfast' preset.  Still testing this, might have to
revise this later.
2014-02-27 23:14:03 -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 7f087e95b3 Merge branch 'master' of https://github.com/jp9000/obs-studio 2014-02-27 15:06:45 -07:00
jp9000 55c0b11209 Set default buffering time to 1000ms
After a mac just boots up, it often takes about 700 milliseconds for
audio devices to work on first use, so it would often have issues with
the 700ms audio buffering time, and audio data would get cut off.  Just
increasing the buffering a little bit fixes the issue.
2014-02-27 15:04:24 -07:00
jp9000 a4792b9469 Merge branch 'master' of https://github.com/jp9000/obs-studio 2014-02-27 12:23:57 -08:00
jp9000 1927dc7eaa Add callback for device format change (CoreAudio) 2014-02-27 12:22:58 -08:00
jp9000 9236b940a2 Fix audio startup (CoreAudio)
Forgot to add a '!'.
2014-02-27 04:12:41 -07:00
jp9000 9e8c003282 Remove redundant connect message 2014-02-27 00:32:03 -07:00
jp9000 702c364ceb Fix a memory leak in ca_warn (CoreAudio) 2014-02-27 00:20:43 -07:00
jp9000 1a5220acf1 Fix more failure handling for CoreAudio
Actually, if initializing failed at all, it would never properly
uninitialize because the 'initialized' variable was never set until the
very end.  Instead, set the "initialized" flag from the beginning to
ensure initialization.
2014-02-27 00:17:35 -07:00
jp9000 c519933eb1 Fix a case where audio wouldn't free correctly
If coreaudio_start failed, it wouldn't free the audio data properly.
Fixed that issue.
2014-02-27 00:14:50 -07:00
jp9000 4d5ece6f08 Merge branch 'master' of https://github.com/jp9000/obs-studio 2014-02-26 23:08:14 -08:00
jp9000 4c19a60e16 Fix device disconnect detection for CoreAudio
These address structures are very confusing and I wish apple designed
better system APIs.
2014-02-26 23:06:33 -08:00
jp9000 5441dca937 Fix VS2013 project files
Last commit was on mac so I was unable to incude the VS project files
additions for threading-windows.c.
2014-02-26 23:56:48 -07:00
jp9000 61c9ff2a0a Fix libobs/CMakeLists.txt for linux
Was pointing to a bad filename for the new threading stuff
2014-02-26 22:54:05 -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 a1a1f1a64c Fix stereo output bug with ffmpeg test output 2014-02-24 01:51:39 -07:00
jp9000 6c2d067e05 Make ffmpeg test output sync A/V properly
FFmpeg test output wasn't make any attempt to sync data before.  Should
be much more accurate now.

Also, added a restart message to audio settings if base audio settings
are changed.
2014-02-24 01:48:14 -07:00
jp9000 268e4e7811 Add more checks for NULL pointers 2014-02-23 22:39:33 -07:00
jp9000 096cce9a86 Rename scene signals
the signals for scenes could have potentially conflicted with default
source signals.  "remove" should be used for source removal, for
example.  Changed the scene signals to "item-add" and "item-remove" for
its items.
2014-02-23 18:58:01 -07:00
jp9000 75b66872e4 Require restart for audio changes (for now)
Resetting audio while libobs is active is a real pain.  I think I'm just
going to do audio resetting later, or maybe just require restart
regardless just because having to shut down audio streams/lines while
there's sources currently active requires recreating all the audio
lines for each audio source.  Very painful.

Video fortunately is no big deal, so at least there's that.
2014-02-23 18:00:09 -07:00
jp9000 60e6316a5e Separate source activation for main/aux views
Split off activate to activate and show callbacks, and split off
deactivate to deactivate and hide callbacks.  Sources didn't previously
have a means to know whether it was actually being displayed in the main
view or just happened to be visible somewhere.  Now, for things like
transition sources, they have a means of knowing when they have actually
been "activated" so they can initiate their sequence.

A source is now only considered "active" when it's being displayed by
the main view.  When a source is shown in the main view, the activate
callback/signal is triggered.  When it's no longer being displayed by
the main view, deactivate callback/signal is triggered.

When a source is just generally visible to see by any view, the show
callback/signal is triggered.  If it's no longer visible by any views,
then the hide callback/signal is triggered.

Presentation volume will now only be active when a source is active in
the main view rather than also in auxilary views.

Also fix a potential bug where parents wouldn't properly increment or
decrement all the activation references of a child source when a child
was added or removed.
2014-02-23 17:46:00 -07:00
jp9000 c232ebde15 Implement a few more audio options/functions
Implement a few audio options in to the user interface as well as a few
inline audio functions in audio-io.h.

Make it so ffmpeg plugin automatically converts to the desired format.

Use regular interleaved float internally for audio instead of planar
float.
2014-02-23 16:27:19 -07:00