diff options
author | Dr. Seltsam <> | 2013-11-05 16:46:46 +0100 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2013-11-05 16:46:46 +0100 |
commit | 0e40f5f8723951b731cfb56f66947141d18f1526 (patch) | |
tree | 0042f880c1fbb69c23caf30c80eac7dbb6660bc9 /softhddev.c | |
parent | fb2a7f9959d6f9d3bf385a7a32abcf6b1c599ad2 (diff) | |
download | vdr-plugin-softhddevice-0e40f5f8723951b731cfb56f66947141d18f1526.tar.gz vdr-plugin-softhddevice-0e40f5f8723951b731cfb56f66947141d18f1526.tar.bz2 |
Add support to configure and clear buffers on channel switch.
Diffstat (limited to 'softhddev.c')
-rw-r--r-- | softhddev.c | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/softhddev.c b/softhddev.c index 91a031a..ce032f5 100644 --- a/softhddev.c +++ b/softhddev.c @@ -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); + switch (play_mode) { + 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(); + 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 1: // audio/video from player + } + } + if (MyAudioDecoder) { // tell audio parser we have new stream + if (AudioCodecID != AV_CODEC_ID_NONE) { + NewAudioStream = 1; + } + } break; - case 2: // audio only - Debug(3, "softhddev: FIXME: audio only, silence video errors\n"); + case 1: // audio/video from player + VideoDisplayWakeup(); + Play(); break; - case 3: // audio only, black screen + 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 4: // video only + case 4: // video only from player, audio from decoder + VideoDisplayWakeup(); + Play(); break; } - - Play(); - return 1; } |