0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
Commit Graph

50 Commits

Author SHA1 Message Date
jp9000
65d38864b6 deps/media-playback: Fix formatting 2020-02-01 21:51:20 -08:00
Jim
4cae7c55a1
Merge pull request #2300 from cg2121/media-pause-seek
media-playback: Add functions to pause/seek media source
2020-01-30 18:30:36 -08:00
Jiaxun Yang
6366f6ab59 libobs: Build SIMDE on platforms without SSE2
SIMDE was introduced for aarch64 support, however, the library itself
supports non-SIMD fallback, which allows us provide support to other
platforms without code changes.

There is another world beyond x86. So we can simply enable SIMDE for
processors without SSE2 support.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
2020-01-22 15:41:15 +08:00
Clayton Groeneveld
f24c1004c1 media-playback: Add functions to pause/seek media source 2020-01-12 01:08:01 -06:00
pkubaj
03ab727495 CMake: Fix build on ppc64
ppc64le was fixed before, but ppc64 (big-endian) was still failing.
2020-01-04 02:19:38 -08:00
Jim
2a6baf9886
Merge pull request #2069 from pgwipeout/aarch64
Enable Aarch64 support via SIMDe
2019-11-25 23:56:43 -08:00
jp9000
9826528c31 deps/media-playback: Don't use interrupt cb for local files
This fixes an issue where local files were using the avformat interrupt
callback, which is only supposed to be use to prevent blocking on
network calls.
2019-11-25 23:04:06 -08:00
jp9000
2fae85ab4a deps/media-playback: Don't exit thread on AVERROR_EXIT
The interrupt callback is designed to prevent the media source from
blocking; FFmpeg will internally call it periodically to prevent FFmpeg
function calls from blocking too long, and allow the caller to determine
whether blocking should stop.

The problem with this however is that AVERROR_EXIT causes the thread to
completely exit.  This fixes it so that it treats it as an EOF rather
than as an abnormal error.
2019-11-25 23:04:06 -08:00
Peter Geis
64d0b7fcb4 libobs: Enable compilation on aarch64
Add arch checks to enable aarch-compat layer on aarch64, retain normal
gcc intrinsics on x86 and ppc64.
2019-11-25 13:04:21 -05:00
jp9000
86572935af deps/media-playback: Remove cuda for hardware decoding
Cuda appears to be a bit buggy and can result in corruption where as
it's not being seen with other hardware decoders.  Remove cuda for now
as a hardware decoder to prevent the possibility of corruption.
2019-08-29 12:06:55 -07:00
jp9000
43957286d7 deps/media-playback: Fix hw decode dropping last few frames
Fixes a bug where hardware frames would not transfer to RAM for the last
few frames of a video.  The 'ret' variable can be 0 even though there
are still frames ready.
2019-08-29 11:55:49 -07:00
VodBox
c2a2bc5e40 deps/media-playback: Use hwaccel with non-alpha WebM files 2019-08-27 22:57:59 -07:00
jp9000
707f83f57d deps/media-playback: Fix memory leak
The hardware accelerated decoder context needs to be explicitly unrefed
when it's no longer in use, otherwise it and many resources associated
with it will leak.
2019-08-24 18:15:25 -07:00
jp9000
94581952b5 deps/media-playback: Fix hw accel decode crash
When hardware accelerated decoding is enabled, sometimes it can't
initialize for whatever reason, so it will fall back to software on its
own.  When this occurs, it will not use the hardware pixel format on the
frame; instead it will defer to a standard format on the frame.  So if
the frame format does not match the expected format, assume software
decoding.  (This was also what the hw-decode.c FFmpeg example did if the
format did not match the expected format)
2019-08-24 18:12:02 -07:00
Jim
444991ba21
Merge pull request #2021 from jpark37/yuva-format
Add support for YUV alpha formats
2019-08-11 20:38:17 -07:00
jpark37
1e87df89bb deps/media-playback: Convert YUV alpha formats to RGB on GPU
I40A -> RGBA, 1080p, CPU
swscale (MMX), Intel i7-6700: 1910 us -> 0 us

GPU measurements used Intel GPA with SetStablePowerState.

I40A -> RGBA, 1080p, GPU
Intel HD Graphics 530: 0 us -> 677 us
NVIDIA RTX 2080 Ti: 0 us -> 43 us
2019-08-11 11:26:52 -07:00
jpark37
6600bd13ea deps/media-playback: Add missing header to CMake 2019-08-11 07:27:42 -07:00
jp9000
68a5a40df9 libobs, obs-ffmpeg, win-dshow: Fix FFmpeg 4.0 deprecation
Fixes FFmpeg 4.0 deprecation warnings.
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
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
James Park
df05f65d63 deps/media-playback: YUV444P support
Use libobs for YUV444P conversion previously handled by FFmpeg. This
ensures the libobs path resists rot.
2019-04-11 23:00:04 -07:00
J Lynn
36a6629e6b Add support for building on PPC64LE using x86 Intrinsic Compat Shim 2018-12-17 05:33:16 +11:00
Exeldro
277b664001 obs-ffmpeg: Add speed percentage option
(Note: This commit also modifies the deps/media-playback module.)

Allows modifying the speed of local file playback.

Closes jp9000/obs-studio#1091
2018-02-15 15:18:13 -08:00
jp9000
dc0363d3e8 deps/media-playback: Use a struct for media init data
Instead of using countless parameters for the media initialization data,
use a structure.
2018-02-15 13:32:35 -08:00
jp9000
e7de41fc01 deps/media-playback: Free frame data before freeing frame
Prevents a potential memory leak if data was previously allocated in the
frame.
2018-01-11 20:07:47 -08:00
jp9000
548f3fa9a9 deps/media-playback: Use avcodec_free_context when possible
A bit better handling that should prevent any possible memory leakage
due to any internal data allocated by FFmpeg.
2018-01-11 20:06:21 -08: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
pkviet
89bc6bdc03 deps/media-playback: Fix compilation with older FFmpeg versions
Fixes an issue where media-playback would not compile with older FFmpeg
versions due to the fact that the AV_PIX_FMT_VIDEOTOOLBOX was
unavailable until version 54.31.100 of libavutil (FFmpeg 2.8).

Fixes mantis issue 1045.

Closes jp9000/obs-studio#1089
2017-12-02 09:09:26 -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
pkviet
d670d7badb libobs: Fix FFmpeg constants
(This commit also modifies the deps/media-playback, obs-ffmpeg, and
win-dshow modules)

More fixes due to ffmpeg renaming some constants and deprecating
AVFMT_RAWPICTURE and AV_PIX_FMT_VDA_VLD.
Latter replaced by AV_PIX_FMT_VIDEOTOOLBOX per ffmpeg dev advice.

Closes jp9000/obs-studio#1061
2017-11-16 21:38:37 -08:00
Richard Stanway
c571ba469b deps/media-playback: Use new ffmpeg constants 2017-10-26 19:16:49 +02:00
jp9000
c9182a9878 obs-ffmpeg: Fix potential seek issues with media source
(This commit also modifies deps/media-playback)

Before, the media-playback library would detect whether something was
seekable by checking the filename for "://", which is unideal because
there are other cases where targets may not be seekable.  So instead, an
explicit "seekable" property (off by default) is now in place in the
media source when not in "local file" mode.  Seeking will only be
enabled if local file mode is on, or if "seekable" is explicitly checked
by the user.

Closes jp9000/obs-studio#1022
2017-09-17 05:55:56 -07:00
jp9000
f4a1ee3658 deps/media-playback: Add concat playback support
Allows using a makeshift playlist file with media playback.
2017-08-03 02:07:58 -07:00
jp9000
d5adfff978 deps/media-playback: Fix playback reset fail after stop
The recent changes in 88ae9af causes av_read_frame to check for
m->stopping, and fail with AVERROR_EXIT if true, which would happen
after each reset.  Moving mp_media_prepare_frames to a line after
m->stopping is reset to false fixes the issue.
2017-06-14 08:20:30 -07:00
jp9000
3f5920ae5d deps/media-playback: Fix AV_NOPTS_VALUE being used as timestamp
With certain media files (wmv in particular), the very last frame will
have a timestamp of AV_NOPTS_VALUE.  This could cause the media to stick
on that frame indefinitely.  Instead, use the estimated next timestamp
that was calculated in the previous frame.
2017-06-14 00:43:31 -07:00
jp9000
c1cf44fd91 deps/media-playback: Add timeout when waiting for frames
Media files that have a very low framerate or very long interval between
frames would cause the media playback to stall indefinitely until the
next frame is played.  This adds a 200ms timeout to ensure that the
media can be destroyed without being forced to wait indefinitely for the
next frame.
2017-06-14 00:39:10 -07:00
jp9000
88ae9aff6e deps/media-playback: Fix lockup issues
Certain functions such as avformat_open_input and av_read_frame can
block, causing the program to someone wait very long periods of time
when a network URL is used with the media source.  The
interrupt_callback member variable in AVFormatContext allows safely
canceling IO operations when trying to shut down or stop the
media-playback interface.
2017-06-04 00:44:04 -07:00
jp9000
f0ff1c481d deps/media-playback: Call stop callback on failure 2017-05-29 19:30:14 -07:00
jp9000
892a6548e7 obs-ffmpeg: Add network buffering property
(Note: This commit also modifies deps/media-playback)

Allows buffering network-based media sources where supported.  Default
is two megabytes of buffering.
2017-05-29 19:30:13 -07:00
jp9000
0302a4e7f7 deps/media-playback: Start decoding regardless of keyframe
Currently, when media-playback is used with a network address, video has
to wait for the first keyframe before it starts decoding.  This is
probably not wise because the first packet of video may contain
additional header information, and because audio is forced to wait and
buffer while waiting for a keyframe, potentially causing a lot of audio
to get backed up unnecessarily which could inadvertently cause sync or
audio playback issues.

So, instead of waiting for a keyframe before decoding starts, decode
right away, and make it wait for a keyframe before calling the video
callback instead.
2017-05-29 19:30:12 -07:00
jp9000
ea6bdf58e0 deps/media-playback: Output av_read_frame error string 2017-05-29 19:30:11 -07:00
jp9000
4217f273a6 deps/media-playback: Fix bug where inverted media would crash
When media returns frames with negative linesizes, it means they're
inverted RGB formats and start from the last line of the image and move
back to the top via the negative linesize number.  This would cause a
crash because this wasn't being taken in to account, and it would
traverse in to invalid memory.
2017-05-20 11:14:58 -07:00
jp9000
4aea3ce7da deps/media-playback: Always check for new frame first
Fixes potential decoding errors with FFmpeg's new decode API.  Because
avcodec_send_packet may process multiple packets, you must call
avcodec_receive_frame continually until no more frames are left.
2017-05-17 17:10:32 -07:00
jp9000
d54b51edf4 deps/media-playback: Use new FFmpeg decode funcs when possible
Prevents potential decoding issues by relying on FFmpeg to manage
sub-packet handling.
2017-05-17 16:58:47 -07:00
jp9000
5ebec76b60 deps/media-playback: Discard packet returns of invalid sizes 2017-05-17 16:23:21 -07:00
jp9000
2b3d619c31 deps/media-playback: Init avformat in thread
Prevents the media playback object from locking the render thread.
2017-05-16 01:55:58 -07:00
jp9000
3b091b1668 deps/media-playback: Do not seek network streams
Will cause avformat to lock up perpetually on av_read_frame.
2017-05-16 01:54:39 -07:00
jp9000
a78daa8a1c deps/media-playback: Include SSE flags 2017-05-16 00:51:04 -07:00
jp9000
b2717132d9 deps/media-playback: Remove unnecessary logging
Failure to decode is unfortunately quite common with certain file types,
and is most of the time safely recoverable.  There's no reason to
actually output a log message for this unless really needed.
2017-05-15 15:17:13 -07:00
jp9000
2329c71dac deps: Add media-playback static lib
Intended to replace libff as the media playback library.  Intended to
use less threads and be more extensible.  It was nearly impossible to
modify libff without bursting a vein.
2017-03-31 12:10:31 -07:00