Commit Graph

587 Commits (bcf8400137ce424bd9f8d5b698fe1a4ed4f483b5)

Author SHA1 Message Date
jp9000 c1289b893e win-capture: Log more hooking errors
Adds a few previously-missing log messages that specify the actual
reason why there was an error acquiring the hook, rather than just
saying nothing.
2015-01-05 03:01:20 -08:00
jp9000 e7790ab52c win-capture: Wait before auto-fullscreen hooking
If using the auto-fullscreen feature to hook in to a fullscreen, I found
that if you don't wait a few seconds before initializing the hook that
you can catch the process when it's just starting up and loading
important libraries (especially things such as steam/uplay/etc), which
can cause a little bit of interference with the process and on rare
occasions cause it to crash.

To help prevent the likelihood of that happening, this just makes it so
that the hook waits at least 3 seconds before even attempting to inject
the hook when using auto-fullscreen mode.  After some extensive testing
I haven't had any issues since.
2015-01-05 03:01:19 -08:00
jp9000 69223e3645 win-capture: Retry hooks on most failures
The design to not retry the hooks on most general error is just bad.
There are plenty of legitimate cases where it should retry the hook.

This changes it so that if a general failure occurs or if it isn't
capturing when the inject helper exits, it retries and increases the
length of time between retries.
2015-01-05 03:01:12 -08:00
jp9000 6a0677a407 win-capture: Rename variables for consistency
Variables that track time should not have the name 'interval', they
should have the name 'time' instead so it's crystal clear that the
variable is tracking time.
2015-01-05 02:53:29 -08:00
jp9000 edf9d9f41f win-capture: Add 'retry_interval' variable
Adds a variable 'retry_interval' to game capture that allows the
interval at which game capture checks to update to longer intervals if
the hook initialization has some sort of failure.

The reason why I want to do this is because I don't really like it when
the hook updates too often in failure, it just leads to log file spam
that I feel can be reduced, and it frequent updates feel a bit invasive.
I just generally feel more comfortable reducing the interval at which
the hook retries after failure.
2015-01-05 02:52:57 -08:00
jp9000 272f709d1d win-hook: Fix variable name typo
Was 'error_aqcuiring', now 'error_acquiring'
2015-01-05 02:45:42 -08:00
jp9000 14bcb3ad18 win-capture: Change inject-hook intervals
This makes a minor adjustment to the interval at which the inject helper
tries to post the inject message to the target process.  Only 2 seconds
before, now up to 4 seconds, with the PostThreadMessage called every
half second for the duration.

The reason I did this is because I noticed that on rare occasions that
it wouldn't hook due to the low interval; usually just because the
target process is busy and isn't able to process its message queue, and
therefor the hook wouldn't go through due to the fact that
SetWindowsHookEx won't inject until the set event has occurred.  The
inject helper program would just close before the thread message had
finally been processed, which would cancel the SetWindowsHookEx hooking.
2015-01-05 02:45:41 -08:00
jp9000 8a97199072 text-freetype2: Set font log warning to debug only 2015-01-05 02:45:38 -08:00
jp9000 12011d4380 win-capture: Increase game capture update interval
Instead of checking every 3 seconds whether to hook, check every 2
seconds.  3 seconds felt a bit long to me.
2015-01-05 02:45:37 -08:00
jp9000 e6752f6b41 win-capture: Fix potentially overwritten values
The code neglected to take in to account that start_capture can also be
called when the texture updates its size/format in the hook and 'ready'
is signaled again, so it's possible that existing variables in the game
capture structure could be overwritten with new ones unintentionally.
2015-01-05 02:45:37 -08:00
jp9000 6d5aecbb70 win-capture: Fix cursor hotspot bug
Did I just..  forget to have it save the cursor hotspot?  You have to
have the cursor hotspot to draw it correctly.
2015-01-05 02:45:36 -08:00
jp9000 6a85407270 win-capture: Change 'Activate' text if active
The game capture 'Activate' button is likely to fool users in to
thinking it's not actually active if the game capture displays black, so
if it's active, rename the button to 'Reactivate' in order to sort of
hint at the user that it's actually active.
2015-01-05 02:42:18 -08:00
jp9000 b277f2b737 Don't update video of sources if not displaying
This is a bit of an optimization to reduce load a little bit if any of
the video capture sources are not currently being displayed on the
screen.  They will simply not capture or update their texture data if
they are not currently being shown anywhere.

The mac and window game capture sources don't really apply due to the
fact that their textures aren't updated on the source's end (they update
inside of the hooks).
2015-01-05 02:10:32 -08:00
jp9000 77105f1d93 win-dshow: Add activate/deactivate button
The DirectShow input source would always turn on first use, whether the
user wanted it to or not.  I feel like having an activate/deactivate
option is a really nice thing to have, and makes configuration feel a
little bit less awkward.
2015-01-05 02:10:31 -08:00
jp9000 f93b2fe794 Set various thread names
Helps identify which threads are which when debugging
2015-01-03 02:37:20 -08:00
jp9000 3259a6831b obs-x264: Fix color space/range not being set
I originally had it set the color space and color range in the video
info callback, but I forgot that it's a function that's called after the
encoder is initialized.  You can change the color space and color range,
but you have to reconfigure the encoder, and there's no real reason to
do that.
2015-01-03 02:37:19 -08:00
jp9000 f466e9ec1c win-capture: Add win8+ monitor capture
Uses the output duplicator API in order to get a high performance
monitor capture on windows 8+.  This is actually designed to be
interchangeable with regular GDI-based monitor capture (uses the same
source id).
2015-01-03 02:37:18 -08:00
jp9000 d3abdf39a2 win-capture: Don't draw cursor if outside area 2015-01-03 02:37:18 -08:00
jp9000 d6e98829ca win-dshow: Add buffering options
Allow the user to select whether to buffer the source or not.  The
settings are auto-detect, on, and off.  Auto-Detect turns it off for
non-encoded devices, and on for encoded devices.

Webcams, internal devices, and other such things on windows do not
really need to be buffered, and buffering incurs a tiny bit of delay, so
turning off buffering is actually a little better for non-encoded
devices.
2015-01-03 02:37:17 -08:00
jp9000 a7d2450d8e obs-outputs: Fix FLV corruption bug
The 'sent_headers' member variable of the FLV output would not be reset
when the output was restarted, causing important data to not be written,
thus creating an invalid FLV file.
2014-12-31 04:03:46 -08:00
Jim 903bb137a0 Merge pull request #312 from fryshorts/xshm-xcb-conversion
linux-capture: Xshm plugin xcb conversion
2014-12-28 23:31:32 -08:00
raincomplex 01491a96d3 Mark windows changed on Expose
On i3wm, windows aren't unmapped when switching away from a window's
workspace, but it does cause OBS to lose the capture. Because
switching back will not trigger a MapNotify, the capture fails to
restart unless you resize or move the window (ConfigureNotify). An
Expose event is fired by the wm, however, so catching this correctly
restarts the capture.
2014-12-24 15:23:08 -05:00
fryshorts db9b71b80b linux-capture: Refactor source data
Remove comments from and align members in the source data struct for the
xshm capture plugin.
2014-12-22 00:47:44 +01:00
fryshorts ed839dce19 linux-capture: Remove unused dependencies
Remove dependencies from cmake that are no longer needed due to the
port to xcb.
2014-12-22 00:47:44 +01:00
fryshorts 2dffa894f3 linux-capture: Port display connection to xcb
Remove the last bits of Xlib code from the xshm capture plugin and use
xcb exclusively.
2014-12-22 00:30:14 +01:00
fryshorts 114ccd33ee linux-capture: Port geometry functions to xcb
Replace XLib code with xcb in the geometry helper functions.
2014-12-22 00:13:42 +01:00
fryshorts 4d2e730bfa linux-capture: Remove XLib based shm helpers
Remove the old XLib based shm helper functions from xhelpers.
2014-12-22 00:13:41 +01:00
fryshorts 008f4467f0 linux-capture: Use xcb to check for extensions
Use the previously added helper function to check for needed extensions.
2014-12-22 00:13:41 +01:00
fryshorts aa016706a2 linux-capture: Port cursor handling to xcb
Use the new xcb based cursor library to handle the cursor in the
xshm plugin.
2014-12-22 00:13:41 +01:00
fryshorts 38f2c57c12 linux-capture: Port xshm handling to xcb
Use the new xcb based xshm functions to attach the shared memory segment
and capture the image from the xserver.
2014-12-22 00:13:41 +01:00
fryshorts e20cf649b8 linux-capture: Add xcb screen to source data
Add xcb screen structure to the source data for later use in the porting
process.
2014-12-22 00:13:41 +01:00
fryshorts 53ee22ae5a linux-capture: Add xcb connection to source data
Add a xcb connection to the source data for the xshm capture for later
use in the porting process.
2014-12-22 00:13:41 +01:00
fryshorts 4ad41004e0 linux-capture: Add function to check extensions
Add an internal function to check for all the extensions needed by the
xshm capture to work.
2014-12-21 23:21:46 +01:00
fryshorts 172a4d7a52 linux-capture: Add xcb cursor helper library
Add a new helper library to handle the mouse cursor using xcb.
Since porting the old library without either keeping legacy code or
breaking the api would have been non-trivial, this is added as a
completely separate implementation. Once all code is ported over to
use this library, the old one can be removed.
2014-12-21 23:13:46 +01:00
fryshorts 069ee92ff4 linux-capture: Add helper to get xcb screen
Add a helper function to get a xcb screen from a screen id.
2014-12-21 23:13:27 +01:00
fryshorts e7cdb837aa linux-capture: Add xcb helper functions for shm
Add new helper functions managing the shm segment with xcb to xhelpers.
2014-12-21 23:13:27 +01:00
fryshorts 8caba4deca linux-capture: Add xcb libraries to cmake
Add xcb libraries needed to port the plugin away from xlib to cmake.
2014-12-21 23:13:25 +01:00
jp9000 c456e42191 win-dshow: Use actual encoder names
Was using a temporary name for the encoders still; now uses the actual
encoder names.
2014-12-21 10:41:30 -08:00
jp9000 eb4a05667f win-dshow: Add C985/C353 hardware h264 encoders
This adds support for the AverMedia C985 encoder (which is available on
C985 capture cards) as well as the C353 hardware encoder (which is
currently available on the X99S Gaming 9 motherboards).

These encoders have some limitations, such as limited resolutions
(1280x720 and 1024x768), a max GOP size of 30, and the encoder format
only supports YV12, which requires conversion if the current output
format isn't the same.  The C985 and C353 encoders seem to be pretty
much identical, although it seems like the C353 has a bit more efficient
encoding.

I don't believe these are really suitable for streaming, as they do not
really have the encoding efficiency needed to stream at lower bitrates,
and seem to only support variable bitrate.  However, for recording these
encoders are quite nice to have available, and work quite well.
2014-12-21 10:14:27 -08:00
jp9000 bbff0eeeb9 win-dshow: Move module loading to separate file
The main module code was originally all packed in to the win-dshow.cpp
file, which isn't exactly ideal or clean if one wants to add other
things to the module as a whole.
2014-12-21 10:14:26 -08:00
jp9000 67587fbced win-dshow: Allow use of YV12 video format
Previously, due to a bug in libdshowcapture, the NV12 format was
actually being used for YV12 erroneously, and no actual support for YV12
existed.  This fixes the bug with NV12 and adds support for YV12.
2014-12-21 10:14:26 -08:00
jp9000 77f0f6802a win-dshow: Put device id mangling in separate file
This is going to be used for other code as well, so may as well put it
in its own file.
2014-12-21 10:14:25 -08:00
jp9000 1884fea349 win-dshow: Use obs_avc_keyframe instead of own 2014-12-21 10:14:24 -08:00
jp9000 3412a0e190 obs-outputs: Wait for packet before header output
Waiting for the first packet to arrive before sending the headers helps
prevent issues with certain types of encoders that may not get their
header/SEI until the first packet has been received.
2014-12-21 10:14:23 -08:00
jp9000 35d7a9ff1f obs-x264: Set x264 to use the cur. set cs/range
This causes x264 to use the currently set color space and color range
of the video media.  This helps prevent issues with decoding where the
colors wouldn't look right due to the fact that these settings were
never specified to x264, and prevents darkness and brightness from
looking washed out due to a potentially incorrect color range.
2014-12-11 20:06:54 -08:00
jp9000 56899df08f win-capture: Add game capture
This adds the windows version of game capture.

New features:

- An option to hook any fullscreen application automatically (that
  doesn't have borders) so that no specific window configuration is
  required.  Definitely a sorely needed feature

- An option to force memory capture for the sake of compatibility with
  things such as SLI, multi-adapter setups (usually laptops), as well as
  the ability to be used with the OpenGL renderer

- An optimization option to force scaling on the GPU before texture
  transfer, reducing the transfer bandwidth (which is especially
  important for compatibility capture)

- An optimization option to limit framerate to the current OBS framerate
  to improve capture performance (mostly useful for compatibility
  capture)

- An option to capture third-party overlays (such as steam)

- Logging improvements, game capture log will now be sent via pipe
  instead of written to a separate file, making diagnosing problems a
  little bit easier
2014-12-09 15:25:59 -08:00
jp9000 ca59b0c7d0 win-capture: Add cursor capture capability 2014-12-09 14:21:08 -08:00
jp9000 a5872955f4 win-capture: Add graphics-hook library
This library is a completely refactored and rewritten version of the
original graphics hook.  The code is more clean, readable, and has a
variety of new features, such as scaling and forcing memory capture.

Currently, only D3D9, 10, and 11 are implemented.  (This commit may be
updated on this branch)
2014-12-09 14:21:07 -08:00
jp9000 cb0db6240b win-capture: Add inject-helper program
This program simply injects a library in to the target progress using
SetWindowsHookEx.
2014-12-09 14:21:07 -08:00
jp9000 f02342ac0c win-capture: Add get-graphics-offsets helper
Before, game capture would find addresses to important graphics
functions by creating a graphics context for the desired API inside of
the hook, and then find the function addresses that way.

The big problem with that is that the context could often cause the
hooked application to crash, especially if another hook was active.

This bypasses that entire need by a simple console application that
creates the contexts, finds the hook address offsets and then returns
them via console output.
2014-12-09 14:21:06 -08:00
jp9000 afbd376f71 win-capture: Add d3d8 headers
These headers allow Direct3D 8 to be used.
2014-12-09 14:21:05 -08:00
jp9000 8c3878b0b6 win-capture: Add graphics-hook-info.h
This header contains global defines, structures, and helper inline
functions for the graphics hook that will be shared between game
capture, the hook, and the get-graphics-addrs helper application.
2014-12-09 14:21:04 -08:00
jp9000 6ece794334 win-capture: Add hook helper functions for IPC
These inline functions simplify the process of using windows IPC
objects, such as mutexes and events.
2014-12-09 14:21:04 -08:00
jp9000 46aeb46757 win-capture: Add hooking functions
These functions allow the safe hooking of windows functions,
specifically windows API functions that may or may not have built-in
machine code to help aid in reverse chain hooks.

If a new hook is applied to an existing forward hook, that hook will be
preserved to prevent that new hook's data from being removed
unintentionally.

Hopefully with all these precautions this will reduce the likelihood of
crashes and abnormal hook behavior, while allowing existing hooks to be
preserved, and allowing new hooks to be applied.
2014-12-09 14:21:03 -08:00
jp9000 dcae2a0624 win-capture: Expose get_window_exe as extern
This allows get_window_exe to be used with other .c files in the module.
2014-12-08 01:53:53 -08:00
jp9000 5e2eef6231 win-capture: Fix a bug with INCLUDE_MINIMIZED
This fixes a bug where if INCLUDE_MINIMIZED was set and the window size
was (0, 0), the window would still be excluded from the resulting list
that was created.
2014-12-08 01:53:52 -08:00
jp9000 422c6ffe86 win-capture: Obfuscate OpenProcess in win-helpers
OpenProcess can often be misinterpreted as invasive.  To avoid it, a
simple obfuscation workaround does the trick.
2014-12-08 01:53:52 -08:00
jp9000 a49d731df8 win-capture: Add obfuscation functions
This adds obfuscation functions primarily for use with GetProcAddress.
This takes an obfuscated string and uses a simple integer key to
de-obfuscate it to the intended function name string, which is then
loaded dynamically using GetProcAddress.

This is typically only used with functions such as OpenProcess,
SetWindowsHookEx, and the like, which can often be misinterpreted the
wrong way by security programs if those strings are found within the
strings segment of a scanned executable.
2014-12-08 01:53:51 -08:00
jp9000 7bf69e8a0a win-capture: Always set class/title/exe to null
When getting the class/title/exe of a particular window handle in the
build_window_strings function, always set the class/title/exe pointers
to null to prevent any potential references to invalid values if any of
them do not happen to be set for whatever reason.
2014-12-08 01:53:51 -08:00
Jim 963f052c2f Merge pull request #303 from fryshorts/xshm-different-xserver
linux-xshm: Allow capturing from a different X server
2014-11-19 16:22:34 -08:00
fryshorts cc56634e91 linux-xshm: Handle missing screens.
This adds a check to the screen enumeration in order to handle missing
screens by adding them to the list but disabling them.
2014-11-20 00:14:10 +01:00
fryshorts 67ca94f7e4 linux-xshm: Add server property.
This adds a property to the source properties which lets the user
specify the X server to capture from. Since this is probably something
thats only useful under certain circumstances it is implemented as
an advanced setting which is only shown when the corresponding option
for advanced settings is checked.
2014-11-20 00:10:11 +01:00
fryshorts 04a7db867f linux-xshm: Refactoring of setup code.
This moves the code to start/stop the capture to respectively named
function in order to clean up the update function.
This means that the capture is stopped/started whenever the settings are
changed. While this increases overhead for some settings, this will also
enable future settings that require a full restart of capture process.
2014-11-18 21:03:50 +01:00
fryshorts a4d09fe742 linux-xshm: Small change for texture update function.
This removes the entering/leaving of the graphics context from this
function and requires the calling code to make sure the context is
present.
2014-11-18 21:03:50 +01:00
fryshorts cc52b432e7 linux-xshm: Improve geometry update function.
This adds the screen id from the source properties to the source
struct and changes the geometry function to use that value instead
of requiring the settings object of the source.
2014-11-18 21:03:50 +01:00
fryshorts 08c9f39220 linux-xshm: Use macro for logging.
This adds a macro to automatically prepend the plugin name to debug
statements like it is done in other plugins.
2014-11-18 21:03:50 +01:00
fryshorts 1a51d5fab7 linux-xshm: Improve source struct.
This adds documentation to the source struct and moves one bool to the
end to avoid a hole due to alignment.
2014-11-18 21:03:50 +01:00
Lexsus a2deddfa77 text-freetype2: Fix CR char. rendering as space
On windows, carriage return characters are used along with line feed
characters. When the carriage return is used, it's rendered as a space.
This removes carriage returns from strings before rendering them via
freetype.
2014-11-18 04:04:54 -08:00
Lexsus 9c34be8af1 obs-outputs: Allow blank RTMP stream key usage
Allows a blank stream key to be used for RTMP streams.
2014-11-18 03:45:49 -08:00
jp9000 ce99829d01 text-freetype2: Remove null pointer dereference 2014-11-17 06:47:49 -08:00
jp9000 f199e2c096 text-freetype2: Do not call wcslen in loop expr.
Doing this in the expression will cause it to execute the function every
time the expression is evaluated, which is needless cycles wasted.
Instead, call wcslen before the loops begin.
2014-11-17 06:47:49 -08:00
jp9000 ae862c16a6 obs-ffmpeg: If ffaac is used, change cutoff freq
If FFmpeg's experimental aac encoder is used, this changes the cutoff
frequency to better values in order to try to help make up for the
inherent lack of encoder quality a bit.  If FFmpeg is compiled to use
another encoder by default, these settings will not be applied.
2014-11-17 06:47:48 -08:00
Zachary Lund ab7fa5bdb4 linux-capture: Add X border option to xcomposite
XComposite, which is currently our only capture method for windows,
doesn't handle X border width. This works in a lot of cases but anytime
there's a border, a bug occurs where the lower right is clipped.  This
patch has two goals:

1) To position and size the capture texture correctly in accordance to
the border.

2) Adds a configuration option to allow people to toggle it (which in
most cases will simply do nothing) with a default of not including it.
2014-11-09 22:17:45 -08:00
jp9000 28ac194257 text-freetype2: Fix null pointer dereference
Somehow, there were fonts with empty face names.  Regardless, it's
always important to check your pointers.  Invalid pointers spell doom.
2014-10-31 20:39:37 -07:00
Palana a21a369ec9 mac-syphon: Track inject status and retry injecting if needed
Some applications defer loading OpenGL until after they are visible as
running applications, which causes SyphonInject to not install a server
on the first try (e.g. Minecraft does this)
2014-11-01 03:07:06 +01:00
Palana dfbe7156be mac-syphon: List bundle identifier and pid in case of duplicate names 2014-11-01 03:07:06 +01:00
Palana b766faedb3 mac-syphon: Inject the best match(es) only 2014-11-01 03:07:06 +01:00
Palana 20f805a850 mac-syphon: Keep old inject settings in case of partial match
In some cases the actual application (bundle identifier) would get
overwritten with a wrapper application bundle identifier when the
application names matched (this happened with e.g., Minecraft)
2014-11-01 03:07:05 +01:00
Palana 56d220395e mac-syphon: Move release calls to helper function 2014-11-01 03:07:05 +01:00
dodgepong 17804ec12f Add latest translations from CrowdIn 2014-10-31 21:02:47 -04:00
fryshorts d9a7b9062d linux-v4l2: Update properties when devices change.
This causes the properties for v4l2 sources to be refreshed when a
device is disconnected/connected.
2014-10-29 10:18:21 -07:00
fryshorts ac40408dfa linux-v4l2: Disable properties when device is not there.
This adds helper function to disable/enable all properties which is
used in the device selected callback to enable/disable the properties
when the selected device is available/unavailable.
2014-10-29 10:18:20 -07:00
fryshorts 3a85d662be linux-v4l2: Always display currently selected device.
This adds some code to the device enumeration that checks if the
currently selected device is present. In case it is not it will
add the device but disable it.
2014-10-29 10:18:20 -07:00
fryshorts 24d1495b84 linux-v4l2: Avoid nested device open/close.
This moves the calls to the property modified functions so the old
handler can close the device. Otherwise this would cause the device
to be opened multiple times.
2014-10-29 10:17:59 -07:00
fryshorts 1945804624 linux-v4l2: Make frame counter local.
This replaces the var in the source struct that was used to print out
the number of captured frames with a local one.
2014-10-29 09:41:34 -07:00
fryshorts 45583a759a linux-v4l2: Make timestamp offset local.
This replaces the var in the source struct that are handling the
timestamp offset with a local one in the capture thread.
This change is mostly to make the code more readable.
2014-10-29 09:41:33 -07:00
fryshorts c0f6733b58 linux-v4l2: Fix select in capture thread.
This moves the enabling/resetting of the file descriptors inside the
capture loop so it is done before each select call. Why this even worked
before is unclear, but doing it the *right* way seems to reduce latency.
2014-10-29 09:41:33 -07:00
Jim b539a5304c Merge pull request #289 from Gol-D-Ace/remove-twitch-ingest-server
Remove ingest server live-ord.twitch.tv from services.json
2014-10-27 13:28:18 -07:00
Gol-D-Ace ebffa6b47c Remove ingest server live-ord.twitch.tv from services.json
Server doesn't exist anymore
https://api.twitch.tv/kraken/ingests
http://blog.twitch.tv/2014/09/service-update-chicago-point-of-presence-closure/
2014-10-27 21:00:34 +01:00
Palana 26964634d1 mac-syphon: Add "Allow Transparency" property
Transparency is now disabled by default, so that alpha values from
injected back buffers don't propagate to OBS (e.g. Minecraft doesn't
render properly in OBS unless "Allow Transparency" is disabled)
2014-10-27 01:01:14 +01:00
jp9000 d6b3230dbc linux-v4l2: Start timestamps from 0 per device
When a new device starts up, make it so that the first timestamp that
occurs starts from 0.  This prevents the internal source timestamp
handling from trying to buffer new frames to the new timestamp value in
case the device changes.
2014-10-23 11:38:59 -07:00
jp9000 40b1cc180d linux-v4l2: Add 'Use System Timing' property
Due to potential driver issues with certain devices, the timestamps are
not always reliable.  This option allows of using the time in which the
frame was received as a timestamp instead.
2014-10-23 11:38:59 -07:00
jp9000 db81c59b5e Revert "Add flag to obs_source_frame for unbuffered video"
This reverts commit c3f4b0f018.

The obs_source_frame should not need to take flags to do this.  This
shouldn't be a setting associated with the frame, but rather a setting
associated with the source itself.  This was the wrong approach to
solving this particular problem.
2014-10-23 10:15:26 -07:00
jp9000 ae0f6b5e3f Revert "linux-v4l2: Add 'unbuffered' property"
This reverts commit cd306d975a.

This removes the 'unbuffered' property for the time being.  There should
be a better way of handling this, such as using system timestamps.
Also, the obs_source_frame::flags member needs to be removed and
replaced with something a bit more ideal.
2014-10-23 10:14:32 -07:00
jp9000 cd306d975a linux-v4l2: Add 'unbuffered' property
This allows the user to select whether to use unbuffered video or not.
Unbuffered video cause the video frames to play back as soon as they're
received, rather than be buffered and attempt to play them back
according to the timestamp value of each frame.
2014-10-22 20:32:47 -07:00
jp9000 c3f4b0f018 Add flag to obs_source_frame for unbuffered video
Add 'flags' member variable to obs_source_frame structure.

The OBS_VIDEO_UNBUFFERED flags causes the video to play back as soon as
it's received (in the next frame playback), causing it to disregard the
timestamp value for the sake of video playback (however, note that the
video timestamp is still used for audio synchronization if audio is
present on the source as well).

This is partly a convenience feature, and partly a necessity for certain
plugins (such as the linux v4l plugin) where timestamp information for
the video frames can sometimes be unreliable.
2014-10-22 20:32:47 -07:00
fryshorts 3d29662084 linux-pulseaudio: Force stereo if unknown layout
This adds a check to change the capture settings to use 2 channels when
a channel number is encountered that would otherwise be interpreted as
SPEAKERS_UNKNOWN.
2014-10-18 14:47:54 -07:00
jp9000 89591843dc linux-pulseaudio: Use defaults for pa_buffer_attr
Although these values aren't used in capture mode, set these to the
default values just to be safe.
2014-10-18 14:45:05 -07:00
fryshorts d82f986ebd linux-pulseaudio: Fix the default req. buffer len
This changes the the requested buffer length to 25ms.
2014-10-18 14:44:30 -07:00
jp9000 9898060223 win-capture: Separate window finding source code
Because other capture methods may end up needing to share this code,
separate the window finding source code to window-helpers.c and
window-helpers.h.

This include a function to fill out a property list with windows, a
function to find a window based upon priority/title/class/exe, and a
function to decode the window title/class/exe strings from a window
setting string.
2014-10-17 04:15:57 -07:00
fryshorts 8a51431fdb Fix left open file descriptor in v4l2 plugin. 2014-10-15 00:13:43 +02:00
fryshorts 9a37b2ce9c Use udev events in the v4l2 plugin.
This adds code to set up the udev monitoring library and use the events
to detect connects/disconnects of devices.
When the currently used device is disconnected the plugin will stop
recording and clean up, so that the device node is freed up.
On reconnection of the device the plugin will use the event to
automatically start the capture again.
2014-10-15 00:13:43 +02:00
fryshorts 1bae57668c Add udev helper library to v4l2 plugin.
This adds a small helper library to the v4l2 plugin that uses udev to
get events for v4l2 devices.
2014-10-15 00:13:43 +02:00
Manuel Kroeber a7af7ccbfe Add monitor selection and basic properties 2014-10-14 20:45:16 +02:00
Manuel Kroeber ff2c7bd9de Fix for enum_monitors
Function enum_monitors would always stop after first found monitor due to wrong return value.
2014-10-14 20:41:56 +02:00
Manuel Kroeber fa1b9a9048 Use of text macros instead of direct obs_module_text calls 2014-10-14 20:41:05 +02:00
jp9000 e14f0fe56b win-dshow: Fix integer size conversion warnings 2014-10-11 21:18:34 -07:00
Ben Torell 958b5c12de Latest translations from Crowdin 2014-10-11 18:47:35 -04:00
Jim 8dead6a948 Merge pull request #272 from palana/syphon
Add mac-syphon plugin
2014-10-10 17:44:24 -07:00
Christoph Hohmann ed1430622b Force PulseAudio sample format if the source format is not supported by OBS
If the sample format used by PulseAudio can not be converted into an
OBS audio format it will be handled as AUDIO_FORMAT_UNKNOWN which will
not result in a proper audio recording. So instead we request a format
that OBS supports from PulseAudio and let it do the format conversion.
2014-10-08 00:05:11 +02:00
Christoph Hohmann 8166932d00 Fix PulseAudio audio format to OBS audio format mapping
The format PA_SAMPLE_S24_32LE is a 24 bit audio format in 32 bit integers
and not a 32 bit audio format and so it should no be mapped to
AUDIO_FORMAT_32BIT.
2014-10-07 21:56:32 +02:00
jp9000 4e308c955d linux-pulseaudio: Use interpolated system timing
Before it was giving timestamps based upon system time for each new
segment of audio data.  Also, it was subtracting pulse latency from the
audio timestamp, which seems like it was really meant for use with the
pulse audio time rather than system time.

Now, it just uses system time for timestamps.  Still might not be
totally perfect, but seems to be much better than it was.

This also removes the latency calculation.  Latency is no longer used
because we're not using pulseaudio timing.
2014-10-06 18:49:53 -04:00
jp9000 164f9b4517 linux-pulseaudio: Use inline for small functions 2014-10-06 18:49:53 -04:00
Palana 019a70f0d4 Add mac-syphon plugin
Allows adding Syphon servers as sources, and provides game-capture if
used with SyphonInject (specifically the scripting additions have to be
installed for SyphonInject to work from within OBS)
2014-10-04 17:26:29 +02:00
Palana 802ae79601 mac-capture: Use obs_get_default_rect_effect 2014-10-03 23:53:37 +02:00
Palana abb95781dd mac-capture: Rename display_capture::draw_effect to …::effect 2014-10-03 23:53:37 +02:00
Palana 9c4024f5b3 Implement 'update_properties' for mac-avcapture 2014-10-01 15:48:16 +02:00
Palana 94a93abb2b (API Change) Pass data to get_properties when possible 2014-10-01 15:39:57 +02:00
BtbN 599febcb54 cmake: Replace FFMpeg modules with single module
Now using components instead of one find_package call per module
2014-09-27 09:41:13 -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 d753cee1e7 win-dshow: Update libdshowcapture to 0.3.3
Adds full support for the HD-PVR Rocket
2014-09-23 04:56:39 -07:00
jp9000 46c0dd7ffb win-dshow: Change FFmpeg MPGA decoder
Apparently MPGA is equivalent to MP2, not MP1.
2014-09-23 04:56:33 -07:00
jp9000 1ccc03308d win-dshow: Add debug macros for logging timestamps 2014-09-23 04:56:32 -07:00
Jim 34e2b77c0f Merge pull request #266 from fryshorts/v4l2-input
Fix device capabilities checking and add "Leave unchanged" option for all settings.
2014-09-22 11:53:05 -07:00
fryshorts 0132453d23 Add video format check in v4l2 input.
This adds a check whether the video format from the device is compatible
with obs. This could either happen if the "Leave unchanged" option is
selected for the video format, or if the driver simply overwrites the
requested video format.
2014-09-16 21:54:42 +02:00
fryshorts 91fc59faca Refactor source structure in v4l2 input.
Due to the refactoring of the update function the separation of data
members only to be accessed from inside/outside the capture thread is
no longer needed.
2014-09-16 21:54:42 +02:00
fryshorts 875398e9dd Refactor update function for v4l2 input.
The old implementation of this function assumed that there would be some
settings that could be changed on the fly without restarting the
capture. That was actually never used for any setting.
2014-09-16 20:46:04 +02:00
fryshorts 632642010d Minor refactoring in v4l2 input.
We don't really need to use a dstr here, simply using the
right format specifier for blog will suffice.
2014-09-16 20:35:09 +02:00
fryshorts c3783d055f Add option to leave settings unchanged in v4l2 input.
This adds an additional option for all settings to leave the current
configuration of the device unchanged.
2014-09-16 00:12:45 +02:00
fryshorts dcd395f77e Use helper function to set framerate in v4l2 input. 2014-09-16 00:11:36 +02:00
fryshorts 6c8216c6a6 Use helper function to set format in v4l2 input.
Since the helper function also needs to pack/unpack the resolution, the
pack/unpack functions were moved to the helper library and prefixed with
v4l2_ in order to avoid possible collisions.
2014-09-16 00:11:28 +02:00
fryshorts 8d95a7fb47 Use helper function to set input in v4l2 input. 2014-09-16 00:09:16 +02:00
fryshorts 0abf0f5740 Do not explicitly set a default device in v4l2 input.
This was added at a time where the source properties dialog did not
pop up automatically on source creation. Now when the properties are
displayed the first device in the select input will be selected by
default if there was none already specified by the source settings.

This will make the code cleaner and also save one redundant round of
device enumeration.
2014-09-15 23:27:43 +02:00
fryshorts 841f02be87 Fix device capability checking in v4l2 input.
The capabilities flags that were used previously describe all
capabilities the physical device offers. This would cause devices
that are accessible through multiple device nodes to show up with
all device nodes while only one of the nodes might actually offer
the needed video capture capability.

If the device has more nodes the CAP_DEVICES_CAP flag might be set
in which case the device_caps field is filled with the capabilities
that only apply to that specific node that is opened.
2014-09-15 23:27:43 +02:00
BtbN 9f8b74b720 Add disable options for optional plugins 2014-09-15 19:34:53 +02:00
jp9000 f0568f772d Update libdshowcapture to 0.3.2 2014-09-14 18:36:47 -07:00
jp9000 4e78635764 win-dshow: Use a single thread per device
This prevents certain issues I've encountered with devices where they
expect to shut down in a specific thread they started up in, as well as
a number of other issues, such as the configuration dialogs.

The configuration dialogs require that a message loop be present, and
this was not the case previously because everything was in the video
thread, which has no windows-specific code.

Configuration/crossbar/etc dialogs will now execute correctly.
2014-09-12 20:36:34 -07:00
jp9000 1291351a2a win-dshow: Properly log colorspace on format fail 2014-09-12 20:36:34 -07:00
jp9000 8bdc967ae9 win-dshow: Implement dynamic format change support
This adds support for dynamic format changes on the fly.  Format,
resolution, sample rate, can all now be changed by the current
directshow device on the fly.
2014-09-12 20:36:34 -07:00
jp9000 24ae80a481 win-dshow: Implement decoding of encoded devices 2014-09-12 20:36:33 -07:00
jp9000 2378ecdbb5 win-dshow: Clear video/audio frame data on init 2014-09-12 20:36:33 -07:00
jp9000 755f95a3a7 win-dshow: Add FFmpeg decoding support 2014-09-12 20:36:32 -07:00
jp9000 bf1fea3494 win-dshow: Allow automatic handling of source res
On an asynchronous video source, the source resolution is automatically
handled by the core, and set to the resolution of the last video data
that was sent.  There is no need to manually specify a resolution.
2014-09-12 20:36:32 -07:00
Jim 07c2d32a68 Merge pull request #261 from fryshorts/pulse-input
Use default source settings for recording in pulse input
2014-09-12 13:03:54 -07:00
jp9000 febede1fde Update libdshowcapture to 0.2.3 (Fix audio assert) 2014-09-06 14:37:52 -07:00
jp9000 4cb0c0c6f0 Update libdshowcapture to 0.2.2 (fix for HD-PVR 1) 2014-09-06 14:15:01 -07:00
jp9000 f3c47796ab Update libdshowcapture to 0.2.1 (HD-PVR 1 support) 2014-09-06 14:00:47 -07:00
jp9000 6c14dbe6ff Update libdshowcapture to 0.2.0 2014-09-06 12:45:21 -07:00
jp9000 20e005e34a win-dshow: Swap UYVY and YVYU formats
These values were erroneously using their opposing types for the source
frame format.
2014-09-04 14:02:32 -07:00
jp9000 cabc47c147 Add more null pointer checks to text source 2014-09-02 20:44:50 -07:00