summaryrefslogtreecommitdiff
path: root/src/player
diff options
context:
space:
mode:
Diffstat (limited to 'src/player')
-rw-r--r--src/player/backends/direct_show.c1
-rw-r--r--src/player/backends/media_foundation.cpp1
-rw-r--r--src/player/player2.c11
-rw-r--r--src/player/player2.h2
-rw-r--r--src/player/player2_private.h1
5 files changed, 13 insertions, 3 deletions
diff --git a/src/player/backends/direct_show.c b/src/player/backends/direct_show.c
index d6597c0..111f042 100644
--- a/src/player/backends/direct_show.c
+++ b/src/player/backends/direct_show.c
@@ -442,6 +442,7 @@ static bool DSPlayerIsFinished(player2_t player)
player2_iface player2_direct_show =
{
+ .Id = "ds",
.Name = "Direct Show",
.Create = DSPlayerCreate,
.Destroy = DSPlayerDestroy,
diff --git a/src/player/backends/media_foundation.cpp b/src/player/backends/media_foundation.cpp
index 749a6f3..6aa0d00 100644
--- a/src/player/backends/media_foundation.cpp
+++ b/src/player/backends/media_foundation.cpp
@@ -1088,6 +1088,7 @@ extern "C" bool WMFPlayerIsFinished(player2_t player)
extern "C" player2_iface player2_windows_media_foundation =
{
+ /*.Id =*/ "mf",
/*.Name =*/ "Windows Media Foundation",
/*.Create =*/ WMFPlayerCreate,
/*.Destroy =*/ WMFPlayerDestroy,
diff --git a/src/player/player2.c b/src/player/player2.c
index c95600c..cd9beae 100644
--- a/src/player/player2.c
+++ b/src/player/player2.c
@@ -28,6 +28,7 @@ THE SOFTWARE.
#include "config.h"
#include "player2_private.h"
#include <stdlib.h>
+#include <string.h>
#include <memory.h>
# define length_of(x) (sizeof(x)/sizeof(*(x)))
@@ -44,7 +45,7 @@ struct _player_t
player2_t player;
};
-bool BarPlayer2Init(player2_t* outPlayer)
+bool BarPlayer2Init(player2_t* outPlayer, const char* defaultPlayer)
{
player2_t player;
struct _player_t result;
@@ -56,7 +57,13 @@ bool BarPlayer2Init(player2_t* outPlayer)
{
player2_iface* backend = player2_backends[i];
- result.player = backend->Create();
+ bool acceptPlayer = true;
+ if (defaultPlayer && !(strcmp(backend->Id, defaultPlayer) == 0))
+ acceptPlayer = false;
+
+ if (acceptPlayer)
+ result.player = backend->Create();
+
if (result.player)
{
result.backend = backend;
diff --git a/src/player/player2.h b/src/player/player2.h
index d50d76f..710b35d 100644
--- a/src/player/player2.h
+++ b/src/player/player2.h
@@ -31,7 +31,7 @@ THE SOFTWARE.
typedef struct _player_t *player2_t;
-bool BarPlayer2Init(player2_t* outPlayer);
+bool BarPlayer2Init(player2_t* outPlayer, const char* defaultPlayer);
void BarPlayer2Destroy(player2_t player);
void BarPlayer2SetVolume(player2_t player, float volume);
float BarPlayer2GetVolume(player2_t player);
diff --git a/src/player/player2_private.h b/src/player/player2_private.h
index 054b81f..757a07e 100644
--- a/src/player/player2_private.h
+++ b/src/player/player2_private.h
@@ -8,6 +8,7 @@
typedef struct _player2_iface
{
+ const char* Id;
const char* Name;
player2_t (*Create) ();
void (*Destroy) (player2_t player);