mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Merge pull request #2854 from IvanSavenko/video_player_fix
Fix looped playback of video files
This commit is contained in:
commit
f50f32fade
@ -17,6 +17,7 @@
|
||||
#include "renderSDL/SDL_Extensions.h"
|
||||
#include "CPlayerInterface.h"
|
||||
#include "../lib/filesystem/Filesystem.h"
|
||||
#include "../lib/filesystem/CInputStream.h"
|
||||
|
||||
#include <SDL_render.h>
|
||||
|
||||
@ -367,7 +368,8 @@ void CVideoPlayer::update( int x, int y, SDL_Surface *dst, bool forceRedraw, boo
|
||||
show(x,y,dst,update);
|
||||
else
|
||||
{
|
||||
open(fname);
|
||||
VideoPath filenameToReopen = fname; // create copy to backup this->fname
|
||||
open(filenameToReopen);
|
||||
nextFrame();
|
||||
|
||||
// The y position is wrong at the first frame.
|
||||
|
@ -15,7 +15,7 @@
|
||||
struct SDL_Surface;
|
||||
struct SDL_Texture;
|
||||
|
||||
class IVideoPlayer
|
||||
class IVideoPlayer : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
virtual bool open(const VideoPath & name, bool scale = false)=0; //true - succes
|
||||
@ -31,8 +31,6 @@ public:
|
||||
class IMainVideoPlayer : public IVideoPlayer
|
||||
{
|
||||
public:
|
||||
VideoPath fname; //name of current video file (empty if idle)
|
||||
|
||||
virtual void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true){}
|
||||
virtual bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false)
|
||||
{
|
||||
@ -55,14 +53,16 @@ public:
|
||||
|
||||
#ifndef DISABLE_VIDEO
|
||||
|
||||
#include "../lib/filesystem/CInputStream.h"
|
||||
|
||||
struct AVFormatContext;
|
||||
struct AVCodecContext;
|
||||
struct AVCodec;
|
||||
struct AVFrame;
|
||||
struct AVIOContext;
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
class CInputStream;
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
class CVideoPlayer : public IMainVideoPlayer
|
||||
{
|
||||
int stream; // stream index in video
|
||||
@ -74,6 +74,8 @@ class CVideoPlayer : public IMainVideoPlayer
|
||||
|
||||
AVIOContext * context;
|
||||
|
||||
VideoPath fname; //name of current video file (empty if idle)
|
||||
|
||||
// Destination. Either overlay or dest.
|
||||
|
||||
SDL_Texture *texture;
|
||||
|
Loading…
Reference in New Issue
Block a user