- proper implementation of video repeat (looping)
This commit is contained in:
parent
c4ead34ad3
commit
c33c1826ae
|
@ -4571,6 +4571,7 @@ void Game::playStreamingVideo(const string &playVideo) {
|
||||||
screen->w,
|
screen->w,
|
||||||
screen->h,
|
screen->h,
|
||||||
screen->format->BitsPerPixel,
|
screen->format->BitsPerPixel,
|
||||||
|
false,
|
||||||
vlcPluginsPath,
|
vlcPluginsPath,
|
||||||
SystemFlags::VERBOSE_MODE_ENABLED);
|
SystemFlags::VERBOSE_MODE_ENABLED);
|
||||||
}
|
}
|
||||||
|
@ -4596,6 +4597,7 @@ void Game::playStreamingVideo(const string &playVideo) {
|
||||||
screen->w,
|
screen->w,
|
||||||
screen->h,
|
screen->h,
|
||||||
screen->format->BitsPerPixel,
|
screen->format->BitsPerPixel,
|
||||||
|
false,
|
||||||
vlcPluginsPath,
|
vlcPluginsPath,
|
||||||
SystemFlags::VERBOSE_MODE_ENABLED);
|
SystemFlags::VERBOSE_MODE_ENABLED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,6 +338,7 @@ void BattleEnd::initBackgroundVideo() {
|
||||||
screen->w,
|
screen->w,
|
||||||
screen->h,
|
screen->h,
|
||||||
screen->format->BitsPerPixel,
|
screen->format->BitsPerPixel,
|
||||||
|
true,
|
||||||
vlcPluginsPath,
|
vlcPluginsPath,
|
||||||
SystemFlags::VERBOSE_MODE_ENABLED);
|
SystemFlags::VERBOSE_MODE_ENABLED);
|
||||||
menuBackgroundVideo->initPlayer();
|
menuBackgroundVideo->initPlayer();
|
||||||
|
|
|
@ -526,6 +526,7 @@ Intro::Intro(Program *program):
|
||||||
screen->w,
|
screen->w,
|
||||||
screen->h,
|
screen->h,
|
||||||
screen->format->BitsPerPixel,
|
screen->format->BitsPerPixel,
|
||||||
|
false,
|
||||||
vlcPluginsPath,
|
vlcPluginsPath,
|
||||||
SystemFlags::VERBOSE_MODE_ENABLED);
|
SystemFlags::VERBOSE_MODE_ENABLED);
|
||||||
player.PlayVideo();
|
player.PlayVideo();
|
||||||
|
|
|
@ -128,6 +128,7 @@ void MainMenu::initBackgroundVideo() {
|
||||||
screen->w,
|
screen->w,
|
||||||
screen->h,
|
screen->h,
|
||||||
screen->format->BitsPerPixel,
|
screen->format->BitsPerPixel,
|
||||||
|
true,
|
||||||
vlcPluginsPath,
|
vlcPluginsPath,
|
||||||
SystemFlags::VERBOSE_MODE_ENABLED);
|
SystemFlags::VERBOSE_MODE_ENABLED);
|
||||||
menuBackgroundVideo->initPlayer();
|
menuBackgroundVideo->initPlayer();
|
||||||
|
|
|
@ -3857,6 +3857,7 @@ void MenuStateConnectedGame::initFactionPreview(const GameSettings *gameSettings
|
||||||
screen->w,
|
screen->w,
|
||||||
screen->h,
|
screen->h,
|
||||||
screen->format->BitsPerPixel,
|
screen->format->BitsPerPixel,
|
||||||
|
true,
|
||||||
vlcPluginsPath,
|
vlcPluginsPath,
|
||||||
SystemFlags::VERBOSE_MODE_ENABLED);
|
SystemFlags::VERBOSE_MODE_ENABLED);
|
||||||
factionVideo->initPlayer();
|
factionVideo->initPlayer();
|
||||||
|
|
|
@ -2744,6 +2744,7 @@ void MenuStateCustomGame::initFactionPreview(const GameSettings *gameSettings) {
|
||||||
screen->w,
|
screen->w,
|
||||||
screen->h,
|
screen->h,
|
||||||
screen->format->BitsPerPixel,
|
screen->format->BitsPerPixel,
|
||||||
|
true,
|
||||||
vlcPluginsPath,
|
vlcPluginsPath,
|
||||||
SystemFlags::VERBOSE_MODE_ENABLED);
|
SystemFlags::VERBOSE_MODE_ENABLED);
|
||||||
factionVideo->initPlayer();
|
factionVideo->initPlayer();
|
||||||
|
|
|
@ -45,6 +45,7 @@ protected:
|
||||||
|
|
||||||
bool stop;
|
bool stop;
|
||||||
bool finished;
|
bool finished;
|
||||||
|
bool loop;
|
||||||
|
|
||||||
VideoLoadingCallbackInterface *loadingCB;
|
VideoLoadingCallbackInterface *loadingCB;
|
||||||
ctx *ctxPtr;
|
ctx *ctxPtr;
|
||||||
|
@ -61,7 +62,7 @@ public:
|
||||||
string filenameFallback,
|
string filenameFallback,
|
||||||
SDL_Surface *surface, int x, int y,
|
SDL_Surface *surface, int x, int y,
|
||||||
int width, int height, int colorBits,
|
int width, int height, int colorBits,
|
||||||
string pluginsPath,bool verboseEnabled=false);
|
bool loop, string pluginsPath,bool verboseEnabled=false);
|
||||||
virtual ~VideoPlayer();
|
virtual ~VideoPlayer();
|
||||||
|
|
||||||
static void setDisabled(bool value) { disabled = value; }
|
static void setDisabled(bool value) { disabled = value; }
|
||||||
|
|
|
@ -412,7 +412,9 @@ VideoPlayer::VideoPlayer(VideoLoadingCallbackInterface *loadingCB,
|
||||||
string filenameFallback,
|
string filenameFallback,
|
||||||
SDL_Surface *surface,
|
SDL_Surface *surface,
|
||||||
int x, int y,int width, int height,int colorBits,
|
int x, int y,int width, int height,int colorBits,
|
||||||
string pluginsPath, bool verboseEnabled) : ctxPtr(NULL) {
|
bool loop, string pluginsPath, bool verboseEnabled)
|
||||||
|
: ctxPtr(NULL) {
|
||||||
|
|
||||||
this->loadingCB = loadingCB;
|
this->loadingCB = loadingCB;
|
||||||
this->filename = filename;
|
this->filename = filename;
|
||||||
this->filenameFallback = filenameFallback;
|
this->filenameFallback = filenameFallback;
|
||||||
|
@ -422,6 +424,7 @@ VideoPlayer::VideoPlayer(VideoLoadingCallbackInterface *loadingCB,
|
||||||
this->width = width;
|
this->width = width;
|
||||||
this->height = height;
|
this->height = height;
|
||||||
this->colorBits = colorBits;
|
this->colorBits = colorBits;
|
||||||
|
this->loop = loop;
|
||||||
this->pluginsPath = pluginsPath;
|
this->pluginsPath = pluginsPath;
|
||||||
//this->verboseEnabled = true;
|
//this->verboseEnabled = true;
|
||||||
this->verboseEnabled = verboseEnabled;
|
this->verboseEnabled = verboseEnabled;
|
||||||
|
@ -492,6 +495,11 @@ bool VideoPlayer::initPlayer(string mediaURL) {
|
||||||
ctxPtr->vlc_argv.push_back("--no-video-title-show");
|
ctxPtr->vlc_argv.push_back("--no-video-title-show");
|
||||||
//ctxPtr->vlc_argv.push_back("--network-caching=10000");
|
//ctxPtr->vlc_argv.push_back("--network-caching=10000");
|
||||||
|
|
||||||
|
if(loop == true) {
|
||||||
|
ctxPtr->vlc_argv.push_back("--loop");
|
||||||
|
ctxPtr->vlc_argv.push_back("--repeat");
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(LIBVLC_VERSION_PRE_2)
|
#if defined(LIBVLC_VERSION_PRE_2)
|
||||||
ctxPtr->vlc_argv_str.push_back("--plugin-path=" + pluginsPath);
|
ctxPtr->vlc_argv_str.push_back("--plugin-path=" + pluginsPath);
|
||||||
ctxPtr->vlc_argv.push_back(ctxPtr->vlc_argv_str[ctxPtr->vlc_argv_str.size()-1].c_str());
|
ctxPtr->vlc_argv.push_back(ctxPtr->vlc_argv_str[ctxPtr->vlc_argv_str.size()-1].c_str());
|
||||||
|
@ -659,6 +667,10 @@ bool VideoPlayer::initPlayer(string mediaURL) {
|
||||||
/* Create a new item */
|
/* Create a new item */
|
||||||
if(verboseEnabled) printf("In [%s] Line: %d, m [%p]\n",__FUNCTION__,__LINE__,ctxPtr->m);
|
if(verboseEnabled) printf("In [%s] Line: %d, m [%p]\n",__FUNCTION__,__LINE__,ctxPtr->m);
|
||||||
|
|
||||||
|
if(loop == true) {
|
||||||
|
libvlc_media_add_option(ctxPtr->m, "input-repeat=-1");
|
||||||
|
}
|
||||||
|
|
||||||
if(mediaURL.find(HTTP_PREFIX) == 0) {
|
if(mediaURL.find(HTTP_PREFIX) == 0) {
|
||||||
ctxPtr->mp = libvlc_media_player_new(ctxPtr->libvlc);
|
ctxPtr->mp = libvlc_media_player_new(ctxPtr->libvlc);
|
||||||
}
|
}
|
||||||
|
@ -1401,6 +1413,21 @@ bool VideoPlayer::playFrame(bool swapBuffers) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoPlayer::RestartVideo() {
|
void VideoPlayer::RestartVideo() {
|
||||||
|
printf("Restart video\n");
|
||||||
|
|
||||||
|
this->stop = false;
|
||||||
|
this->finished = false;
|
||||||
|
ctxPtr->started = true;
|
||||||
|
ctxPtr->error = false;
|
||||||
|
ctxPtr->stopped = false;
|
||||||
|
ctxPtr->end_of_media = false;
|
||||||
|
ctxPtr->isPlaying = true;
|
||||||
|
ctxPtr->needToQuit = false;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
this->closePlayer();
|
||||||
|
|
||||||
this->stop = false;
|
this->stop = false;
|
||||||
this->finished = false;
|
this->finished = false;
|
||||||
this->successLoadingLib = false;
|
this->successLoadingLib = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user