From 9517179718f80218756c469a9071b809487aa560 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 25 Feb 2020 22:42:27 +0000 Subject: [PATCH] 27 CWFs --- demuxer.h | 4 ++-- playerlivetv.cc | 6 +++--- playervideorec.cc | 17 ++++++++++------- playervideorec.h | 15 ++++++++------- vdr.cc | 18 +++++++++--------- 5 files changed, 32 insertions(+), 28 deletions(-) diff --git a/demuxer.h b/demuxer.h index 20f544b..b7c9771 100644 --- a/demuxer.h +++ b/demuxer.h @@ -128,7 +128,7 @@ class Demuxer int getHorizontalSize() { return horizontal_size; } int getVerticalSize() { return vertical_size; } - int getAspectRatio(int *tparx,int *tpary) { + UCHAR getAspectRatio(int *tparx,int *tpary) { *tparx=parx; *tpary=pary;return aspect_ratio; } int getFrameRate() { return frame_rate; } int getBitRate() { return bit_rate; } @@ -136,7 +136,7 @@ class Demuxer ULLONG getVideoPTS() { return video_pts; } ULLONG getAudioPTS() { return audio_pts; } - enum AspectRatio + enum AspectRatio : UCHAR { ASPECT_1_1 = 1, ASPECT_4_3 = 2, diff --git a/playerlivetv.cc b/playerlivetv.cc index 4e2e3f7..6e1e813 100644 --- a/playerlivetv.cc +++ b/playerlivetv.cc @@ -230,7 +230,7 @@ void PlayerLiveTV::call(void* caller) logger->log("PlayerLiveTV", Log::DEBUG, "Callback from demuxer"); int parx,pary; - int dxCurrentAspect = demuxer->getAspectRatio(&parx, &pary); + UCHAR dxCurrentAspect = demuxer->getAspectRatio(&parx, &pary); if (dxCurrentAspect == Demuxer::ASPECT_4_3) { if (video->getTVsize() == Video::ASPECT16X9) @@ -341,7 +341,7 @@ void PlayerLiveTV::chunkToDemuxer() StreamChunk s = streamChunks.front(); streamChunks.pop(); // logger->log("PlayerLiveTV", Log::DEBUG, "About to call demuxer with %p %lu", s.data, s.len); - /* int a =*/ demuxer->put((UCHAR*)s.data, s.len); + /* int a =*/ demuxer->put(static_cast(s.data), s.len); // logger->log("PlayerLiveTV", Log::DEBUG, "put %i to demuxer", a); free(s.data); if (pendingAudioPlay && (demuxer->getHorizontalSize() || !video->independentAVStartUp())) //Horizontal Size is zero, if not parsed @@ -838,7 +838,7 @@ void PlayerLiveTV::threadMethod() { // logger->log("PlayerLiveTV", Log::DEBUG, "chunk mark3"); ++preBufferCount; - ULONG percentDone = (ULONG)(preBufferCount / (float)preBufferAmount * 100); + ULONG percentDone = (preBufferCount * 100) / preBufferAmount; logger->log("PlayerLiveTV", Log::DEBUG, "Prebuffering %lu%%", percentDone); Message* m = new Message(); diff --git a/playervideorec.cc b/playervideorec.cc index 83a02ea..73a25a7 100644 --- a/playervideorec.cc +++ b/playervideorec.cc @@ -36,8 +36,8 @@ // ----------------------------------- Called from outside, one offs or info funcs PlayerVideoRec::PlayerVideoRec(MessageQueue* tmessageQueue, void* tmessageReceiver, OSDReceiver* tosdReceiver) -: vfeed(this), afeed(this), tfeed(this), messageQueue(tmessageQueue), - messageReceiver(tmessageReceiver), osdReceiver(tosdReceiver) +: vfeed(this), afeed(this), tfeed(this), + osdReceiver(tosdReceiver), messageQueue(tmessageQueue), messageReceiver(tmessageReceiver) { audio = Audio::getInstance(); video = Video::getInstance(); @@ -962,7 +962,7 @@ void PlayerVideoRec::call(void* caller) } int parx,pary; - int dxCurrentAspect = demuxer->getAspectRatio(&parx,&pary); + UCHAR dxCurrentAspect = demuxer->getAspectRatio(&parx,&pary); if (dxCurrentAspect == Demuxer::ASPECT_4_3) { logger->log("Player", Log::DEBUG, "Demuxer said video is 4:3 aspect, switching TV"); @@ -1211,7 +1211,7 @@ void PlayerVideoRec::threadPTSFeedScan() baseFrameNumber = iframeNumber; - frameTimeOffset =(int) ((double)(abs((int)iframeNumber - (int)currentfeedFrameNumber) * 1000) / (fps * (double)ifactor)); + frameTimeOffset = static_cast((abs(static_cast(iframeNumber - currentfeedFrameNumber)) * 1000) / (fps * ifactor)); logger->log("Player", Log::DEBUG, "XXX Got frame"); @@ -1241,7 +1241,7 @@ void PlayerVideoRec::threadPTSFeedScan() // logger->log("Player", Log::ERR, "FFN: %d CFN: %d dirfac %d time %lld ifac %d fps %g", // firstFrameNumber, currentFrameNumber,dir_fac,cur_time,ifactor,fps); if (cur_time!=0) { - currentFrameNumber=firstFrameNumber+(int)(((double)(dir_fac*((long long)cur_time)*((int)ifactor))*fps/90000.)); + currentFrameNumber=firstFrameNumber+(int)(((double)(dir_fac*((long long)cur_time)*((int)ifactor))*fps/90000.)); // old } } @@ -1253,7 +1253,7 @@ void PlayerVideoRec::threadPTSFeedScan() // logger->log("Player", Log::ERR, "FFN: %d CFN: %d dirfac %d time %lld ifac %d fps %g", // firstFrameNumber, currentFrameNumber,dir_fac,cur_time,ifactor,fps); if (cur_time!=0) { - currentFrameNumber=firstFrameNumber+(int)(((double)(dir_fac*((long long)cur_time)*((int)ifactor))*fps/90000.)); + currentFrameNumber=firstFrameNumber+(int)(((double)(dir_fac*((long long)cur_time)*((int)ifactor))*fps/90000.)); // old } } @@ -1309,7 +1309,10 @@ void PlayerVideoRec::threadFeedScan() // scan has got to the end of what we knew to be there before we started scanning baseFrameNumber = iframeNumber; - frameTimeOffset =(int) ((double)(abs((int)iframeNumber - (int)currentFrameNumber) * 1000) / (fps * (double)ifactor)); + frameTimeOffset = static_cast((abs(static_cast(iframeNumber - currentFrameNumber)) * 1000) / (fps * ifactor)); + +// logger->log("Player", Log::DEBUG, "Frame Time Offset: %i", frameTimeOffset); + #ifndef WIN32 gettimeofday(&clock0, NULL); #else diff --git a/playervideorec.h b/playervideorec.h index f55169e..8d44911 100644 --- a/playervideorec.h +++ b/playervideorec.h @@ -135,26 +135,27 @@ class PlayerVideoRec : public Thread_TYPE, public Callback void restartAtFrame(ULONG newFrame); void restartAtFramePI(ULONG newFrame); - bool subtitlesShowing{}; + VFeed vfeed; + AFeed afeed; + TFeed tfeed; OSDReceiver* osdReceiver; + MessageQueue* messageQueue; + void* messageReceiver; Log* logger; Audio* audio; Video* video; Demuxer* demuxer; DVBSubtitles* subtitles; VDR* vdr; - VFeed vfeed; - AFeed afeed; - TFeed tfeed; + TeletextDecoderVBIEBU *teletext; - MessageQueue* messageQueue; - void* messageReceiver; bool initted{}; bool startup; bool videoStartup{}; - + bool subtitlesShowing{}; bool is_pesrecording{true}; + double fps; std::mutex stateMutex; diff --git a/vdr.cc b/vdr.cc index 0a242e7..11e9b56 100644 --- a/vdr.cc +++ b/vdr.cc @@ -861,7 +861,7 @@ int VDR::deleteRecording(char* fileName) VDR_ResponsePacket* vresp = RequestResponse(&vrp); if (vresp->noResponse()) { delete vresp; return 0; } - int toReturn = (int)vresp->extractULONG(); + int toReturn = static_cast(vresp->extractULONG()); delete vresp; return toReturn; @@ -876,7 +876,7 @@ int VDR::deleteRecResume(char* fileName) VDR_ResponsePacket* vresp = RequestResponse(&vrp); if (vresp->noResponse()) { delete vresp; return 0; } - int toReturn = (int)vresp->extractULONG(); + int toReturn = static_cast(vresp->extractULONG()); delete vresp; return toReturn; @@ -893,7 +893,7 @@ char* VDR::moveRecording(char* fileName, char* newPath) if (vresp->noResponse()) { delete vresp; return NULL; } char* toReturn = NULL; - int success = (int)vresp->extractULONG(); + int success = static_cast(vresp->extractULONG()); if (success == 1) { toReturn = vresp->extractString(); @@ -923,7 +923,7 @@ ChannelList* VDR::getChannelsList(ULONG type) chan->number = vresp->extractULONG(); chan->type = vresp->extractULONG(); chan->name = vresp->extractString(); - chan->vstreamtype = vresp->extractULONG(); + chan->vstreamtype = static_cast(vresp->extractULONG()); if (chan->type == type && ((chan->vstreamtype==0x1b && h264support)|| (chan->vstreamtype!=0x1b &&mpeg2support)) ) { @@ -978,7 +978,7 @@ int VDR::streamChannel(ULONG number, StreamReceiver* tstreamReceiver) return 0; } - int toReturn = (int)vresp->extractULONG(); + int toReturn = static_cast(vresp->extractULONG()); logger->log("VDR", Log::DEBUG, "VDR said %lu to start streaming request", toReturn); delete vresp; @@ -1001,7 +1001,7 @@ int VDR::stopStreaming() VDR_ResponsePacket* vresp = RequestResponse(&vrp); if (vresp->noResponse()) { delete vresp; return 0; } - int toReturn = (int)vresp->extractULONG(); + int toReturn = static_cast(vresp->extractULONG()); delete vresp; return toReturn; @@ -1176,7 +1176,7 @@ int VDR::configSave(const char* section, const char* key, const char* value) VDR_ResponsePacket* vresp = RequestResponse(&vrp); if (vresp->noResponse()) { delete vresp; return 0; } - int toReturn = (int)vresp->extractULONG(); + int toReturn = static_cast(vresp->extractULONG()); delete vresp; return toReturn; @@ -1380,7 +1380,7 @@ void VDR::getChannelPids(Channel* channel) // } channel->vpid = vresp->extractULONG(); - channel->vstreamtype = vresp->extractULONG(); + channel->vstreamtype = static_cast(vresp->extractULONG()); channel->numAPids = vresp->extractULONG(); for (ULONG i = 0; i < channel->numAPids; i++) @@ -1607,7 +1607,7 @@ int VDR::deleteTimer(RecTimer* delTimer) VDR_ResponsePacket* vresp = RequestResponse(&vrp); if (vresp->noResponse()) { delete vresp; return 0; } - int toReturn = (int)vresp->extractULONG(); + int toReturn = static_cast(vresp->extractULONG()); delete vresp; return toReturn; -- 2.39.5