Commit Graph

101 Commits (a94c0e055b879f68bb7b378bfc53fb1412754d9b)

Author SHA1 Message Date
jp9000 072a886453 win-dshow: Add "activate" proc to proc handler 2020-09-07 16:12:50 -07:00
jpark37 b6afaceeae Update VIDEO_CS_DEFAULT to mean 709 instead of 601
Consistent with modified default UI setting.
2020-09-06 20:51:28 -07:00
jp9000 40817331d3 win-dshow: Fix rotation not working in all cases 2020-03-07 06:48:07 -08:00
jp9000 07089873fc win-dshow: Add support for devices that relay rotation
Adds support for devices that can relay rotation, such as the Logitech
StreamCam.
2020-03-01 03:42:46 -08:00
jpark37 9eeef48b5a win-dshow: Fix upside-down RGB DIBs
Fix regression to RGB DIB orientation according to MSDN.
2020-01-13 21:50:54 -08:00
Jim c36e3fbc92
Merge pull request #2196 from jpark37/ffmpeg-mjpeg-spam
win-dshow: Suppress MJPEG error spam
2019-11-29 20:48:40 -08:00
jpark37 f685322a0f win-dshow: Suppress MJPEG error spam
Only print the first message for this known benign error.
2019-11-24 23:59:27 -08:00
Clayton Groeneveld 82ffcdc827 UI: Add source icons 2019-11-24 20:50:42 -08:00
jpark37 f896c773e8 win-dshow: Support bottom-up DIBs
The biHeight field can be negative, leading to crashes on some cards
like VisionRGB-E1S. Adding flip support is fairly straightforward.

There also appears to be a hack to automatically flip for RGB formats,
but I wish to remove it because it seems to fight with this change. We
already have a separate vertical flip checkbox to deal with non
compliant behavior.
2019-11-12 17:59:59 -08:00
wanhongqing 9b4d9c6788 win-dshow: Fix format switching issue
If the format was one encoded format and changes to another encoded
format, it could cause it to continue to treat it as the old format.
2019-11-12 14:37:32 -08:00
jpark37 f60b820fee win-dshow: Fix color range when using FFmpeg decode
Full color range seems to be active when decoding video with FFMmpeg
even when partial is explicitly selected. This should keep the range
synchronized.
2019-09-14 17:12:29 -07:00
jp9000 deaeb5e632 win-dshow: Use unbuffered by default for MJPEG
Due to the recent change of using FFmpeg to decode MJPEG, MJPEG was
getting included in the delayed device check.  This fixes that so that
it doesn't.  MJPEG can decode in real time.
2019-07-29 20:34:13 -07:00
jp9000 cd6e9e34b8 win-dshow: Clarify function name/purpose
IsEncoded is meant to be used to indicated delayed devices, such as
older Elgato devices, or Hauppauge device.  Devices that use H264 and
have a 800+ millisecond latency.  This changes the function name to
better indicate that.
2019-07-29 20:34:13 -07:00
jp9000 a3fface27f win-dshow, obs-ffmpeg: Add hardware decoding support
Fixes hardware decoding support and updates it to FFmpeg 4.0.
2019-07-29 20:34:13 -07:00
James Park 0e7eec8f2d win-dshow: Use FFmpeg for MJPEG decompression
Measured lower CPU usage and latency than default DirectShow filter.
Tested with Logitech BRIO camera at 4K, 30 FPS.
2019-07-25 20:11:44 -07:00
Jim ffcfe4c9d9
Merge pull request #1951 from jpark37/audio-buffering
Fix audio buffering for devices like GV-USB2
2019-07-20 17:05:27 -07:00
jpark37 1fc0a357d2 win-dshow: Add "Default" color range setting
VIDEO_RANGE_DEFAULT uses partial range for YUV and full range for RGB.
Previous default was always partial.
2019-07-10 23:40:53 -07:00
James Park 534c553b23 win-dshow: Decouple audio from video
If a device produces video and audio timestamps atdifferent rates,
this divergence can cause massive buffering on the audio side, leading
to a capped audio buffer, and total sound loss. This change allows a
hardcoded list of devices to use the existing decoupling logic. For
now, only "GV-USB2" has been added.

When combined with another fix, 5+ hours of stable audio without any
buffering on my GV-USB2 where it used to drop sound completely after
an hour or so.

Partially fixes https://obsproject.com/mantis/view.php?id=1269
2019-07-05 09:12:57 -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 7d136c3ce1 decklink, win-dshow: Use obs_source_output_video2
Allows the ability to override and use partial range RGB with the
DirectShow and Decklink device sources when partial range RGB is
implemented.  Fixes certain cases where devices could capture RGB in
limited range via HDMI (per the HDMI specs).
2019-04-25 15:12:33 -07:00
James Park b3c2e74d0f win-dshow: Fix "Highest FPS" algorithm
MatcherClosestFrameRateSelector updates best_match as a side effect of
visiting every VideoInfo instance, but CapsMatch uses std::any_of,
which will stop iterating prematurely on first match. This means that
the highest FPS is not selected.

This change switches to a for loop that doesn't exit early.
2019-03-03 10:05:09 -08:00
Ilya Melamed db06a1c12a win-dshow: Allow synchronous create/update
Allows the ability to (optionally) synchronously create/update a
directshow device source rather than always asynchronously update the
device.  This is useful if creating/destroying scenes/sources very
quickly, and helps minimize the risk of creating new directshow sources
that use the same device, yet may not activate because an existing
source may already exist.  To use, set "synchronous_activate" to true in
its settings when updating or creating.  Note that this setting will be
erased after it's used, and will not be saved to user settings, so it
must be set each time in order to be used.

Closes obsproject/obs-studio#1228
2018-05-05 11:44:14 -07:00
pkviet 67e48ecc2c libobs/media-io: Replace quad with 4.0
(also obs, deps/media-playback, libobs/audio-monitoring, decklink,
linux-alsa, linux-pulseaudio, mac-capture, obs-ffmpeg, win-dshow,
win-wasapi)

Default channel layout for 4 channels is 4.0 in FFmpeg.
Replacing quad with 4.0 will improve compatibility since FFmpeg has
better support of its default channel layouts.
2018-01-05 09:48:52 -08:00
jp9000 0d6204c8af Fix a number of MSVC warnings
Fixes a number of warnings with all modules
2017-12-05 13:53:44 -08:00
Thomas Schnitzler 09e79aba08 win-dshow: Improve automatic Elgato audio device selection
Implement automatic audio device selection for devices that use two
separate DirectShow filters for audio and video instead of having a
single filter with audio and video output pins.

Please note that this fix is currently only active for Elgato USB and
PCIe devices (e.g. Cam Link, HD60 S, HD60 Pro, 4K60 Pro) to avoid
unintentionally changing the behavior for any other devices (e.g.
webcams).

(Jim edit: This fixes an issue with newer Elgato devices where the
devices would not automatically have their audio coupled with the video;
users would have to manually select the audio device in order to get
audio functioning.)

Closes jp9000/obs-studio#1081
2017-11-29 04:04:53 -08:00
pkviet bbac3280c1 libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)

Adds surround sound audio support to the core, core plugins, and user
interface.

Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts  (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
		   opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
	 HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
	 videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
         (due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST:	 stereo plugins keep in general only the first two channels.
	 surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
         (not implemented due to lack of usefulness)

Closes jp9000/obs-studio#968
2017-11-26 03:41:53 -08:00
jp9000 a0e8c7a5c1 win-dshow: Fix video playback when default format is MJPEG
Video playback doesn't work if the default format is MJPEG and there are
other formats to use; this is because the useDefaultConfig variable is
still set to true, which overrides the format value that would normally
tell it to convert to RGB.
2017-10-04 15:58:06 -07:00
jp9000 d13fa96851 libobs: Don't use source flags for async buffering
(This commit also modifies the decklink, linux-v4l2, mac-avcapture,
obs-ffmpeg, and win-dshow modules)

Originally, async buffering for sources was supposed to be a
user-controllable flag.  However, that turned out to be less than ideal
because sources (such as the win-dshow plugin) were programmed with
automatic control over their buffering (such as automatically detecting
USB 2.0 capture devices and then enabling in those cases).

The fact that it was a flag caused a design flaw to where buffering
values would be overwritten when a source is loaded from save data.

Because of that, this flag is being deprecated and replaced with a
specific function to enable unbuffered mode instead.
2017-05-13 23:32:40 -07:00
jp9000 c422d84d6e win-dshow: Fix issue with activating when not set to
When the windows video device source source is set to only activate when
showing, it would still activate on first startup of the program even if
it was in another scene and not showing anywhere to the user.  This
fixes that issue.
2017-03-26 05:45:42 -07:00
jp9000 a8d7419732 win-dshow: Actually fix LGP issue
The LGP issue is caused by the device drivers returning two or more
packets in a single segment of audio data.  This fixes it by detecting
that and decoding subsequent packets.

When the FFmpeg audio decoder returns, it returns how many bytes of data
was decoded.  To have it decode multiple packets in a single segment,
just subtract the return value from the expected size, and if that size
is still larger than zero, then there are more packets in the segment to
decode.  Otherwise, stop.
2017-03-03 17:02:06 -08:00
jp9000 084e9daf88 Revert "win-dshow: Add LGP timestamp fix"
This reverts commit 32f60d07a3.
2017-03-03 17:02:05 -08:00
jp9000 32f60d07a3 win-dshow: Add LGP timestamp fix
LGP devices are devices that induce anger in any sane developer because
they're prone to bad audio timestamps when using their decoded data
directly.  For that reason, add a hack that smooths the timestamps
within a large threshold to prevent audio skipping.
2017-02-22 01:18:24 -08:00
jp9000 001f3c751b win-dshow: Add tooltip to "Use Buffering" option 2016-09-11 04:16:14 -07:00
Kazuki Oishi 7328c2e2d7 win-dshow: Fix audio output mode not showing up 2016-06-05 00:27:28 +09:00
jp9000 e460dfeb83 win-dshow: Add 'deactivate when not showing' option
Useful for two purposes:

1.) When many devices are hooked up to the system and used in separate
scenes, but only one device active at once is desired

2.) Allows users who are dependent on outputting audio to desktop to
disable that audio (via disabling that device) when the device isn't
being displayed
2016-04-03 15:55:15 -07:00
jpk dd75f1a661 win-dshow: Add support for Y800 video format (grayscale)
Add support for devices that can output in grayscale (Y800).
2016-03-24 03:34:05 -07:00
jp9000 c431e0434c win-dshow: Pass proper range value to frame
The "full_range" member variable of the video frame was being passed
"false" each time even though it may not necessarily be set to partial
range
2016-01-27 15:07:15 -08:00
jp9000 cd97ce2a17 libobs: Add source output flag OBS_SOURCE_DO_NOT_DUPLICATE
Certain types of sources (display captures, game captures, audio
device captures, video device captures) should not be duplicated.  This
capability flag hints that the source prefers references over full
duplication.
2016-01-26 11:49:50 -08:00
jp9000 6285a47726 (API Change) libobs: Pass type data to get_name callbacks
API changed from:
obs_source_info::get_name(void)
obs_output_info::get_name(void)
obs_encoder_info::get_name(void)
obs_service_info::get_name(void)

API changed to:
obs_source_info::get_name(void *type_data)
obs_output_info::get_name(void *type_data)
obs_encoder_info::get_name(void *type_data)
obs_service_info::get_name(void *type_data)

This allows the type data to be used when getting the name of the
object (useful for plugin wrappers primarily).

NOTE: Though a parameter was added, this is backward-compatible with
older plugins due to calling convention.  The new parameter will simply
be ignored by older plugins, and the stack (if used) will be cleaned up
by the caller.
2015-09-16 09:21:12 -07:00
jp9000 bdc1a052fe win-dshow: Fix mingw compiler errors/warnings 2015-07-11 14:26:52 -07:00
jp9000 e30255fbee win-dshow: Log device info on update
Logs all device settings on update
2015-07-06 17:03:41 -07:00
jp9000 5492c02e0b win-dshow: Add audio output mode options
This allows the ability to output the audio of the device as desktop
audio (via the WaveOut or DirectSound audio renderers) instead of
capturing the audio only.

In the future, we'll implement audio monitoring which will make this
feature obsolete, but for the time being I decided to add this option as
a temporary measure to allow users to play the audio from their devices
via the DirectShow output.
2015-06-05 10:49:50 -07:00
jp9000 13051da0e8 win-dshow: Add option to allow vertical flip
I'm putting this option in due to the fact that there are legitimate
cases where a device may flip the output unexpectedly (such as the
Datapath VisionDVI-DL running in RGB video format), and that a user may
want to be able to view the source in a projector or source properties
without the image being inverted.

My original line of thinking was that they can just use a transform to
flip the image, but I felt this problem impacts rendering everywhere,
such as in the projector and in the source properties, so having it as
an option in the source itself feels like the best way to ensure that a
user can get it to render everywhere properly.
2015-04-13 15:13:45 -07:00
jp9000 21deb26557 win-dshow: Ensure autoselected FPS updates formats
Fix an issue where if the FPS property is set to "Match Output FPS" it
will not show all the available video formats.
2015-04-10 07:27:30 -07:00
jp9000 24053f4a9c win-dshow: Fix bad settings causing frozen video
If the settings are reset to defaults or if the settings are just bad,
the video would get stuck on the last frame that was displayed, which
feels a bit awkward.  Best to make it stop video output entirely rather
than get stuck on the last video frame.
2015-03-22 19:18:16 -07:00
jp9000 d5631dd1f8 win-dshow: Make devices active by default
Having devices not active by default may cause confusion for some users.
2015-03-22 19:18:16 -07:00
Martell Malone f079bc9f7f win-dshow: Reorder CapsMatch for gcc 2015-02-14 19:14:27 +00:00
jp9000 c90e55739f win-dshow: Allow overriding of color space/range
Certain devices may have a different color space or color range than
they may report, so allow the user to set it manually themselves if they
so wish.
2015-02-11 13:10:55 -08:00
jp9000 7e0a86e583 win-dshow: Fix stack overflow bug
Martell changed this function without realizing that this was calling a
function below it, not recursively calling itself.  The reason why he
got the warning was because there was no forward declaration of the
function that was being called; I think he's used to C where only one
function definition can exist with the same name.  In this case, it was
another function with the same name but with different parameters,
something that's permitted in C++.  I wish I had realized this sooner.

This fixes the crashes people have been having with devices.
2015-02-11 13:10:54 -08:00
jp9000 0c1d121ff2 Remove various unused variables
Unused variables detected by mingw
2015-02-09 03:49:13 -08:00