KVIrc 5.2.0
Developer APIs
Macros | Functions | Variables
libkvimediaplayer.cpp File Reference
#include "MpInterface.h"
#include "MpAmipInterface.h"
#include "MpMprisInterface.h"
#include "MpWinampInterface.h"
#include "MpXmmsInterface.h"
#include "KviModule.h"
#include "KviOptions.h"
#include "KviLocale.h"
#include "kvi_out.h"
#include <QUrl>

Macros

#define MP_KVS_COMMAND(__name)   static bool mediaplayer_kvs_cmd_##__name(KviKvsModuleCommandCall * c)
 
#define MP_KVS_FAIL_ON_NO_INTERFACE
 
#define MP_KVS_FUNCTION(__name)   static bool mediaplayer_kvs_fnc_##__name(KviKvsModuleFunctionCall * c)
 
#define MP_KVS_REGCMD(__name, __stringname)   KVSM_REGISTER_SIMPLE_COMMAND(m, __stringname, mediaplayer_kvs_cmd_##__name)
 
#define MP_KVS_REGFNC(__name, __stringname)   KVSM_REGISTER_FUNCTION(m, __stringname, mediaplayer_kvs_fnc_##__name)
 
#define MP_KVS_SIMPLE_BOOL_FUNCTION(__name, __ifacecommand)
 
#define MP_KVS_SIMPLE_COMMAND(__name, __ifacecommand)
 
#define MP_KVS_SIMPLE_INT_FUNCTION(__name, __ifacecommand)
 
#define MP_KVS_SIMPLE_STRING_FUNCTION(__name, __ifacecommand)
 

Functions

static MpInterfaceauto_detect_player (KviWindow *pOut=nullptr)
 
static bool mediaplayer_module_can_unload (KviModule *)
 
static bool mediaplayer_module_cleanup (KviModule *)
 
static bool mediaplayer_module_ctrl (KviModule *, const char *operation, void *param)
 
static bool mediaplayer_module_init (KviModule *m)
 
 MP_KVS_COMMAND (amipExec)
 
 MP_KVS_COMMAND (detect)
 
 MP_KVS_COMMAND (jumpTo)
 
 MP_KVS_COMMAND (playMrl)
 
 MP_KVS_COMMAND (setEqData)
 
 MP_KVS_COMMAND (setPlayer)
 
 MP_KVS_COMMAND (setPlayListPos)
 
 MP_KVS_COMMAND (setRepeat)
 
 MP_KVS_COMMAND (setShuffle)
 
 MP_KVS_COMMAND (setVol)
 
 MP_KVS_FUNCTION (amipEval)
 
 MP_KVS_FUNCTION (getEqData)
 
 MP_KVS_FUNCTION (localFile)
 
 MP_KVS_FUNCTION (player)
 
 MP_KVS_FUNCTION (playerList)
 
 MP_KVS_FUNCTION (status)
 

Variables

static KviPointerList< MpInterfaceDescriptor > * g_pDescriptorList = nullptr
 
static MpInterfaceg_pMPInterface = nullptr
 

Macro Definition Documentation

◆ MP_KVS_COMMAND

#define MP_KVS_COMMAND (   __name)    static bool mediaplayer_kvs_cmd_##__name(KviKvsModuleCommandCall * c)

◆ MP_KVS_FAIL_ON_NO_INTERFACE

#define MP_KVS_FAIL_ON_NO_INTERFACE
Value:
{ \
c->warning(__tr2qs_ctx("No mediaplayer interface selected. Try /mediaplayer.detect", "mediaplayer")); \
return true; \
}
#define __tr2qs_ctx(text, context)
Definition KviLocale.h:230
static MpInterface * g_pMPInterface
Definition libkvimediaplayer.cpp:41

◆ MP_KVS_FUNCTION

#define MP_KVS_FUNCTION (   __name)    static bool mediaplayer_kvs_fnc_##__name(KviKvsModuleFunctionCall * c)

◆ MP_KVS_REGCMD

#define MP_KVS_REGCMD (   __name,
  __stringname 
)    KVSM_REGISTER_SIMPLE_COMMAND(m, __stringname, mediaplayer_kvs_cmd_##__name)

◆ MP_KVS_REGFNC

#define MP_KVS_REGFNC (   __name,
  __stringname 
)    KVSM_REGISTER_FUNCTION(m, __stringname, mediaplayer_kvs_fnc_##__name)

◆ MP_KVS_SIMPLE_BOOL_FUNCTION

#define MP_KVS_SIMPLE_BOOL_FUNCTION (   __name,
  __ifacecommand 
)
Value:
MP_KVS_FUNCTION(__name) \
{ \
MP_KVS_FAIL_ON_NO_INTERFACE \
bool bRet = g_pMPInterface->__ifacecommand(); \
c->returnValue()->setBoolean(bRet); \
return true; \
}
#define MP_KVS_FUNCTION(__name)
Definition libkvimediaplayer.cpp:119

◆ MP_KVS_SIMPLE_COMMAND

#define MP_KVS_SIMPLE_COMMAND (   __name,
  __ifacecommand 
)
Value:
MP_KVS_COMMAND(__name) \
{ \
KVSM_PARAMETERS_BEGIN(c) \
KVSM_PARAMETERS_END(c) \
\
MP_KVS_FAIL_ON_NO_INTERFACE \
\
if(!g_pMPInterface->__ifacecommand()) \
{ \
if(!c->hasSwitch('q', "quiet")) \
{ \
c->warning(__tr2qs_ctx("The selected media player interface failed to execute the requested function", "mediaplayer")); \
QString tmp = __tr2qs_ctx("Last interface error: ", "mediaplayer"); \
c->warning(tmp); \
} \
} \
return true; \
}
const QString & lastError() const
Definition MpInterface.h:43
#define MP_KVS_COMMAND(__name)
Definition libkvimediaplayer.cpp:118

◆ MP_KVS_SIMPLE_INT_FUNCTION

#define MP_KVS_SIMPLE_INT_FUNCTION (   __name,
  __ifacecommand 
)
Value:
MP_KVS_FUNCTION(__name) \
{ \
MP_KVS_FAIL_ON_NO_INTERFACE \
int iRet = g_pMPInterface->__ifacecommand(); \
c->returnValue()->setInteger(iRet); \
return true; \
}

◆ MP_KVS_SIMPLE_STRING_FUNCTION

#define MP_KVS_SIMPLE_STRING_FUNCTION (   __name,
  __ifacecommand 
)
Value:
MP_KVS_FUNCTION(__name) \
{ \
MP_KVS_FAIL_ON_NO_INTERFACE \
QString szRet = g_pMPInterface->__ifacecommand(); \
c->returnValue()->setString(szRet); \
return true; \
}

Function Documentation

◆ auto_detect_player()

static MpInterface * auto_detect_player ( KviWindow pOut = nullptr)
static

◆ mediaplayer_module_can_unload()

static bool mediaplayer_module_can_unload ( KviModule )
static

◆ mediaplayer_module_cleanup()

static bool mediaplayer_module_cleanup ( KviModule )
static

References g_pDescriptorList.

◆ mediaplayer_module_ctrl()

static bool mediaplayer_module_ctrl ( KviModule ,
const char *  operation,
void *  param 
)
static

◆ mediaplayer_module_init()

static bool mediaplayer_module_init ( KviModule m)
static

◆ MP_KVS_COMMAND() [1/10]

MP_KVS_COMMAND ( amipExec  )

◆ MP_KVS_COMMAND() [2/10]

MP_KVS_COMMAND ( detect  )

◆ MP_KVS_COMMAND() [3/10]

MP_KVS_COMMAND ( jumpTo  )

◆ MP_KVS_COMMAND() [4/10]

MP_KVS_COMMAND ( playMrl  )

◆ MP_KVS_COMMAND() [5/10]

MP_KVS_COMMAND ( setEqData  )

◆ MP_KVS_COMMAND() [6/10]

MP_KVS_COMMAND ( setPlayer  )

◆ MP_KVS_COMMAND() [7/10]

MP_KVS_COMMAND ( setPlayListPos  )

◆ MP_KVS_COMMAND() [8/10]

MP_KVS_COMMAND ( setRepeat  )

◆ MP_KVS_COMMAND() [9/10]

MP_KVS_COMMAND ( setShuffle  )

◆ MP_KVS_COMMAND() [10/10]

MP_KVS_COMMAND ( setVol  )

◆ MP_KVS_FUNCTION() [1/6]

MP_KVS_FUNCTION ( amipEval  )

◆ MP_KVS_FUNCTION() [2/6]

MP_KVS_FUNCTION ( getEqData  )

◆ MP_KVS_FUNCTION() [3/6]

MP_KVS_FUNCTION ( localFile  )

◆ MP_KVS_FUNCTION() [4/6]

MP_KVS_FUNCTION ( player  )

◆ MP_KVS_FUNCTION() [5/6]

MP_KVS_FUNCTION ( playerList  )

◆ MP_KVS_FUNCTION() [6/6]

MP_KVS_FUNCTION ( status  )

Variable Documentation

◆ g_pDescriptorList

KviPointerList<MpInterfaceDescriptor>* g_pDescriptorList = nullptr
static

◆ g_pMPInterface

MpInterface* g_pMPInterface = nullptr
static