From f5796a769e0f958c2c6372e1374f2e59d81fd50d Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 3 Mar 2020 22:02:20 +0000 Subject: [PATCH] Rename class: PlayerRadio to PlayerRadioRec --- objects.mk | 4 +- playerradio.cc => playerradiorec.cc | 90 ++++++++++++++--------------- playerradio.h => playerradiorec.h | 10 ++-- vradiorec.cc | 12 ++-- vradiorec.h | 4 +- 5 files changed, 60 insertions(+), 60 deletions(-) rename playerradio.cc => playerradiorec.cc (78%) rename playerradio.h => playerradiorec.h (94%) diff --git a/objects.mk b/objects.mk index 5fa2805..8be3227 100644 --- a/objects.mk +++ b/objects.mk @@ -1,7 +1,7 @@ OBJ_COMMON = command.o tcp.o dsock.o thread.o timers.o i18n.o vdp6.o \ message.o messagequeue.o wol.o audio.o video.o log.o \ vdr.o recman.o recording.o recinfo.o channel.o rectimer.o event.o \ - directory.o mark.o option.o playerradio.o vfeed.o afeed.o \ + directory.o mark.o option.o vfeed.o afeed.o \ demuxer.o demuxervdr.o demuxerts.o stream.o osd.o surface.o \ region.o colour.o boxstack.o boxx.o tbboxx.o vrecording.o \ vinfo.o vquestion.o vrecordinglist.o vrecordinglistclassic.o \ @@ -19,7 +19,7 @@ OBJ_COMMON = command.o tcp.o dsock.o thread.o timers.o i18n.o vdp6.o teletextdecodervbiebu.o teletxt/txtfont.o movieinfo.o seriesinfo.o \ wmovieview.o wseriesview.o tvmedia.o wtvmedia.o wpictureview.o \ osdvector.o surfacevector.o buffer.o \ - playervideorec.o playervideolive.o playerradiolive.o + playervideorec.o playervideolive.o playerradiolive.o playerradiorec.o OBJ_RASPBERRY = main.o threadp.o osdopenvg.o \ ledraspberry.o videoomx.o audioomx.o imageomx.o \ diff --git a/playerradio.cc b/playerradiorec.cc similarity index 78% rename from playerradio.cc rename to playerradiorec.cc index a1f9c1f..0fdf0ad 100644 --- a/playerradio.cc +++ b/playerradiorec.cc @@ -27,11 +27,11 @@ #include "message.h" #include "messagequeue.h" -#include "playerradio.h" +#include "playerradiorec.h" // ----------------------------------- Called from outside, one offs or info funcs -PlayerRadio::PlayerRadio(MessageQueue* tmessageQueue, void* tmessageReceiver) +PlayerRadioRec::PlayerRadioRec(MessageQueue* tmessageQueue, void* tmessageReceiver) : messageQueue(tmessageQueue), messageReceiver(tmessageReceiver), afeed(this) { audio = Audio::getInstance(); @@ -40,12 +40,12 @@ PlayerRadio::PlayerRadio(MessageQueue* tmessageQueue, void* tmessageReceiver) Video::getInstance()->turnVideoOff(); } -PlayerRadio::~PlayerRadio() +PlayerRadioRec::~PlayerRadioRec() { if (initted) shutdown(); } -bool PlayerRadio::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRecording) +bool PlayerRadioRec::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRecording) { if (initted) return false; @@ -57,7 +57,7 @@ bool PlayerRadio::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRecor if (!demuxer->init(this, audio, NULL, NULL, 0, 40000, 0)) { - logger->log("PlayerRadio", Log::ERR, "Demuxer failed to init"); + logger->log("PlayerRadioRec", Log::ERR, "Demuxer failed to init"); shutdown(); return false; } @@ -67,7 +67,7 @@ bool PlayerRadio::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRecor lengthBytes = tlengthBytes; lengthFrames = tlengthFrames; - logger->log("PlayerRadio", Log::DEBUG, "PlayerRadio has received length bytes of %llu", lengthBytes); + logger->log("PlayerRadioRec", Log::DEBUG, "PlayerRadioRec has received length bytes of %llu", lengthBytes); UINT thisRead = 0; int success; @@ -75,7 +75,7 @@ bool PlayerRadio::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRecor UCHAR* buffer = vdr->getBlock(0, 10000, &thisRead); if (!buffer) { - logger->log("PlayerRadio", Log::ERR, "Failed to get start block"); + logger->log("PlayerRadioRec", Log::ERR, "Failed to get start block"); shutdown(); if (!vdr->isConnected()) doConnectionLost(); return false; @@ -84,7 +84,7 @@ bool PlayerRadio::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRecor success = demuxer->findPTS(buffer, thisRead, &startPTS); if (!success) { - logger->log("PlayerRadio", Log::ERR, "Failed to get start PTS"); + logger->log("PlayerRadioRec", Log::ERR, "Failed to get start PTS"); free(buffer); shutdown(); return false; @@ -94,7 +94,7 @@ bool PlayerRadio::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRecor if (!setLengthSeconds()) { - logger->log("PlayerRadio", Log::ERR, "Failed to setLengthSeconds"); + logger->log("PlayerRadioRec", Log::ERR, "Failed to setLengthSeconds"); shutdown(); return false; } @@ -103,7 +103,7 @@ bool PlayerRadio::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRecor return true; } -bool PlayerRadio::setLengthSeconds() +bool PlayerRadioRec::setLengthSeconds() { int success; ULLONG endPTS = 0; @@ -111,7 +111,7 @@ bool PlayerRadio::setLengthSeconds() UCHAR* buffer = vdr->getBlock(lengthBytes - 10000, 10000, &thisRead); if (!buffer) { - logger->log("PlayerRadio", Log::ERR, "Failed to get end block"); + logger->log("PlayerRadioRec", Log::ERR, "Failed to get end block"); if (!vdr->isConnected()) doConnectionLost(); return false; } @@ -120,7 +120,7 @@ bool PlayerRadio::setLengthSeconds() free(buffer); if (!success) { - logger->log("PlayerRadio", Log::ERR, "Failed to get end PTS"); + logger->log("PlayerRadioRec", Log::ERR, "Failed to get end PTS"); return false; } @@ -136,7 +136,7 @@ bool PlayerRadio::setLengthSeconds() return true; } -int PlayerRadio::shutdown() +int PlayerRadioRec::shutdown() { if (!initted) return 0; switchState(S_STOP); @@ -149,17 +149,17 @@ int PlayerRadio::shutdown() } -void PlayerRadio::setCurrentFrameNumber(ULONG num) +void PlayerRadioRec::setCurrentFrameNumber(ULONG num) { currentFrameNumber = num; } -ULONG PlayerRadio::getLengthSeconds() +ULONG PlayerRadioRec::getLengthSeconds() { return lengthSeconds; } -ULONG PlayerRadio::getCurrentSeconds() +ULONG PlayerRadioRec::getCurrentSeconds() { if (startup) return 0; @@ -172,7 +172,7 @@ ULONG PlayerRadio::getCurrentSeconds() // ----------------------------------- Externally called events -void PlayerRadio::play() +void PlayerRadioRec::play() { if (!initted) return; if (state == S_PLAY) return; @@ -182,7 +182,7 @@ void PlayerRadio::play() } -void PlayerRadio::playpause() +void PlayerRadioRec::playpause() { if (!initted) return; stateLock.lock(); @@ -194,17 +194,17 @@ void PlayerRadio::playpause() stateLock.unlock(); } -void PlayerRadio::stop() +void PlayerRadioRec::stop() { if (!initted) return; if (state == S_STOP) return; stateLock.lock(); - logger->log("PlayerRadio", Log::DEBUG, "Stop called lock"); + logger->log("PlayerRadioRec", Log::DEBUG, "Stop called lock"); switchState(S_STOP); stateLock.unlock(); } -void PlayerRadio::pause() +void PlayerRadioRec::pause() { if (!initted) return; stateLock.lock(); @@ -221,19 +221,19 @@ void PlayerRadio::pause() stateLock.unlock(); } -void PlayerRadio::jumpToPercent(double percent) +void PlayerRadioRec::jumpToPercent(double percent) { stateLock.lock(); - logger->log("PlayerRadio", Log::DEBUG, "JUMP TO %i%%", percent); + logger->log("PlayerRadioRec", Log::DEBUG, "JUMP TO %i%%", percent); ULONG newFrame = static_cast(percent * lengthFrames / 100); switchState(S_JUMP, newFrame); stateLock.unlock(); } -void PlayerRadio::skipForward(UINT seconds) +void PlayerRadioRec::skipForward(UINT seconds) { stateLock.lock(); - logger->log("PlayerRadio", Log::DEBUG, "SKIP FORWARD %i SECONDS", seconds); + logger->log("PlayerRadioRec", Log::DEBUG, "SKIP FORWARD %i SECONDS", seconds); ULONG currentSeconds = getCurrentSeconds(); ULONG currentFrame = demuxer->getPacketNum(); @@ -246,10 +246,10 @@ void PlayerRadio::skipForward(UINT seconds) stateLock.unlock(); } -void PlayerRadio::skipBackward(UINT seconds) +void PlayerRadioRec::skipBackward(UINT seconds) { stateLock.lock(); - logger->log("PlayerRadio", Log::DEBUG, "SKIP BACKWARD %i SECONDS", seconds); + logger->log("PlayerRadioRec", Log::DEBUG, "SKIP BACKWARD %i SECONDS", seconds); ULONG currentSeconds = getCurrentSeconds(); ULONG currentFrame = demuxer->getPacketNum(); @@ -269,11 +269,11 @@ void PlayerRadio::skipBackward(UINT seconds) // ----------------------------------- Implementations called events -void PlayerRadio::switchState(UCHAR toState, ULONG jumpToFrame) +void PlayerRadioRec::switchState(UCHAR toState, ULONG jumpToFrame) { if (!initted) return; - logger->log("PlayerRadio", Log::DEBUG, "Switch state from %u to %u", state, toState); + logger->log("PlayerRadioRec", Log::DEBUG, "Switch state from %u to %u", state, toState); switch(state) // current state selector { @@ -362,7 +362,7 @@ void PlayerRadio::switchState(UCHAR toState, ULONG jumpToFrame) demuxer->setPacketNum(currentFrameNumber); state = S_PLAY; threadStart(); - logger->log("PlayerRadio", Log::DEBUG, "Immediate play"); + logger->log("PlayerRadioRec", Log::DEBUG, "Immediate play"); afeed.start(); audio->play(); @@ -388,7 +388,7 @@ void PlayerRadio::switchState(UCHAR toState, ULONG jumpToFrame) // ----------------------------------- Internal functions -void PlayerRadio::restartAtFrame(ULONG newFrame) +void PlayerRadioRec::restartAtFrame(ULONG newFrame) { afeed.stop(); threadStop(); @@ -404,32 +404,32 @@ void PlayerRadio::restartAtFrame(ULONG newFrame) audio->doMuting(); } -void PlayerRadio::doConnectionLost() +void PlayerRadioRec::doConnectionLost() { - logger->log("PlayerRadio", Log::DEBUG, "Connection lost, sending message"); + logger->log("PlayerRadioRec", Log::DEBUG, "Connection lost, sending message"); Message* m = new Message(); m->to = messageReceiver; m->from = this; m->message = Message::PLAYER_EVENT; - m->parameter = PlayerRadio::CONNECTION_LOST; + m->parameter = PlayerRadioRec::CONNECTION_LOST; messageQueue->postMessage(m); } // ----------------------------------- Callback -void PlayerRadio::call(void* /*caller*/) +void PlayerRadioRec::call(void* /*caller*/) { threadSignalNoLock(); } // ----------------------------------- Feed thread -void PlayerRadio::threadMethod() +void PlayerRadioRec::threadMethod() { if (state == S_PLAY) threadFeedPlay(); } -void PlayerRadio::threadFeedPlay() +void PlayerRadioRec::threadFeedPlay() { ULLONG feedPosition; UINT thisRead, writeLength, thisWrite, askFor; @@ -437,7 +437,7 @@ void PlayerRadio::threadFeedPlay() feedPosition = vdr->positionFromFrameNumber(currentFrameNumber); if (!vdr->isConnected()) { doConnectionLost(); return; } - logger->log("PlayerRadio", Log::DEBUG, "startFeedPlay: wantedFrame %i goto %llu", currentFrameNumber, feedPosition); + logger->log("PlayerRadioRec", Log::DEBUG, "startFeedPlay: wantedFrame %i goto %llu", currentFrameNumber, feedPosition); while(1) @@ -453,12 +453,12 @@ void PlayerRadio::threadFeedPlay() { lengthBytes = vdr->rescanRecording(&lengthFrames); if (!vdr->isConnected()) { doConnectionLost(); return; } - logger->log("PlayerRadio", Log::DEBUG, "Rescanned and reset length: %llu", lengthBytes); + logger->log("PlayerRadioRec", Log::DEBUG, "Rescanned and reset length: %llu", lengthBytes); lastRescan = time(NULL); if (!setLengthSeconds()) { - logger->log("PlayerRadio", Log::ERR, "Failed to setLengthSeconds in thread"); + logger->log("PlayerRadioRec", Log::ERR, "Failed to setLengthSeconds in thread"); return; } } @@ -495,7 +495,7 @@ void PlayerRadio::threadFeedPlay() { int a_stream = demuxer->scan(threadBuffer, thisRead); demuxer->setAudioStream(a_stream); - logger->log("PlayerRadio", Log::DEBUG, "Startup Audio stream chosen %x", a_stream); + logger->log("PlayerRadioRec", Log::DEBUG, "Startup Audio stream chosen %x", a_stream); startup = false; } @@ -523,7 +523,7 @@ void PlayerRadio::threadFeedPlay() } // end of recording - logger->log("PlayerRadio", Log::DEBUG, "Recording playback ends"); + logger->log("PlayerRadioRec", Log::DEBUG, "Recording playback ends"); threadCheckExit(); @@ -532,12 +532,12 @@ void PlayerRadio::threadFeedPlay() m->to = messageReceiver; m->from = this; m->message = Message::PLAYER_EVENT; - m->parameter = PlayerRadio::STOP_PLAYBACK; - logger->log("PlayerRadio", Log::DEBUG, "Posting message to %p...", messageQueue); + m->parameter = PlayerRadioRec::STOP_PLAYBACK; + logger->log("PlayerRadioRec", Log::DEBUG, "Posting message to %p...", messageQueue); messageQueue->postMessage(m); } -void PlayerRadio::threadPostStopCleanup() +void PlayerRadioRec::threadPostStopCleanup() { if (threadBuffer) { diff --git a/playerradio.h b/playerradiorec.h similarity index 94% rename from playerradio.h rename to playerradiorec.h index 57e6625..56a9fc9 100644 --- a/playerradio.h +++ b/playerradiorec.h @@ -18,8 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef PLAYERRADIO_H -#define PLAYERRADIO_H +#ifndef PLAYERRADIOREC_H +#define PLAYERRADIOREC_H #include #include @@ -50,11 +50,11 @@ class MessageQueue; * I don't know where this comes from but things seem to work. */ -class PlayerRadio : public Thread_TYPE, public Callback +class PlayerRadioRec : public Thread_TYPE, public Callback { public: - PlayerRadio(MessageQueue* messageQueue, void* messageReceiver); - virtual ~PlayerRadio(); + PlayerRadioRec(MessageQueue* messageQueue, void* messageReceiver); + virtual ~PlayerRadioRec(); bool init(ULLONG lengthBytes, ULONG lengthFrames, bool IsPesRecording); int shutdown(); diff --git a/vradiorec.cc b/vradiorec.cc index f574ef3..dec56c2 100644 --- a/vradiorec.cc +++ b/vradiorec.cc @@ -25,7 +25,7 @@ #include "message.h" #include "vdr.h" #include "video.h" -#include "playerradio.h" +#include "playerradiorec.h" #include "boxstack.h" #include "input.h" #include "vinfo.h" @@ -46,7 +46,7 @@ VRadioRec::VRadioRec(Recording* rec) startMargin = 0; endMargin = 0; - player = new PlayerRadio(Command::getInstance(), this); + player = new PlayerRadioRec(Command::getInstance(), this); char* cstartMargin = vdr->configLoad("Timers", "Start margin"); char* cendMargin = vdr->configLoad("Timers", "End margin"); @@ -311,7 +311,7 @@ void VRadioRec::processMessage(Message* m) switch(m->parameter) { - case PlayerRadio::CONNECTION_LOST: // connection lost detected + case PlayerRadioRec::CONNECTION_LOST: // connection lost detected { // I can't handle this, send it to command Message* m2 = new Message(); @@ -320,7 +320,7 @@ void VRadioRec::processMessage(Message* m) MessageQueue::getInstance()->postMessage(m2); break; } - case PlayerRadio::STOP_PLAYBACK: + case PlayerRadioRec::STOP_PLAYBACK: { // FIXME Obselete ish - improve this Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex @@ -385,8 +385,8 @@ void VRadioRec::doBar(int action) else { playerState = player->getState(); - if (playerState == PlayerRadio::S_PAUSE_P) w.nextSymbol = WSymbol::PAUSE; - else if (playerState == PlayerRadio::S_PAUSE_I) w.nextSymbol = WSymbol::PAUSE; + if (playerState == PlayerRadioRec::S_PAUSE_P) w.nextSymbol = WSymbol::PAUSE; + else if (playerState == PlayerRadioRec::S_PAUSE_I) w.nextSymbol = WSymbol::PAUSE; else w.nextSymbol = WSymbol::PLAY; } diff --git a/vradiorec.h b/vradiorec.h index dfff16d..b333628 100644 --- a/vradiorec.h +++ b/vradiorec.h @@ -30,7 +30,7 @@ class Recording; class Message; class VDR; class Video; -class PlayerRadio; +class PlayerRadioRec; class BoxStack; class VRadioRec : public Boxx, public TimerReceiver @@ -50,7 +50,7 @@ class VRadioRec : public Boxx, public TimerReceiver VDR* vdr; Video* video; Timers* timers; - PlayerRadio* player; + PlayerRadioRec* player; Recording* myRec; BoxStack* boxstack; -- 2.39.5