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

111 Commits

Author SHA1 Message Date
PatTheMav
cfa0dc573e media-playback: Fix non-exhaustive switch statement 2023-02-18 15:22:33 -08:00
tytan652
918c0c0aeb deps/media-playback: Fix deprecation warning 2023-01-28 23:20:41 -08:00
pkv
ce2d1ffab7 obs-ffmpeg: Fix deprecation of channels member of several structs
This fixes deprecation warnings since the channels member of
AVCodecContext is marked as deprecated [1], as well as the channels
member of AVFrame [2].
In all instances where a warning appear, a switch to the new API is
done.
[1] lavc: switch to the new channel layout API
FFmpeg/FFmpeg@548aeb9
[2] Bump minor versions after the channel layout changes
FFmpeg/FFmpeg@cdba98bb80

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-10 19:37:07 -05:00
jpark37
d3bd511d4d media-playback: Fix crash on free
Need to call mp_decode_clear_packets before destroying orig_pkt in case
packet_pending is true.
2022-08-01 09:20:26 -07:00
jpark37
d8551e444b media-playback: Compute HDR colorspace
Figure out colorspace from TRC and primaries if necessary. AMF in
particular doesn't seem to provide full metadata.
2022-07-30 17:25:37 -07:00
tytan652
17ba8359e4 deps,libobs,plugins: Fix discarded-qualifiers warnings with FFmpeg 5 2022-07-22 08:50:36 -04:00
mvji
f0b3593349 deps/media-playback: Fix invalid seek at reset
When AVFormatContext->startime is set to AV_NO_PTS
mp_media_reset try to seek to INT64_MIN
use 0 instead.
Fix loop with aac file
2022-07-16 16:29:02 -07:00
jpark37
22fde5cdcd deps/media-playback: Fix metadata for hw_accel
av_hwframe_transfer_data doesn't seem to transfer metadata, so do it
manually.
2022-06-18 16:03:34 -07:00
jpark37
54f09fe6a7 deps/media-playback: Use metadata for HDR EETF
Used in situations where source luminance is greater than HDR nominal
peak setting to avoid clipping by applying BT.2408 maxRGB EETF.
2022-05-27 14:56:47 -07:00
jpark37
226249e1c3 deps/media-playback: Fix video looping
Previous FFmpeg deprecation fix, and optimization attempt causes short
videos to loop badly. Keep deprecation fix, and fix the rest later.

Fixes d528f6cafa
2022-05-21 15:28:08 -07:00
stopforumspam
3215189c97 deps/media-playback: Add support for FFmpeg options for media playback 2022-05-16 15:17:13 -04:00
Jim
952988d9ec
Merge pull request #6231 from mvji/prores_pix_fmt
Add support for GPU conversion of YUV422P10LE, YUV444P12LE, YUVA444P12LE
2022-05-04 02:01:27 -07:00
tytan652
865a358a52 media-playback: Fix unused-parameter warning 2022-05-04 01:37:10 -07:00
mvji
93490da4c2 obs-ffmpeg: Use YVYU for FFmpeg pix fmt YVYU422
This commit also modifies deps/media-playback and libobs.
2022-04-19 19:39:22 +02:00
mvji
5f35e73d8b deps/media-playback: Use YUV422 for planar 422 pix fmt
Instead of UYVY422
2022-04-19 19:39:05 +02:00
mvji
ae94c35152 obs-ffmpeg: Add support for YUV422P10LE, YUV444P12LE, YUVA444P12LE
This commit also modifies deps/media-playback
2022-04-19 19:38:28 +02:00
jpark37
05b673381f deps/media-playback: Add P010 to closest_format
Used by HDR media playback with hardware decode.
2022-04-18 05:23:13 -07:00
wangshaohui
d2fb302e5c deps/media-playback: Use avcodec_free_context to free AVCodecContext 2022-04-16 16:23:58 -07:00
jpark37
59dbc3eb81 libobs: Rename Rec. 2020 to Rec. 2100
Rec. 2020 is really an SDR spec, but I think HDR10 made it okay to slap
PQ on it, call it an HDR spec. Rec. 2100 came along after and formally
allowed the use of PQ/HLG, so we should use 2100 instead.
2022-04-10 00:13:52 -07:00
jpark37
6ed2edde71 deps/media-playback: Fix AVColorSpace usages
More completeness and consistency.
2022-04-09 21:20:10 -07:00
jpark37
007ed2c355 deps/media-playback: Add more accurate TRC hints
Allows us to tell the difference between HDR and high-precision SDR.
2022-04-08 17:19:23 -07:00
jpark37
848e128435 libobs,plugins: Replace video matrix function
video_format_get_parameters_for_format provides a more accurate matrix
than video_format_get_parameters.
2022-04-07 19:28:51 -07:00
wangshaohui
db8145e8a2 obs-ffmpeg, win-dshow, deps/media-playback: Use recommended API for AVCodecContext 2022-04-07 01:59:30 -07:00
jpark37
4ae3956010 deps/media-playback: Add I010/P010 support 2022-04-03 00:03:34 -07:00
mvji
c62dc7ffee obs-ffmpeg : use I422 for YUV422P input format
Avoid conversion to UYVY422 for 422P video input files (like dnxhd or xdcam422)
2022-03-26 21:05:45 -07:00
PatTheMav
dba1041034
deps: Update CMakeLists.txt for dependencies 2022-03-16 23:11:07 +01:00
jpark37
d528f6cafa deps/media-playback: New AVPacket pattern
FFmpeg has deprecated stack-allocated AVPacket objects, so make a pool
and use the new pattern instead.
2022-03-08 12:39:04 -08:00
pkv
50aec9c2a0 media-playback: Fix rist demuxing
We currently pass a 'buffer_size' option to avformat in bytes.
Unfortunately, avformat/librist.c admits an option with the same name but in milliseconds.
The default values set in the UI (2 MB) go beyond the range admitted in ms (0-30 000)
so avformat issues errors.
This fix disables the option when rist protocol is detected.

Signed-off-by: pkv <pkv@obsproject.com>
2022-01-14 20:50:14 -08:00
Ryan Foster
ce734366bc obs-ffmpeg: Respect AVFormatContext and AVOutputFormat constness
AVFormatContext::oformat was made const on April 27, 2021 [1]. If we
respect the constness of AVOutputFormat and do not cast results from
FFmpeg functions to non-const, we cannot modify the results after the
fact. Our choices are either to cast them to non-const (and presumably
have them implicitly casted back to const on later function calls), or
only try to modify the results in versions of FFmpeg where these are not
expected to be const.

Instead of relying on casts, we can set the encoder values in the
ffmpeg_cfg struct, which are later passed to new_stream.

Also modifies deps/media-playback. Removes compiler warnings.
Some avformat functions return const AV(In/Out)putFormat per [1], so
ifdef as needed.

[1]: 56450a0ee4
     lavf 59.0.100 avformat.h
     avformat: Constify the API wrt AV(In|Out)putFormat

     Also constify AVProbeData.
2021-11-23 12:10:25 -05:00
Eric Lindvall
ef34a5f765 deps/media-playback: Handle discontinuities to fix video stalls
If there is a PTS discontinuity in the playback stream that causes the PTS to
reset, it is likely that new audio frames will come in while there are still
video frames waiting to be dequeued. This will cause the audio frames to be
played while the video frames wait for the PTS to get back up to where they
were before the discontinuity.
2021-09-11 22:28:53 -07:00
jp9000
1d44ace7d0 deps/media-playback: Fix trailing whitespace 2021-08-15 10:59:03 -07:00
wangshaohui
decd3c2678 deps/media-playback: Fix bug about audio without best_effort_timestamp 2021-08-15 06:11:03 -07:00
jpark37
976d76dfbd deps/media-playback: Less accurate sleep
Avoid busy-wait for media sources by not caring about sleep precision.

Reduces CPU usage in status bar from 1.1% to 0.8% on my machine.
2021-08-15 00:12:14 -07:00
jpark37
c021338ceb libobs,deps/media-playback: Avoid bitfields
Use unused padding of obs_source_frame/obs_source_frame2 instead.
2021-06-11 07:02:37 -07:00
jpark37
ce6f233e2d deps/media-playback: Plumb linear alpha flag 2021-06-04 19:04:08 -07:00
Eric Lindvall
3c76fc4ddb obs-ffmpeg: Enable macOS hardware decoding for media source
Reverts  c7395b05ec
2021-03-30 03:45:06 -07:00
jp9000
f8cc3bfe01 deps/media-playback: Fix audio segment duration calc
With certain audio encoders, gaps can be introduced into the audio
packets, causing the audio duration to be miscalculated because it
calculated audio duration based upon the PTS of the current packet to
the last packet. However, this audio encoder also did not store
timestamps for most of its audio packets, causing PTS values to be
calculated based upon duration values. So those two things combined
caused audio timestamps to go all out of whack when playing back certain
videos with the media source. This is particularly prevalent with WMV
files using Microsoft codecs.

So to fix it, when the duration needs to be calculated, just calculate
the duration based upon the sample count of the audio packet. This fixes
the issue with the video in question that caused problems, and likely
fixes issues in a lot of videos that may have been floating out there
for some time. Basically this is a fix for a potential long-standing
issue.

Closes obsproject/obs-studio#3683
2020-11-15 04:57:41 -08:00
Exeldro
1c774008b4 deps/media-playback: Fix time at non-standard speeds 2020-09-24 01:15:57 -07:00
Richard Stanway
5889e2905e CMake: Set PIC for all library targets
Fixes https://github.com/obsproject/obs-studio/issues/3436
2020-09-09 01:55:50 +02:00
nkmerrill
a5656d12b4 deps/media-playback: Fix fast-forward after reset
Fixes #3341 by ensuring timestamps are reset after pausing.
2020-09-07 19:50:40 -06:00
Jim
86147d9719
Merge pull request #3415 from jpark37/default-color-space
Unify color space settings as 709
2020-09-07 13:29:44 -07:00
jp9000
2ac1ad5290 deps/media-playback: Fix pause continually running loop
Fixes an issue where when paused, the thread loop would continue to
repeat endlessly until unpaused.
2020-09-07 12:36:40 -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
Jim
bfdf5dc947
Merge pull request #2356 from jpark37/sycc-color-space
Color space refinements
2020-08-05 08:58:21 -07:00
jp9000
bff7ae89ad deps/media-playback: Add seek callback
Allows setting the current frame directly when seeking. If not set, will
just use preload if avaialble.
2020-07-29 13:59:49 -07:00
jp9000
83913e1d31 deps/media-playback: Don't EOF while paused and seeking
Fixes a bug where playback would completely stop when manually seeking
to the end of the file. Playback should not officially stop until
playback has unpaused.
2020-07-21 16:40:33 -07:00
Exeldro
7a33167769 deps/media-playback: Preload video when seeking paused 2020-07-20 14:23:13 -07:00
jpark37
f8cae4639e deps/media-playback: Remove unused #define 2020-07-18 23:33:21 -07:00
jpark37
24e18c73f5 media-playback: Leverage VIDEO_CS_SRGB
Doesn't change much now, but may someday.
2020-07-18 19:44:13 -07:00
jp9000
56e56cd265 deps/media-playback: Reset TS when seeking
If seeking occurs too close to the previous time value, it could cause
the playback to delay an abnormal amount of time, or if the time value
is under the previous value, then it would cause an assert.  So instead,
reset the next timestamp value to be instant in both cases if a seek
occurs to ensure timely playback.
2020-07-16 19:00:01 -07:00