Add SVDRP HOTK command support and cleanup.

This commit is contained in:
Johns 2012-02-25 13:02:15 +01:00
parent b2cab00599
commit aa426cd8b2
2 changed files with 25 additions and 12 deletions

View File

@ -1,6 +1,7 @@
User johns User johns
Date: Date:
Add SVDRP HOTK command support.
Increased audio buffer time for PES packets. Increased audio buffer time for PES packets.
Support configuration and set of video background. Support configuration and set of video background.
Survive lost X11 display. Survive lost X11 display.

View File

@ -745,6 +745,8 @@ cSoftHdMenu::~cSoftHdMenu()
/** /**
** Handle hot key commands. ** Handle hot key commands.
**
** @param code numeric hot key code
*/ */
static void HandleHotkey(int code) static void HandleHotkey(int code)
{ {
@ -861,10 +863,10 @@ class cSoftHdDevice:public cDevice
virtual void GetVideoSize(int &, int &, double &); virtual void GetVideoSize(int &, int &, double &);
virtual void GetOsdSize(int &, int &, double &); virtual void GetOsdSize(int &, int &, double &);
virtual int PlayVideo(const uchar *, int); virtual int PlayVideo(const uchar *, int);
#ifndef xxUSE_TS_AUDIO
virtual int PlayAudio(const uchar *, int, uchar); virtual int PlayAudio(const uchar *, int, uchar);
#ifdef USE_TS_VIDEO
virtual int PlayTsVideo(const uchar *, int);
#endif #endif
//virtual int PlayTsVideo(const uchar *, int);
#if !defined(USE_AUDIO_THREAD) || defined(USE_TS_AUDIO) #if !defined(USE_AUDIO_THREAD) || defined(USE_TS_AUDIO)
virtual int PlayTsAudio(const uchar *, int); virtual int PlayTsAudio(const uchar *, int);
#endif #endif
@ -1094,7 +1096,7 @@ bool cSoftHdDevice::Flush(int timeout_ms)
** device has an MPEG decoder). ** device has an MPEG decoder).
*/ */
void cSoftHdDevice:: SetVideoDisplayFormat(eVideoDisplayFormat void cSoftHdDevice:: SetVideoDisplayFormat(eVideoDisplayFormat
video_display_format) video_display_format)
{ {
static int last = -1; static int last = -1;
@ -1151,8 +1153,6 @@ void cSoftHdDevice::GetOsdSize(int &width, int &height, double &pixel_aspect)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifndef xxUSE_TS_AUDIO
/** /**
** Play a audio packet. ** Play a audio packet.
** **
@ -1167,8 +1167,6 @@ int cSoftHdDevice::PlayAudio(const uchar * data, int length, uchar id)
return::PlayAudio(data, length, id); return::PlayAudio(data, length, id);
} }
#endif
void cSoftHdDevice::SetAudioTrackDevice( void cSoftHdDevice::SetAudioTrackDevice(
__attribute__ ((unused)) eTrackType type) __attribute__ ((unused)) eTrackType type)
{ {
@ -1219,14 +1217,18 @@ int cSoftHdDevice::PlayVideo(const uchar * data, int length)
return::PlayVideo(data, length); return::PlayVideo(data, length);
} }
#if 0 #ifdef USE_TS_VIDEO
/// ///
/// Play a TS video packet. /// Play a TS video packet.
/// ///
/// @param data ts data buffer
/// @param length ts packet length (188)
///
int cSoftHdDevice::PlayTsVideo(const uchar * data, int length) int cSoftHdDevice::PlayTsVideo(const uchar * data, int length)
{ {
// many code to repeat
} }
#endif #endif
#if !defined(USE_AUDIO_THREAD) || defined(USE_TS_AUDIO) #if !defined(USE_AUDIO_THREAD) || defined(USE_TS_AUDIO)
@ -1234,10 +1236,8 @@ int cSoftHdDevice::PlayTsVideo(const uchar * data, int length)
/// ///
/// Play a TS audio packet. /// Play a TS audio packet.
/// ///
/// misuse this function as audio poller
///
/// @param data ts data buffer /// @param data ts data buffer
/// @param length ts packet length /// @param length ts packet length (188)
/// ///
int cSoftHdDevice::PlayTsAudio(const uchar * data, int length) int cSoftHdDevice::PlayTsAudio(const uchar * data, int length)
{ {
@ -1625,6 +1625,7 @@ const char **cPluginSoftHdDevice::SVDRPHelpPages(void)
static const char *text[] = { static const char *text[] = {
"SUSP\n" " Suspend plugin.\n", "SUSP\n" " Suspend plugin.\n",
"RESU\n" " Resume plugin.\n", "RESU\n" " Resume plugin.\n",
"HOTK key\n" " Execute hotkey.\n",
NULL NULL
}; };
@ -1633,6 +1634,10 @@ const char **cPluginSoftHdDevice::SVDRPHelpPages(void)
/** /**
** Handle SVDRP commands. ** Handle SVDRP commands.
**
** @param command SVDRP command
** @param option all command arguments
** @param reply_code reply code
*/ */
cString cPluginSoftHdDevice::SVDRPCommand(const char *command, cString cPluginSoftHdDevice::SVDRPCommand(const char *command,
__attribute__ ((unused)) const char *option, __attribute__ ((unused)) const char *option,
@ -1658,6 +1663,13 @@ cString cPluginSoftHdDevice::SVDRPCommand(const char *command,
Resume(); Resume();
return "SoftHdDevice is resumed"; return "SoftHdDevice is resumed";
} }
if (!strcasecmp(command, "HOTK")) {
int hotk;
hotk = strtol(option, NULL, 0);
HandleHotkey(hotk);
return "hot-key executed";
}
return NULL; return NULL;
} }