Added menu option and integrations for VideoFFmpegComponent

This commit is contained in:
Leon Styhre 2021-05-09 22:56:41 +02:00
parent ef8b008d28
commit b87d7238fc
4 changed files with 41 additions and 3 deletions

View file

@ -12,6 +12,7 @@
#if defined(_RPI_)
#include "components/VideoOmxComponent.h"
#endif
#include "components/VideoFFmpegComponent.h"
#include "components/VideoVlcComponent.h"
#include "resources/Font.h"
#include "utils/FileSystemUtil.h"
@ -179,10 +180,18 @@ void SystemScreensaver::startScreensaver(bool generateMediaList)
// Create the correct type of video component.
if (Settings::getInstance()->getBool("ScreensaverOmxPlayer"))
mVideoScreensaver = new VideoOmxComponent(mWindow);
else if (Settings::getInstance()->getString("VideoPlayer") == "vlc")
mVideoScreensaver = new VideoVlcComponent(window);
else
mVideoScreensaver = new VideoFFmpegComponent(window);
else
mVideoScreensaver = new VideoVlcComponent(mWindow);
#else
mVideoScreensaver = new VideoVlcComponent(mWindow);
if (Settings::getInstance()->getString("VideoPlayer") == "vlc")
mVideoScreensaver = new VideoVlcComponent(mWindow);
else
mVideoScreensaver = new VideoFFmpegComponent(mWindow);
#endif
mVideoScreensaver->topWindow(true);

View file

@ -755,6 +755,25 @@ void GuiMenu::openOtherSettings()
});
#endif
// Video player.
auto video_player = std::make_shared<OptionListComponent<std::string>>
(mWindow, getHelpStyle(), "FULLSCREEN MODE", false);
std::string selectedPlayer = Settings::getInstance()->getString("VideoPlayer");
video_player->add("VLC", "vlc", selectedPlayer == "vlc");
video_player->add("FFmpeg (experimental)", "ffmpeg", selectedPlayer == "ffmpeg");
// If there are no objects returned, then there must be a manually modified entry in the
// configuration file. Simply set the video player to VLC in this case.
if (video_player->getSelectedObjects().size() == 0)
video_player->selectEntry(0);
s->addWithLabel("VIDEO PLAYER", video_player);
s->addSaveFunc([video_player, s] {
if (video_player->getSelected() != Settings::getInstance()->getString("VideoPlayer")) {
Settings::getInstance()->setString("VideoPlayer", video_player->getSelected());
s->setNeedsSaving();
s->setNeedsReloading();
}
});
// When to save game metadata.
auto save_gamelist_mode = std::make_shared<OptionListComponent<std::string>>
(mWindow, getHelpStyle(), "WHEN TO SAVE METADATA", false);

View file

@ -12,12 +12,14 @@
#if defined(_RPI_)
#include "components/VideoOmxComponent.h"
#endif
#include "components/VideoFFmpegComponent.h"
#include "components/VideoVlcComponent.h"
#include "utils/FileSystemUtil.h"
#include "views/ViewController.h"
#if defined(_RPI_)
#include "Settings.h"
#endif
#include "AudioManager.h"
#include "CollectionSystemsManager.h"
#include "SystemData.h"
@ -64,10 +66,15 @@ VideoGameListView::VideoGameListView(
#if defined(_RPI_)
if (Settings::getInstance()->getBool("VideoOmxPlayer"))
mVideo = new VideoOmxComponent(window);
else
else if (Settings::getInstance()->getString("VideoPlayer") == "vlc")
mVideo = new VideoVlcComponent(window);
else
mVideo = new VideoFFmpegComponent(window);
#else
mVideo = new VideoVlcComponent(window);
if (Settings::getInstance()->getString("VideoPlayer") == "vlc")
mVideo = new VideoVlcComponent(window);
else
mVideo = new VideoFFmpegComponent(window);
#endif
mList.setPosition(mSize.x() * (0.50f + padding), mList.getPosition().y());
@ -388,8 +395,10 @@ void VideoGameListView::updateInfoPanel()
mThumbnail.setImage(file->getThumbnailPath());
mMarquee.setImage(file->getMarqueePath());
mVideo->setImage(file->getImagePath());
AudioManager::getInstance()->clearStream();
mVideo->onHide();
if (!mVideo->setVideo(file->getVideoPath()))
mVideo->setDefaultVideo();
}

View file

@ -205,6 +205,7 @@ void Settings::setDefaults()
#if defined (__unix__)
mStringMap["FullscreenMode"] = { "normal", "normal" };
#endif
mStringMap["VideoPlayer"] = { "vlc", "vlc" };
#if defined(_RPI_)
mBoolMap["VideoOmxPlayer"] = { false, false };
// We're defaulting to OMX Player for full screen video on the Pi.