From 31a52ce4f6d8eceb62ed1e8deb484eaad8a15d72 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 14 Jan 2012 14:28:33 +0100 Subject: [PATCH] libtriple: add video parameter watchdog Add the video parameter watchdog to the (already existing) input thread, so we can remove it from zapit. Unfortunately, we need an ugly hack in cDemux for making sure we do not crash on exit... :-( Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/e83b77d0e569e8dcde85bbcd05338727bf8de2c9 Author: Stefan Seyfried Date: 2012-01-14 (Sat, 14 Jan 2012) ------------------ This commit was generated by Migit --- libtriple/dmx_td.cpp | 16 ++++++++++++++++ libtriple/lt_dfbinput.cpp | 11 ++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/libtriple/dmx_td.cpp b/libtriple/dmx_td.cpp index a912e8f..15c6627 100644 --- a/libtriple/dmx_td.cpp +++ b/libtriple/dmx_td.cpp @@ -12,6 +12,10 @@ #include "dmx_td.h" #include "lt_debug.h" +/* Ugh... see comment in destructor for details... */ +#include "video_td.h" +extern cVideo *videoDecoder; + #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) @@ -60,6 +64,18 @@ cDemux::~cDemux() { lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); Close(); + /* in zapit.cpp, videoDemux is deleted after videoDecoder + * in the video watchdog, we access videoDecoder + * the thread still runs after videoDecoder has been deleted + * => set videoDecoder to NULL here to make the check in the + * watchdog thread pick this up. + * This is ugly, but it saves me from changing neutrino + * + * if the delete order in neutrino will ever be changed, this + * will blow up badly :-( + */ + if (dmx_type == DMX_VIDEO_CHANNEL) + videoDecoder = NULL; } bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBufferSize) diff --git a/libtriple/lt_dfbinput.cpp b/libtriple/lt_dfbinput.cpp index 0a2ada1..252d14f 100644 --- a/libtriple/lt_dfbinput.cpp +++ b/libtriple/lt_dfbinput.cpp @@ -39,6 +39,10 @@ #include #include "lt_dfbinput.h" +/* needed for videodecoder watchdog */ +#include "video_td.h" +extern cVideo *videoDecoder; + /* same defines as in neutrino's rcinput.h */ #define KEY_TTTV KEY_FN_1 #define KEY_TTZOOM KEY_FN_2 @@ -245,7 +249,12 @@ static void *input_thread(void *data) thread_running = 1; while (thread_running) { - if (events->WaitForEventWithTimeout(events, 1, 0) == DFB_TIMEOUT) + /* check every 250ms (if a key is pressed on remote, we might + * even check earlier, but it does not really hurt... */ + if (videoDecoder) + videoDecoder->VideoParamWatchdog(); + + if (events->WaitForEventWithTimeout(events, 0, 250) == DFB_TIMEOUT) continue; DFBInputEvent e; while (events->GetEvent(events, DFB_EVENT(&e)) == DFB_OK)