KVIrc 5.2.6
Developer APIs
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)
 
#define MP_KVS_FAIL_ON_NO_INTERFACE
 
#define MP_KVS_FUNCTION(__name)
 
#define MP_KVS_REGCMD(__name, __stringname)
 
#define MP_KVS_REGFNC(__name, __stringname)
 
#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)
Value:
static bool mediaplayer_kvs_cmd_##__name(KviKvsModuleCommandCall * c)
Definition KviKvsModuleInterface.h:69

Referenced by MP_KVS_COMMAND(), and MP_KVS_COMMAND().

◆ 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:223
static MpInterface * g_pMPInterface
Definition libkvimediaplayer.cpp:41

Referenced by MP_KVS_COMMAND(), MP_KVS_COMMAND(), MP_KVS_COMMAND(), MP_KVS_COMMAND(), MP_KVS_COMMAND(), MP_KVS_COMMAND(), MP_KVS_COMMAND(), MP_KVS_COMMAND(), MP_KVS_FUNCTION(), MP_KVS_FUNCTION(), MP_KVS_FUNCTION(), and MP_KVS_FUNCTION().

◆ MP_KVS_FUNCTION

#define MP_KVS_FUNCTION ( __name)
Value:
static bool mediaplayer_kvs_fnc_##__name(KviKvsModuleFunctionCall * c)
Definition KviKvsModuleInterface.h:112

Referenced by MP_KVS_FUNCTION().

◆ MP_KVS_REGCMD

#define MP_KVS_REGCMD ( __name,
__stringname )
Value:
KVSM_REGISTER_SIMPLE_COMMAND(m, __stringname, mediaplayer_kvs_cmd_##__name)
#define KVSM_REGISTER_SIMPLE_COMMAND(_pModule, _szCmd, _procname)
Definition KviKvsModuleInterface.h:207
#define m
Definition detector.cpp:78

Referenced by mediaplayer_module_init().

◆ MP_KVS_REGFNC

#define MP_KVS_REGFNC ( __name,
__stringname )
Value:
KVSM_REGISTER_FUNCTION(m, __stringname, mediaplayer_kvs_fnc_##__name)
#define KVSM_REGISTER_FUNCTION(_pModule, _szFnc, _procname)
Definition KviKvsModuleInterface.h:219

Referenced by mediaplayer_module_init().

◆ 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"); \
tmp += g_pMPInterface->lastError(); \
c->warning(tmp); \
} \
} \
return true; \
}
#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()

◆ 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()

◆ MP_KVS_COMMAND() [1/10]

◆ MP_KVS_COMMAND() [2/10]

MP_KVS_COMMAND ( detect )

◆ MP_KVS_COMMAND() [3/10]

◆ MP_KVS_COMMAND() [4/10]

◆ MP_KVS_COMMAND() [5/10]

◆ MP_KVS_COMMAND() [6/10]

◆ MP_KVS_COMMAND() [7/10]

◆ MP_KVS_COMMAND() [8/10]

◆ MP_KVS_COMMAND() [9/10]

◆ MP_KVS_COMMAND() [10/10]

◆ MP_KVS_FUNCTION() [1/6]

◆ MP_KVS_FUNCTION() [2/6]

◆ 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 )

References d, g_pDescriptorList, and pArray.

◆ MP_KVS_FUNCTION() [6/6]

Variable Documentation

◆ g_pDescriptorList

◆ g_pMPInterface