Add support to configure and clear buffers on channel switch.

This commit is contained in:
Dr. Seltsam 2013-11-05 16:46:46 +01:00 committed by Johns
parent fb2a7f9959
commit 0e40f5f872
4 changed files with 55 additions and 34 deletions

View File

@ -1,5 +1,10 @@
User Dr. Seltsam
Date: Tue Nov 5 16:46:34 CET 2013
Add support to configure and clear buffers on channel switch.
User johns
Date:
Date: Tue Oct 8 10:18:04 CET 2013
CLOCK_REALTIME -> CLOCK_MONOTONIC to allow time changes.
Add function VideoStreamOpen and always use VideoStreamClose.

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: VDR \n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-08-03 17:21+0200\n"
"POT-Creation-Date: 2013-10-06 22:20+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -510,6 +510,9 @@ msgstr "Sanftanlauf A/V Sync"
msgid "Black during channel switch"
msgstr "Schwarz während Kanalwechsel"
msgid "Clear decoder on channel switch"
msgstr "Decoder bei Kanalwechsel leeren"
msgid "Brightness (-1000..1000) (vdpau)"
msgstr "Helligkeit (-1000..1000) (vdpau)"

View File

@ -83,6 +83,7 @@ static char VdpauDecoder = 1; ///< vdpau decoder used
#endif
extern int ConfigAudioBufferTime; ///< config size ms of audio buffer
extern int ConfigVideoClearOnSwitch; //< clear decoder on channel switch
char ConfigStartX11Server; ///< flag start the x11 server
static char ConfigStartSuspended; ///< flag to start in suspend mode
static char ConfigFullscreen; ///< fullscreen modus
@ -2465,45 +2466,47 @@ uint8_t *GrabImage(int *size, int jpeg, int quality, int width, int height)
*/
int SetPlayMode(int play_mode)
{
VideoDisplayWakeup();
// tell video parser we have new stream
if (MyVideoStream->Decoder && !MyVideoStream->SkipStream) {
if (MyVideoStream->ClearClose) { // replay clear buffers on close
Clear(); // flush all buffers
MyVideoStream->ClearClose = 0;
}
if (MyVideoStream->CodecID != AV_CODEC_ID_NONE) {
MyVideoStream->NewStream = 1;
MyVideoStream->InvalidPesCounter = 0;
// tell hw decoder we are closing stream
VideoSetClosing(MyVideoStream->HwDecoder);
VideoResetStart(MyVideoStream->HwDecoder);
#ifdef DEBUG
VideoSwitch = GetMsTicks();
#endif
}
}
if (MyAudioDecoder) { // tell audio parser we have new stream
if (AudioCodecID != AV_CODEC_ID_NONE) {
NewAudioStream = 1;
}
}
switch (play_mode) {
case 0: // nothing
case 0: // audio/video from decoder
// tell video parser we get new stream
if (MyVideoStream->Decoder && !MyVideoStream->SkipStream) {
// clear buffers on close configured always or replay only
if (ConfigVideoClearOnSwitch || MyVideoStream->ClearClose) {
Clear(); // flush all buffers
MyVideoStream->ClearClose = 0;
}
if (MyVideoStream->CodecID != AV_CODEC_ID_NONE) {
MyVideoStream->NewStream = 1;
MyVideoStream->InvalidPesCounter = 0;
// tell hw decoder we are closing stream
VideoSetClosing(MyVideoStream->HwDecoder);
VideoResetStart(MyVideoStream->HwDecoder);
#ifdef DEBUG
VideoSwitch = GetMsTicks();
#endif
}
}
if (MyAudioDecoder) { // tell audio parser we have new stream
if (AudioCodecID != AV_CODEC_ID_NONE) {
NewAudioStream = 1;
}
}
break;
case 1: // audio/video from player
VideoDisplayWakeup();
Play();
break;
case 2: // audio only
case 2: // audio only from player, video from decoder
case 3: // audio only from player, no video (black screen)
Debug(3, "softhddev: FIXME: audio only, silence video errors\n");
VideoDisplayWakeup();
Play();
break;
case 3: // audio only, black screen
Debug(3, "softhddev: FIXME: audio only, silence video errors\n");
break;
case 4: // video only
case 4: // video only from player, audio from decoder
VideoDisplayWakeup();
Play();
break;
}
Play();
return 1;
}

View File

@ -91,6 +91,7 @@ static char ConfigVideoStudioLevels; ///< config use studio levels
static char ConfigVideo60HzMode; ///< config use 60Hz display mode
static char ConfigVideoSoftStartSync; ///< config use softstart sync
static char ConfigVideoBlackPicture; ///< config enable black picture mode
char ConfigVideoClearOnSwitch; ///< config enable Clear on channel switch
static int ConfigVideoBrightness; ///< config video brightness
static int ConfigVideoContrast = 1000; ///< config video contrast
@ -595,6 +596,7 @@ class cMenuSetupSoft:public cMenuSetupPage
int _60HzMode;
int SoftStartSync;
int BlackPicture;
int ClearOnSwitch;
int Brightness;
int Contrast;
@ -785,6 +787,8 @@ void cMenuSetupSoft::Create(void)
trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Black during channel switch"),
&BlackPicture, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Clear decoder on channel switch"),
&ClearOnSwitch, trVDR("no"), trVDR("yes")));
Add(new cMenuEditIntItem(tr("Brightness (-1000..1000) (vdpau)"),
&Brightness, -1000, 1000, tr("min"), tr("max")));
@ -1010,6 +1014,7 @@ cMenuSetupSoft::cMenuSetupSoft(void)
_60HzMode = ConfigVideo60HzMode;
SoftStartSync = ConfigVideoSoftStartSync;
BlackPicture = ConfigVideoBlackPicture;
ClearOnSwitch = ConfigVideoClearOnSwitch;
Brightness = ConfigVideoBrightness;
Contrast = ConfigVideoContrast;
@ -1133,6 +1138,7 @@ void cMenuSetupSoft::Store(void)
VideoSetSoftStartSync(ConfigVideoSoftStartSync);
SetupStore("BlackPicture", ConfigVideoBlackPicture = BlackPicture);
VideoSetBlackPicture(ConfigVideoBlackPicture);
SetupStore("ClearOnSwitch", ConfigVideoClearOnSwitch = ClearOnSwitch);
SetupStore("Brightness", ConfigVideoBrightness = Brightness);
VideoSetBrightness(ConfigVideoBrightness);
@ -2852,6 +2858,10 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value)
VideoSetBlackPicture(ConfigVideoBlackPicture = atoi(value));
return true;
}
if (!strcasecmp(name, "ClearOnSwitch")) {
ConfigVideoClearOnSwitch = atoi(value);
return true;
}
if (!strcasecmp(name, "Brightness")) {
VideoSetBrightness(ConfigVideoBrightness = atoi(value));
return true;