-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move
internalpayerbackend
out of config.cc
to src/audio
- Loading branch information
1 parent
c7d0feb
commit bd13598
Showing
9 changed files
with
157 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "internalplayerbackend.hh" | ||
|
||
bool InternalPlayerBackend::anyAvailable() | ||
{ | ||
#if defined( MAKE_FFMPEG_PLAYER ) || defined( MAKE_QTMULTIMEDIA_PLAYER ) | ||
return true; | ||
#else | ||
return false; | ||
#endif | ||
} | ||
|
||
InternalPlayerBackend InternalPlayerBackend::defaultBackend() | ||
{ | ||
#if defined( MAKE_FFMPEG_PLAYER ) | ||
return ffmpeg(); | ||
#elif defined( MAKE_QTMULTIMEDIA_PLAYER ) | ||
return qtmultimedia(); | ||
#else | ||
return InternalPlayerBackend( QString() ); | ||
#endif | ||
} | ||
|
||
QStringList InternalPlayerBackend::nameList() | ||
{ | ||
QStringList result; | ||
#ifdef MAKE_FFMPEG_PLAYER | ||
result.push_back( ffmpeg().uiName() ); | ||
#endif | ||
#ifdef MAKE_QTMULTIMEDIA_PLAYER | ||
result.push_back( qtmultimedia().uiName() ); | ||
#endif | ||
return result; | ||
} | ||
|
||
bool InternalPlayerBackend::isFfmpeg() const | ||
{ | ||
#ifdef MAKE_FFMPEG_PLAYER | ||
return *this == ffmpeg(); | ||
#else | ||
return false; | ||
#endif | ||
} | ||
|
||
bool InternalPlayerBackend::isQtmultimedia() const | ||
{ | ||
#ifdef MAKE_QTMULTIMEDIA_PLAYER | ||
return *this == qtmultimedia(); | ||
#else | ||
return false; | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#pragma once | ||
#include <QStringList> | ||
|
||
/// Overly engineered dummy/helper/wrapper "backend", which is not, to manage backends. | ||
class InternalPlayerBackend | ||
{ | ||
public: | ||
/// Returns true if at least one backend is available. | ||
static bool anyAvailable(); | ||
/// Returns the default backend or null backend if none is available. | ||
static InternalPlayerBackend defaultBackend(); | ||
/// Returns the name list of supported backends. | ||
static QStringList nameList(); | ||
|
||
/// Returns true if built with FFmpeg player support and the name matches. | ||
bool isFfmpeg() const; | ||
/// Returns true if built with Qt Multimedia player support and the name matches. | ||
bool isQtmultimedia() const; | ||
|
||
QString const & uiName() const | ||
{ | ||
return name; | ||
} | ||
|
||
void setUiName( QString const & name_ ) | ||
{ | ||
name = name_; | ||
} | ||
|
||
bool operator==( InternalPlayerBackend const & other ) const | ||
{ | ||
return name == other.name; | ||
} | ||
|
||
bool operator!=( InternalPlayerBackend const & other ) const | ||
{ | ||
return !operator==( other ); | ||
} | ||
|
||
private: | ||
#ifdef MAKE_FFMPEG_PLAYER | ||
static InternalPlayerBackend ffmpeg() | ||
{ | ||
return InternalPlayerBackend( "FFmpeg" ); | ||
} | ||
#endif | ||
|
||
#ifdef MAKE_QTMULTIMEDIA_PLAYER | ||
static InternalPlayerBackend qtmultimedia() | ||
{ | ||
return InternalPlayerBackend( "Qt Multimedia" ); | ||
} | ||
#endif | ||
|
||
explicit InternalPlayerBackend( QString const & name_ ): | ||
name( name_ ) | ||
{ | ||
} | ||
|
||
QString name; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.