From 3bf9fde506f14e5217dfa67cc597d8392c956139 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 14 Aug 2022 16:52:01 +0000 Subject: [PATCH] Type updates: static_cast -> toi4 ULONG -> u4 ULLONG -> u8 --- src/audioomx.cc | 4 +- src/audioomx.h | 2 +- src/audioplayer.cc | 32 +-- src/audioplayer.h | 34 ++-- src/audiowin.cc | 10 +- src/bitmap.cc | 8 +- src/bitmap.h | 14 +- src/boxx.cc | 14 +- src/channel.cc | 6 +- src/config.cc | 3 +- src/control.cc | 2 +- src/defines.h | 3 +- src/demuxer.cc | 16 +- src/demuxer.h | 28 +-- src/demuxeraudio.cc | 42 ++-- src/demuxeraudio.h | 18 +- src/demuxermedia.cc | 24 +-- src/demuxermedia.h | 26 +-- src/demuxerts.cc | 42 ++-- src/demuxerts.h | 14 +- src/demuxervdr.cc | 34 ++-- src/demuxervdr.h | 14 +- src/directory.cc | 8 +- src/directory.h | 4 +- src/draintarget.h | 8 +- src/dsallocator.cc | 6 +- src/dsallocator.h | 4 +- src/dssourcefilter.cc | 26 +-- src/dssourcefilter.h | 4 +- src/dssourcepin.cc | 30 +-- src/dssourcepin.h | 6 +- src/dvbsubtitles.cc | 26 +-- src/dvbsubtitles.h | 8 +- src/event.h | 6 +- src/image.h | 28 +-- src/imageloader.cc | 6 +- src/imageloader.h | 4 +- src/imagereader.cc | 4 +- src/imagereader.h | 6 +- src/input.cc | 12 +- src/input.h | 4 +- src/inputcec.cc | 2 +- src/inputlinux.h | 2 +- src/inputwin.cc | 14 +- src/media.cc | 22 +- src/media.h | 42 ++-- src/mediafile.cc | 28 +-- src/mediafile.h | 18 +- src/mediaplayer.cc | 18 +- src/mediaplayer.h | 14 +- src/mediaprovider.h | 10 +- src/mediaproviderids.h | 8 +- src/message.h | 4 +- src/osdopenvg.cc | 6 +- src/osdopenvg.h | 2 +- src/osdvector.h | 2 +- src/osdvectortypes.h | 4 +- src/osdwinvector.cc | 2 +- src/osdwinvector.h | 2 +- src/playerlive.h | 8 +- src/playermedia.cc | 44 ++-- src/playermedia.h | 50 ++--- src/playerradiolive.cc | 12 +- src/playerradiolive.h | 6 +- src/playerradiorec.cc | 36 ++-- src/playerradiorec.h | 22 +- src/playervideolive.cc | 14 +- src/playervideolive.h | 6 +- src/playervideorec.cc | 76 +++---- src/playervideorec.h | 22 +- src/recinfo.cc | 12 +- src/recinfo.h | 18 +- src/recman.cc | 10 +- src/recman.h | 16 +- src/recording.cc | 8 +- src/recording.h | 6 +- src/rectimer.h | 20 +- src/serialize.cc | 82 ++++---- src/serialize.h | 42 ++-- src/sleeptimer.cc | 2 +- src/stream.cc | 28 +-- src/surface.cc | 10 +- src/surfaceopengl.cc | 2 +- src/surfaceopengl.h | 2 +- src/surfacewin.cc | 2 +- src/surfacewin.h | 2 +- src/tcp.cc | 14 +- src/tcp.h | 4 +- src/teletextdecodervbiebu.cc | 6 +- src/udp4.cc | 8 +- src/udp4.h | 4 +- src/udp6.cc | 8 +- src/udp6.h | 4 +- src/util.cc | 18 +- src/util.h | 6 +- src/vaudioselector.cc | 2 +- src/vchannellist.cc | 2 +- src/vchannellist.h | 4 +- src/vchannelselect.cc | 2 +- src/vdpc.cc | 10 +- src/vdpc.h | 10 +- src/vdr.cc | 376 +++++++++++++++++------------------ src/vdr.h | 66 +++--- src/vdrcommand.h | 104 +++++----- src/vdrrequestpacket.cc | 34 ++-- src/vdrrequestpacket.h | 34 ++-- src/vdrresponsepacket.cc | 38 ++-- src/vdrresponsepacket.h | 30 +-- src/vepglistadvanced.cc | 24 +-- src/vepglistadvanced.h | 6 +- src/vepgsettimer.cc | 2 +- src/vepgsummary.cc | 6 +- src/video.cc | 2 +- src/video.h | 6 +- src/videoomx.cc | 12 +- src/videoomx.h | 6 +- src/videowin.cc | 36 ++-- src/videowin.h | 8 +- src/vmedialist.cc | 22 +- src/vmedialist.h | 16 +- src/vmediaview.cc | 18 +- src/vmediaview.h | 4 +- src/vpicturebanner.cc | 2 +- src/vradiorec.cc | 22 +- src/vrecmove.cc | 2 +- src/vrecording.cc | 2 +- src/vrecordingmenu.cc | 4 +- src/vscreensaver.cc | 4 +- src/vtimerlist.cc | 2 +- src/vvideolivetv.cc | 24 +-- src/vvideolivetv.h | 6 +- src/vvideomedia.cc | 10 +- src/vvideomedia.h | 4 +- src/vvideorec.cc | 28 +-- src/vwelcome.cc | 2 +- src/wbutton.cc | 8 +- src/winmain.cc | 14 +- src/wjpegcomplex.cc | 42 ++-- src/wjpegcomplex.h | 6 +- src/wol.cc | 2 +- src/woptionbox.cc | 8 +- src/woptionpane.cc | 4 +- src/wremoteconfig.cc | 8 +- src/wselectlist.cc | 18 +- src/wtextbox.cc | 4 +- src/wwinaudiofilter.cc | 8 +- src/wwinmp3audiofilter.cc | 8 +- src/wwinvideofilter.cc | 12 +- src/wwinvideoh264filter.cc | 12 +- 149 files changed, 1283 insertions(+), 1283 deletions(-) diff --git a/src/audioomx.cc b/src/audioomx.cc index 2ba6bb9..1b415dc 100644 --- a/src/audioomx.cc +++ b/src/audioomx.cc @@ -1201,7 +1201,7 @@ int AudioOMX::PrepareInputBufsOMX(bool setportdef) //needs to be called with loc if (setportdef) { port_def_type.nBufferCountActual=2; - port_def_type.nBufferSize=std::max(static_cast(port_def_type.nBufferSize),50000); // for transcoder important + port_def_type.nBufferSize=std::max(toi4(port_def_type.nBufferSize),50000); // for transcoder important error=OMX_SetParameter(omx_aud_rend/*dec*/,OMX_IndexParamPortDefinition, &port_def_type); @@ -1596,7 +1596,7 @@ int AudioOMX::setVolume(int tvolume) #ifdef DEV int AudioOMX::test() { -// ULLONG stc = 0; +// u8 stc = 0; // return ioctl(fdAudio, AV_SET_AUD_STC, &stc); /* aud_sync_parms_t a; diff --git a/src/audioomx.h b/src/audioomx.h index 556f0f1..edc4df5 100644 --- a/src/audioomx.h +++ b/src/audioomx.h @@ -148,7 +148,7 @@ class AudioOMX : public Audio OMX_U32 omx_clock_output_port; long long lastreftimeOMX; - ULLONG lastreftimePTS; + u8 lastreftimePTS; diff --git a/src/audioplayer.cc b/src/audioplayer.cc index 44ade44..dab329d 100644 --- a/src/audioplayer.cc +++ b/src/audioplayer.cc @@ -228,16 +228,16 @@ int AudioPlayer::fastBackward(){ int AudioPlayer::jumpToPercent(double percent){ if (! canPosition) return 1; threadLock(); - ULONG fsec=demuxer->getSecondsFromLen(lenInBytes); - ULONG npos=streampos; + u4 fsec=demuxer->getSecondsFromLen(lenInBytes); + u4 npos=streampos; if (fsec != 0) { - fsec=(ULONG)(((double)fsec*percent)/(double)100); + fsec=(u4)(((double)fsec*percent)/(double)100); npos=demuxer->positionFromSeconds(fsec); logger->log("AudioPlayer",Log::DEBUG,"new pos %ld from demux",npos); } if (npos == 0) { //the demuxer cannot help us - npos=(ULONG)(((double)lenInBytes*percent)/(double)100); + npos=(u4)(((double)lenInBytes*percent)/(double)100); logger->log("AudioPlayer",Log::DEBUG,"new pos %ld without demux",npos); } if (npos > lenInBytes) npos=lenInBytes-1; @@ -252,8 +252,8 @@ int AudioPlayer::jumpToPercent(double percent){ int AudioPlayer::skipForward(int seconds) { if (! canPosition) return 1; threadLock(); - ULONG curr=demuxer->getSecondsFromLen(streampos); - ULONG dest=demuxer->positionFromSeconds(curr+(UINT)seconds); + u4 curr=demuxer->getSecondsFromLen(streampos); + u4 dest=demuxer->positionFromSeconds(curr+(UINT)seconds); if (dest != 0) { logger->log("AudioPlayer",Log::DEBUG,"new pos %ld skip %ds",dest,seconds); requestedStreampos=dest; @@ -266,9 +266,9 @@ int AudioPlayer::skipForward(int seconds) { int AudioPlayer::skipBackward(int seconds) { if (! canPosition) return 1; threadLock(); - ULONG curr=demuxer->getSecondsFromLen(streampos); + u4 curr=demuxer->getSecondsFromLen(streampos); if (curr > (UINT)seconds) { - ULONG dest=demuxer->positionFromSeconds(curr-(UINT)seconds); + u4 dest=demuxer->positionFromSeconds(curr-(UINT)seconds); if (dest != 0) { logger->log("AudioPlayer",Log::DEBUG,"new pos %ld skip %ds",dest,seconds); requestedStreampos=dest; @@ -285,7 +285,7 @@ int AudioPlayer::skipBackward(int seconds) { // ----------------------------------- Internal functions -void AudioPlayer::sendFrontendMessage(ULONG para) +void AudioPlayer::sendFrontendMessage(u4 para) { logger->log("AudioPlayer", Log::DEBUG, "sending frontend message %ld",para); Message* m = new Message(); @@ -316,7 +316,7 @@ int AudioPlayer::openFile() { MediaInfo mi; rt=MediaPlayer::getInstance()->getMediaInfo(2,&mi); canPosition=mi.canPosition; - ULONG rsize=0; + u4 rsize=0; UCHAR *idbuf=NULL; if (canPosition) { rt=MediaPlayer::getInstance()->getMediaBlock(2,0,demuxer->headerBytes(),&rsize,&idbuf); @@ -597,11 +597,11 @@ void AudioPlayer::threadMethod() audio->PrepareMediaSample(pl,0); UINT bytesWritten=0; UINT rt=audio->DeliverMediaSample(threadBuffer,&bytesWritten); - ULONG written=thisRead; + u4 written=thisRead; if (rt == 0) written=bytesWritten; */ - ULONG written= demuxer->put(threadBuffer + thisWrite, thisRead - thisWrite); + u4 written= demuxer->put(threadBuffer + thisWrite, thisRead - thisWrite); thisWrite+=written; bytesWritten+=written; if (thisWrite < thisRead) { @@ -741,8 +741,8 @@ char * AudioPlayer::getID3Info() { return rt; } -ULONG AudioPlayer::getCurrentTimes(){ - ULONG rt=0; +u4 AudioPlayer::getCurrentTimes(){ + u4 rt=0; threadLock(); if (streampos != 0){ rt=demuxer->getSecondsFromLen(bytesWritten); @@ -755,8 +755,8 @@ ULONG AudioPlayer::getCurrentTimes(){ return rt; } -ULONG AudioPlayer::getSonglen(){ - ULONG rt=0; +u4 AudioPlayer::getSonglen(){ + u4 rt=0; threadLock(); const DemuxerAudio::vbrInfo * vbr=demuxer->getVBRINfo(); if (vbr) rt=vbr->fileSeconds; diff --git a/src/audioplayer.h b/src/audioplayer.h index f39df37..2fe1223 100644 --- a/src/audioplayer.h +++ b/src/audioplayer.h @@ -97,9 +97,9 @@ class AudioPlayer : public Thread_TYPE, public Callback, public TimerReceiver //info functions //get current position in s - ULONG getCurrentTimes(); + u4 getCurrentTimes(); //get song len in s - ULONG getSonglen(); + u4 getSonglen(); //current bitrate int getCurrentBitrate(); @@ -119,13 +119,13 @@ class AudioPlayer : public Thread_TYPE, public Callback, public TimerReceiver const static UCHAR S_BACK = 10; //message parameters for frontend messages - const static ULONG CONNECTION_LOST=1; - const static ULONG STREAM_END=2; - const static ULONG STREAM_ERR=3; - const static ULONG STATUS_CHANGE=4; //some info has been changed - const static ULONG NEW_SONG=5; //some info has been changed - const static ULONG SHORT_UPDATE=6; //timer info update - const static ULONG EXTERN1=7; //for other users as parameter to player event + const static u4 CONNECTION_LOST=1; + const static u4 STREAM_END=2; + const static u4 STREAM_ERR=3; + const static u4 STATUS_CHANGE=4; //some info has been changed + const static u4 NEW_SONG=5; //some info has been changed + const static u4 SHORT_UPDATE=6; //timer info update + const static u4 EXTERN1=7; //for other users as parameter to player event virtual void timercall(int reference); @@ -135,7 +135,7 @@ class AudioPlayer : public Thread_TYPE, public Callback, public TimerReceiver private: //to guess lengthes if the demux does not know - const static ULONG DEFAULT_BITRATE=128000; + const static u4 DEFAULT_BITRATE=128000; AudioPlayer(Boxx *frontend); virtual ~AudioPlayer(); static AudioPlayer * instance; @@ -163,17 +163,17 @@ class AudioPlayer : public Thread_TYPE, public Callback, public TimerReceiver UCHAR checkState(); //variables used by the thread - ULONG thisWrite; - ULONG thisRead; + u4 thisWrite; + u4 thisRead; bool running; UCHAR *threadBuffer; UCHAR state; UCHAR requestState; - ULLONG streampos; - ULLONG lenInBytes; - ULLONG bytesWritten; - ULLONG requestedStreampos; + u8 streampos; + u8 lenInBytes; + u8 bytesWritten; + u8 requestedStreampos; int skipfactor; //the buffer len in bytes @@ -194,7 +194,7 @@ class AudioPlayer : public Thread_TYPE, public Callback, public TimerReceiver MediaURI *uri; int openFile(); - void sendFrontendMessage(ULONG para); + void sendFrontendMessage(u4 para); void waitTimed(int ms); diff --git a/src/audiowin.cc b/src/audiowin.cc index 7e7a214..7a074aa 100644 --- a/src/audiowin.cc +++ b/src/audiowin.cc @@ -200,7 +200,7 @@ void AudioWin::initFilterDatabase() Log::getInstance()->log("AudioWin", Log::ERR , "Unable to enum Filters!"); return; } - ULONG gethowmany; + u4 gethowmany; IMoniker * moni; while(myenum->Next(1,&moni,&gethowmany)==S_OK) { @@ -266,7 +266,7 @@ void AudioWin::initMp3FilterDatabase() Log::getInstance()->log("AudioWin", Log::ERR , "Unable to enum Filters!"); return; } - ULONG gethowmany; + u4 gethowmany; IMoniker * moni; while(myenum->Next(1,&moni,&gethowmany)==S_OK) { @@ -502,7 +502,7 @@ int AudioWin::dsInitAudioFilter(IGraphBuilder* dsgraphbuilder) if (audiofilter->EnumPins(&pinenum) == S_OK) { IPin *current=NULL; - ULONG fetch=0; + u4 fetch=0; bool firststep=false; while (pinenum->Next(1,¤t,&fetch)==S_OK) { @@ -588,7 +588,7 @@ IBaseFilter *AudioWin::getAudioFilter() LPCOLESTR name=new WCHAR[strlen(audiofilterlist[audiofilterselected].displayname)+1]; mbstowcs((wchar_t*)name,audiofilterlist[audiofilterselected].displayname, strlen(audiofilterlist[audiofilterselected].displayname)+1); - ULONG eater; + u4 eater; if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK) { if (moni->BindToObject(0,0,IID_IBaseFilter,(void**)&curfilter) == S_OK) @@ -635,7 +635,7 @@ IBaseFilter *AudioWin::getMp3AudioFilter() LPCOLESTR name=new WCHAR[strlen(mp3audiofilterlist[mp3audiofilterselected].displayname)+1]; mbstowcs((wchar_t*)name,mp3audiofilterlist[mp3audiofilterselected].displayname, strlen(mp3audiofilterlist[mp3audiofilterselected].displayname)+1); - ULONG eater; + u4 eater; if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK) { if (moni->BindToObject(0,0,IID_IBaseFilter,(void**)&curfilter) == S_OK) diff --git a/src/bitmap.cc b/src/bitmap.cc index 7947994..ade61be 100644 --- a/src/bitmap.cc +++ b/src/bitmap.cc @@ -36,7 +36,7 @@ Palette::Palette(UCHAR tBpp) setBpp(tBpp); } -void Palette::argb2yrba(ULONG argb, UCHAR& y, UCHAR& cr, UCHAR& cb, UCHAR& a) +void Palette::argb2yrba(u4 argb, UCHAR& y, UCHAR& cr, UCHAR& cb, UCHAR& a) { a = static_cast((argb & 0xFF000000) >> 24); int r = (argb & 0x00FF0000) >> 16; @@ -47,7 +47,7 @@ void Palette::argb2yrba(ULONG argb, UCHAR& y, UCHAR& cr, UCHAR& cb, UCHAR& a) cb = static_cast((-608*r - 1191*g + 1799*b + 4096*128 + 2048) / 4096); } -ULONG Palette::yrba2argb(UCHAR y, UCHAR cr, UCHAR cb, UCHAR a) +u4 Palette::yrba2argb(UCHAR y, UCHAR cr, UCHAR cb, UCHAR a) { int r, g, b; r = (4769*(y-16) + 6537*(cr-128) + 2048) / 4096; @@ -75,7 +75,7 @@ void Palette::setBpp(UCHAR tBpp) A.resize(maxColours,255); } -void Palette::setColour(UCHAR index, ULONG tColour) +void Palette::setColour(UCHAR index, u4 tColour) { if (index >= maxColours) return; if (index >= numColours) numColours = index + 1; @@ -125,7 +125,7 @@ UCHAR Bitmap::getIndex(UINT x, UINT y) const return bitmap[x + y*width]; } -ULONG Bitmap::getColour(UINT x, UINT y) const +u4 Bitmap::getColour(UINT x, UINT y) const { if (x > width || y > height) return 0; diff --git a/src/bitmap.h b/src/bitmap.h index f59b5a5..a0fe441 100644 --- a/src/bitmap.h +++ b/src/bitmap.h @@ -39,10 +39,10 @@ class Palette UCHAR getBpp() const { return bpp; } void reset() { numColours = 0; } void setBpp(UCHAR tBpp); - ULONG getColour(UCHAR index) const { return index < maxColours ? colour[index] : 0; } - void setColour(UCHAR index, ULONG tColour); + u4 getColour(UCHAR index) const { return index < maxColours ? colour[index] : 0; } + void setColour(UCHAR index, u4 tColour); void setYCrCbA(UCHAR index, UCHAR tY, UCHAR tCr, UCHAR tCb, UCHAR tA); - const std::vector& getColourVector() const { return colour; } + const std::vector& getColourVector() const { return colour; } const std::vector& getYVector() const { return Y; } const std::vector& getCrVector() const { return Cr; } const std::vector& getCbVector() const { return Cb; } @@ -50,15 +50,15 @@ class Palette UINT getNumColours() const { return numColours; } private: const static UINT MAX_DEPTH = 8; - std::vector colour; + std::vector colour; std::vector Y; std::vector Cr; std::vector Cb; std::vector A; UCHAR bpp; UINT maxColours, numColours; - void argb2yrba(ULONG argb, UCHAR& y, UCHAR& cr, UCHAR& cb, UCHAR& a); - ULONG yrba2argb(UCHAR y, UCHAR cr, UCHAR cb, UCHAR a); + void argb2yrba(u4 argb, UCHAR& y, UCHAR& cr, UCHAR& cb, UCHAR& a); + u4 yrba2argb(UCHAR y, UCHAR cr, UCHAR cb, UCHAR a); }; class Bitmap @@ -72,7 +72,7 @@ class Bitmap UINT getWidth() const { return width; } UINT getHeight() const { return height; } UCHAR getIndex(UINT x, UINT y) const; - ULONG getColour(UINT x, UINT y) const; + u4 getColour(UINT x, UINT y) const; const std::vector & rawData() const { return bitmap; } void setSize(UINT tWidth, UINT tHeight); bool setIndex(UINT x, UINT y, UCHAR index); diff --git a/src/boxx.cc b/src/boxx.cc index d5e6342..c0bc05b 100644 --- a/src/boxx.cc +++ b/src/boxx.cc @@ -539,7 +539,7 @@ void Boxx::drawImage(Image& image, float x, float y, float width, float height, { SurfaceVector* surfacevector = dynamic_cast(surface); if (surfacevector) surfacevector->drawImage(image, x, y, width, height, corner); - else surface->fillblt(static_cast(x), static_cast(y), static_cast(width), static_cast(height), DrawStyle::RED); // Signal that something went wrong + else surface->fillblt(toi4(x), toi4(y), toi4(width), toi4(height), DrawStyle::RED); // Signal that something went wrong } } @@ -599,8 +599,8 @@ Surface* Boxx::getSurface() bool Boxx::mouseMove(int x, int y) { - if ( (x >= static_cast(area.x)) && (x < static_cast(area.x2())) - && (y >= static_cast(area.y)) && (y < static_cast(area.y2())) ) + if ( (x >= toi4(area.x)) && (x < toi4(area.x2())) + && (y >= toi4(area.y)) && (y < toi4(area.y2())) ) { return true; } @@ -612,8 +612,8 @@ bool Boxx::mouseMove(int x, int y) bool Boxx::mouseLBDOWN(int x, int y) { - if ( (x >= static_cast(area.x)) && (x < static_cast(area.x2())) - && (y >= static_cast(area.y)) && (y < static_cast(area.y2())) ) + if ( (x >= toi4(area.x)) && (x < toi4(area.x2())) + && (y >= toi4(area.y)) && (y < toi4(area.y2())) ) { return true; } @@ -634,8 +634,8 @@ bool Boxx::coordsOutsideBox(Message* m) if ( (x < 0) || (y < 0) - || (x > static_cast(area.w)) - || (y > static_cast(area.h)) + || (x > toi4(area.w)) + || (y > toi4(area.h)) ) return true; diff --git a/src/channel.cc b/src/channel.cc index 8e6f22f..8b545ad 100644 --- a/src/channel.cc +++ b/src/channel.cc @@ -52,15 +52,15 @@ void Channel::loadPids() logger->debug(TAG, "C.{} loaded, VPid={}, numApids={}, numDpids={}, numSpids={} TPid={}", number, vpid, numAPids, numDPids, numSPids, tpid); - for (ULONG i = 0; i < numAPids; i++) + for (u4 i = 0; i < numAPids; i++) { logger->debug(TAG, "APid {} {} {}", apids[i].pid, apids[i].desc,apids[i].type); } - for (ULONG i = 0; i < numDPids; i++) + for (u4 i = 0; i < numDPids; i++) { logger->debug(TAG, "DPid {} {} {}", dpids[i].pid, dpids[i].desc,dpids[i].type); } - for (ULONG i = 0; i < numSPids; i++) + for (u4 i = 0; i < numSPids; i++) { logger->debug(TAG, "SPid {} {} {} {} {}", spids[i].pid, spids[i].desc,spids[i].type,spids[i].data1,spids[i].data2); } diff --git a/src/config.cc b/src/config.cc index 00e9365..8139fe7 100644 --- a/src/config.cc +++ b/src/config.cc @@ -5,6 +5,7 @@ // http://open-source-parsers.github.io/jsoncpp-docs/doxygen/namespacemembers.html +#include "defines.h" #include "config.h" @@ -94,7 +95,7 @@ bool Config::getInt(const std::string& section, const std::string& key, int& out { Json::Value v = jconfigro[section][key]; if (!v.isInt64()) return false; - out = static_cast(v.asInt64()); + out = toi4(v.asInt64()); return true; } diff --git a/src/control.cc b/src/control.cc index 0efd720..7c46668 100644 --- a/src/control.cc +++ b/src/control.cc @@ -1257,7 +1257,7 @@ void Control::doJustConnected(VConnect* vconnect) Channel* chan = NULL; for (UINT i = 0; i < chanList->size(); i++) { - if ((*chanList)[i]->number == static_cast(startToLiveTV)) + if ((*chanList)[i]->number == static_cast(startToLiveTV)) { chan = (*chanList)[i]; break; diff --git a/src/defines.h b/src/defines.h index f140035..884d0d4 100644 --- a/src/defines.h +++ b/src/defines.h @@ -23,8 +23,7 @@ typedef unsigned char UCHAR; typedef unsigned short USHORT; typedef unsigned int UINT; -typedef unsigned long ULONG; -typedef unsigned long long ULLONG; + #include diff --git a/src/demuxer.cc b/src/demuxer.cc index 075a8b9..24a4564 100644 --- a/src/demuxer.cc +++ b/src/demuxer.cc @@ -260,7 +260,7 @@ int PESPacket::write(const UCHAR *buf, int len) return 1; } -ULLONG PESPacket::getPTS() const +u8 PESPacket::getPTS() const { if ( ( (packetType >= Demuxer::PESTYPE_AUD0 && packetType <= Demuxer::PESTYPE_AUDMAX) @@ -272,11 +272,11 @@ ULLONG PESPacket::getPTS() const ) && size >= 14 && data[7] & 0x80) { - return ( (ULLONG)(data[ 9] & 0x0E) << 29) | - ( (ULLONG)(data[10]) << 22 ) | - ( (ULLONG)(data[11] & 0xFE) << 14 ) | - ( (ULLONG)(data[12]) << 7 ) | - ( (ULLONG)(data[13] & 0xFE) >> 1 ); + return ( (u8)(data[ 9] & 0x0E) << 29) | + ( (u8)(data[10]) << 22 ) | + ( (u8)(data[11] & 0xFE) << 14 ) | + ( (u8)(data[12]) << 7 ) | + ( (u8)(data[13] & 0xFE) >> 1 ); } else return PTS_INVALID; } @@ -560,7 +560,7 @@ Demuxer* Demuxer::getInstance() } int Demuxer::init(Callback* tcallback, DrainTarget* audio, DrainTarget* video, DrainTarget* teletext, - ULONG demuxMemoryV, ULONG demuxMemoryA, ULONG demuxMemoryT,double infps, DVBSubtitles* tsubtitles) + u4 demuxMemoryV, u4 demuxMemoryA, u4 demuxMemoryT,double infps, DVBSubtitles* tsubtitles) { if (!initted) { @@ -1180,7 +1180,7 @@ void Demuxer::changeTimes(UCHAR* buf, UINT len,UINT playtime) packet_length = ((buf[read_pos+4] << 8) | (buf[read_pos+5])) + 6; // ok we have a packet figure out if pts and dts are present and replace them if (read_pos + 19 > len) return; - ULLONG new_ts=playtime*90; //play time is on ms so multiply it by 90 + u8 new_ts=playtime*90; //play time is on ms so multiply it by 90 if (buf[read_pos+7] & 0x80) { // pts is here, replace it buf[read_pos+9]=0x21 | (( new_ts>>29)& 0xde ); buf[read_pos+10]=0x00 |(( new_ts>>22)& 0xff ); diff --git a/src/demuxer.h b/src/demuxer.h index b7c9771..36b9b7e 100644 --- a/src/demuxer.h +++ b/src/demuxer.h @@ -65,14 +65,14 @@ class PESPacket UCHAR getPacketType() const { return packetType; } void setSubstream(UCHAR s) { substream = s; } UCHAR getSubstream() const { return substream; } - ULLONG getPTS() const; + u8 getPTS() const; bool hasPTS() const { return (getPTS() != PTS_INVALID); } UINT findPictureHeader(bool h264) const; UINT findSeqHeader(bool h264) const; UINT findSeqExtHeader(bool h264) const; UINT countPictureHeaders(bool h264, struct PictCountInfo& pinfo) const; - static const ULLONG PTS_INVALID = (1LL << 33); + static const u8 PTS_INVALID = (1LL << 33); @@ -94,7 +94,7 @@ class Demuxer static Demuxer* getInstance(); int init(Callback* tcallback, DrainTarget* audio, DrainTarget* video, DrainTarget* teletext, - ULONG demuxMemoryV, ULONG demuxMemoryA, ULONG demuxMemoryT, double fps=25., + u4 demuxMemoryV, u4 demuxMemoryA, u4 demuxMemoryT, double fps=25., DVBSubtitles* tsubtitles=NULL); virtual void reset(); virtual void flush(); @@ -111,12 +111,12 @@ class Demuxer bool writeTeletext(bool * dataavail=NULL); virtual int scan(UCHAR* buf, int len) = 0; - virtual int findPTS(UCHAR* buf, int len, ULLONG* dest) = 0; + virtual int findPTS(UCHAR* buf, int len, u8* dest) = 0; virtual int put(UCHAR* buf, int len) = 0; - virtual void setFrameNum(ULONG /* frame */) {} - virtual void setPacketNum(ULONG /* packet */) {} - virtual ULONG getFrameNumFromPTS(ULLONG /* pts */) { return 0; } - virtual ULONG getPacketNum() {return 0;} + virtual void setFrameNum(u4 /* frame */) {} + virtual void setPacketNum(u4 /* packet */) {} + virtual u4 getFrameNumFromPTS(u8 /* pts */) { return 0; } + virtual u4 getPacketNum() {return 0;} bool* getmpAudioChannels(); //Maybe virtual ? bool* getac3AudioChannels(); //Maybe virtual ? @@ -133,8 +133,8 @@ class Demuxer int getFrameRate() { return frame_rate; } int getBitRate() { return bit_rate; } bool getInterlaced() { return interlaced;} - ULLONG getVideoPTS() { return video_pts; } - ULLONG getAudioPTS() { return audio_pts; } + u8 getVideoPTS() { return video_pts; } + u8 getAudioPTS() { return audio_pts; } enum AspectRatio : UCHAR { @@ -232,10 +232,10 @@ class Demuxer int arcnt; int frame_rate; int bit_rate; - ULLONG video_pts; - ULLONG video_pts_seek; - ULLONG audio_pts; - ULLONG teletext_pts; + u8 video_pts; + u8 video_pts_seek; + u8 audio_pts; + u8 teletext_pts; bool isteletextdecoded; diff --git a/src/demuxeraudio.cc b/src/demuxeraudio.cc index ad6f391..56bd51e 100644 --- a/src/demuxeraudio.cc +++ b/src/demuxeraudio.cc @@ -94,8 +94,8 @@ class PacketBuffer { Stream * audio; UCHAR streamtype; //global counters - ULONG numpackets; - ULONG numbytes; + u4 numpackets; + u4 numbytes; int skipfactor; int numskip; }; @@ -695,7 +695,7 @@ int DemuxerAudio::parseVBR(UCHAR *data, int len) { //compute file size in seconds //should be (#of frames -1) *samplesPerFrame / sampleRate //TODO: difference for Mono? - ULONG samplesPerFrame=384; //layer1 + u4 samplesPerFrame=384; //layer1 if (layer != 3) samplesPerFrame=1152; vbr->fileSeconds=(vbr->numFrames-1)*samplesPerFrame/hdrSamplingRate; Log::getInstance()->log("DemuxerAudio::parseVBR",Log::DEBUG,"successfully read VBR %ldbytes, %ld frames, %ldsec", @@ -821,7 +821,7 @@ int DemuxerAudio::readHeader(UCHAR * hbuf,int len,bool writeInfo) { return 0; } -int DemuxerAudio::findPTS(UCHAR* buf, int len, ULLONG* dest) +int DemuxerAudio::findPTS(UCHAR* buf, int len, u8* dest) { //we have no PTS number ... *dest=0; @@ -1109,9 +1109,9 @@ UINT DemuxerAudio::getSyncErrors() { return outOfSync; } -ULONG DemuxerAudio::getBytesPerSecond() +u4 DemuxerAudio::getBytesPerSecond() { - ULONG bps=hdrBitrate; + u4 bps=hdrBitrate; if (! hasHdrInfo) return 0; if (hdrBitrate != avrBitrate) { //we seem to have vbr @@ -1128,16 +1128,16 @@ ULONG DemuxerAudio::getBytesPerSecond() return bps; } -ULONG DemuxerAudio::getSecondsFromLen(ULONG len) { +u4 DemuxerAudio::getSecondsFromLen(u4 len) { if (! hasHdrInfo) return 0; if (vbr) { //first find the index where we are between //rough starting point: - ULONG idx=100*len/vbr->numBytes; + u4 idx=100*len/vbr->numBytes; if (idx >= 100) idx=99; - ULONG idxPos=(vbr->table[idx]) * vbr->numBytes/256; - ULONG pbefore=idxPos; - ULONG pafter=idxPos; + u4 idxPos=(vbr->table[idx]) * vbr->numBytes/256; + u4 pbefore=idxPos; + u4 pafter=idxPos; //OK now we know whether we have to go up or down if (idxPos > len) { //down @@ -1162,36 +1162,36 @@ ULONG DemuxerAudio::getSecondsFromLen(ULONG len) { } //idx is now the index before our position //approximate between the 2 points - ULONG idxTime=idx * vbr->fileSeconds/100; + u4 idxTime=idx * vbr->fileSeconds/100; if (pafter == pbefore) return idxTime; - ULONG rt=idxTime+ (len-pbefore)* vbr->fileSeconds/(100 * (pafter-pbefore)) ; + u4 rt=idxTime+ (len-pbefore)* vbr->fileSeconds/(100 * (pafter-pbefore)) ; if (rt > vbr -> fileSeconds) return vbr->fileSeconds; if (rt < idxTime) return idxTime; return rt; } else { - ULONG bps=getBytesPerSecond(); + u4 bps=getBytesPerSecond(); if (bps == 0) return 0; return len/bps; } } -ULONG DemuxerAudio::positionFromSeconds(ULONG seconds) { +u4 DemuxerAudio::positionFromSeconds(u4 seconds) { if (! hasHdrInfo) return 0; if (vbr) { - ULONG idx=seconds*100/vbr->fileSeconds; + u4 idx=seconds*100/vbr->fileSeconds; if (idx > 99) idx=99; - ULONG idxPos=vbr->table[idx] * vbr->numBytes/256; - ULONG idx2=idx; + u4 idxPos=vbr->table[idx] * vbr->numBytes/256; + u4 idx2=idx; if (idx < 99) idx2++; - ULONG nextPos=vbr->table[idx] * vbr->numBytes/256; - ULONG rt=idxPos+(nextPos-idxPos) * (seconds - idx * vbr->fileSeconds /256); + u4 nextPos=vbr->table[idx] * vbr->numBytes/256; + u4 rt=idxPos+(nextPos-idxPos) * (seconds - idx * vbr->fileSeconds /256); if (rt < idxPos) return idxPos; if ( rt > vbr->numBytes) return vbr->numBytes; return rt; } else { - ULONG bps=getBytesPerSecond(); + u4 bps=getBytesPerSecond(); return bps*seconds; } } diff --git a/src/demuxeraudio.h b/src/demuxeraudio.h index 4bbb868..6be7b29 100644 --- a/src/demuxeraudio.h +++ b/src/demuxeraudio.h @@ -41,9 +41,9 @@ class DemuxerAudio : public Demuxer } mpegInfo; typedef struct { - ULONG numFrames; - ULONG numBytes; - ULONG fileSeconds; + u4 numFrames; + u4 numBytes; + u4 fileSeconds; UCHAR table[100]; } vbrInfo; DemuxerAudio(int p_vID = 0, int p_aID = 0); @@ -51,7 +51,7 @@ class DemuxerAudio : public Demuxer virtual void flush(); virtual void reset(); virtual int scan(UCHAR* buf, int len); - virtual int findPTS(UCHAR* buf, int len, ULLONG* dest); + virtual int findPTS(UCHAR* buf, int len, u8* dest); virtual void setVID(int p_vID); virtual void setAID(int p_aID,int type); virtual int put(UCHAR* buf, int len); @@ -90,11 +90,11 @@ class DemuxerAudio : public Demuxer //return length if we can do this //otherwise return 0 - ULONG getSecondsFromLen(ULONG len); + u4 getSecondsFromLen(u4 len); //position within a file //return 0 if we cannot - ULONG positionFromSeconds(ULONG seconds); + u4 positionFromSeconds(u4 seconds); //try to read the iD3 tag value (V2xx) and //fill it into the ID3 store @@ -129,8 +129,8 @@ class DemuxerAudio : public Demuxer int streamtype; bool isStarting; - ULONG readHeaders; - ULONG globalBytesWritten; + u4 readHeaders; + u4 globalBytesWritten; //search for the start of a header @@ -143,7 +143,7 @@ class DemuxerAudio : public Demuxer //compute the bytes/second from the BR info //return 0 if not there; - ULONG getBytesPerSecond(); + u4 getBytesPerSecond(); //parse ID3V2 at the beginning //set info if there diff --git a/src/demuxermedia.cc b/src/demuxermedia.cc index 77a6a42..365846b 100644 --- a/src/demuxermedia.cc +++ b/src/demuxermedia.cc @@ -36,10 +36,10 @@ #define PTS_ALLOWANCE 90000 // TODO: PTS class to handle wrapping arithmetic & comparisons? -static ULLONG PTSDistance(ULLONG pts1, ULLONG pts2) +static u8 PTSDistance(u8 pts1, u8 pts2) { // Assume pts1, pts2 < 2^33; calculate shortest distance between - ULLONG ret = (pts1 > pts2) ? pts1 - pts2 : pts2 - pts1; + u8 ret = (pts1 > pts2) ? pts1 - pts2 : pts2 - pts1; if (ret > (1LL<<32)) ret = (1LL<<33) - ret; return ret; } @@ -118,21 +118,21 @@ int DemuxerMedia::scan(UCHAR *buf, int len) return ret; } -int DemuxerMedia::findPTS(UCHAR* buf, int len, ULLONG* dest) +int DemuxerMedia::findPTS(UCHAR* buf, int len, u8* dest) { // nobody uses this // No PTS found. return 0; } -void DemuxerMedia::setFrameNum(ULONG frame) +void DemuxerMedia::setFrameNum(u4 frame) { frameCounting = true; frameNumber = frame; Log::getInstance()->log("Demuxer", Log::DEBUG, "setFrameNum %d", frame); } -void DemuxerMedia::setPacketNum(ULONG npacket) +void DemuxerMedia::setPacketNum(u4 npacket) { packetCounting = true; packetNumber = npacket; @@ -237,7 +237,7 @@ int DemuxerMedia::put(UCHAR* buf, int len) return ret; } -ULONG DemuxerMedia::getPacketNum() +u4 DemuxerMedia::getPacketNum() { return packetNumber; } @@ -256,7 +256,7 @@ void DemuxerMedia::parseVDRPacketDetails() packet.getPacketType() >= PESTYPE_VID0 && packet.getPacketType() <= PESTYPE_VIDMAX) { - ULLONG pts=packet.getPTS(); + u8 pts=packet.getPTS(); if (packet.findSeqHeader(h264) > 1 && pts != PESPacket::PTS_INVALID) { if (firstPTS == 0) firstPTS=pts; @@ -282,10 +282,10 @@ void DemuxerMedia::parseVDRPacketDetails() //find a sequence header backward //search for 00 00 01