diff --git a/generic-pc/audio.cpp b/generic-pc/audio.cpp index bb814e7..8641c4d 100644 --- a/generic-pc/audio.cpp +++ b/generic-pc/audio.cpp @@ -45,12 +45,15 @@ extern cDemux *audioDemux; static uint8_t *dmxbuf = NULL; static int bufpos; +extern bool HAL_nodec; + static cAudio *gThiz = NULL; cAudio::cAudio(void *, void *, void *) { thread_started = false; - dmxbuf = (uint8_t *)malloc(DMX_BUF_SZ); + if (!HAL_nodec) + dmxbuf = (uint8_t *)malloc(DMX_BUF_SZ); bufpos = 0; curr_pts = 0; gThiz = this; @@ -89,7 +92,8 @@ int cAudio::setVolume(unsigned int left, unsigned int right) int cAudio::Start(void) { lt_info("%s >\n", __func__); - OpenThreads::Thread::start(); + if (! HAL_nodec) + OpenThreads::Thread::start(); lt_info("%s <\n", __func__); return 0; } diff --git a/generic-pc/dmx.cpp b/generic-pc/dmx.cpp index e771986..84f32cf 100644 --- a/generic-pc/dmx.cpp +++ b/generic-pc/dmx.cpp @@ -76,6 +76,8 @@ static const char *devname[] = { static int dmx_tp_count = 0; #define MAX_TS_COUNT 8 +extern bool HAL_nodec; + cDemux::cDemux(int n) { if (n < 0 || n > 2) @@ -383,10 +385,14 @@ bool cDemux::pesFilter(const unsigned short pid) case DMX_AUDIO_CHANNEL: p_flt.pes_type = DMX_PES_OTHER; p_flt.output = DMX_OUT_TSDEMUX_TAP; + if (HAL_nodec) /* no need to demux if we don't decode... */ + return true; break; case DMX_VIDEO_CHANNEL: p_flt.pes_type = DMX_PES_OTHER; p_flt.output = DMX_OUT_TSDEMUX_TAP; + if (HAL_nodec) + return true; break; case DMX_PES_CHANNEL: p_flt.pes_type = DMX_PES_OTHER; diff --git a/generic-pc/init.cpp b/generic-pc/init.cpp index ad272f9..5fadc88 100644 --- a/generic-pc/init.cpp +++ b/generic-pc/init.cpp @@ -9,6 +9,7 @@ static bool initialized = false; GLFramebuffer *glfb = NULL; +bool HAL_nodec = false; void init_td_api() { @@ -35,6 +36,10 @@ void init_td_api() glfb = new GLFramebuffer(x, y); /* hard coded to PAL resolution for now */ } + /* allow disabling of Audio/video decoders in case we just want to + * valgrind-check other parts... export HAL_NOAVDEC=1 */ + if (getenv("HAL_NOAVDEC")) + HAL_nodec = true; initialized = true; } diff --git a/generic-pc/video.cpp b/generic-pc/video.cpp index 429c3d9..2b2cfe9 100644 --- a/generic-pc/video.cpp +++ b/generic-pc/video.cpp @@ -50,6 +50,8 @@ extern cDemux *videoDemux; extern GLFramebuffer *glfb; int system_rev = 0; +extern bool HAL_nodec; + static uint8_t *dmxbuf; static int bufpos; @@ -66,7 +68,8 @@ cVideo::cVideo(int, void *, void *) { lt_debug("%s\n", __func__); av_register_all(); - dmxbuf = (uint8_t *)malloc(DMX_BUF_SZ); + if (!HAL_nodec) + dmxbuf = (uint8_t *)malloc(DMX_BUF_SZ); bufpos = 0; thread_running = false; w_h_changed = false; @@ -135,7 +138,7 @@ int cVideo::setCroppingMode(int) int cVideo::Start(void *, unsigned short, unsigned short, void *) { lt_info("%s running %d >\n", __func__, thread_running); - if (!thread_running) + if (!thread_running && !HAL_nodec) OpenThreads::Thread::start(); lt_info("%s running %d <\n", __func__, thread_running); return 0;