From ad8b0a60b4db339ea8b27b246538bc0842fb8f4b Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 25 Nov 2006 02:15:10 +0000 Subject: [PATCH] A really rubbish hack way of identifying radio streams --- recording.cc | 32 ++++++++++++++++++++++++++++++++ recording.h | 4 ++++ vrecordinglist.cc | 7 +++++-- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/recording.cc b/recording.cc index c0d1157..c0af7af 100644 --- a/recording.cc +++ b/recording.cc @@ -90,3 +90,35 @@ void Recording::dropRecInfo() recInfo = NULL; recInfoFor = NULL; } + +bool Recording::isRadio() +{ + VDR* vdr = VDR::getInstance(); + if (!vdr) return false; + + ULONG lengthFrames = 0; + ULLONG lengthBytes = vdr->streamRecording(getFileName(), &lengthFrames); + if (!lengthBytes || !lengthFrames) return false; + + UINT thisRead; + UCHAR* buffer = vdr->getBlock(0ULL, 250000U, &thisRead); + if (!buffer) return false; + + if (!thisRead) + { + free(buffer); + return false; + } + + bool hasVideo = Demuxer::scanForVideo(buffer, thisRead); + + free(buffer); + + // FIXME + vdr->stopStreaming(); + + + if (!hasVideo) return true; + return false; +} + diff --git a/recording.h b/recording.h index 03dbc63..e1eaba5 100644 --- a/recording.h +++ b/recording.h @@ -27,6 +27,8 @@ #include "vdr.h" #include "recinfo.h" +#include "demuxer.h" + class Recording { public: @@ -46,6 +48,8 @@ class Recording void loadRecInfo(); void dropRecInfo(); + bool isRadio(); + static RecInfo* recInfo; private: diff --git a/vrecordinglist.cc b/vrecordinglist.cc index 8aa39f7..46d46db 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -296,8 +296,11 @@ int VRecordingList::doPlay(bool resume) Recording* toPlay = getCurrentOptionRecording(); if (toPlay) { - toPlay->loadRecInfo(); - if (toPlay->recInfo->hasNoVideo()) + toPlay->loadRecInfo(); // check if still need this + + bool isRadio = toPlay->isRadio(); + + if (isRadio) { VRadioRec* radrec = new VRadioRec(toPlay); radrec->draw(); -- 2.39.5