Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPI support: split omxplayer build option #792

Merged
merged 1 commit into from
May 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion CMakeLists.txt
Expand Up @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 2.8)

option(GLES "Set to ON if targeting Embedded OpenGL" ${GLES})
option(GL "Set to ON if targeting Desktop OpenGL" ${GL})
option(RPI "Set to ON to enable the Raspberry PI video player (omxplayer) and audio options" ${RPI})
option(RPI "Set to ON to enable the Raspberry PI memory and audio options" ${RPI})
option(OMX "Set to On to enable OMXPlayer for video snapshots" ${OMX})
option(CEC "Set to ON to enable CEC" ${CEC})
option(PROFILING "Set to ON to enable profiling" ${PROFILING})

Expand Down Expand Up @@ -110,6 +111,10 @@ if(DEFINED BCMHOST OR RPI)
add_definitions(-D_RPI_)
endif()

if(OMX)
add_definitions(-D_OMX_)
endif()

if(DEFINED libCEC_FOUND)
add_definitions(-DHAVE_LIBCEC)
endif()
Expand Down
10 changes: 7 additions & 3 deletions README.md
Expand Up @@ -54,14 +54,18 @@ NOTE: to generate a `Debug` build on Unix/Linux, run the Makefile generation ste
cmake -DCMAKE_BUILD_TYPE=Debug .
```

**On the Raspberry Pi**
**On the Raspberry Pi**

* Choosing a GLES implementation.

* if the Pi system uses the legacy/Broadcom driver, install the `libraspberry-dev` package before running `cmake` to configure the build
* if the Pi system uses the Mesa VC3/V3D GL driver, build using `-DUSE_MESA_GLES=On` to choose the MESA GLES implementation. This option is _mandatory_ when compiling for a Pi4 system, since the legacy GL drivers are not supported anymore on this system.
* if the Pi system uses the Mesa VC4/V3D GL driver, build using `-DUSE_MESA_GLES=On` to choose the MESA GLES implementation. This option is _mandatory_ when compiling for a Pi4 system, since the legacy GL drivers are not supported anymore on this system.

* Support for using `omxplayer` to play video previews in the gamelist is enabled by adding `-DRPI=On` to the build options
NOTE: Starting with RasPI OS 'Bullseye', the legacy/Broadcom drivers are not supported anymore, so `-DUSE_MESA_GLES=On` should be used.

* Enable the audio/memory defaults by adding `-DRPI=On` to the build options
* Support for using `omxplayer` to play video previews in the gamelist is enabled by adding `-DOMX=On` to the build options.
NOTE: `omxplayer` support is not available on 64bit RasPI OS or in the default RasPI OS 'Bullseye' configuration.

**GLES build notes**

Expand Down
4 changes: 2 additions & 2 deletions es-app/src/SystemScreenSaver.cpp
@@ -1,6 +1,6 @@
#include "SystemScreenSaver.h"

#ifdef _RPI_
#ifdef _OMX_
#include "components/VideoPlayerComponent.h"
#endif
#include "components/VideoVlcComponent.h"
Expand Down Expand Up @@ -64,7 +64,7 @@ bool SystemScreenSaver::isScreenSaverActive()

void SystemScreenSaver::setVideoScreensaver(std::string& path)
{
#ifdef _RPI_
#ifdef _OMX_
// Create the correct type of video component
if (Settings::getInstance()->getBool("ScreenSaverOmxPlayer"))
mVideoScreensaver = new VideoPlayerComponent(mWindow, getTitlePath());
Expand Down
4 changes: 2 additions & 2 deletions es-app/src/guis/GuiMenu.cpp
Expand Up @@ -164,7 +164,7 @@ void GuiMenu::openSoundSettings()
s->addWithLabel("ENABLE VIDEO AUDIO", video_audio);
s->addSaveFunc([video_audio] { Settings::getInstance()->setBool("VideoAudio", video_audio->getState()); });

#ifdef _RPI_
#ifdef _OMX_
// OMX player Audio Device
auto omx_audio_dev = std::make_shared< OptionListComponent<std::string> >(mWindow, "OMX PLAYER AUDIO DEVICE", false);
std::vector<std::string> omx_cards;
Expand Down Expand Up @@ -463,7 +463,7 @@ void GuiMenu::openOtherSettings()
s->addWithLabel("SHOW HIDDEN FILES", hidden_files);
s->addSaveFunc([hidden_files] { Settings::getInstance()->setBool("ShowHiddenFiles", hidden_files->getState()); });

#ifdef _RPI_
#ifdef _OMX_
// Video Player - VideoOmxPlayer
auto omx_player = std::make_shared<SwitchComponent>(mWindow);
omx_player->setState(Settings::getInstance()->getBool("VideoOmxPlayer"));
Expand Down
8 changes: 4 additions & 4 deletions es-app/src/guis/GuiVideoScreensaverOptions.cpp
Expand Up @@ -23,7 +23,7 @@ GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const cha
addWithLabel("STRETCH VIDEO ON SCREENSAVER", stretch_screensaver);
addSaveFunc([stretch_screensaver] { Settings::getInstance()->setBool("StretchVideoOnScreenSaver", stretch_screensaver->getState()); });

#ifdef _RPI_
#ifdef _OMX_
auto ss_omx = std::make_shared<SwitchComponent>(mWindow);
ss_omx->setState(Settings::getInstance()->getBool("ScreenSaverOmxPlayer"));
addWithLabel("USE OMX PLAYER FOR SCREENSAVER", ss_omx);
Expand Down Expand Up @@ -59,7 +59,7 @@ GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const cha
addWithLabel("VLC: SCREENSAVER VIDEO RESOLUTION", ss_vlc_resolution);
addSaveFunc([ss_vlc_resolution, this] { Settings::getInstance()->setString("VlcScreenSaverResolution", ss_vlc_resolution->getSelected()); });

#ifdef _RPI_
#ifdef _OMX_
ComponentListRow row;

// Set subtitle position
Expand Down Expand Up @@ -103,12 +103,12 @@ GuiVideoScreensaverOptions::~GuiVideoScreensaverOptions()

void GuiVideoScreensaverOptions::save()
{
#ifdef _RPI_
#ifdef _OMX_
bool startingStatusNotRisky = (Settings::getInstance()->getString("ScreenSaverGameInfo") == "never" || !Settings::getInstance()->getBool("ScreenSaverOmxPlayer"));
#endif
GuiScreensaverOptions::save();

#ifdef _RPI_
#ifdef _OMX_
bool endStatusRisky = (Settings::getInstance()->getString("ScreenSaverGameInfo") != "never" && Settings::getInstance()->getBool("ScreenSaverOmxPlayer"));
if (startingStatusNotRisky && endStatusRisky) {
// if before it wasn't risky but now there's a risk of problems, show warning
Expand Down
4 changes: 2 additions & 2 deletions es-app/src/views/gamelist/GridGameListView.cpp
Expand Up @@ -6,7 +6,7 @@
#include "CollectionSystemManager.h"
#include "Settings.h"
#include "SystemData.h"
#ifdef _RPI_
#ifdef _OMX_
#include "components/VideoPlayerComponent.h"
#endif
#include "components/VideoVlcComponent.h"
Expand All @@ -29,7 +29,7 @@ GridGameListView::GridGameListView(Window* window, FileData* root) :
const float padding = 0.01f;

// Create the correct type of video window
#ifdef _RPI_
#ifdef _OMX_
if (Settings::getInstance()->getBool("VideoOmxPlayer"))
mVideo = new VideoPlayerComponent(window, "");
else
Expand Down
6 changes: 3 additions & 3 deletions es-app/src/views/gamelist/VideoGameListView.cpp
@@ -1,13 +1,13 @@
#include "views/gamelist/VideoGameListView.h"

#include "animations/LambdaAnimation.h"
#ifdef _RPI_
#ifdef _OMX_
#include "components/VideoPlayerComponent.h"
#endif
#include "components/VideoVlcComponent.h"
#include "utils/FileSystemUtil.h"
#include "views/ViewController.h"
#ifdef _RPI_
#ifdef _OMX_
#include "Settings.h"
#endif

Expand All @@ -30,7 +30,7 @@ VideoGameListView::VideoGameListView(Window* window, FileData* root) :
const float padding = 0.01f;

// Create the correct type of video window
#ifdef _RPI_
#ifdef _OMX_
Utils::FileSystem::removeFile(getTitlePath());
if (Settings::getInstance()->getBool("VideoOmxPlayer"))
mVideo = new VideoPlayerComponent(window, "");
Expand Down
2 changes: 1 addition & 1 deletion es-core/src/Settings.cpp
Expand Up @@ -120,7 +120,7 @@ void Settings::setDefaults()
// This setting only applies to raspberry pi but set it for all platforms so
// we don't get a warning if we encounter it on a different platform
mBoolMap["VideoOmxPlayer"] = false;
#ifdef _RPI_
#ifdef _OMX_
// we're defaulting to OMX Player for full screen video on the Pi
mBoolMap["ScreenSaverOmxPlayer"] = true;
// use OMX Player defaults
Expand Down
2 changes: 1 addition & 1 deletion es-core/src/components/VideoPlayerComponent.cpp
@@ -1,4 +1,4 @@
#ifdef _RPI_
#ifdef _OMX_
#include "components/VideoPlayerComponent.h"

#include "renderers/Renderer.h"
Expand Down
4 changes: 2 additions & 2 deletions es-core/src/components/VideoPlayerComponent.h
@@ -1,4 +1,4 @@
#ifdef _RPI_
#ifdef _OMX_
#pragma once
#ifndef ES_CORE_COMPONENTS_VIDEO_PLAYER_COMPONENT_H
#define ES_CORE_COMPONENTS_VIDEO_PLAYER_COMPONENT_H
Expand Down Expand Up @@ -38,4 +38,4 @@ class VideoPlayerComponent : public VideoComponent
};

#endif // ES_CORE_COMPONENTS_VIDEO_PLAYER_COMPONENT_H
#endif // _RPI_
#endif // _OMX_