AprilAndFriends / theoraplayer

A multi-threaded C++ library that plays video files supporting multiple codecs across platforms. Easy to use, fast, responsive, abstract interface and minimal dependencies, you'll soon be wondering how you lived without it! ;) Audio and Video interfaces are completely abstracted so the library can be used anywhere, regardless of what you use to display video frames and play audio samples (eg. OpenGL / OpenAL, Direct3D / DirectSound?, SDL / SDL_mixer, X11 / alsa ...) The library can pre-cache video frames and decoded audio samples for maximum efficiency and smooth playback, even on single-cpu systems. Currently, the library supports Theora on Windows, Mac, iOS, Linux, Android, WinRT and Windows Phone. H.264 is supported on Mac and iOS.
BSD 3-Clause "New" or "Revised" License
84 stars 43 forks source link

User should have possibility to update each individual clip manually #15

Closed AndriyAstakhov closed 7 years ago

AndriyAstakhov commented 7 years ago

VideoClip::_update() function made public and renamed to VideoClip::update(). User should have possibility to update each individual clip manually instead of always be forced to use Manager::update() for all clips at once. VideoClip::update() is used to be in public section until commit 49bf03bc06482e54f1e8ac240bdfa3731f561cbc.

borisblizzard commented 7 years ago

Kreso, what do you think? I think it's fine.

kspes commented 7 years ago

Um, guys, I'm not sure this is good. This could cause a thread safety isssue. The manager calls this in another thread (locked by workMutex.)

It's ok if you know what you're doing, but maybe we should leave _update() and make a threadSave update()?

@Boris: don't merge pull requests before we reach an unanimous decision.

AndriyAstakhov commented 7 years ago

It's ok if you know what you're doing, but maybe we should leave _update() and make a threadSave update()?

I think this is good idea to have threadSaveUpdate() function since some of library users (e.g. me :) ) really need possibility to update (or not update) each clip manually based on game logic.

kspes commented 7 years ago

agreed :) But would you prefer to use the threadSafeUpdate() or does your logic rely on directly updating the video clips without the video manager maybe?

AndriyAstakhov commented 7 years ago

Since all calls in my game engine to the library is from one thread (thus avoiding thread safety issue you've mentioned before) I just call GetVideoClip()->update(dt); directly without using Manager.

borisblizzard commented 7 years ago

@kspes Sure, no problem. The merge request's just been out there for a while so I assumed you had nothing against it since you didn't say anything.