Commit Graph

31 Commits

Author SHA1 Message Date
Alex Szpakowski fc4847c69d Update copyright for the new year 2020-01-03 22:40:36 -04:00
Bart van Strien cb625d890a Make sure luax_getfile always returns a retained value
Before it would return a retained value if it returned a freshly constructed file, and an unretained value otherwise.
Also update all (3) call sites, to correctly retain or release as needed.
2019-08-11 11:13:22 +02:00
Bart van Strien 7b7d03721c Prevent the currently displayed video frame from changing if the video is paused
If you'd seek while the video was paused, you'd see the next frame of the video.
2019-05-22 20:00:30 +02:00
Bart van Strien 064296a6ce Don't write intermediate frames to the backbuffer if catching up or seeking
There's no need to lock a mutex twice and copy the entire frame if we know
we'll just discard the data anyway.
2019-05-22 19:57:39 +02:00
Bart van Strien 1e8ab8ce1e Never seek video more than once when trying to catch up (issue #1472, issue #1438)
I'm not sure if this actually helps, because I haven't been able to reproduce
the issue so far, but at least this should make it less likely the decoder
thread ends up in an infinite loop.
2019-05-22 19:50:51 +02:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Bart van Strien 75e0caa0ff Faster video seeking
By using our current position (if known), we shrink the search area.

--HG--
branch : minor
2017-10-12 15:24:07 +02:00
Bart van Strien de945a528b Catch up on video faster
Previously every (internal) update the decoder would advance 0 or 1 frame. Now
it will advance until it catches up. Like before, if it takes too many steps
(5) before catching up, it seeks instead. This should mostly mean seeking
forwards has less latency.

--HG--
branch : minor
2017-10-12 15:20:38 +02:00
Bart van Strien 52ae68b288 Fixes for video files that do not have the video as first stream, and better EOS detection
--HG--
branch : minor
2017-10-12 15:11:15 +02:00
Bart van Strien 0e9f71b29a Split theora::VideoStream into OggDemuxer and TheoraVideoStream
This makes the internal API more modular, but the split also forces a cleaner
implementation. It also means the OggDemuxer is now responsible for the
ogg-specific stuff like seeking and (ogg-specific) type detection.

Backported from the love.video-vpx branch of love-experiments

--HG--
branch : minor
2017-10-12 14:23:58 +02:00
Alex Szpakowski 324ef8f690 Remove an unused variable.
--HG--
branch : minor
2017-08-27 10:45:06 -03:00
Alex Szpakowski b590edf27d Merge default into minor
--HG--
branch : minor
2017-04-30 00:37:26 -03:00
Bart van Strien bc8783869e Improved seeking support, especially for short video files
Support inter-page seeking, in case there are multiple packets per page.
Also support seeking in single-page files.
2017-02-19 16:22:00 +01:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Bart van Strien 9f6aa716fa Pass Type to luax_register_type by pointer instead of reference
Since the type is passed to va_start, and apparently that's undefined behaviour if it's a reference.

<Textmode> the best kind of behavior

--HG--
branch : dynamiccore2
2016-11-14 21:51:47 +01:00
Bart van Strien d967a755e5 Make love::Type handle type names
TODO: Fix undefined behaviour in luax_register_type, you can't use a va_list after a reference type

--HG--
branch : dynamiccore2
2016-11-14 21:06:53 +01:00
Bart van Strien 5d43c9601a Automatically deduce the type in luax_pushtype, if possible
--HG--
branch : dynamiccore2
2016-11-13 17:38:42 +01:00
Bart van Strien 7dd960619d Automatically deduce the type in luax_checktype, luax_getmodule, luax_optmodule and luax_totype
--HG--
branch : dynamiccore2
2016-11-13 17:13:40 +01:00
Bart van Strien c761202486 Build type information on first use (load-time), instead of using a hardcoded list
--HG--
branch : dynamiccore2
2016-11-13 16:38:57 +01:00
Alex Szpakowski b1b4a637b5 Fix a potential crash when a Thread ends (resolves issue #1219). 2016-10-08 10:50:50 -03:00
Alex Szpakowski 15ba27f417 Merge default into minor
--HG--
branch : minor
2016-10-08 11:03:37 -03:00
Bart van Strien f76879c6b7 New audio playback API
Instead of having three states, stopped, paused and playing, now there's only
two states: paused and playing.

This means resume() is gone, as is isStopped(), and isPaused() has become
isPlaying(). stop() now pauses and rewinds, whereas pause() only pauses.
rewind() has been removed, and should either be replaced with stop() or
seek(0).

The same has been applied to the functions in the love.audio module, except they
get some extra magic:

- love.audio.pause() now returns a table/list of Source objects, which contains
  only the sources it has just paused. This means you can then later restart
  only them, instead of everything (as before).
- love.audio.play/pause/stop now have variants that take a list of Source
  objects, and it starts or stops them all at the same time, this means calling
  play(srcA, srcB) should mean srcA and srcB are much more (but possibly not
  exactly) synchronised than they were with play(srcA); play(srcB).

--HG--
branch : minor
2016-04-02 17:38:19 +02:00
Bart van Strien 8dd7cc16ab Fix end-of-stream detection for videos
Fixes hang when a video file contains frames past the end of the video stream
2016-03-29 22:43:20 +02:00
Alex Szpakowski a0bbcce8ee The video decoding thread efficiently waits for a video to be created before doing anything, rather than sleeping for 2ms in a loop. Reduces the CPU usage of the video worker thread to ~0% when no videos are loaded. 2016-03-05 21:56:51 -04:00
Alex Szpakowski f51bbb8462 Cleaned up some StrongRef-related code. 2016-03-01 18:57:17 -04:00
Alex Szpakowski cf4b409302 Renamed some things. 2016-02-18 22:11:41 -04:00
Bart van Strien f53e0026ab Make VideoStream::isPlaying return false when EOS has been reached
Before it would return the playing status of the FrameSync, but a DeltaSync doesn't stop at the end of the video, now it returns the least of the FrameSync and the EOS condition
2016-01-05 21:45:44 +01:00
Bart van Strien 2313f3091a Improve seeking, hopefully fix hangs on shutdown
Instead of returning the frame past our target, now return the frame for our target.
Also defer to rewind implictly, rather than explicitly.
Lastly, detect seeking past the end of the stream, and set EOS appropriately.
2016-01-05 17:48:44 +01:00
Alex Szpakowski 46a2e7b85c Happy new year! 🎉 2016-01-01 00:05:06 -04:00
Bart van Strien 22f2175bec Add initial video playback support for Ogg Theora videos (resolves issue #66.)
The basic APIs are:

video = love.graphics.newVideo("myvideo.ogv")

love.graphics.draw(video, ...) -- Video objects are Drawables.

video:play(), video:pause()

video:getDuration(), video:tell(), video:rewind(), video:seek(seconds)

video:getSource()

video:getWidth(), video:getHeight(), video:setFilter(min, mag)

More advanced APIs include video:setSource(source), video:getStream(), and videostream:setSync.

To use a custom pixel shader when drawing a Video, call the new TexelVideo(texcoords) function instead of Texel(texture, texcoords) in order to get the pixel colors of a video frame.
2015-12-08 22:41:19 -04:00