Commit Graph

51 Commits (91c292d394d46856d5ab56fafec3e8650d524091)

Author SHA1 Message Date
jp9000 cffbdd6408 obs-ffmpeg: Add proc handler function to get media duration
Allows getting the duration of a video via the proc handler of the
source.
2017-07-19 16:23:06 -07:00
Jim cfe77fdaae Merge pull request #938 from admshao/incompatible-pointer-types
plugins: Clear warnings about -Wincompatible-pointer-types
2017-07-01 10:37:32 -07:00
Shaolin e5756a922a libobs/plugins/UI: Suppress unused variables warnings
Closes jp9000/obs-studio#937
2017-06-27 21:55:37 -07:00
jp9000 d295ad3ed3 obs-ffmpeg: Remove "Buffering (MS)" property
There's no need to display this property at the moment, the default
amount is more than sufficient for most cases.  That and most people
wouldn't know what to do with it anyway.
2017-06-22 00:58:45 -07:00
jp9000 b787c796cd obs-ffmpeg: Do not precache if set to close when inactive
In the media source, do not pre-cache frames if the source is set to
close the file when inactive because that setting is designed to allow
the file to be replaced by the user.  If it's replaced, it can
unintentionally keep the old precache frame, playing the frame from the
older video when it starts up.
2017-06-19 22:58:01 -07:00
jp9000 054148a0af obs-ffmpeg: Don't preload media frames if set to pause on end
Preloading is designed to overwrite the current internal render texture
of the source so it'll be ready to play the first frame right when the
source is first displayed.

However, When the media source is set to pause on the last frame, it
keeps that current render texture visible, so preloading it with the
first frame will essentially overwrite the current render, causing it to
inadvertently show and pause on the first frame rather than the last
frame.  So instead, just disable preloading when the user has it set to
pause on the last frame.
2017-06-14 08:30:44 -07:00
Shaolin cfcb2f4f39 plugins: Clear warnings about -Wincompatible-pointer-types
Signed-off-by: Shaolin <admshao@gmail.com>
2017-06-01 05:25:55 -03: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 c7395b05ec obs-ffmpeg: Disable media source HW accel. for now
Due to a noticeable frequency of crashes inside of FFmpeg when using
hardware encoding on mac, this feature is going to be disabled for now
pending more investigation at a later time.
2017-05-18 23:42:01 -07:00
jp9000 514387f7cd obs-ffmpeg: Always close network sources when inactive 2017-05-16 01:58:18 -07:00
jp9000 65c344d75d obs-ffmpeg: Only preload frames for local files 2017-05-16 01:58:01 -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 8962899b77 obs-ffmpeg: Add signal/proc to restart media playback
A convenient feature if the user wants to trigger the media to play back
on the fly for whatever reason.
2017-05-10 19:54:03 -07:00
jp9000 8f4f38c30e obs-ffmpeg: Fix bug on non-MSVC compilers
This happens because the enum had the incorrect name, and microsoft
automatically treats all enums as integers in C, regardless of whether
they actually exist or not.  Microsoft makes terrible compilers and
whoever decided this was a good idea should be fired.
2017-03-31 12:45:47 -07:00
jp9000 1d69e359ec obs-ffmpeg: Always open on update unless set otherwise 2017-03-31 12:30:10 -07:00
jp9000 9174ba8403 obs-ffmpeg: Remove unnecessary open call 2017-03-31 12:28:10 -07:00
jp9000 45d029b1fb obs-ffmpeg: Change from libff to media-playback 2017-03-31 12:10:32 -07:00
jp9000 a47ef76bd5 obs-ffmpeg: Do not use HW accel by default on mac
Due to crashes being caused by hardware acceleration in the media source
on mac, disable hardware acceleration of the media source being on by
default for the time being.
2017-02-06 15:10:02 -08:00
Richard Stanway 65fcd20242
libff: Improved handling of EOF in the decoder threads
(Also modifies obs-ffmpeg to handle empty frames on EOF)

Previously the demuxer could hit EOF before the decoder threads are
finished, resulting in truncated output. In the worse case scenario the
demuxer could read small files before ff_decoder_refresh even has a chance
to start the clocks, resulting in no output at all.
2016-04-28 23:58:28 +02:00
jp9000 1faaba73b0 obs-ffmpeg: Allow user to set color range on media source 2016-04-03 21:54:02 -07:00
jp9000 2fa7ef5807 obs-ffmpeg: When browsing files, start from last file dir 2016-03-21 21:22:24 -07:00
jp9000 74c78c1f13 obs-ffmpeg: Fix media source starting even if not active
If the media source is set to restart on activation, it also shuts down
when not active.  However, it would *always* start regardless of
active/inactive when the source is first created.  It shouldn't do that,
it should start up only when it becomes active.
2016-02-04 10:58:26 -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 22885713b0 obs-ffmpeg: Add "restart when active" media source property
Adds the option of making the media file restart when the source becomes
active (such as switching to a scene with it).

Due to lack of libff features to start/stop/pause/seek media files,
currently this just destroys the demuxer and recreates it.  Ideally,
libff should have some functions to allow a more optimal means of doing
those things.
2016-01-26 11:49:26 -08:00
jp9000 419d6b1a22 obs-ffmpeg: Refactor media source properties
Reactors a bit of code related to starting up FFmpeg and makes it so the
initial view for the media source's properties displays the most
commonly desired settings.

Instead of the media source properties showing the URL mode by default
along with a whole bunch of properties that are confusing to most users,
starts on file mode and changes defaults to be a bit more sensible
related to file input.

Also, as a temporary measure for fixing color format issues (some video
files would display their color information incorrectly), forced format
conversion is now enabled by default, and has been moved to advanced
settings.  Ideally, the actual bug causing color format issues in either
media-io or libff should be fixed at some point.
2016-01-26 11:49:26 -08:00
jp9000 df4f0c4142 obs-ffmpeg: Fix media source file filter
When browsing for a file, it would also just use *.* for the file
filter, which is a pain to use.  This has been changed to use a
reasonable file filter related to common video/audio files so you don't
have to wade through non-media files just to select a media file.  A
filter to show all files is still available as well.
2016-01-26 11:49:25 -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
Mathias Panzenböck b266b563fa obs-ffmpeg: Fix compile error
This fixes the compile error: "'AVDISCARD_NONINTRA' undeclared" when
using a libavcodec version earlier than 55.67.100.

Closes jp9000/obs-studio#469
2015-09-12 22:14:24 -07:00
John Bradley 6e69b0f4f0 obs-ffmpeg: Move log callback up to plugin scope 2015-08-14 07:53:51 -07:00
John Bradley d04fbd7549 obs-ffmpeg: Log source info on update/create
Adds a log message whenever the source is created or updated
containing all the properties set to help debugging remote
users' problems.
2015-08-14 07:53:50 -07:00
John Bradley 78d5240e18 obs-ffmpeg: Add more informative logging to source 2015-08-14 07:53:48 -07:00
John Bradley 207203d104 obs-ffmpeg: Normalize ffmpeg source argument name 2015-08-14 07:53:47 -07:00
John Bradley 59482ec29b obs-ffmpeg: Normalize video frame method arguments 2015-08-14 07:53:46 -07:00
kc5nra 34cc2438c1 obs-ffmpeg: Output ffmpeg messages line by line 2015-08-14 07:53:45 -07:00
jp9000 4d75c888a3 obs-ffmpeg: Use timestamps from video/audio frames
Instead of using system timestamps for playback, use the timestamps
directly from the video/audio data to ensure all the data is synced up
using the obs_source back-end.

I think the original misconception when this was written was that OBS
would not handle timestamp resets/loops, which isn't the case; it will
actually handle all timestamp resets and abnormalities.  It's always
best to use the obs_source back-end for all playback and syncing.
2015-06-10 09:44:25 -07:00
Ethan Lee fd4f2e29aa Buildfix for older FFmpeg versions (F20 RPMFusion) 2015-04-01 06:50:22 -04:00
John Bradley fc596f6141 obs-ffmpeg: Fix spurious bad channel layout
Some formats (like WMV) would send out audio packets that
had channels set but did not specify a channel layout.
Solution is to no longer rely on channel layout to get the
channels and just get the channel count directly off the
FFmpeg audio frame.
2015-03-30 10:59:59 -05:00
kc5nra dd2d6494a1 obs-ffmpeg: Add clear on media end option
Clears source video when the media stream ends.
2015-03-24 00:21:24 -05:00
kc5nra c7ad555eae obs-ffmpeg: Handle null frames in frame callbacks
This is in preparation of an API change that will send null
frames to signal the end of the media being played.
2015-03-24 00:16:35 -05:00
kc5nra b091b03291 obs-ffmpeg: Split definition and assignment 2015-03-24 00:12:10 -05:00
kc5nra 54baa1a369 obs-ffmpeg: Change from sws_* cacheing to our own
Since sws_getCachedContext possibly logs a message every
time it is used (depending on the input), use our own caching
logic to minimize log spam.
2015-03-23 22:14:42 -05:00
John Bradley d69f03c6a5 obs-ffmpeg: Use deferred update flag for properties 2015-03-19 16:02:24 -05:00
John Bradley c539c16ecc obs-ffmpeg: Instead of failing with unsupported CS, use default 2015-03-19 14:40:24 -05:00
John Bradley 52aae96f74 obs-ffmpeg: Add alias of CS601 support 2015-03-19 14:40:24 -05:00
John Bradley 17f8e3c58b obs-ffmpeg: Add frame drop controls to the ffmpeg source UI 2015-03-19 14:40:24 -05:00
John Bradley f23d958122 obs-ffmpeg: Cache picture buffer in the same way as sws context 2015-03-10 14:37:28 -05:00
John Bradley baea0f583a obs-ffmpeg: Remove extra curly braces 2015-03-10 14:34:37 -05:00
John Bradley a73c15ae16 obs-ffmpeg: Fix bug where update_sws_context result not checked 2015-03-10 14:33:21 -05:00
John Bradley e13bb8f479 obs-ffmpeg: Cache swscale context during frame callback
Some codecs don't report the correct dimensions until the first
frame is rendered.
2015-03-10 12:53:17 -05:00
John Bradley 0e944735e0 obs-ffmpeg: Fix error fetching properties from wrong pointer 2015-03-10 12:25:24 -05:00