if (setportdef) {
port_def_type.nBufferCountActual=2;
- port_def_type.nBufferSize=std::max(static_cast<int>(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);
#ifdef DEV
int AudioOMX::test()
{
-// ULLONG stc = 0;
+// u8 stc = 0;
// return ioctl(fdAudio, AV_SET_AUD_STC, &stc);
/* aud_sync_parms_t a;
OMX_U32 omx_clock_output_port;
long long lastreftimeOMX;
- ULLONG lastreftimePTS;
+ u8 lastreftimePTS;
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;
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;
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;
// ----------------------------------- 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();
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);
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) {
return rt;
}
-ULONG AudioPlayer::getCurrentTimes(){
- ULONG rt=0;
+u4 AudioPlayer::getCurrentTimes(){
+ u4 rt=0;
threadLock();
if (streampos != 0){
rt=demuxer->getSecondsFromLen(bytesWritten);
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;
//info functions
//get current position in s
- ULONG getCurrentTimes();
+ u4 getCurrentTimes();
//get song len in s
- ULONG getSonglen();
+ u4 getSonglen();
//current bitrate
int getCurrentBitrate();
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);
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;
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
MediaURI *uri;
int openFile();
- void sendFrontendMessage(ULONG para);
+ void sendFrontendMessage(u4 para);
void waitTimed(int ms);
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)
{
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)
{
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)
{
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)
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)
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<UCHAR>((argb & 0xFF000000) >> 24);
int r = (argb & 0x00FF0000) >> 16;
cb = static_cast<UCHAR>((-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;
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;
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;
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<ULONG>& getColourVector() const { return colour; }
+ const std::vector<u4>& getColourVector() const { return colour; }
const std::vector<UCHAR>& getYVector() const { return Y; }
const std::vector<UCHAR>& getCrVector() const { return Cr; }
const std::vector<UCHAR>& getCbVector() const { return Cb; }
UINT getNumColours() const { return numColours; }
private:
const static UINT MAX_DEPTH = 8;
- std::vector<ULONG> colour;
+ std::vector<u4> colour;
std::vector<UCHAR> Y;
std::vector<UCHAR> Cr;
std::vector<UCHAR> Cb;
std::vector<UCHAR> 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
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<UCHAR> & rawData() const { return bitmap; }
void setSize(UINT tWidth, UINT tHeight);
bool setIndex(UINT x, UINT y, UCHAR index);
{
SurfaceVector* surfacevector = dynamic_cast<SurfaceVector*>(surface);
if (surfacevector) surfacevector->drawImage(image, x, y, width, height, corner);
- else surface->fillblt(static_cast<int>(x), static_cast<int>(y), static_cast<int>(width), static_cast<int>(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
}
}
bool Boxx::mouseMove(int x, int y)
{
- if ( (x >= static_cast<int>(area.x)) && (x < static_cast<int>(area.x2()))
- && (y >= static_cast<int>(area.y)) && (y < static_cast<int>(area.y2())) )
+ if ( (x >= toi4(area.x)) && (x < toi4(area.x2()))
+ && (y >= toi4(area.y)) && (y < toi4(area.y2())) )
{
return true;
}
bool Boxx::mouseLBDOWN(int x, int y)
{
- if ( (x >= static_cast<int>(area.x)) && (x < static_cast<int>(area.x2()))
- && (y >= static_cast<int>(area.y)) && (y < static_cast<int>(area.y2())) )
+ if ( (x >= toi4(area.x)) && (x < toi4(area.x2()))
+ && (y >= toi4(area.y)) && (y < toi4(area.y2())) )
{
return true;
}
if ( (x < 0)
|| (y < 0)
- || (x > static_cast<int>(area.w))
- || (y > static_cast<int>(area.h))
+ || (x > toi4(area.w))
+ || (y > toi4(area.h))
)
return true;
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);
}
// http://open-source-parsers.github.io/jsoncpp-docs/doxygen/namespacemembers.html
+#include "defines.h"
#include "config.h"
{
Json::Value v = jconfigro[section][key];
if (!v.isInt64()) return false;
- out = static_cast<int>(v.asInt64());
+ out = toi4(v.asInt64());
return true;
}
Channel* chan = NULL;
for (UINT i = 0; i < chanList->size(); i++)
{
- if ((*chanList)[i]->number == static_cast<ULONG>(startToLiveTV))
+ if ((*chanList)[i]->number == static_cast<u4>(startToLiveTV))
{
chan = (*chanList)[i];
break;
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned int UINT;
-typedef unsigned long ULONG;
-typedef unsigned long long ULLONG;
+
#include <stdint.h>
return 1;
}
-ULLONG PESPacket::getPTS() const
+u8 PESPacket::getPTS() const
{
if ( ( (packetType >= Demuxer::PESTYPE_AUD0 &&
packetType <= Demuxer::PESTYPE_AUDMAX)
)
&& 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;
}
}
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)
{
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 );
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);
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();
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 ?
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
{
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;
Stream * audio;
UCHAR streamtype;
//global counters
- ULONG numpackets;
- ULONG numbytes;
+ u4 numpackets;
+ u4 numbytes;
int skipfactor;
int numskip;
};
//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",
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;
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
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
}
//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;
}
}
} 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);
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);
//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
int streamtype;
bool isStarting;
- ULONG readHeaders;
- ULONG globalBytesWritten;
+ u4 readHeaders;
+ u4 globalBytesWritten;
//search for the start of a header
//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
#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;
}
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;
return ret;
}
-ULONG DemuxerMedia::getPacketNum()
+u4 DemuxerMedia::getPacketNum()
{
return packetNumber;
}
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;
//find a sequence header backward
//search for 00 00 01 <video> backwards
-ULLONG DemuxerMedia::findLastPTS(UCHAR *buffer, ULONG len) {
+u8 DemuxerMedia::findLastPTS(UCHAR *buffer, u4 len) {
PESPacket pack;
int pstate=4;
- ULONG minlen=12;
+ u4 minlen=12;
if (len < minlen) return 0;
UCHAR *curpos=buffer+len-minlen;
UCHAR *packend=buffer+len;
pack.init(*(curpos+4));
pack.write(curpos+7,packend-curpos-7);
packend=curpos+1;
- ULLONG pts=pack.getPTS();
+ u8 pts=pack.getPTS();
if (pts != PESPacket::PTS_INVALID) {
//ok we have it
lastPTS=pts;
return 0;
}
-ULLONG DemuxerMedia::getCurrentPTS() {
+u8 DemuxerMedia::getCurrentPTS() {
return PTSDistance(currentPTS,firstPTS);
}
-ULLONG DemuxerMedia::getLenPTS() {
+u8 DemuxerMedia::getLenPTS() {
if (lastPTS == 0) return 0;
if (lastPTS < firstPTS) return 0;
return PTSDistance(lastPTS,firstPTS);
void reset();
void flush();
int scan(UCHAR* buf, int len);
- int findPTS(UCHAR* buf, int len, ULLONG* dest);
+ int findPTS(UCHAR* buf, int len, u8* dest);
int put(UCHAR* buf, int len);
- void setFrameNum(ULONG frame);
- void setPacketNum(ULONG npacket);
- ULONG getFrameNumFromPTS(ULLONG pts) {return 0;}
- ULONG getPacketNum();
- ULLONG getLenPTS();
- ULLONG getCurrentPTS();
- ULLONG findLastPTS(UCHAR *buf, ULONG len);
+ void setFrameNum(u4 frame);
+ void setPacketNum(u4 npacket);
+ u4 getFrameNumFromPTS(u8 pts) {return 0;}
+ u4 getPacketNum();
+ u8 getLenPTS();
+ u8 getCurrentPTS();
+ u8 findLastPTS(UCHAR *buf, u4 len);
private:
int state;
int packetLength;
PESPacket packet;
- ULONG frameNumber, packetNumber;
+ u4 frameNumber, packetNumber;
bool frameCounting, packetCounting;
- typedef struct { ULLONG pts; ULONG frame; } PTSMapEntry;
+ typedef struct { u8 pts; u4 frame; } PTSMapEntry;
typedef std::deque<PTSMapEntry> PTSMap;
PTSMap pts_map;
- ULLONG firstPTS;
- ULLONG currentPTS;
- ULLONG lastPTS;
+ u8 firstPTS;
+ u8 currentPTS;
+ u8 lastPTS;
int last_horizontal_size;
int last_vertical_size;
#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;
}
-static ULLONG PTSDifference(ULLONG pts1, ULLONG pts2)
+static u8 PTSDifference(u8 pts1, u8 pts2)
{
// Assume pts1, pts2 < 2^33; calculate pts1 - pts2
if (pts1 > pts2)
-int DemuxerTS::findPTS(UCHAR* buf, int len, ULLONG* dest)
+int DemuxerTS::findPTS(UCHAR* buf, int len, u8* dest)
{
int scanaid=0;
if ( curbuf[7] & 0x80 ) // PTS_DTS_flags indicate that PTS is present
{
- *dest = ( (ULLONG)(curbuf[9] & 0x0E) << 29 ) |
- ( (ULLONG)(curbuf[10]) << 22 ) |
- ( (ULLONG)(curbuf[11] & 0xFE) << 14 ) |
- ( (ULLONG)(curbuf[12]) << 7 ) |
- ( (ULLONG)(curbuf[13] & 0xFE) >> 1 );
+ *dest = ( (u8)(curbuf[9] & 0x0E) << 29 ) |
+ ( (u8)(curbuf[10]) << 22 ) |
+ ( (u8)(curbuf[11] & 0xFE) << 14 ) |
+ ( (u8)(curbuf[12]) << 7 ) |
+ ( (u8)(curbuf[13] & 0xFE) >> 1 );
return 1;
}
}
return 0;
}
-void DemuxerTS::setFrameNum(ULONG frame)
+void DemuxerTS::setFrameNum(u4 frame)
{
frameCounting = true;
frameNumber = frame;
LogNT::getInstance()->debug("DemuxerTS", "setFrameNum {}", frame);
}
-void DemuxerTS::setPacketNum(ULONG npacket)
+void DemuxerTS::setPacketNum(u4 npacket)
{
packetCounting = true;
packetNumber = npacket;
}
bool audioPIDpresent=false; //Check if pids chnages
- ULONG i;
+ u4 i;
for (i=0;i<channelinfo.numAPids;i++) {
if (aID == (int)channelinfo.apids[i].pid) {
audioPIDpresent=true;
if (channelinfo.numDPids > 0 && Audio::getInstance()->maysupportAc3())
{
- ULONG j = 0;
+ u4 j = 0;
while (j < channelinfo.numDPids)
{
int newpref = control->getLangPref(false, channelinfo.dpids[j].desc);
if (channelinfo.numAPids > 0)
{
- ULONG j = 0;
+ u4 j = 0;
while (j < channelinfo.numAPids)
{
int newpref = control->getLangPref(false, channelinfo.apids[j].desc);
selected = -1;
prefered=-1;
if (channelinfo.numSPids) {
- ULONG j = 0;
+ u4 j = 0;
while (j < channelinfo.numSPids)
{
int newpref = control->getLangPref(true, channelinfo.spids[j].desc);
return 1;
}
-ULONG DemuxerTS::getPacketNum()
+u4 DemuxerTS::getPacketNum()
{
return packetNumber;
}
-ULONG DemuxerTS::getFrameNumFromPTS(ULLONG pts)
+u4 DemuxerTS::getFrameNumFromPTS(u8 pts)
{
- ULLONG difference = (1LL<<33);
- ULONG ref_frame = 0;
+ u8 difference = (1LL<<33);
+ u4 ref_frame = 0;
int total = 0, actual = 0;
if (pts==0) return 0; //we are in startup
pts_map_mutex.lock();
actual = total;
break;
}
- ULLONG newdiff = PTSDifference(pts, iter->pts);
+ u8 newdiff = PTSDifference(pts, iter->pts);
if (newdiff < difference)
{
difference = newdiff;
packet.getPacketType() <= PESTYPE_VIDMAX)
{
frameNumber+=numpicts;
- ULONG frame_num = frameNumber;
+ u4 frame_num = frameNumber;
if ((h264 || packet.findSeqHeader(h264) > 1) && packet.hasPTS())
{
PTSMapEntry me;
DemuxerTS(int p_vID = 0, int p_aID = 0, int p_subID = 0, int p_tID = 0);
void flush();
int scan(UCHAR* buf, int len);
- int findPTS(UCHAR* buf, int len, ULLONG* dest);
+ int findPTS(UCHAR* buf, int len, u8* dest);
void setVID(int p_vID);
void setTID(int p_tID);
void setAID(int p_aID, int type, int streamtype,bool slivetv);
int getSubID() { return subID; }
int put(UCHAR* buf, int len);
- void setFrameNum(ULONG frame);
- void setPacketNum(ULONG npacket);
- ULONG getFrameNumFromPTS(ULLONG pts);
- ULONG getPacketNum();
+ void setFrameNum(u4 frame);
+ void setPacketNum(u4 npacket);
+ u4 getFrameNumFromPTS(u8 pts);
+ u4 getPacketNum();
UINT stripAudio(UCHAR* buf, UINT len);
static bool scanForVideo(UCHAR* buf, UINT len, bool &ish264);
Channel *getChannelInfo() {return &channelinfo;};
//TODO HANS which of next do I need
- ULONG frameNumber, packetNumber;
+ u4 frameNumber, packetNumber;
bool frameCounting, packetCounting;
// bool doubledframerate;
int framereserve;
- typedef struct { ULLONG pts; ULONG frame; } PTSMapEntry;
+ typedef struct { u8 pts; u4 frame; } PTSMapEntry;
typedef std::deque<PTSMapEntry> PTSMap;
PTSMap pts_map;
std::mutex pts_map_mutex;
static const char* TAG = "DemuxerVDR";
// 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;
}
-static ULLONG PTSDifference(ULLONG pts1, ULLONG pts2)
+static u8 PTSDifference(u8 pts1, u8 pts2)
{
// Assume pts1, pts2 < 2^33; calculate pts1 - pts2
if (pts1 > pts2)
return ret;
}
-int DemuxerVDR::findPTS(UCHAR* buf, int len, ULLONG* dest) {
+int DemuxerVDR::findPTS(UCHAR* buf, int len, u8* dest) {
while (len >= 14) {
UINT pattern = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
buf++;
& 0x01) != 0x01)
continue;
- *dest = ((ULLONG)(buf[8] & 0x0E) << 29) | ((ULLONG)(buf[9]) << 22)
- | ((ULLONG)(buf[10] & 0xFE) << 14) | ((ULLONG)(buf[11])
- << 7) | ((ULLONG)(buf[12] & 0xFE) >> 1);
+ *dest = ((u8)(buf[8] & 0x0E) << 29) | ((u8)(buf[9]) << 22)
+ | ((u8)(buf[10] & 0xFE) << 14) | ((u8)(buf[11])
+ << 7) | ((u8)(buf[12] & 0xFE) >> 1);
return 1;
}
return 0;
}
-void DemuxerVDR::setFrameNum(ULONG frame)
+void DemuxerVDR::setFrameNum(u4 frame)
{
frameCounting = true;
frameNumber = frame;
LogNT::getInstance()->debug(TAG, "setFrameNum {}", frame);
}
-void DemuxerVDR::setPacketNum(ULONG npacket)
+void DemuxerVDR::setPacketNum(u4 npacket)
{
packetCounting = true;
packetNumber = npacket;
return ret;
}
-ULONG DemuxerVDR::getPacketNum()
+u4 DemuxerVDR::getPacketNum()
{
return packetNumber;
}
-ULONG DemuxerVDR::getFrameNumFromPTS(ULLONG pts)
+u4 DemuxerVDR::getFrameNumFromPTS(u8 pts)
{
- ULLONG difference = (1LL<<33);
- ULONG ref_frame = 0;
+ u8 difference = (1LL<<33);
+ u4 ref_frame = 0;
int total = 0, actual = 0;
pts_map_mutex.lock();
PTSMap::iterator iter = pts_map.begin();
actual = total;
break;
}
- ULLONG newdiff = PTSDifference(pts, iter->pts);
+ u8 newdiff = PTSDifference(pts, iter->pts);
if (newdiff < difference)
{
difference = newdiff;
if (difference == (1LL<<33))
return 0; // We cannot make sense of the pts
else
- return ref_frame + (ULONG)((double) (difference / 90000) *fps);
+ return ref_frame + (u4)((double) (difference / 90000) *fps);
}
void DemuxerVDR::dealWithSubtitlePacket()
packet.getPacketType() >= PESTYPE_VID0 &&
packet.getPacketType() <= PESTYPE_VIDMAX)
{
- ULONG frame_num = (frameNumber)++;
+ u4 frame_num = (frameNumber)++;
if (packet.findSeqHeader(h264) > 1 && packet.hasPTS())
{
PTSMapEntry me;
pts_map_mutex.unlock();
// UINT fps = Video::getInstance()->getFPS();
- ULLONG pts_expected = me.pts + 90000*((ULONG)((double)(frame_num - me.frame)) / fps);
+ u8 pts_expected = me.pts + 90000*((u4)((double)(frame_num - me.frame)) / fps);
while (pts_expected > (1LL<<33)) pts_expected -= (1LL<<33);
if (PTSDistance(pts_expected, packet.getPTS()) > PTS_JUMP_MARGIN) // PTS jump!
void reset();
void flush();
int scan(UCHAR* buf, int len);
- int findPTS(UCHAR* buf, int len, ULLONG* dest);
+ int findPTS(UCHAR* buf, int len, u8* dest);
int put(UCHAR* buf, int len);
- void setFrameNum(ULONG frame);
- void setPacketNum(ULONG npacket);
- ULONG getFrameNumFromPTS(ULLONG pts);
- ULONG getPacketNum();
+ void setFrameNum(u4 frame);
+ void setPacketNum(u4 npacket);
+ u4 getFrameNumFromPTS(u8 pts);
+ u4 getPacketNum();
private:
int state;
PESPacket subtitlePacket;
UINT subtitlePacketPosition;
- ULONG frameNumber, packetNumber;
+ u4 frameNumber, packetNumber;
bool frameCounting, packetCounting;
- typedef struct { ULLONG pts; ULONG frame; } PTSMapEntry;
+ typedef struct { u8 pts; u4 frame; } PTSMapEntry;
typedef std::deque<PTSMapEntry> PTSMap;
PTSMap pts_map;
std::mutex pts_map_mutex;
return NULL;
}
-ULONG Directory::getNumRecordings()
+u4 Directory::getNumRecordings()
{
- ULONG total = recList.size();
+ u4 total = recList.size();
for(UINT i = 0; i < dirList.size(); i++)
{
total += dirList[i]->getNumRecordings();
return total;
}
-ULONG Directory::getNumNewRecordings()
+u4 Directory::getNumNewRecordings()
{
- ULONG total = 0;
+ u4 total = 0;
for (UINT i = 0; i < recList.size(); i++)
{
if (recList[i]->getNew()) ++total;
~Directory();
Directory* getDirByName(char* dirName);
- ULONG getNumRecordings();
- ULONG getNumNewRecordings();
+ u4 getNumRecordings();
+ u4 getNumNewRecordings();
void sort(bool chronoSortOrder);
struct MediaPacket
{
- ULONG pos_buffer; //position in stream buffer
- ULONG length; //length of the packet
+ u4 pos_buffer; //position in stream buffer
+ u4 length; //length of the packet
// The fields below are not needed by the MVP
UCHAR type;
- ULLONG pts;
- ULLONG dts;
+ u8 pts;
+ u8 dts;
bool synched;
int index;
#ifndef VOMP_PLATTFORM_MVP
-ULONG STDMETHODCALLTYPE DsAllocator::AddRef(){
+u4 STDMETHODCALLTYPE DsAllocator::AddRef(){
return InterlockedIncrement(&refcount);
}
-ULONG STDMETHODCALLTYPE DsAllocator::Release(){
- ULONG ref=0;
+u4 STDMETHODCALLTYPE DsAllocator::Release(){
+ u4 ref=0;
ref=InterlockedDecrement(&refcount);
if (ref==NULL) {
delete this; //Commit suicide
virtual HRESULT STDMETHODCALLTYPE AdviseNotify(IVMRSurfaceAllocatorNotify9* allnoty);
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID refiid,void ** obj);
- virtual ULONG STDMETHODCALLTYPE AddRef();
- virtual ULONG STDMETHODCALLTYPE Release();
+ virtual u4 STDMETHODCALLTYPE AddRef();
+ virtual u4 STDMETHODCALLTYPE Release();
void LostDevice(IDirect3DDevice9 *d3ddev, IDirect3D9* d3d);
class DsSFEnumPins: public IEnumPins {
public:
- DsSFEnumPins(DsSourcePin* audio,DsSourcePin* video,DsSourceFilter *filt,ULONG pos=0);
+ DsSFEnumPins(DsSourcePin* audio,DsSourcePin* video,DsSourceFilter *filt,u4 pos=0);
virtual ~DsSFEnumPins();
- virtual HRESULT STDMETHODCALLTYPE Next(ULONG numpin,IPin **pins,ULONG *fetched);
- virtual HRESULT STDMETHODCALLTYPE Skip(ULONG numpin);
+ virtual HRESULT STDMETHODCALLTYPE Next(u4 numpin,IPin **pins,u4 *fetched);
+ virtual HRESULT STDMETHODCALLTYPE Skip(u4 numpin);
virtual HRESULT STDMETHODCALLTYPE Reset();
virtual HRESULT STDMETHODCALLTYPE Clone(IEnumPins **enuma);
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id,void ** object);
- virtual ULONG STDMETHODCALLTYPE AddRef();
- virtual ULONG STDMETHODCALLTYPE Release();
+ virtual u4 STDMETHODCALLTYPE AddRef();
+ virtual u4 STDMETHODCALLTYPE Release();
protected:
DsSourcePin* audiopin;
DsSourcePin* videopin;
DsSourceFilter *filter;
- ULONG curpos;
+ u4 curpos;
volatile long refs;
};
-DsSFEnumPins::DsSFEnumPins(DsSourcePin* audio,DsSourcePin* video,DsSourceFilter *filt,ULONG pos){
+DsSFEnumPins::DsSFEnumPins(DsSourcePin* audio,DsSourcePin* video,DsSourceFilter *filt,u4 pos){
audiopin=audio;
videopin=video;
curpos=pos;
}
-HRESULT STDMETHODCALLTYPE DsSFEnumPins::Next(ULONG numpin,IPin **pins,ULONG *fetched) {
+HRESULT STDMETHODCALLTYPE DsSFEnumPins::Next(u4 numpin,IPin **pins,u4 *fetched) {
int i;
if (fetched==NULL) return E_POINTER;
if (pins==NULL) return E_POINTER;
return S_OK;
}
-HRESULT STDMETHODCALLTYPE DsSFEnumPins::Skip(ULONG numpin){
+HRESULT STDMETHODCALLTYPE DsSFEnumPins::Skip(u4 numpin){
curpos+=numpin;
if (curpos>2) return S_FALSE;
return S_OK;
-ULONG STDMETHODCALLTYPE DsSFEnumPins::AddRef(){
+u4 STDMETHODCALLTYPE DsSFEnumPins::AddRef(){
InterlockedIncrement(&refs);
long tempref=refs;
if (tempref>1) return tempref;
else return 1;
}
-ULONG STDMETHODCALLTYPE DsSFEnumPins::Release(){
+u4 STDMETHODCALLTYPE DsSFEnumPins::Release(){
long tempref=InterlockedDecrement(&refs);
if (tempref==0) {
}
}
-ULONG STDMETHODCALLTYPE DsSourceFilter::AddRef(){
+u4 STDMETHODCALLTYPE DsSourceFilter::AddRef(){
InterlockedIncrement(&refs);
long tempref=refs;
if (tempref>1) return tempref;
else return 1;
}
-ULONG STDMETHODCALLTYPE DsSourceFilter::Release(){
+u4 STDMETHODCALLTYPE DsSourceFilter::Release(){
long tempref=InterlockedDecrement(&refs);
if (tempref==0) {
/* IUnknown */
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id,void ** object);
- virtual ULONG STDMETHODCALLTYPE AddRef();
- virtual ULONG STDMETHODCALLTYPE Release();
+ virtual u4 STDMETHODCALLTYPE AddRef();
+ virtual u4 STDMETHODCALLTYPE Release();
/*IPersist*/
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *clsid);
class DsSFEnumMediaTypes: public IEnumMediaTypes {
public:
- DsSFEnumMediaTypes(DsSourcePin* papa,ULONG pos=0);
+ DsSFEnumMediaTypes(DsSourcePin* papa,u4 pos=0);
virtual ~DsSFEnumMediaTypes();
- virtual HRESULT STDMETHODCALLTYPE Next(ULONG nummedia, AM_MEDIA_TYPE **pins,ULONG *fetched);
- virtual HRESULT STDMETHODCALLTYPE Skip(ULONG numpin);
+ virtual HRESULT STDMETHODCALLTYPE Next(u4 nummedia, AM_MEDIA_TYPE **pins,u4 *fetched);
+ virtual HRESULT STDMETHODCALLTYPE Skip(u4 numpin);
virtual HRESULT STDMETHODCALLTYPE Reset();
virtual HRESULT STDMETHODCALLTYPE Clone(IEnumMediaTypes **enuma);
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id,void ** object);
- virtual ULONG STDMETHODCALLTYPE AddRef();
- virtual ULONG STDMETHODCALLTYPE Release();
+ virtual u4 STDMETHODCALLTYPE AddRef();
+ virtual u4 STDMETHODCALLTYPE Release();
protected:
DsSourcePin* parent;
- ULONG curpos;
+ u4 curpos;
volatile long refs;
};
-DsSFEnumMediaTypes::DsSFEnumMediaTypes(DsSourcePin* papa,ULONG pos){
+DsSFEnumMediaTypes::DsSFEnumMediaTypes(DsSourcePin* papa,u4 pos){
parent=papa;
curpos=pos;
parent->AddRef();
parent->Release();
}
-HRESULT STDMETHODCALLTYPE DsSFEnumMediaTypes::Next(ULONG numpin, AM_MEDIA_TYPE **pins,ULONG *fetched) {
+HRESULT STDMETHODCALLTYPE DsSFEnumMediaTypes::Next(u4 numpin, AM_MEDIA_TYPE **pins,u4 *fetched) {
int i;
if (pins==NULL) return E_POINTER;
return S_OK;
}
-HRESULT STDMETHODCALLTYPE DsSFEnumMediaTypes::Skip(ULONG numpin){
+HRESULT STDMETHODCALLTYPE DsSFEnumMediaTypes::Skip(u4 numpin){
curpos+=numpin;
if (curpos>1) return S_FALSE;
return S_OK;
-ULONG STDMETHODCALLTYPE DsSFEnumMediaTypes::AddRef(){
+u4 STDMETHODCALLTYPE DsSFEnumMediaTypes::AddRef(){
InterlockedIncrement(&refs);
long tempref=refs;
if (tempref>1) return tempref;
else return 1;
}
-ULONG STDMETHODCALLTYPE DsSFEnumMediaTypes::Release(){
+u4 STDMETHODCALLTYPE DsSFEnumMediaTypes::Release(){
long tempref=InterlockedDecrement(&refs);
if (tempref==0) {
}
}
-ULONG STDMETHODCALLTYPE DsSourcePin::AddRef(){
+u4 STDMETHODCALLTYPE DsSourcePin::AddRef(){
return m_pFilter->AddRef();
}
-ULONG STDMETHODCALLTYPE DsSourcePin::Release(){
+u4 STDMETHODCALLTYPE DsSourcePin::Release(){
return m_pFilter->Release();
}
IEnumMediaTypes * emt;
EnumMediaTypes(&emt);
AM_MEDIA_TYPE * emtype;
- ULONG fetched=0;
+ u4 fetched=0;
pinempf->AddRef();
return S_OK;
}
-HRESULT STDMETHODCALLTYPE DsSourcePin::QueryInternalConnections(IPin **pin,ULONG *numpin){
+HRESULT STDMETHODCALLTYPE DsSourcePin::QueryInternalConnections(IPin **pin,u4 *numpin){
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE DsSourcePin::EndOfStream(){
virtual HRESULT STDMETHODCALLTYPE QueryId(LPWSTR *id);
virtual HRESULT STDMETHODCALLTYPE QueryAccept(const AM_MEDIA_TYPE *mtype);
virtual HRESULT STDMETHODCALLTYPE EnumMediaTypes(IEnumMediaTypes **enuma);
- virtual HRESULT STDMETHODCALLTYPE QueryInternalConnections(IPin **pin,ULONG *numpin);
+ virtual HRESULT STDMETHODCALLTYPE QueryInternalConnections(IPin **pin,u4 *numpin);
virtual HRESULT STDMETHODCALLTYPE EndOfStream();
virtual HRESULT STDMETHODCALLTYPE NewSegment(REFERENCE_TIME start,REFERENCE_TIME stop,double rate);
/* IUnknown */
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id,void ** object);
- virtual ULONG STDMETHODCALLTYPE AddRef();
- virtual ULONG STDMETHODCALLTYPE Release();
+ virtual u4 STDMETHODCALLTYPE AddRef();
+ virtual u4 STDMETHODCALLTYPE Release();
virtual HRESULT STDMETHODCALLTYPE BeginFlush(){return E_UNEXPECTED;};
virtual HRESULT STDMETHODCALLTYPE EndFlush(){return E_UNEXPECTED;};
virtual HRESULT GetMediaType(int iPosition, AM_MEDIA_TYPE *pmt);
for (int i = 0; i < 256; ++i) palette8.setColour(i, defaultPalette8[i]);
}
-const ULONG DVBSubtitleCLUT::defaultPalette2[4] = {
+const u4 DVBSubtitleCLUT::defaultPalette2[4] = {
0x00000000, 0xFFFFFFFF, 0xFF000000, 0xFF808080
};
-const ULONG DVBSubtitleCLUT::defaultPalette4[16] = {
+const u4 DVBSubtitleCLUT::defaultPalette4[16] = {
0x00000000, 0xFFFF0000, 0xFF00FF00, 0xFFFFFF00,
0xFF0000FF, 0xFFFF00FF, 0xFF00FFFF, 0xFFFFFFFF,
0xFF000000, 0xFF800000, 0xFF008000, 0xFF808000,
0xFF000080, 0xFF800080, 0xFF008080, 0xFF808080
};
-const ULONG DVBSubtitleCLUT::defaultPalette8[256] = {
+const u4 DVBSubtitleCLUT::defaultPalette8[256] = {
0x00000000, 0x40FF0000, 0x4000FF00, 0x40FFFF00, // 0000 0000
0x400000FF, 0x40FF00FF, 0x4000FFFF, 0x40FFFFFF, // 0000 0100
0x80000000, 0x80550000, 0x80005500, 0x80555500, // 0000 1000
}
}
-static ULLONG PTSDifference(ULLONG pts1, ULLONG pts2)
+static u8 PTSDifference(u8 pts1, u8 pts2)
{
// Assume pts1, pts2 < 2^33; calculate pts1 - pts2
if (pts1 > pts2)
// FIXME dvbsubsdebug
// TEMP DEBUG - re-enable nowPTS below when this goes
- ULLONG nowPTS = Video::getInstance()->getCurrentTimestamp();
+ u8 nowPTS = Video::getInstance()->getCurrentTimestamp();
fprintf(DBG, "\033[H\033[2J");
fprintf(DBG, "Now: %s %llu\n", tp2str(std::chrono::system_clock::now()).c_str(), Video::getInstance()->getCurrentTimestamp());
for (auto p : worklist)
else
{
#ifndef DVBSDEBUG
- ULLONG nowPTS = Video::getInstance()->getCurrentTimestamp();
+ u8 nowPTS = Video::getInstance()->getCurrentTimestamp();
#endif
if (nowPTS == 0)
worklistTimeoutPointActive = true;
LogNT::getInstance()->debug(TAG, "Calc: Num packets available: {}", worklist.size());
- ULLONG pktPTS = worklist.front().getPTS();
- ULLONG diff = PTSDifference(pktPTS, nowPTS);
+ u8 pktPTS = worklist.front().getPTS();
+ u8 diff = PTSDifference(pktPTS, nowPTS);
diff /= 90; // convert diff to ms (PTS difference is in 1/90000s)
if (diff < 60 * 1000)
{
waitExpireWL = false;
worklistTimeoutPointActive = false;
#ifndef DVBSDEBUG
- ULLONG nowPTS = Video::getInstance()->getCurrentTimestamp();
+ u8 nowPTS = Video::getInstance()->getCurrentTimestamp();
#endif
// Guaranteed to be at least one packet in the worklist
PESPacket packet = worklist.front();
- ULLONG pktPTS = worklist.front().getPTS();
+ u8 pktPTS = worklist.front().getPTS();
while(1)
{
threadNudged = false;
threadUnlock();
bool finished = false;
- ULLONG nowPTS, pktPTS;
+ u8 nowPTS, pktPTS;
int wait;
while (!finished)
{
if (pktPTS != PESPacket::PTS_INVALID)
{ // A future action exists
nowPTS = Video::getInstance()->getCurrentTimestamp();
- ULLONG diff = PTSDifference(pktPTS, nowPTS);
+ u8 diff = PTSDifference(pktPTS, nowPTS);
diff /= 90; // convert diff in ms as PTS difference in 1/90000s
if (diff < 60 * 1000)
{
- if (diff < (ULLONG)wait)
+ if (diff < (u8)wait)
wait = (int)diff;
sleeptime.tv_nsec = (long)(wait % 1000) * 10000L / 1000L * 100000L;
}
Palette palette2;
Palette palette4;
Palette palette8;
- const static ULONG defaultPalette2[4];
- const static ULONG defaultPalette4[16];
- const static ULONG defaultPalette8[256];
+ const static u4 defaultPalette2[4];
+ const static u4 defaultPalette4[16];
+ const static u4 defaultPalette8[256];
};
class DVBSubtitleRegion : public Bitmap
{
public:
DVBSubtitlePage();
- ULLONG pts;
+ u8 pts;
bool dirty;
UCHAR version;
UINT timeout;
public:
void loadinfos(UINT channelid);
- ULONG id{};
- ULONG time{};
- ULONG duration{};
+ u4 id{};
+ u4 time{};
+ u4 duration{};
std::string title;
std::string subtitle;
bool failed{};
bool usingFallback{};
int staticArtworkID{-1};
- ULONG serverLoadingRef{};
+ u4 serverLoadingRef{};
OsdImage osdImage;
Image otherImage; // If set, this image will use otherImage's osdImage when it is ready
};
public:
const char* getFileName() { return fileName.c_str(); }
- void setServerLoadingRef(ULONG slr) { serverLoadingRef = slr; }
+ void setServerLoadingRef(u4 slr) { serverLoadingRef = slr; }
private:
std::string fileName;
friend class ImageLoader;
public:
- ULONG getChannel() { return channel; }
- ULONG getEvent() { return event; }
- void setServerLoadingRef(ULONG slr) { serverLoadingRef = slr; }
+ u4 getChannel() { return channel; }
+ u4 getEvent() { return event; }
+ void setServerLoadingRef(u4 slr) { serverLoadingRef = slr; }
private:
- ULONG channel{};
- ULONG event{};
+ u4 channel{};
+ u4 event{};
};
friend class ImageLoader;
public:
- ULONG getChannelID() { return channel; }
- void setServerLoadingRef(ULONG slr) { serverLoadingRef = slr; }
+ u4 getChannelID() { return channel; }
+ void setServerLoadingRef(u4 slr) { serverLoadingRef = slr; }
private:
- ULONG channel{};
+ u4 channel{};
};
5 poster thumb (channel, eventid)
6 channel logo
-const static ULONG VDR_LOADTVMEDIA = 41; 0,1,2
-const static ULONG VDR_LOADTVMEDIARECTHUMB = 42; 3
-const static ULONG VDR_LOADTVMEDIAEVENTTHUMB = 44; 5
-const static ULONG VDR_LOADCHANNELLOGO = 45; 6
+const static u4 VDR_LOADTVMEDIA = 41; 0,1,2
+const static u4 VDR_LOADTVMEDIARECTHUMB = 42; 3
+const static u4 VDR_LOADTVMEDIAEVENTTHUMB = 44; 5
+const static u4 VDR_LOADCHANNELLOGO = 45; 6
Types 3, 4, 5, 6 are handled by create*() methods in ImageLoader.
Types 0, 1, 2 (though probably only 2 of these) are created with ImageLoader::createGeneric().
return recThumbImage;
}
-ImageEventThumb ImageLoader::createEventThumb(ULONG channel, ULONG event)
+ImageEventThumb ImageLoader::createEventThumb(u4 channel, u4 event)
{
// Does this image already exist?
{
return eventThumbImage;
}
-ImageChannelLogo ImageLoader::createChannelLogo(ULONG channel, int sa_id)
+ImageChannelLogo ImageLoader::createChannelLogo(u4 channel, int sa_id)
{
// Does this image already exist?
{
Image image;
bool free_it = false;
UCHAR* imageData{};
- ULONG length{};
+ u4 length{};
if (pwi.vresp)
ImageGeneric createGeneric();
ImageRecFolder createRecFolder(const char* recFileName);
ImageRecThumb createRecThumb(const char* recFileName);
- ImageEventThumb createEventThumb(ULONG channel, ULONG event);
- ImageChannelLogo createChannelLogo(ULONG channel, int sa_id = -1);
+ ImageEventThumb createEventThumb(u4 channel, u4 event);
+ ImageChannelLogo createChannelLogo(u4 channel, int sa_id = -1);
ImageLoader();
~ImageLoader();
}
// the real entry for receiving data
-int ImageReader::getImageChunk(ULLONG offset,UINT len, UINT * rsize, UCHAR **buffer){
+int ImageReader::getImageChunk(u8 offset,UINT len, UINT * rsize, UCHAR **buffer){
logger->log("ImageReader", Log::DEBUG, "request chunk offset=%llu, len=%u",offset,len);
threadLock();
*buffer=NULL;
logger->log("ImageReader", Log::DEBUG, "ready chunk found at index %u,offset=%llu, len=%u",i,data[i].offset,data[i].len);
if ( data[i].len >0) {
//check if the next chunk is already on the way
- ULLONG nexto=data[i].offset+data[i].len;
+ u8 nexto=data[i].offset+data[i].len;
bool nfound=false;
for (int x=0;x<MAXCHUNKS;x++) {
if (data[x].state != S_FREE && data[x].state != S_BREAK && data[x].offset==nexto) {
//rsize will return the received len: 0 on EOF, -1 on error
//the returned buffer has to be freed outside (really use free!)
//if the buffer is not filled it will wait until the chunk is received!
- int getImageChunk(ULLONG offset,UINT len, UINT * rsize,UCHAR **buffer);
+ int getImageChunk(u8 offset,UINT len, UINT * rsize,UCHAR **buffer);
//is the reader still running?
bool isReaderRunning();
class Chunk{
public:
UCHAR * buffer; //receive buffer (to be deallocated with free)
- ULLONG offset; //offset within stream/file
+ u8 offset; //offset within stream/file
UINT reqlen; //requested len
- ULONG len; //received len
+ u4 len; //received len
rstate state; //current state
Chunk() {
buffer=NULL;
void Input::LoadKeysConfig(VDR *vdr,const char *cfg)
{
- ULONG number=0;
+ u4 number=0;
if (sscanf(cfg,"%ld",&number) != 1) return;
LogNT::getInstance()->info(TAG, "Config Input/Remote keys num keys {}", number);
char keybuf[1024];
- for (ULONG i = 0; i < number; i++) {
+ for (u4 i = 0; i < number; i++) {
sprintf(keybuf, "RemoteKey%lu", i);
const char *keytrans = vdr->configLoad(modName(), keybuf);
if (keytrans) {
- ULONG ul1, ul2;
- ULONG uc;
+ u4 ul1, ul2;
+ u4 uc;
if (sscanf(keytrans, "%lXI%lXK%lX", &ul1, &ul2, &uc) == 3) {
- translist[((ULLONG) ul1) | ((ULLONG) ul2) << 32] = (UCHAR) uc;
+ translist[((u8) ul1) | ((u8) ul2) << 32] = (UCHAR) uc;
}
delete[] keytrans;
}
for (it = translist.begin(); it != translist.end(); it++)
{
sprintf(buffer,"%08lXI%08lXK%02X",
- (ULONG)it->first ,(ULONG) (it->first >> 32), it->second);
+ (u4)it->first ,(u4) (it->first >> 32), it->second);
sprintf(keybuf,"RemoteKey%d",number);
VDR::getInstance()->configSave(modName(), keybuf, buffer);
number++;
#include "abstractoption.h"
#ifdef WIN32
-#define HWC_TYPE ULLONG
+#define HWC_TYPE u8
#else
#define HWC_TYPE int
#endif
virtual std::string getHardwareKeyName(HWC_TYPE hardwareKey) = 0;
- const static ULONG NOLEARNMODE = 256;
+ const static u4 NOLEARNMODE = 256;
// Not buttons
const static UCHAR NA_LEARN = 101;
const static UCHAR NA_NONE = 98;
static const char* TAG = "InputCEC";
-//#define W_G_HCW(type,code) ((static_cast<ULLONG>(type) << 32) | code)
+//#define W_G_HCW(type,code) ((static_cast<u8>(type) << 32) | code)
//#define W_HCW_KC 1 /* key code as defined by kernel for keyboard and remotes through /dev/input */
//#define W_HCW_CEC 2 /* HDMI_CEC */
#endif
-// FIXME remove all ULLONG for hwc
+// FIXME remove all u8 for hwc
#include "log.h"
#include "inputwin.h"
-#define W_G_HCW(type,code) ( (((ULLONG)(type))<<32) | code)
+#define W_G_HCW(type,code) ( (((u8)(type))<<32) | code)
#define W_HCW_VK 1 /* virtual key */
#define W_HCW_AP 2 /* App command */
std::string InputWin::getHardwareKeyName(HWC_TYPE hardwareKey)
{
//Determine type
- ULONG type = hardwareKey >> 32;
+ u4 type = hardwareKey >> 32;
char rt[10];
switch(type)
{
case W_HCW_VK:
{
- ULONG vk = (ULONG)hardwareKey;
- ULONG scancode = MapVirtualKey(vk,0);
+ u4 vk = (u4)hardwareKey;
+ u4 scancode = MapVirtualKey(vk,0);
GetKeyNameText(scancode << 16, rt, 10);
break;
}
case W_HCW_CH:
{
- ULONG ch = (ULONG)hardwareKey;
- ULONG scancode = OemKeyScan(ch);
+ u4 ch = (u4)hardwareKey;
+ u4 scancode = OemKeyScan(ch);
GetKeyNameText(scancode << 16, rt, 10);
break;
}
case W_HCW_RI:
{
- ULONG ri = (ULONG)hardwareKey;
+ u4 ri = (u4)hardwareKey;
sprintf(rt, "R: %X", ri);
break;
}
}
}
}
-MediaURI::MediaURI(ULONG p, const char * n, const char * dp) {
+MediaURI::MediaURI(u4 p, const char * n, const char * dp) {
_allowedTypes=MEDIA_TYPE_ALL;
_providerId=p;
if (n) {
_display=NULL;
if (b->decodeLong(_providerId) != 0) return -1;
if (b->decodeLong(_allowedTypes) != 0) return -1;
- ULONG nlen=0;
+ u4 nlen=0;
if (b->decodeString(nlen,_name) != 0) return -1;
if (b->decodeString(nlen,_display) != 0) return -1;
//if (version > 1) ...
index = -1; // just in case
}
-ULONG Media::getTime() const
+u4 Media::getTime() const
{
return mtime;
}
return fileName;
}
-void Media::setTime(ULONG tstartTime)
+void Media::setTime(u4 tstartTime)
{
mtime = tstartTime;
}
-void Media::setMediaType(ULONG mtype)
+void Media::setMediaType(u4 mtype)
{
mediaType=mtype;
}
-ULONG Media::getMediaType() const
+u4 Media::getMediaType() const
{
return mediaType;
}
uri=NULL;
if (b->decodeLong(mediaType) != 0) return -1;
if (b->decodeLong(mtime) != 0) return -1;
- ULONG nlen=0;
+ u4 nlen=0;
if (b->decodeString(nlen,fileName) != 0) return -1;
if (b->decodeString(nlen,displayName) != 0) return -1;
UCHAR hasURI=0;
MediaURI * rt=new MediaURI();
rt->_providerId=c->_providerId;
rt->_allowedTypes=c->_allowedTypes;
- ULONG nlen=0;
+ u4 nlen=0;
if (c->_name) {
char * ls=strrchr(c->_name,'/');
if (ls) {
return new MediaURI(_root);
}
-ULONG MediaList::getProvider() {
+u4 MediaList::getProvider() {
if (! _root) return 0;
return _root->getProvider();
}
int MediaList::deserializeImpl(SerializeBuffer *b) {
emptyList();
- ULONG numelem;
+ u4 numelem;
if (b->decodeLong(numelem) != 0) return -1;
UCHAR hasRoot=0;
if (b->decodeByte(hasRoot) != 0) return -1;
_root=new MediaURI();
if (_root->deserialize(b) != 0) return -1;
}
- for (ULONG i=0;i<numelem;i++) {
+ for (u4 i=0;i<numelem;i++) {
Media *m=new Media();
if (m->deserialize(b) != 0) {
delete m;
private:
char * _name;
char * _display;
- ULONG _providerId;
- ULONG _allowedTypes;
+ u4 _providerId;
+ u4 _allowedTypes;
public:
MediaURI() {
_name=NULL;
_allowedTypes=MEDIA_TYPE_ALL;
}
//constructor copying params
- MediaURI(ULONG provider, const char * name, const char * display);
+ MediaURI(u4 provider, const char * name, const char * display);
virtual ~MediaURI() {
if (_name) delete _name;
if (_display) delete _display;
if (_display) return _display;
return _name;
}
- ULONG getProvider() const {
+ u4 getProvider() const {
return _providerId;
}
- void setProvider(ULONG pid) {
+ void setProvider(u4 pid) {
_providerId=pid;
}
- ULONG getAllowedTypes() const {
+ u4 getAllowedTypes() const {
return _allowedTypes;
}
- void setAllowedTypes(ULONG allowedTypes) {
+ void setAllowedTypes(u4 allowedTypes) {
_allowedTypes=allowedTypes;
}
bool hasDisplayName() const {
*/
class MediaInfo : public Serializable{
public:
- ULLONG size;
+ u8 size;
bool canPosition;
- ULONG type; //a media type
- ULONG subtype; //TODO
+ u4 type; //a media type
+ u4 subtype; //TODO
/**
* return any info item contained within this info
*/
- virtual const char * getInfo(ULONG /* infoId */) { return NULL;}
- virtual ULLONG getIntegerInfo(ULONG /* infoId */) { return 0;}
- virtual const char * getInfoName(ULONG /* infoId */) { return NULL;}
- virtual bool hasInfo(ULONG /* infoId */) { return false;}
+ virtual const char * getInfo(u4 /* infoId */) { return NULL;}
+ virtual u8 getIntegerInfo(u4 /* infoId */) { return 0;}
+ virtual const char * getInfoName(u4 /* infoId */) { return NULL;}
+ virtual bool hasInfo(u4 /* infoId */) { return false;}
MediaInfo() {
size=0;
canPosition=true;
Media(const Media *m);
virtual ~Media();
- void setTime(ULONG mtimeTime);
+ void setTime(u4 mtimeTime);
void setDisplayName(const char* displayName);
void setFileName(const char* fileName);
- void setMediaType(ULONG mtype);
+ void setMediaType(u4 mtype);
- ULONG getTime() const;
+ u4 getTime() const;
const char* getDisplayName() const;
const char* getFileName() const;
//return the time as a string
//length for the time display buffer
const static int TIMEBUFLEN=100;
int index;
- ULONG getMediaType() const;
+ u4 getMediaType() const;
bool hasDisplayName() const;
//optionally the media can contain an URI
//in this case the filename is not considered
virtual int deserializeImpl(SerializeBuffer *b);
private:
- ULONG mtime;
+ u4 mtime;
char* displayName;
char* fileName;
- ULONG mediaType;
+ u4 mediaType;
MediaURI *uri;
virtual MediaURI * getRootURI();
virtual MediaURI * getParent(MediaURI *c) ;
virtual MediaURI * getURI(Media *m);
- virtual ULONG getProvider();
+ virtual u4 getProvider();
virtual void setOwning(bool owning);
//serialize functions
//get the #of bytes needed to serialize
-MediaFile::MediaFile(ULONG pid){
+MediaFile::MediaFile(u4 pid){
providerid=pid;
}
static struct mtype{
const char* extension;
- ULONG type;
+ u4 type;
} mediatypes[]= {
{".mp3",MEDIA_TYPE_AUDIO},
{".MP3",MEDIA_TYPE_AUDIO},
return NULL;
}
-ULONG MediaFile::getMediaType(const char * filename) {
- for (ULONG i=0;i<NUMTYPES;i++) {
+u4 MediaFile::getMediaType(const char * filename) {
+ for (u4 i=0;i<NUMTYPES;i++) {
if (endswith(filename,mediatypes[i].extension)) {
return mediatypes[i].type;
}
char *buffer=(char*)malloc(strlen(dirname)+strlen(filename)+2);
sprintf(buffer, "%s/%s", dirname, filename);
- ULONG mtype=MEDIA_TYPE_UNKNOWN;
+ u4 mtype=MEDIA_TYPE_UNKNOWN;
#ifndef WIN32
struct stat st;
if (stat(buffer, &st) == 0) {
}
MediaList* MediaFile::getMediaList(const MediaURI * parent){
- ULONG mediaType=parent->getAllowedTypes();
+ u4 mediaType=parent->getAllowedTypes();
Log::getInstance()->log("MediaFile::getMediaList",Log::DEBUG,"parent %s,types=0x%0lx",parent->getName(),mediaType);
MediaList *rt=NULL;
rt=new MediaList(parent);
}
-int MediaFile::openMedium(ULONG channel, const MediaURI * uri, ULLONG * size, ULONG xsize, ULONG ysize) {
+int MediaFile::openMedium(u4 channel, const MediaURI * uri, u8 * size, u4 xsize, u4 ysize) {
Log::getInstance()->log("Media::openMedium",Log::DEBUG,"fn=%s,chan=%u",uri->getName(),channel);
*size=0;
if (channel <0 || channel >= NUMCHANNELS) return -1;
return -1;
}
- ULLONG mysize=0;
+ u8 mysize=0;
#ifndef WIN32
struct stat st;
if ( fstat(fileno(fp),&st) == 0) mysize=st.st_size;
}
-int MediaFile::getMediaBlock(ULONG channel, ULLONG offset, ULONG len, ULONG * outlen,
+int MediaFile::getMediaBlock(u4 channel, u8 offset, u4 len, u4 * outlen,
unsigned char ** buffer) {
Log::getInstance()->log("Media::getMediaBlock",Log::DEBUG,"chan=%u,offset=%llu,len=%lu",channel,offset,len);
*outlen=0;
Log::getInstance()->log("Media::getMediaBlock",Log::ERR,"not open chan=%u",channel);
return -1;
}
- ULLONG cpos=ftell(info->file);
+ u8 cpos=ftell(info->file);
if (offset != cpos) {
fseek(info->file,offset-cpos,SEEK_CUR);
}
- if (offset != (ULLONG)ftell(info->file)) {
+ if (offset != (u8)ftell(info->file)) {
Log::getInstance()->log("Client", Log::DEBUG, "getMediaBlock pos = %llu not available", offset);
return -1;
}
Log::getInstance()->log("Media::getMediaBlock",Log::ERR,"uanble to allocate buffer");
return -1;
}
- ULONG amount=fread(*buffer,1,len,info->file);
+ u4 amount=fread(*buffer,1,len,info->file);
Log::getInstance()->log("Media::getMediaBlock",Log::DEBUG,"readlen=%lu",amount);
*outlen=amount;
return 0;
}
-int MediaFile::closeMediaChannel(ULONG channel){
+int MediaFile::closeMediaChannel(u4 channel){
Log::getInstance()->log("Media::closeMediaChannel",Log::DEBUG,"chan=%u",channel);
if (channel <0 || channel >= NUMCHANNELS) return -1;
struct ChannelInfo *info=&channels[channel];
}
//TODO: fill in more info
-int MediaFile::getMediaInfo(ULONG channel, MediaInfo * result){
+int MediaFile::getMediaInfo(u4 channel, MediaInfo * result){
Log::getInstance()->log("Media::getMediaInfo",Log::DEBUG,"chan=%u",channel);
if (channel <0 || channel >= NUMCHANNELS) return -1;
struct ChannelInfo *info=&channels[channel];
class MediaFile : public MediaProvider
{
public:
- MediaFile(ULONG providerId);
+ MediaFile(u4 providerId);
virtual ~MediaFile();
/**
* get the root media list
* @return != 0 in case of error
*
*/
- virtual int openMedium(ULONG channel, const MediaURI * uri, ULLONG * size, ULONG xsize, ULONG ysize);
+ virtual int openMedium(u4 channel, const MediaURI * uri, u8 * size, u4 xsize, u4 ysize);
/**
* get a block for a channel
* @param buffer out the allocated buffer (must be freed with free!)
* @return != 0 in case of error
*/
- virtual int getMediaBlock(ULONG channel, ULLONG offset, ULONG len, ULONG * outlen,
+ virtual int getMediaBlock(u4 channel, u8 offset, u4 len, u4 * outlen,
unsigned char ** buffer);
/**
* close a media channel
*/
- virtual int closeMediaChannel(ULONG channel);
+ virtual int closeMediaChannel(u4 channel);
/**
* return the media info for a given channel
* return != 0 on error
* the caller has to provide a pointer to an existing media info
*/
- virtual int getMediaInfo(ULONG channel, MediaInfo * result);
+ virtual int getMediaInfo(u4 channel, MediaInfo * result);
protected:
struct ChannelInfo {
public:
FILE *file;
- ULONG provider;
+ u4 provider;
char *filename;
- ULLONG size;
+ u8 size;
ChannelInfo(){
file=NULL;
provider=0;
}
};
struct ChannelInfo channels[NUMCHANNELS];
- ULONG providerid;
+ u4 providerid;
- virtual ULONG getMediaType(const char *filename);
+ virtual u4 getMediaType(const char *filename);
};
class MediaProviderHolder {
public:
MediaProvider *provider;
- ULONG id;
- ULONG range;
- MediaProviderHolder(MediaProvider *p,ULONG i, ULONG r=1) {
+ u4 id;
+ u4 range;
+ MediaProviderHolder(MediaProvider *p,u4 i, u4 r=1) {
provider=p;
range=r;
id=i;
* @return != 0 in case of error
*
*/
-int MediaPlayer::openMedium(ULONG channel, const MediaURI * uri, ULLONG * size, ULONG xsize, ULONG ysize){
+int MediaPlayer::openMedium(u4 channel, const MediaURI * uri, u8 * size, u4 xsize, u4 ysize){
if ( channel >= NUMCHANNELS) return -1;
info[channel].provider=NULL;
*size= 0;
* @param buffer out the allocated buffer (must be freed with free!)
* @return != 0 in case of error
*/
-int MediaPlayer::getMediaBlock(ULONG channel, ULLONG offset, ULONG len, ULONG * outlen,
+int MediaPlayer::getMediaBlock(u4 channel, u8 offset, u4 len, u4 * outlen,
unsigned char ** buffer) {
if ( channel >= NUMCHANNELS) return -1;
if ( info[channel].provider == NULL) return -1;
/**
* close a media channel
*/
-int MediaPlayer::closeMediaChannel(ULONG channel){
+int MediaPlayer::closeMediaChannel(u4 channel){
if ( channel >= NUMCHANNELS) return -1;
if ( info[channel].provider == NULL) return -1;
int rt=info[channel].provider->closeMediaChannel(channel);
* return != 0 on error
* the caller has to provide a pointer to an existing media info
*/
-int MediaPlayer::getMediaInfo(ULONG channel, struct MediaInfo * result){
+int MediaPlayer::getMediaInfo(u4 channel, struct MediaInfo * result){
if ( channel >= NUMCHANNELS) return -1;
if ( info[channel].provider == NULL) return -1;
return info[channel].provider->getMediaInfo(channel,result);
-void MediaPlayer::registerMediaProvider(MediaProvider *p,ULONG providerId,ULONG range) {
+void MediaPlayer::registerMediaProvider(MediaProvider *p,u4 providerId,u4 range) {
if (! p) return;
MediaProviderHolder *h=new MediaProviderHolder(p,providerId,range);
Log::getInstance()->log("MediaPlayer::registerMediaProvider",Log::DEBUG,"p=%p",p);
plist.push_back(h);
}
-MediaProvider * MediaPlayer::providerById(ULONG id) {
+MediaProvider * MediaPlayer::providerById(u4 id) {
MediaProvider *rt=NULL;
for (Tplist::iterator it=plist.begin();it<plist.end();it++) {
MediaProviderHolder *h=*it;
* @return != 0 in case of error
*
*/
- virtual int openMedium(ULONG channel, const MediaURI * uri, ULLONG * size, ULONG xsize, ULONG ysize);
+ virtual int openMedium(u4 channel, const MediaURI * uri, u8 * size, u4 xsize, u4 ysize);
/**
* get a block for a channel
* @param buffer out the allocated buffer (must be freed with free!)
* @return != 0 in case of error
*/
- virtual int getMediaBlock(ULONG channel, ULLONG offset, ULONG len, ULONG * outlen,
+ virtual int getMediaBlock(u4 channel, u8 offset, u4 len, u4 * outlen,
unsigned char ** buffer);
/**
* close a media channel
*/
- virtual int closeMediaChannel(ULONG channel);
+ virtual int closeMediaChannel(u4 channel);
/**
* return the media info for a given channel
* return != 0 on error
* the caller has to provide a pointer to an existing media info
*/
- virtual int getMediaInfo(ULONG channel, struct MediaInfo * result);
+ virtual int getMediaInfo(u4 channel, struct MediaInfo * result);
/**
* from MediaPlayerRegister
*/
- virtual void registerMediaProvider(MediaProvider *p,ULONG providerID,ULONG range);
+ virtual void registerMediaProvider(MediaProvider *p,u4 providerID,u4 range);
/**
* the instance
static MediaPlayer * getInstance();
private:
- MediaProvider * providerById(ULONG id);
+ MediaProvider * providerById(u4 id);
typedef std::vector<MediaProviderHolder *> Tplist;
Tplist plist;
struct channelInfo {
- ULONG providerId;
+ u4 providerId;
MediaProvider *provider;
channelInfo() {
provider=NULL;
* @return != 0 in case of error
*
*/
- virtual int openMedium(ULONG channel, const MediaURI * uri, ULLONG * size, ULONG xsize, ULONG ysize)=0;
+ virtual int openMedium(u4 channel, const MediaURI * uri, u8 * size, u4 xsize, u4 ysize)=0;
/**
* get a block for a channel
* when calling
* @return != 0 in case of error
*/
- virtual int getMediaBlock(ULONG channel, ULLONG offset, ULONG len, ULONG * outlen,
+ virtual int getMediaBlock(u4 channel, u8 offset, u4 len, u4 * outlen,
unsigned char ** buffer)=0;
/**
* close a media channel
*/
- virtual int closeMediaChannel(ULONG channel)=0;
+ virtual int closeMediaChannel(u4 channel)=0;
/**
* return the media info for a given channel
* return != 0 on error
* the caller has to provide a pointer to an existing media info
*/
- virtual int getMediaInfo(ULONG channel, MediaInfo * result)=0;
+ virtual int getMediaInfo(u4 channel, MediaInfo * result)=0;
};
*/
class MediaPlayerRegister {
public:
- virtual void registerMediaProvider(MediaProvider *pi,ULONG id,ULONG range=1)=0;
+ virtual void registerMediaProvider(MediaProvider *pi,u4 id,u4 range=1)=0;
virtual ~MediaPlayerRegister(){}
static MediaPlayerRegister* getInstance();
protected:
*/
//we reserve the range 1...999 for client side providers
-static const ULONG MPROVIDERID_LOCALMEDIAFILE=1;
-static const ULONG MPROVIDERID_VDR=1000;
-static const ULONG MPROVIDERRANGE_VDR=10000; //so it has the IDs 1000..10999
+static const u4 MPROVIDERID_LOCALMEDIAFILE=1;
+static const u4 MPROVIDERID_VDR=1000;
+static const u4 MPROVIDERRANGE_VDR=10000; //so it has the IDs 1000..10999
//all providers on the server side
//must fit into this range
-static const ULONG MPROVIDERID_SERVERMEDIAFILE=1001;
+static const u4 MPROVIDERID_SERVERMEDIAFILE=1001;
#ifndef MEDIAPROVIDERIDS_H
#define MEDIAPROVIDERIDS_H
PreDefinedTarget p_to{NA}; // If this is set 'to' is ignored
MessageReceiver* to{};
int message{};
- ULONG parameter{};
- ULONG tag{}; // use this for identifying which object / question is being replied to
+ u4 parameter{};
+ u4 tag{}; // use this for identifying which object / question is being replied to
void* data{}; // Use this for anything. Int, pointer, pointer to memory to be freed by the recipient, etc.
// Never use the values, only the names
m->to = this;
m->data = reinterpret_cast<void*>(handle);
m->message = Message::NEW_PICTURE;
- m->tag = reinterpret_cast<ULONG>(info->lindex);
+ m->tag = reinterpret_cast<u4>(info->lindex);
MessageQueue::getInstance()->postMessage(m);
delete info;
m->to = this;
m->data = reinterpret_cast<void*>(info->handle);
m->message = Message::NEW_PICTURE;
- m->tag = reinterpret_cast<ULONG>(info->lindex);
+ m->tag = reinterpret_cast<u4>(info->lindex);
MessageQueue::getInstance()->postMessage(m); // inform command about new picture
delete info;
putOpenVGCommand(comm, false);
}
-bool OsdOpenVG::getStaticImageData(unsigned int static_id, UCHAR** userdata, ULONG* length)
+bool OsdOpenVG::getStaticImageData(unsigned int static_id, UCHAR** userdata, u4* length)
{
if (sa_MAX > static_id)
{
VectorHandleImage createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data);
void destroyDrawStyleHandle(VectorHandle index);
VectorHandle createDrawStyleHandle(const DrawStyle& c);
- bool getStaticImageData(unsigned int static_id, UCHAR** userdata, ULONG* length);
+ bool getStaticImageData(unsigned int static_id, UCHAR** userdata, u4* length);
void drawSetTrans(SurfaceInfo& sc);
void executeDrawCommand(SVGCommand& command);
virtual void getScreenSize(int& width, int& height) = 0;
virtual void getRealScreenSize(int& width, int& height) = 0;
- virtual bool getStaticImageData(unsigned int static_id, UCHAR** userdata, ULONG* length) = 0;
+ virtual bool getStaticImageData(unsigned int static_id, UCHAR** userdata, u4* length) = 0;
// Used only by OsdVector and SurfaceVector
void removeImageRef(const VectorHandleImage ref);
D2DBitmap
};
PictType type;
- ULONG width;
- ULONG height;
+ u4 width;
+ u4 height;
LoadingIndex lindex;
union
{
}
-bool OsdWinVector::getStaticImageData(unsigned int static_id, UCHAR **userdata, ULONG *length)
+bool OsdWinVector::getStaticImageData(unsigned int static_id, UCHAR **userdata, u4 *length)
{
if (sa_MAX>static_id) {
HRSRC hrc = FindResource(GetModuleHandle(NULL), ext_pict_name[static_id], RT_RCDATA);
void createPicture(struct PictureInfo& pict_inf);
void destroyDrawStyleHandle(VectorHandle index);
VectorHandle createDrawStyleHandle(const DrawStyle &c);
- bool getStaticImageData(unsigned int static_id, UCHAR **userdata, ULONG *length);
+ bool getStaticImageData(unsigned int static_id, UCHAR **userdata, u4 *length);
int loadFont(bool fontchange);
struct StreamChunk
{
void* data;
- ULONG len;
+ u4 len;
};
struct PLInstruction
{
UCHAR instruction;
- ULONG channelIndex;
+ u4 channelIndex;
};
class PlayerLive
virtual int init()=0;
virtual int shutdown()=0;
- virtual void go(ULONG index)=0;
- virtual void setChannel(ULONG index)=0;
+ virtual void go(u4 index)=0;
+ virtual void setChannel(u4 index)=0;
virtual void stop()=0;
virtual void setAudioChannel(int newChannel,int type,int streamtype)=0;
virtual void setSubtitleChannel(int newChannel)=0;
//we leave all the open and close handling to the frontend
//so we only need the channel
-int PlayerMedia::playNew(ULONG mChannel,ULLONG lBytes,ULLONG lFrames)
+int PlayerMedia::playNew(u4 mChannel,u8 lBytes,u8 lFrames)
{
logger->log("PlayerMedia", Log::DEBUG, "play request for channel %lu", mChannel);
if (getState() != S_STOP) {
//try to get the len
UCHAR buf[STARTBUFLEN];
UCHAR *bpointer=buf;
- ULONG rtlen=0;
+ u4 rtlen=0;
logger->log("PlayerMedia", Log::DEBUG, "try to find last PTS with %lu bytes", STARTBUFLEN);
int rb=MediaPlayer::getInstance()->getMediaBlock(mChannel,lBytes-STARTBUFLEN,STARTBUFLEN,&rtlen,&bpointer);
if (rb == 0) {
if (! canPosition) return -1;
logger->log("PlayerMedia",Log::DEBUG,"jump to %i%% ",percent);
threadLock();
- ULLONG npos=streampos;
+ u8 npos=streampos;
//TODO: where to go - currently we simply take bytes...
- npos=(ULLONG)(percent*lengthBytes/100);
+ npos=(u8)(percent*lengthBytes/100);
if (npos > lengthBytes) npos=lengthBytes-1;
requestedStreampos=npos;
requestState=S_POSITION;
if (! canPosition) return -1;
logger->log("PlayerMedia",Log::DEBUG,"skip fw %ds",seconds);
threadLock();
- ULLONG bps=getBytesPerSecond();
- requestedStreampos=streampos+ (ULLONG)seconds*bps;
+ u8 bps=getBytesPerSecond();
+ requestedStreampos=streampos+ (u8)seconds*bps;
requestState=S_POSITION;
requestedSequence++;
threadUnlock();
if (! canPosition) return -1;
logger->log("PlayerMedia",Log::DEBUG,"skip back %ds",seconds);
threadLock();
- ULLONG bps=getBytesPerSecond();
- if (streampos > (ULLONG)seconds*bps)
- requestedStreampos=streampos- (ULLONG)seconds*bps;
+ u8 bps=getBytesPerSecond();
+ if (streampos > (u8)seconds*bps)
+ requestedStreampos=streampos- (u8)seconds*bps;
else
requestedStreampos=0;
requestState=S_POSITION;
-void PlayerMedia::sendFrontendMessage(ULONG para)
+void PlayerMedia::sendFrontendMessage(u4 para)
{
logger->log("PlayerMedia", Log::DEBUG, "sending frontend message %ld",para);
Message* m = new Message();
thisWrite=0;
if (threadBuffer) free(threadBuffer);
threadBuffer=NULL;
- ULLONG bpts=0;
- ULLONG curPts=getCurrentPTS();
+ u8 bpts=0;
+ u8 curPts=getCurrentPTS();
if (curPts != 0) bpts=streampos/curPts;
if (bpts != 0) appDestinationPTS=requestedStreampos/bpts;
else appDestinationPTS=0;
thisRead=0;
thisWrite=0;
threadBuffer=NULL;
- ULONG rd=BUFLEN;
+ u4 rd=BUFLEN;
if (onStartup) rd=STARTBUFLEN;
int rt=MediaPlayer::getInstance()->getMediaBlock(mediaChannel,streampos,rd,&thisRead,&threadBuffer);
if ( thisRead == 0 && threadBuffer) {
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) {
return demuxer->getselAudioChannel();
}
-ULLONG PlayerMedia::getLengthBytes() {
+u8 PlayerMedia::getLengthBytes() {
return lengthBytes;
}
-ULLONG PlayerMedia::getLengthFrames() {
+u8 PlayerMedia::getLengthFrames() {
return lengthFrames;
}
//PTS is always relative to first
-ULLONG PlayerMedia::getCurrentPTS()
+u8 PlayerMedia::getCurrentPTS()
{
if (appDestinationPTS != 0) {
- ULLONG lenPts=demuxer->getLenPTS();
+ u8 lenPts=demuxer->getLenPTS();
if (appDestinationPTS < lenPts) return appDestinationPTS;
return lenPts;
}
return demuxer->getCurrentPTS();
}
-ULLONG PlayerMedia::getLenPTS()
+u8 PlayerMedia::getLenPTS()
{
return demuxer->getLenPTS();
}
-ULLONG PlayerMedia::getBytesPerSecond() {
- ULLONG currsec=getCurrentPTS()/90000;
+u8 PlayerMedia::getBytesPerSecond() {
+ u8 currsec=getCurrentPTS()/90000;
if (currsec == 0) return 0;
return streampos/currsec;
}
//each of the commands works as a request
//only after getSequence returned the same sequence as those commands this is
//handled by the player and getError is valid
- int playNew(ULONG mediaChannel,ULLONG lengthBytes, ULLONG lengthFrames=0);
+ int playNew(u4 mediaChannel,u8 lengthBytes, u8 lengthFrames=0);
//stop the player without shutting it down
int stop();
int play();
//info functions
//get current position in s
- ULONG getCurrentTimes();
+ u4 getCurrentTimes();
//get song len in s
- ULONG getSonglen();
+ u4 getSonglen();
- ULLONG getLengthFrames();
- ULLONG getLengthBytes();
+ u8 getLengthFrames();
+ u8 getLengthBytes();
virtual void call(void * caller);
//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 SHORT_UPDATE=6; //timer info update
- const static ULONG ASPECT43 = 7;
- const static ULONG ASPECT169 = 8;
+ 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 SHORT_UPDATE=6; //timer info update
+ const static u4 ASPECT43 = 7;
+ const static u4 ASPECT169 = 8;
virtual void timercall(int reference);
void setAudioChannel(int channel);
bool * getDemuxerMpegAudioChannels();
bool * getDemuxerAc3AudioChannels();
int getCurrentAudioChannel();
- ULLONG getCurrentPTS();
- ULLONG getLenPTS();
+ u8 getCurrentPTS();
+ u8 getLenPTS();
char * getInfo(); //return some info about the played file,caller has to destroy buffer
protected:
UCHAR checkState();
//variables used by the thread
- ULONG thisWrite;
- ULONG thisRead;
+ u4 thisWrite;
+ u4 thisRead;
bool running;
bool onStartup; //set for the firts chunk to find the audio channel
UCHAR *threadBuffer;
UCHAR state;
UCHAR requestState;
- ULLONG streampos;
- ULLONG bytesWritten;
- ULLONG requestedStreampos;
+ u8 streampos;
+ u8 bytesWritten;
+ u8 requestedStreampos;
//the buffer len in bytes
const static int BUFLEN=100000;
//handled sequence
int sequence;
- void sendFrontendMessage(ULONG para);
+ void sendFrontendMessage(u4 para);
void gotoSeek();
void waitTimed(int ms);
//get the current average bitrate by using PTS compared to streampos
- ULLONG getBytesPerSecond();
+ u8 getBytesPerSecond();
- ULONG mediaChannel;
- ULLONG lengthBytes;
- ULLONG lengthFrames;
- ULLONG appDestinationPTS; //if we are moving set the PTS to the destination
+ u4 mediaChannel;
+ u8 lengthBytes;
+ u8 lengthFrames;
+ u8 appDestinationPTS; //if we are moving set the PTS to the destination
//for display at the bar, take this if !=0
bool playingStarted; //did we ever start to play?
bool canPosition;
// ----------------------------------- Externally called events
-void PlayerRadioLive::go(ULONG index)
+void PlayerRadioLive::go(u4 index)
{
playerThreadMutex.lock();
playerThreadMutex.unlock();
}
-void PlayerRadioLive::setChannel(ULONG index)
+void PlayerRadioLive::setChannel(u4 index)
{
logger->debug(TAG, "setChannel");
struct PLInstruction i;
// -----------------------------------
-void PlayerRadioLive::streamReceive(ULONG flag, void* data, ULONG len)
+void PlayerRadioLive::streamReceive(u4 flag, void* data, u4 len)
{
// Flag:
// 0 = normal stream packet
if (chan->numAPids > 0)
{
- ULONG j = 0;
+ u4 j = 0;
while (j < chan->numAPids && !found)
{
if (Audio::getInstance()->streamTypeSupported(chan->apids[j].type))
{
if (chan->numDPids > 0 && audio->maysupportAc3())
{
- ULONG j = 0;
+ u4 j = 0;
while (j < chan->numDPids && !found)
{
if (Audio::getInstance()->streamTypeSupported(chan->dpids[j].type))
if (state == S_PREBUFFERING)
{
++preBufferCount;
- ULONG percentDone = (preBufferCount * 100) / preBufferAmount;
+ u4 percentDone = (preBufferCount * 100) / preBufferAmount;
logger->debug(TAG, "Prebuffering {}%", percentDone);
virtual int init();
virtual int shutdown();
- virtual void go(ULONG index);
- virtual void setChannel(ULONG index);
+ virtual void go(u4 index);
+ virtual void setChannel(u4 index);
virtual void stop();
virtual void setAudioChannel(int newChannel, int type,int streamtype);
virtual void setSubtitleChannel(int newChannel);
void call(void*); // for callback interface
- virtual void streamReceive(ULONG, void*, ULONG); // stream receiver interface
+ virtual void streamReceive(u4, void*, u4); // stream receiver interface
// Player events
if (initted) shutdown();
}
-bool PlayerRadioRec::init(ULLONG tlengthBytes, ULONG tlengthFrames, bool isPesRecording)
+bool PlayerRadioRec::init(u8 tlengthBytes, u4 tlengthFrames, bool isPesRecording)
{
if (initted) return false;
bool PlayerRadioRec::setLengthSeconds()
{
int success;
- ULLONG endPTS = 0;
+ u8 endPTS = 0;
UINT thisRead = 0;
UCHAR* buffer = vdr->getBlock(lengthBytes - 10000, 10000, &thisRead);
if (!buffer)
}
if (startPTS < endPTS)
- lengthSeconds = static_cast<ULONG>((endPTS - startPTS) / 90000);
+ lengthSeconds = static_cast<u4>((endPTS - startPTS) / 90000);
else
- lengthSeconds = static_cast<ULONG>((startPTS - endPTS) / 90000);
+ lengthSeconds = static_cast<u4>((startPTS - endPTS) / 90000);
return true;
}
playerThread.join();
}
-void PlayerRadioRec::setCurrentFrameNumber(ULONG num)
+void PlayerRadioRec::setCurrentFrameNumber(u4 num)
{
currentFrameNumber = num;
}
-ULONG PlayerRadioRec::getLengthSeconds()
+u4 PlayerRadioRec::getLengthSeconds()
{
return lengthSeconds;
}
-ULONG PlayerRadioRec::getCurrentSeconds()
+u4 PlayerRadioRec::getCurrentSeconds()
{
if (startup) return 0;
long long currentPTS = demuxer->getAudioPTS();
currentPTS -= startPTS;
if (currentPTS < 0) currentPTS += 8589934592ULL;
- ULONG ret = static_cast<ULONG>(currentPTS / 90000);
+ u4 ret = static_cast<u4>(currentPTS / 90000);
return ret;
}
{
stateLock.lock();
logger->debug(TAG, "JUMP TO {}%", percent);
- ULONG newFrame = static_cast<ULONG>(percent * lengthFrames / 100);
+ u4 newFrame = static_cast<u4>(percent * lengthFrames / 100);
switchState(S_JUMP, newFrame);
stateLock.unlock();
}
{
std::lock_guard<std::mutex> lg(stateLock);
logger->debug(TAG, "SKIP FORWARD {} SECONDS", seconds);
- ULONG currentSeconds = getCurrentSeconds();
- ULONG currentFrame = demuxer->getPacketNum();
+ u4 currentSeconds = getCurrentSeconds();
+ u4 currentFrame = demuxer->getPacketNum();
if (currentSeconds == 0) return; // div by zero
if (currentFrame == 0) return; // Current pos from demuxer is not valid
- ULONG newFrame = currentFrame + (currentFrame * seconds / currentSeconds);
+ u4 newFrame = currentFrame + (currentFrame * seconds / currentSeconds);
if (newFrame > lengthFrames) switchState(S_PLAY);
else switchState(S_JUMP, newFrame);
}
{
std::lock_guard<std::mutex> lg(stateLock);
logger->debug(TAG, "SKIP BACKWARD {} SECONDS", seconds);
- ULONG currentSeconds = getCurrentSeconds();
- ULONG currentFrame = demuxer->getPacketNum();
+ u4 currentSeconds = getCurrentSeconds();
+ u4 currentFrame = demuxer->getPacketNum();
if (currentSeconds == 0) return; // div by zero
if (currentFrame == 0) return; // Current pos from demuxer is not valid
- ULONG newFrame;
+ u4 newFrame;
if (seconds > currentSeconds)
newFrame = 0;
else
// ----------------------------------- Implementations called events
-void PlayerRadioRec::switchState(UCHAR toState, ULONG jumpToFrame)
+void PlayerRadioRec::switchState(UCHAR toState, u4 jumpToFrame)
{
if (!initted) return;
// ----------------------------------- Internal functions
-void PlayerRadioRec::restartAtFrame(ULONG newFrame)
+void PlayerRadioRec::restartAtFrame(u4 newFrame)
{
if (state != S_STOP)
{
{
if (state != S_PLAY) return;
- ULLONG feedPosition;
+ u8 feedPosition;
UINT thisRead, writeLength, thisWrite, askFor;
time_t lastRescan = time(NULL);
PlayerRadioRec(MessageQueue* messageQueue, MessageReceiver* messageReceiver);
virtual ~PlayerRadioRec();
- bool init(ULLONG lengthBytes, ULONG lengthFrames, bool IsPesRecording);
+ bool init(u8 lengthBytes, u4 lengthFrames, bool IsPesRecording);
int shutdown();
- void setCurrentFrameNumber(ULONG num);
+ void setCurrentFrameNumber(u4 num);
void play();
void stop();
void skipBackward(UINT seconds);
UCHAR getState() { return state; }
- ULONG getCurrentSeconds();
- ULONG getLengthSeconds();
+ u4 getCurrentSeconds();
+ u4 getLengthSeconds();
void call(void*); // for callback interface
const static UCHAR STREAM_END = 3;
private:
- void switchState(UCHAR newState, ULONG jumpToFrame=0);
+ void switchState(UCHAR newState, u4 jumpToFrame=0);
void threadMethod();
void doConnectionLost();
- void restartAtFrame(ULONG newFrame);
+ void restartAtFrame(u4 newFrame);
bool setLengthSeconds();
MessageQueue* messageQueue;
bool initted{};
bool startup;
- ULLONG startPTS{};
- ULONG lengthSeconds{};
+ u8 startPTS{};
+ u4 lengthSeconds{};
std::mutex stateLock;
bool threadReqQuit;
void threadStop();
- ULLONG lengthBytes{};
- ULONG lengthFrames{};
- ULONG currentFrameNumber{};
+ u8 lengthBytes{};
+ u4 lengthFrames{};
+ u4 currentFrameNumber{};
static const UINT blockSize{10000};
static const UINT startupBlockSize{20000};
UCHAR state{S_STOP};
// ----------------------------------- Externally called events
-void PlayerVideoLive::go(ULONG index)
+void PlayerVideoLive::go(u4 index)
{
playerThreadMutex.lock();
playerThreadMutex.unlock();
}
-void PlayerVideoLive::setChannel(ULONG index)
+void PlayerVideoLive::setChannel(u4 index)
{
logger->debug(TAG, "setChannel");
struct PLInstruction i;
// -----------------------------------
-void PlayerVideoLive::streamReceive(ULONG flag, void* data, ULONG len)
+void PlayerVideoLive::streamReceive(u4 flag, void* data, u4 len)
{
// Flag:
// 0 = normal stream packet
if (chan->numDPids > 0 && audio->maysupportAc3())
{
- ULONG j = 0;
+ u4 j = 0;
while (j < chan->numDPids)
{
int newpref = control->getLangPref(false, chan->dpids[j].desc);
if (chan->numAPids > 0)
{
- ULONG j = 0;
+ u4 j = 0;
while (j < chan->numAPids)
{
int newpref = control->getLangPref(false, chan->apids[j].desc);
prefered = -1;
if (chan->numSPids)
{
- ULONG j = 0;
+ u4 j = 0;
while (j < chan->numSPids)
{
int newpref = control->getLangPref(true, chan->spids[j].desc);
{
// logger->log("PlayerVideoLive", Log::DEBUG, "chunk mark3");
++preBufferCount;
- ULONG percentDone = (preBufferCount * 100) / preBufferAmount;
+ u4 percentDone = (preBufferCount * 100) / preBufferAmount;
logger->debug(TAG, "Prebuffering {}%", percentDone);
Message* m = new Message();
virtual int init();
virtual int shutdown();
- virtual void go(ULONG index);
- virtual void setChannel(ULONG index);
+ virtual void go(u4 index);
+ virtual void setChannel(u4 index);
virtual void stop();
virtual void setAudioChannel(int newChannel,int type,int streamtype);
virtual void setSubtitleChannel(int newChannel);
void call(void*); // for callback interface
- virtual void streamReceive(ULONG, void*, ULONG); // stream receiver interface
+ virtual void streamReceive(u4, void*, u4); // stream receiver interface
// Player events
playerThread.join();
}
-void PlayerVideoRec::setStartFrame(ULONG startFrame)
+void PlayerVideoRec::setStartFrame(u4 startFrame)
{
- ULONG nextiframeNumber;
- ULONG iframeLength;
- ULONG iframeNumber;
- ULLONG filePos;
+ u4 nextiframeNumber;
+ u4 iframeLength;
+ u4 iframeNumber;
+ u8 filePos;
// newFrame could be anywhere, go forwards to next I-Frame
if (!vdr->getNextIFrame(startFrame, 1, &filePos, &nextiframeNumber, &iframeLength)) return;
currentFrameNumber = iframeNumber;
}
-void PlayerVideoRec::setLengthBytes(ULLONG length)
+void PlayerVideoRec::setLengthBytes(u8 length)
{
lengthBytes = length;
logger->debug(TAG, "Player has received length bytes of {}", lengthBytes);
}
-void PlayerVideoRec::setLengthFrames(ULONG length)
+void PlayerVideoRec::setLengthFrames(u4 length)
{
lengthFrames = length;
logger->debug(TAG, "Player has received length frames of {}", lengthFrames);
}
-ULONG PlayerVideoRec::getLengthFrames()
+u4 PlayerVideoRec::getLengthFrames()
{
return lengthFrames;
}
-ULONG PlayerVideoRec::getCurrentFrameNum()
+u4 PlayerVideoRec::getCurrentFrameNum()
{
if (startup) return 0;
switch(state)
{
stateMutex.lock();
logger->debug(TAG, "JUMP TO {}%", percent);
- ULONG newFrame = static_cast<ULONG>(percent * lengthFrames / 100);
+ u4 newFrame = static_cast<u4>(percent * lengthFrames / 100);
switchState(S_JUMP, newFrame);
// stateMutex.unlock(); - let thread unlock this
}
{
stateMutex.lock();
logger->debug(TAG, "SKIP FORWARD {} SECONDS", seconds);
- ULONG newFrame = getCurrentFrameNum();
+ u4 newFrame = getCurrentFrameNum();
if (newFrame == 0) { stateMutex.unlock(); return; } // Current pos from demuxer is not valid
- newFrame += static_cast<ULONG>(static_cast<double>(seconds) * fps);
+ newFrame += static_cast<u4>(static_cast<double>(seconds) * fps);
if (newFrame > lengthFrames) { switchState(S_PLAY); stateMutex.unlock(); }
else switchState(S_JUMP, newFrame);
// stateMutex.unlock(); - let thread unlock this
logger->debug(TAG, "SKIP BACKWARD {} SECONDS", seconds);
long newFrame = getCurrentFrameNum();
if (newFrame == 0) { stateMutex.unlock(); return; } // Current pos from demuxer is not valid
- newFrame -= static_cast<ULONG>(static_cast<double>(seconds) * fps);
+ newFrame -= static_cast<u4>(static_cast<double>(seconds) * fps);
if (newFrame < 0) newFrame = 0;
switchState(S_JUMP, newFrame);
// stateMutex.unlock(); - let thread unlock this
// ----------------------------------- Implementations called events
-void PlayerVideoRec::switchState(UCHAR toState, ULONG jumpFrame)
+void PlayerVideoRec::switchState(UCHAR toState, u4 jumpFrame)
{
if (!initted) return;
case S_PLAY: // to S_PLAY
{
state = S_PLAY;
- ULONG stepback = static_cast<ULONG>(USER_RESPONSE_TIME * ifactor * fps / 1000);
+ u4 stepback = static_cast<u4>(USER_RESPONSE_TIME * ifactor * fps / 1000);
if (stepback < currentFrameNumber)
currentFrameNumber -= stepback;
else
// ----------------------------------- Internal functions
-void PlayerVideoRec::restartAtFrame(ULONG newFrame)
+void PlayerVideoRec::restartAtFrame(u4 newFrame)
{
vfeed.stop();
afeed.stop();
}
-void PlayerVideoRec::restartAtFramePI(ULONG newFrame)
+void PlayerVideoRec::restartAtFramePI(u4 newFrame)
{
- ULLONG filePos;
- ULONG nextiframeNumber;
- ULONG iframeLength;
- ULONG iframeNumber;
+ u8 filePos;
+ u4 nextiframeNumber;
+ u4 iframeLength;
+ u4 iframeNumber;
UCHAR* buffer;
UINT amountReceived;
void PlayerVideoRec::threadFeedPlay()
{
- ULLONG feedPosition;
+ u8 feedPosition;
UINT thisRead, writeLength, thisWrite, askFor;
time_t lastRescan = time(NULL);
{
// This method manipulates the PTS instead of waiting, this is for the android devices, maybe later for windows?
- ULONG direction = 0;
+ u4 direction = 0;
int dir_fac=-1;
- ULONG baseFrameNumber = 0;
- ULONG iframeNumber = 0;
- ULONG iframeLength = 0;
- ULONG currentfeedFrameNumber=currentFrameNumber;
- ULONG firstFrameNumber=currentFrameNumber;
- ULLONG filePos;
+ u4 baseFrameNumber = 0;
+ u4 iframeNumber = 0;
+ u4 iframeLength = 0;
+ u4 currentfeedFrameNumber=currentFrameNumber;
+ u4 firstFrameNumber=currentFrameNumber;
+ u8 filePos;
UINT amountReceived;
UINT videoLength;
baseFrameNumber = iframeNumber;
- frameTimeOffset = static_cast<int>((abs(static_cast<long>(iframeNumber - currentfeedFrameNumber)) * 1000) / (fps * ifactor));
+ frameTimeOffset = toi4((abs(static_cast<long>(iframeNumber - currentfeedFrameNumber)) * 1000) / (fps * ifactor));
logger->debug(TAG, "XXX Got frame");
if (threadReqQuit) return false;
count++;
if (count%300==0) {
- ULLONG cur_time=video->getCurrentTimestamp();
+ u8 cur_time=video->getCurrentTimestamp();
// 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) {
playtime +=frameTimeOffset;
currentfeedFrameNumber = iframeNumber;
{
- ULLONG cur_time=video->getCurrentTimestamp();
+ u8 cur_time=video->getCurrentTimestamp();
// 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) {
// spit it at the video chip, wait for a time. Most of the code here
// is to get the wait right so that the scan occurs at the correct rate.
- ULONG direction = 0;
- ULONG baseFrameNumber = 0;
- ULONG iframeNumber = 0;
- ULONG iframeLength = 0;
- ULLONG filePos;
+ u4 direction = 0;
+ u4 baseFrameNumber = 0;
+ u4 iframeNumber = 0;
+ u4 iframeLength = 0;
+ u8 filePos;
UINT amountReceived;
UINT videoLength;
// scan has got to the end of what we knew to be there before we started scanning
baseFrameNumber = iframeNumber;
- frameTimeOffset = static_cast<int>((abs(static_cast<long>(iframeNumber - currentFrameNumber)) * 1000) / (fps * ifactor));
+ frameTimeOffset = toi4((abs(static_cast<long>(iframeNumber - currentFrameNumber)) * 1000) / (fps * ifactor));
// logger->log("Player", Log::DEBUG, "Frame Time Offset: %i", frameTimeOffset);
int init(bool p_isPesRecording,double framespersec);
int shutdown();
- void setStartFrame(ULONG frameNum);
- void setLengthBytes(ULLONG length);
- void setLengthFrames(ULONG length);
+ void setStartFrame(u4 frameNum);
+ void setLengthBytes(u8 length);
+ void setLengthFrames(u4 length);
void setAudioChannel(int newChannel, int type, int streamtype);
void setSubtitleChannel(int newChannel);
bool toggleSubtitles();
void jumpToFrameP(int newFrame);
UCHAR getState() { return state; }
- ULONG getCurrentFrameNum();
- ULONG getLengthFrames();
+ u4 getCurrentFrameNum();
+ u4 getLengthFrames();
UCHAR getIScanRate() { return ifactor; }
bool* getDemuxerMpegAudioChannels();
bool* getDemuxerAc3AudioChannels();
#endif
private:
- void switchState(UCHAR newState, ULONG jumpFrame=0);
+ void switchState(UCHAR newState, u4 jumpFrame=0);
void threadMethod();
void threadFeedPlay();
bool threadPTSFeedScan();
void doConnectionLost();
- void restartAtFrame(ULONG newFrame);
- void restartAtFramePI(ULONG newFrame);
+ void restartAtFrame(u4 newFrame);
+ void restartAtFramePI(u4 newFrame);
VFeed vfeed;
AFeed afeed;
void threadStart();
void threadStop();
- ULLONG lengthBytes{};
- ULONG lengthFrames{};
- ULONG currentFrameNumber{};
+ u8 lengthBytes{};
+ u4 lengthFrames{};
+ u4 currentFrameNumber{};
UINT blockSize{100000};
UINT startupBlockSize{250000};
UCHAR state{S_STOP};
if (summary) delete[] summary;
- for (ULONG i = 0; i < numComponents; i++)
+ for (u4 i = 0; i < numComponents; i++)
{
LogNT::getInstance()->info(TAG, "i: {}, languages[i]={:p}:{}", i, static_cast<void*>(languages[i]), languages[i]);
LogNT::getInstance()->info(TAG, "i: {}, descripti[i]={:p}:{}", i, static_cast<void*>(descriptions[i]), descriptions[i]);
summaryWithDetails = NULL;
}
-void RecInfo::setNumComponents(ULONG tnumComponents)
+void RecInfo::setNumComponents(u4 tnumComponents)
{
numComponents = tnumComponents;
languages = new char*[numComponents];
types = new UCHAR[numComponents];
}
-void RecInfo::addComponent(ULONG componentNum, UCHAR tstream, UCHAR ttype, char* tlanguage, char* tdescription)
+void RecInfo::addComponent(u4 componentNum, UCHAR tstream, UCHAR ttype, char* tlanguage, char* tdescription)
{
if (componentNum >= numComponents) return;
streams[componentNum] = tstream;
logger->info(TAG, "Summary: {}", summary);
logger->info(TAG, "numComponents: {}", numComponents);
- for (ULONG i = 0; i < numComponents; i++)
+ for (u4 i = 0; i < numComponents; i++)
{
logger->info(TAG, "streams[{}]: {}", i, streams[i]);
logger->info(TAG, "types[{}]: {}", i, types[i]);
// video = 1, audio = 2
- for (ULONG i = 0; i < numComponents; i++)
+ for (u4 i = 0; i < numComponents; i++)
if (streams[i] == 1) return false;
return true;
return summaryWithDetails;
}
-hmsf RecInfo::framesToHMSF(ULONG frames)
+hmsf RecInfo::framesToHMSF(u4 frames)
{
hmsf ret;
/* from vdr */
time_t timerStart;
time_t timerEnd;
- ULONG resumePoint;
+ u4 resumePoint;
char* summary;
double fps;
- ULONG numComponents;
+ u4 numComponents;
UCHAR* streams;
UCHAR* types;
char** languages;
char *title;
char* channelName;
- ULONG duration;
- ULONG fileSize;
- ULONG priority;
- ULONG lifetime;
+ u4 duration;
+ u4 fileSize;
+ u4 priority;
+ u4 lifetime;
- void setNumComponents(ULONG);
- void addComponent(ULONG componentNum, UCHAR tstream, UCHAR ttype, char* tlanguage, char* tdescription);
+ void setNumComponents(u4);
+ void addComponent(u4 componentNum, UCHAR tstream, UCHAR ttype, char* tlanguage, char* tdescription);
// addComponent accepts a pointer to a buffer that RecInfo will free, not the caller
char* buildSummaryWithDetails(bool forceRefresh = false);
void print();
- hmsf framesToHMSF(ULONG frames);
+ hmsf framesToHMSF(u4 frames);
bool hasNoVideo();
private:
delete rootDir;
}
-void RecMan::setStats(ULONG ttotalSpace, ULONG tfreeSpace, ULONG tusedPercent)
+void RecMan::setStats(u4 ttotalSpace, u4 tfreeSpace, u4 tusedPercent)
{
totalSpace = ttotalSpace;
freeSpace = tfreeSpace;
usedPercent = tusedPercent;
}
-void RecMan::addEntry(bool isNew, ULONG startTime, char* name, char* fileName)
+void RecMan::addEntry(bool isNew, u4 startTime, char* name, char* fileName)
{
Recording* rec = new Recording();
rec->setNew(isNew);
targetDirectory->recList.push_back(rec);
}
-ULONG RecMan::getTotalSpace()
+u4 RecMan::getTotalSpace()
{
return totalSpace;
}
-ULONG RecMan::getFreeSpace()
+u4 RecMan::getFreeSpace()
{
return freeSpace;
}
-ULONG RecMan::getUsedPercent()
+u4 RecMan::getUsedPercent()
{
return usedPercent;
}
void setSortOrderChron();
void toggleSortOrder();
- void setStats(ULONG totalSpace, ULONG freeSpace, ULONG usedPercent);
- void addEntry(bool isNew, ULONG startTime, char* name, char* filename); // modifies name
+ void setStats(u4 totalSpace, u4 freeSpace, u4 usedPercent);
+ void addEntry(bool isNew, u4 startTime, char* name, char* filename); // modifies name
void sort();
int deleteRecording(Recording* rec);
int moveRecording(Recording* toMove, Directory* toDir);
DirectoryList* getDirectories();
RecordingList* getRecordings();
- ULONG getTotalSpace();
- ULONG getFreeSpace();
- ULONG getUsedPercent();
+ u4 getTotalSpace();
+ u4 getFreeSpace();
+ u4 getUsedPercent();
private:
- ULONG totalSpace{};
- ULONG freeSpace{};
- ULONG usedPercent{};
+ u4 totalSpace{};
+ u4 freeSpace{};
+ u4 usedPercent{};
Directory* rootDir;
Directory* currentDir;
if (markList) delete markList;
}
-ULONG Recording::getStartTime() const
+u4 Recording::getStartTime() const
{
return start;
}
isNew = param;
}
-void Recording::setStartTime(ULONG tstartTime)
+void Recording::setStartTime(u4 tstartTime)
{
start = tstartTime;
}
bool Recording::isRadio(bool &h264)
{
- ULONG lengthFrames = 0;
- ULLONG lengthBytes = vdr->streamRecording(getFileName(), &lengthFrames, &IsPesRecording);
+ u4 lengthFrames = 0;
+ u8 lengthBytes = vdr->streamRecording(getFileName(), &lengthFrames, &IsPesRecording);
if (!lengthBytes || !lengthFrames) return false;
UINT thisRead;
~Recording();
void setNew(bool isNew);
- void setStartTime(ULONG startTime);
+ void setStartTime(u4 startTime);
void setProgName(char* progName);
void setFileName(char* fileName);
- ULONG getStartTime() const;
+ u4 getStartTime() const;
char* getProgName() const;
char* getFileName() const;
VDR* vdr;
bool isNew{};
- ULONG start{};
+ u4 start{};
char* progName{};
char* fileName{};
const char* getDirectory() { return directory; }
const char* getName() { return name; }
- ULONG active;
- ULONG recording;
- ULONG pending;
- ULONG priority;
- ULONG lifeTime;
- ULONG channelNumber;
- ULONG startTime;
- ULONG stopTime;
- ULONG day;
- ULONG weekDays;
+ u4 active;
+ u4 recording;
+ u4 pending;
+ u4 priority;
+ u4 lifeTime;
+ u4 channelNumber;
+ u4 startTime;
+ u4 stopTime;
+ u4 day;
+ u4 weekDays;
// int index;
start=NULL;
}
}
-SerializeBuffer::SerializeBuffer(ULONG sz,bool isMalloc,bool ai){
+SerializeBuffer::SerializeBuffer(u4 sz,bool isMalloc,bool ai){
autoincrease=ai;
useMalloc=isMalloc;
if (isMalloc) {
owning=true;
}
//constructor for SerializeBuffers with external buffers
-SerializeBuffer::SerializeBuffer(UCHAR *buffer,ULONG sz,bool ow,bool isMalloc,bool ai) {
+SerializeBuffer::SerializeBuffer(UCHAR *buffer,u4 sz,bool ow,bool isMalloc,bool ai) {
useMalloc=isMalloc;
autoincrease=ai;
owning=ow;
* advance buffer pointer
*/
-int SerializeBuffer::encodeLong(ULONG data) {
- if (checkSpace( (int)sizeof(ULONG))!=0) return -1;
- *((ULONG *)(current))=htonl(data);
- current+=sizeof(ULONG);
+int SerializeBuffer::encodeLong(u4 data) {
+ if (checkSpace( (int)sizeof(u4))!=0) return -1;
+ *((u4 *)(current))=htonl(data);
+ current+=sizeof(u4);
return 0;
}
int SerializeBuffer::encodeShort(USHORT data) {
current+=sizeof(UCHAR);
return 0;
}
-int SerializeBuffer::encodeLongLong(ULLONG data) {
- if (checkSpace( (int)sizeof(ULLONG))!=0) return -1;
- *((ULONG *)(current))=htonl((data>>32) & 0xffffffff);
- current+=sizeof(ULONG);
- *((ULONG *)(current))=htonl(data & 0xffffffff);
- current+=sizeof(ULONG);
+int SerializeBuffer::encodeLongLong(u8 data) {
+ if (checkSpace( (int)sizeof(u8))!=0) return -1;
+ *((u4 *)(current))=htonl((data>>32) & 0xffffffff);
+ current+=sizeof(u4);
+ *((u4 *)(current))=htonl(data & 0xffffffff);
+ current+=sizeof(u4);
return 0;
}
//string: 4 len, string with 0
int SerializeBuffer::encodeString(const char *str) {
- if (checkSpace( (int)sizeof(ULONG))!=0) return -1;
- ULONG len=0;
+ if (checkSpace( (int)sizeof(u4))!=0) return -1;
+ u4 len=0;
if (str) len=strlen(str)+1;
- *((ULONG *)(current))=htonl(len);
- current+=sizeof(ULONG);
+ *((u4 *)(current))=htonl(len);
+ current+=sizeof(u4);
if (len == 0) return 0;
if (checkSpace((int)len)!=0) return -1;
strcpy((char *) current,str);
return 0;
}
int SerializeBuffer::decodeLong( int &data) {
- if (checkSpace( (int)sizeof(ULONG))!=0) return -1;
- data=(int)ntohl(*((ULONG *)(current)));
- current+=sizeof(ULONG);
+ if (checkSpace( (int)sizeof(u4))!=0) return -1;
+ data=(int)ntohl(*((u4 *)(current)));
+ current+=sizeof(u4);
return 0;
}
-int SerializeBuffer::decodeLong(ULONG &data) {
- if (checkSpace( (int)sizeof(ULONG))!=0) return -1;
- data=ntohl(*((ULONG *)(current)));
- current+=sizeof(ULONG);
+int SerializeBuffer::decodeLong(u4 &data) {
+ if (checkSpace( (int)sizeof(u4))!=0) return -1;
+ data=ntohl(*((u4 *)(current)));
+ current+=sizeof(u4);
return 0;
}
int SerializeBuffer::decodeShort(USHORT &data) {
current+=sizeof(UCHAR);
return 0;
}
-int SerializeBuffer::decodeLongLong(ULLONG &data) {
- if (checkSpace( (int)sizeof(ULLONG))!=0) return -1;
- ULLONG hd=ntohl(*((ULONG *)(current)));
- current+=sizeof(ULONG);
- ULLONG ld=ntohl(*((ULONG *)(current)));
- current+=sizeof(ULONG);
+int SerializeBuffer::decodeLongLong(u8 &data) {
+ if (checkSpace( (int)sizeof(u8))!=0) return -1;
+ u8 hd=ntohl(*((u4 *)(current)));
+ current+=sizeof(u4);
+ u8 ld=ntohl(*((u4 *)(current)));
+ current+=sizeof(u4);
data=(hd << 32) | ld;
return 0;
}
//string: 4 len, string with 0
-int SerializeBuffer::decodeString(ULONG &len, char *&strbuf) {
+int SerializeBuffer::decodeString(u4 &len, char *&strbuf) {
strbuf=NULL;
len=0;
- if (checkSpace( (int)sizeof(ULONG))!=0) return -1;
- len=ntohl(*((ULONG *)(current)));
- current+=sizeof(ULONG);
+ if (checkSpace( (int)sizeof(u4))!=0) return -1;
+ len=ntohl(*((u4 *)(current)));
+ current+=sizeof(u4);
if (len == 0) return 0;
if (checkSpace((int)len)!=0) return -1;
strbuf=new char[len];
int Serializable::deserialize(SerializeBuffer *b) {
USHORT vers=0;
if (b->decodeShort(vers) != 0) return -1;
- ULONG len=0;
+ u4 len=0;
if (b->decodeLong(len) != 0) return -1;
UCHAR *data=b->getCurrent();
if (data+len > b->getEnd()) return -1;
version=v;
return 0;
}
-int SerializableList::addParam(ULONG *p,USHORT v) {
+int SerializableList::addParam(u4 *p,USHORT v) {
if (v < version || p == NULL) return -1;
Pentry entry;
entry.ptype=TULONG;
version=v;
return 0;
}
-int SerializableList::addParam(ULLONG *p,USHORT v) {
+int SerializableList::addParam(u8 *p,USHORT v) {
if (v < version || p == NULL) return -1;
Pentry entry;
entry.ptype=TULLONG;
if (!e) return false;
return e->isDeserialized;
}
-bool SerializableList::isDeserialized(ULONG *p){
+bool SerializableList::isDeserialized(u4 *p){
SerializableList::Pentry *e=findEntry(p,TULONG);
if (!e) return false;
return e->isDeserialized;
}
-bool SerializableList::isDeserialized(ULLONG *p){
+bool SerializableList::isDeserialized(u8 *p){
SerializableList::Pentry *e=findEntry(p,TULLONG);
if (!e) return false;
return e->isDeserialized;
rt+=sizeof(USHORT);
break;
case TULONG:
- rt+=sizeof(ULONG);
+ rt+=sizeof(u4);
break;
case TULLONG:
- rt+=sizeof(ULLONG);
+ rt+=sizeof(u8);
break;
case TCHAR:
rt+=getSerializedStringLen(*((*it).ptr.pchar));
}
int SerializableList::deserializeImpl(SerializeBuffer *b){
- ULONG dlen=0;
+ u4 dlen=0;
for (vector<Pentry>::iterator it=list.begin();it<list.end();it++) {
if ((*it).version > version) {
//OK - we received an older version - stop here
class SerializeBuffer {
public:
//constructor for send buffers
- SerializeBuffer(ULONG size,bool isMalloc=false,bool autoincrease=false);
+ SerializeBuffer(u4 size,bool isMalloc=false,bool autoincrease=false);
//constructor for SerializeBuffers with external buffers
- SerializeBuffer(UCHAR *buffer,ULONG size,bool owning=false,bool isMalloc=true,bool autoincrease=false);
+ SerializeBuffer(UCHAR *buffer,u4 size,bool owning=false,bool isMalloc=true,bool autoincrease=false);
~SerializeBuffer();
//access to bufferpointer
UCHAR * getStart(){ return start;}
//encode/decode functions
//always return != 0 on error
- int encodeLong(ULONG data);
- int encodeLongLong(ULLONG data);
+ int encodeLong(u4 data);
+ int encodeLongLong(u8 data);
int encodeShort(USHORT data);
int encodeString(const char *data);
int encodeByte(UCHAR data);
- int decodeLong(ULONG & data);
+ int decodeLong(u4 & data);
int decodeLong(int & data);
- int decodeLongLong(ULLONG & data);
+ int decodeLongLong(u8 & data);
int decodeShort(USHORT & data);
- int decodeString(ULONG &len,char * &data);
+ int decodeString(u4 &len,char * &data);
int decodeByte(UCHAR &data);
private:
UCHAR* start;
UCHAR* end;
UCHAR* current;
- ULONG size;
+ u4 size;
bool useMalloc;
bool owning;
bool autoincrease;
* usage example:
* 1. version
* USHORT myP1=0;
- * ULONG myP2=0;
+ * u4 myP2=0;
* SerializableList myList();
* myList.addParam(&myP1);
* myList.addParam(&myP2);
* //now serialize/deserialize...
* //later - second version:
* USHORT myP1=0;
- * ULONG myP2=0;
+ * u4 myP2=0;
* char *myString=NULL;
* SerializableList myList();
* myList.addParam(&myP1);
*/
int addParam(Serializable *p,USHORT version=1);
int addParam(USHORT *p,USHORT version=1);
- int addParam(ULONG *p,USHORT version=1);
- int addParam(ULLONG *p,USHORT version=1);
+ int addParam(u4 *p,USHORT version=1);
+ int addParam(u8 *p,USHORT version=1);
int addParam(char **p,USHORT version=1);
/**
encodeOnly=true;
return addParam(const_cast<USHORT*>(p),vs);
}
- int addParam(const ULONG *p,USHORT vs=1){
+ int addParam(const u4 *p,USHORT vs=1){
encodeOnly=true;
- return addParam(const_cast<ULONG*>(p),vs);
+ return addParam(const_cast<u4*>(p),vs);
}
int addParam(const int *p,USHORT vs=1){
encodeOnly=true;
- return addParam(reinterpret_cast<ULONG*>(const_cast<int*>(p)), vs);
+ return addParam(reinterpret_cast<u4*>(const_cast<int*>(p)), vs);
}
- int addParam(const ULLONG *p,USHORT vs=1){
+ int addParam(const u8 *p,USHORT vs=1){
encodeOnly=true;
- return addParam(const_cast<ULLONG*>(p),vs);
+ return addParam(const_cast<u8*>(p),vs);
}
int addParam(const char **p,USHORT vs=1){
encodeOnly=true;
*/
bool isDeserialized(Serializable *p);
bool isDeserialized(USHORT *p);
- bool isDeserialized(ULONG *p);
- bool isDeserialized(ULLONG *p);
+ bool isDeserialized(u4 *p);
+ bool isDeserialized(u8 *p);
bool isDeserialized(char **p);
//return the highest version after adding params
union {
Serializable *pser;
USHORT *pshort;
- ULONG *plong;
- ULLONG *pllong;
+ u4 *plong;
+ u8 *pllong;
char **pchar;
} ptr;
Pentry() {
{
auto remainingTime = endTime - std::chrono::system_clock::now();
auto remainingTimeS = std::chrono::duration_cast<std::chrono::seconds>(remainingTime);
- sec = static_cast<int>(remainingTimeS.count()); // I think this chrono stuff is a bit too ... wordy .........
+ sec = toi4(remainingTimeS.count()); // I think this chrono stuff is a bit too ... wordy .........
SNPRINTF(liveText, 10, "0:%02d", sec / 60);
}
if ((inbuf[7] & 0x80) && len > 14 )
{
newPacket.synched = true;
- newPacket.pts = ( static_cast<ULLONG>(inbuf[9] & 0x0E) << 29 ) |
- ( static_cast<ULLONG>(inbuf[10]) << 22 ) |
- ( static_cast<ULLONG>(inbuf[11] & 0xFE) << 14 ) |
- ( static_cast<ULLONG>(inbuf[12]) << 7 ) |
- ( static_cast<ULLONG>(inbuf[13] & 0xFE) >> 1 );
+ newPacket.pts = ( static_cast<u8>(inbuf[9] & 0x0E) << 29 ) |
+ ( static_cast<u8>(inbuf[10]) << 22 ) |
+ ( static_cast<u8>(inbuf[11] & 0xFE) << 14 ) |
+ ( static_cast<u8>(inbuf[12]) << 7 ) |
+ ( static_cast<u8>(inbuf[13] & 0xFE) >> 1 );
if ((inbuf[7] & 0x40) && len > 19)
{
- newPacket.dts = ( static_cast<ULLONG>(inbuf[14] & 0x0E) << 29 ) |
- ( static_cast<ULLONG>(inbuf[15]) << 22 ) |
- ( static_cast<ULLONG>(inbuf[16] & 0xFE) << 14 ) |
- ( static_cast<ULLONG>(inbuf[17]) << 7 ) |
- ( static_cast<ULLONG>(inbuf[18] & 0xFE) >> 1 );
+ newPacket.dts = ( static_cast<u8>(inbuf[14] & 0x0E) << 29 ) |
+ ( static_cast<u8>(inbuf[15]) << 22 ) |
+ ( static_cast<u8>(inbuf[16] & 0xFE) << 14 ) |
+ ( static_cast<u8>(inbuf[17]) << 7 ) |
+ ( static_cast<u8>(inbuf[18] & 0xFE) >> 1 );
hasdts = true;
}
//ok we have the pts now convert it to a continously time code in 100ns units
- if (hasdts && draintarget->dtsTimefix()) newPacket.presentation_time = static_cast<ULLONG>(newPacket.dts * 10000LL / 90LL);
- else newPacket.presentation_time = static_cast<ULLONG>(newPacket.pts * 10000LL / 90LL);
+ if (hasdts && draintarget->dtsTimefix()) newPacket.presentation_time = static_cast<u8>(newPacket.dts * 10000LL / 90LL);
+ else newPacket.presentation_time = static_cast<u8>(newPacket.pts * 10000LL / 90LL);
- //newPacket.presentation_time-=draintarget->SetStartOffset(static_cast<ULLONG>(newPacket.pts*10000LL/90LL),&newPacket.disconti);
- newPacket.presentation_time -= draintarget->SetStartOffset(static_cast<ULLONG>(newPacket.pts * 10000LL / 90LL), &newPacket.disconti);
+ //newPacket.presentation_time-=draintarget->SetStartOffset(static_cast<u8>(newPacket.pts*10000LL/90LL),&newPacket.disconti);
+ newPacket.presentation_time -= draintarget->SetStartOffset(static_cast<u8>(newPacket.pts * 10000LL / 90LL), &newPacket.disconti);
}
}
float fposy = ttcharsizey / static_cast<float>(charsizey) * static_cast<float>(py);
float yweight = fposy - floor(fposy);
float yinvweight = 1.0f - yweight;
- interpol_upline[py] = std::min(static_cast<int>(ceil(fposy)), 9);
- interpol_lowline[py] = std::max(static_cast<int>(floor(fposy)), 0);
+ interpol_upline[py] = std::min(toi4(ceil(fposy)), 9);
+ interpol_lowline[py] = std::max(toi4(floor(fposy)), 0);
for (int px = 0; px < charsizex; px++)
{
float fposx = ttcharsizex / static_cast<float>(charsizex) * static_cast<float>(px);
float xweight = fposx - floor(fposx);
float xinvweight = 1.0f - xweight;
- interpol_upbit[px] = (std::min(static_cast<int>(ceil(fposx)), 11));
- interpol_lowbit[px] = (std::max(static_cast<int>(floor(fposx)), 0));
+ interpol_upbit[px] = (std::min(toi4(ceil(fposx)), 11));
+ interpol_lowbit[px] = (std::max(toi4(floor(fposx)), 0));
interpol_table_fac1[px][py] = static_cast<unsigned int>(xweight * yweight * 256);
interpol_table_fac2[px][py] = static_cast<unsigned int>(xinvweight * yweight * 256);
X = 0;
cx = 0;
- ULONG rgba = c.rgba();
+ u4 rgba = c.rgba();
startFastDraw();
for (i = 0; i < n; i++)
}*/
/*
-void SurfaceOpenGL::drawJpeg(char *buffer,ULONG buflength,DWORD x, DWORD y,DWORD *width, DWORD *height){
+void SurfaceOpenGL::drawJpeg(char *buffer,u4 buflength,DWORD x, DWORD y,DWORD *width, DWORD *height){
WaitForSingleObject(event,INFINITE); //since this might be called before surface
//allocation we will wait in this case, hopefully without deadlocks
if (!d3dsurface) {
void ReleaseSurface();
int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy);
void drawJpeg(const char *fileName,int x, int y,int *width, int *height);
-/* void drawJpeg(char *buffer,ULONG buflength,DWORD x, DWORD y,DWORD *width, DWORD *height);*/
+/* void drawJpeg(char *buffer,u4 buflength,DWORD x, DWORD y,DWORD *width, DWORD *height);*/
GLuint getTexture() {return gltexture;};
if (!d3dsurface) {
return 0; //why does this happen
}
- ULONG col=c.rgba();
+ u4 col=c.rgba();
LPDIRECT3DDEVICE9 d3ddev=osd->getD3dDev();
void ReleaseSurface();
int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy);
void drawJpeg(const char *fileName,int x, int y,int *width, int *height);
-/* void drawJpeg(char *buffer,ULONG buflength,DWORD x, DWORD y,DWORD *width, DWORD *height);*/
+/* void drawJpeg(char *buffer,u4 buflength,DWORD x, DWORD y,DWORD *width, DWORD *height);*/
LPDIRECT3DSURFACE9 getD3dsurface() {WaitForSingleObject(event,INFINITE);
return d3dsurface;};
LPDIRECT3DTEXTURE9 getD3dtexture() {return d3dtexture;};
if (sockfd == -1) { logger->crit(TAG, "socket error"); return false; }
#ifdef WIN32
- ULONG param = 1;
+ u4 param = 1;
ioctlsocket(sockfd, FIONBIO, ¶m);
#else
fcntl(sockfd, F_SETFL, O_NONBLOCK);
#endif
}
-bool TCP::write(void* src, ULONG numBytes)
+bool TCP::write(void* src, u4 numBytes)
{
if (!connected) return false;
std::lock_guard<std::mutex> lg(writeMutex);
int result = send(sockfd, reinterpret_cast<char*>(src), numBytes, 0); // FIXME does send return < numBytes? Might need loop
if (result < 0) return false;
- if (static_cast<ULONG>(result) != numBytes) return false;
+ if (static_cast<u4>(result) != numBytes) return false;
return true;
}
-bool TCP::read(void* dst, ULONG numBytes, int timeoutSec)
+bool TCP::read(void* dst, u4 numBytes, int timeoutSec)
{
if (!connected) return false;
fd_set readfds;
struct timeval tv;
- ULONG totalReceived = 0;
+ u4 totalReceived = 0;
int abortCount = 0;
char* pointer = static_cast<char*>(dst); // WIN32 requires char*
sockaddr_in sock_address;
int sockname_len = sizeof(sock_address);
getsockname(sockfd, (sockaddr*)&sock_address, &sockname_len);
- ULONG sockip = sock_address.sin_addr.s_addr;
+ u4 sockip = sock_address.sin_addr.s_addr;
if (GetAdaptersInfo(daptinfo, &size) == ERROR_SUCCESS)
{
PIP_ADAPTER_INFO daptinfo_it = daptinfo;
while (daptinfo_it != NULL)
{
- ULONG ipaddress = inet_addr(daptinfo_it->IpAddressList.IpAddress.String);
+ u4 ipaddress = inet_addr(daptinfo_it->IpAddressList.IpAddress.String);
if (ipaddress == sockip)
{ //Is it our MAC?
memcpy(¯esult, daptinfo_it->Address, 6);
bool connectSocket(const std::string& socketFile);
#endif
- bool read(void* dest, ULONG numBytes, int timeoutSec = 2); // Set timeoutSec to 0 for no timeout
+ bool read(void* dest, u4 numBytes, int timeoutSec = 2); // Set timeoutSec to 0 for no timeout
std::stringstream readString(bool* result, int timeoutSec = 2);
- bool write(void* src, ULONG numBytes);
+ bool write(void* src, u4 numBytes);
bool status();
MACAddress getMAC();
#pragma warning(disable : 4146)
#endif
-static ULLONG TxtPTSDifference(ULLONG pts1, ULLONG pts2)
+static u8 TxtPTSDifference(u8 pts1, u8 pts2)
{
// Assume pts1, pts2 < 2^33; calculate pts1 - pts2
if (pts1 > pts2)
// in this case the data fields should also be added in mediamvp
if (mediapacket.synched)
{ // An entry exists in the work list
- ULLONG nowPTS = Video::getInstance()->getCurrentTimestamp();
+ u8 nowPTS = Video::getInstance()->getCurrentTimestamp();
- ULLONG ptsdifference=TxtPTSDifference(mediapacket.pts, nowPTS);
+ u8 ptsdifference=TxtPTSDifference(mediapacket.pts, nowPTS);
if (ptsdifference >= (120LL*90000LL)) {
*samplepos=0;
}
#ifndef WIN32
-ULONG UDP4::getIPNumber(ULONG)
+u4 UDP4::getIPNumber(u4)
{
return INADDR_ANY;
}
#else
-ULONG UDP4::getIPNumber(ULONG num)
+u4 UDP4::getIPNumber(u4 num)
{
char buffer[100];
- ULONG returnaddress;
+ u4 returnaddress;
if (gethostname(buffer,sizeof(buffer))==SOCKET_ERROR)
{
for (num_ip=0;hosts->h_addr_list[num_ip]!=NULL;num_ip++);
int get_ip=(num%num_ip);//Just wrap around, if no interface are present any more
- memcpy(&returnaddress, hosts->h_addr_list[get_ip], sizeof(ULONG));
+ memcpy(&returnaddress, hosts->h_addr_list[get_ip], sizeof(u4));
return returnaddress;
}
#endif
private:
bool initted{};
- ULONG getIPNumber(ULONG num);
- ULONG iterate_ip{};
+ u4 getIPNumber(u4 num);
+ u4 iterate_ip{};
int socketnum; // Socket descriptor
USHORT myPort{}; // My port number
struct sockaddr_in myAddr; // My address
}
#ifndef WIN32
-ULONG UDP6::getIPNumber(ULONG)
+u4 UDP6::getIPNumber(u4)
{
return INADDR_ANY;
}
#else
-ULONG UDP6::getIPNumber(ULONG num)
+u4 UDP6::getIPNumber(u4 num)
{
char buffer[100];
- ULONG returnaddress;
+ u4 returnaddress;
if (gethostname(buffer,sizeof(buffer))==SOCKET_ERROR)
{
for (num_ip=0;hosts->h_addr_list[num_ip]!=NULL;num_ip++);
int get_ip=(num%num_ip);//Just wrap around, if no interface are present any more
- memcpy(&returnaddress, hosts->h_addr_list[get_ip], sizeof(ULONG));
+ memcpy(&returnaddress, hosts->h_addr_list[get_ip], sizeof(u4));
return returnaddress;
}
#endif
private:
bool initted{};
- ULONG getIPNumber(ULONG num);
- ULONG iterate_ip{};
+ u4 getIPNumber(u4 num);
+ u4 iterate_ip{};
int socketnum; // Socket descriptor
USHORT myPort{}; // My port number
struct sockaddr_in6 myAddr; // My address
#include "util.h"
-void MILLISLEEP(ULONG a)
+void MILLISLEEP(u4 a)
{
#ifndef WIN32
struct timespec delayTime;
std::chrono::milliseconds e = tms.time_since_epoch();
long long c = e.count();
time_t tt = static_cast<long>(c / 1000); // when are we going longlong for time_t ?
- int ttm = static_cast<int>(c % 1000);
+ int ttm = toi4(c % 1000);
auto stm = std::localtime(&tt);
std::stringstream ss;
ss << std::put_time(stm, "%T") << "." << std::setfill('0') << std::setw(3) << ttm;
}
/*
-ULLONG htonll(ULLONG a)
+u8 htonll(u8 a)
{
- return (((ULLONG)htonl((ULONG)((a<<32)>> 32))<<32)
- |(ULONG)htonl(((ULONG) (a >> 32))));
+ return (((u8)htonl((u4)((a<<32)>> 32))<<32)
+ |(u4)htonl(((u4) (a >> 32))));
}
-ULLONG ntohll(ULLONG a)
+u8 ntohll(u8 a)
{
return htonll(a);
}
-ULLONG htonll(ULLONG a)
+u8 htonll(u8 a)
{
#if BYTE_ORDER == BIG_ENDIAN
return a;
#else
- ULLONG b = 0;
+ u8 b = 0;
b = ((a << 56) & 0xFF00000000000000ULL)
| ((a << 40) & 0x00FF000000000000ULL)
#endif
}
-ULLONG ntohll(ULLONG a)
+u8 ntohll(u8 a)
{
return htonll(a);
}
#include "defines.h"
-void MILLISLEEP(ULONG a);
+void MILLISLEEP(u4 a);
std::string tp2str(const std::chrono::time_point<std::chrono::system_clock>& tp);
void dump(void* data, int length);
-//ULLONG htonll(ULLONG a);
-//ULLONG ntohll(ULLONG a);
+//u8 htonll(u8 a);
+//u8 ntohll(u8 a);
[[deprecated]]
int min(UINT a, int b);
int x = m->parameter - getScreenX();
int y = m->tag - getScreenY();
- if (x < 0 || y < 0 || x > static_cast<int>(getWidth()) || y > static_cast<int>(getHeight()))
+ if (x < 0 || y < 0 || x > toi4(getWidth()) || y > toi4(getHeight()))
{
Input::sendInputKey(Input::BACK);
}
static const char* TAG = "VChannelList";
-VChannelList::VChannelList(ULONG ttype)
+VChannelList::VChannelList(u4 ttype)
{
boxstack = BoxStack::getInstance();
setSize(570, 420);
class VChannelList : public TBBoxx, public MessageReceiver
{
public:
- VChannelList(ULONG type);
+ VChannelList(u4 type);
virtual ~VChannelList();
void setList(std::shared_ptr<ChannelList> chanList);
std::shared_ptr<ChannelList> chanList;
WSelectList sl;
- ULONG type;
+ u4 type;
void doShowingBar();
void quickUpdate();
for(i = numGot - 1; i >= 0; i--)
{
- m->parameter += input[i] * static_cast<ULONG>(pow(10., i));
+ m->parameter += input[i] * static_cast<u4>(pow(10., i));
}
MessageQueue::getInstance()->postMessage(m);
{
logger = LogNT::getInstance();
- AddServerCallback addFunc( [this] (int ipVersion, const char* ip, const char* name, USHORT port, ULONG version)
+ AddServerCallback addFunc( [this] (int ipVersion, const char* ip, const char* name, USHORT port, u4 version)
{
std::lock_guard<std::mutex> lg(serversLock);
waitCond.notify_one();
}
-ULONG VDPC::numServers() const
+u4 VDPC::numServers() const
{
return servers.size();
}
-const VDRServer& VDPC::operator[](ULONG index) const
+const VDRServer& VDPC::operator[](u4 index) const
{
if (index >= servers.size()) std::abort();
return servers[index];
USHORT newServerPort;
memcpy(&newServerPort, &vdpreply[26], 2);
- ULONG newServerVersion;
+ u4 newServerVersion;
memcpy(&newServerVersion, &vdpreply[28], 4);
// FIXME - packet length > 24 not checked, end NULL not checked!!
USHORT newServerPort;
memcpy(&newServerPort, &vdpreply[26], 2);
- ULONG newServerVersion;
+ u4 newServerVersion;
memcpy(&newServerVersion, &vdpreply[28], 4);
// FIXME - packet length > 24 not checked, end NULL not checked!!
std::string ip;
std::string name;
USHORT port;
- ULONG version;
+ u4 version;
VDRServer() {}
- VDRServer(int tipVersion, const std::string tip, const std::string tname, USHORT tport, ULONG tversion)
+ VDRServer(int tipVersion, const std::string tip, const std::string tname, USHORT tport, u4 tversion)
: ipVersion(tipVersion), ip(tip), name(tname), port(tport), version(tversion) {}
};
{
private:
LogNT* logger{};
- typedef std::function<void(int, const char*, const char*, USHORT, ULONG)> AddServerCallback;
+ typedef std::function<void(int, const char*, const char*, USHORT, u4)> AddServerCallback;
// Nested classes
#ifdef IPV4
bool init();
int go();
void stop();
- ULONG numServers() const;
- const VDRServer& operator[](ULONG index) const;
+ u4 numServers() const;
+ const VDRServer& operator[](u4 index) const;
private:
std::vector<VDRServer> servers;
delete rt;
return NULL;
}
- if (! rt->copyin(rq->getStart(),(ULONG)(rq->getCurrent()-rq->getStart()))) {
+ if (! rt->copyin(rq->getStart(),(u4)(rq->getCurrent()-rq->getStart()))) {
delete rq;
delete rt;
return NULL;
//delete the package
//return !=0 on error
static int decodeResponse(SerializeBuffer *rp,VDR_Command *c) {
- ULONG expected=c->command;
+ u4 expected=c->command;
if (c->deserialize(rp) != 0) {
delete rp;
Log::getInstance()->error(TAG, "decodeResponse unable to deserialize for command {}", expected);
{
logger->debug(TAG, "VDR RUN");
- ULONG channelID;
+ u4 channelID;
- ULONG requestID;
- ULONG userDataLength;
+ u4 requestID;
+ u4 userDataLength;
void* userData;
- ULONG streamID;
- ULONG flag;
+ u4 streamID;
+ u4 flag;
VDR_ResponsePacket* vresp;
- ULONG timeNow = 0;
- ULONG lastKAsent = 0;
- ULONG lastKArecv = time(NULL);
+ u4 timeNow = 0;
+ u4 lastKAsent = 0;
+ u4 lastKArecv = time(NULL);
bool readSuccess;
while(1)
{
- readSuccess = tcp.read(&channelID, sizeof(ULONG));
+ readSuccess = tcp.read(&channelID, sizeof(u4));
if (threadReqStop) return;
timeNow = time(NULL);
if (channelID == CHANNEL_REQUEST_RESPONSE)
{
- if (!tcp.read(&requestID, sizeof(ULONG))) break;
+ if (!tcp.read(&requestID, sizeof(u4))) break;
if (threadReqStop) return;
requestID = ntohl(requestID);
- if (!tcp.read(&userDataLength, sizeof(ULONG))) break;
+ if (!tcp.read(&userDataLength, sizeof(u4))) break;
if (threadReqStop) return;
userDataLength = ntohl(userDataLength);
if (userDataLength > 5000000) break; // how big can these packets get?
}
else if (channelID == CHANNEL_STREAM || channelID == CHANNEL_TVMEDIA)
{
- if (!tcp.read(&streamID, sizeof(ULONG))) break;
+ if (!tcp.read(&streamID, sizeof(u4))) break;
if (threadReqStop) return;
streamID = ntohl(streamID);
- if (!tcp.read(&flag, sizeof(ULONG))) break;
+ if (!tcp.read(&flag, sizeof(u4))) break;
if (threadReqStop) return;
flag = ntohl(flag);
- if (!tcp.read(&userDataLength, sizeof(ULONG))) break;
+ if (!tcp.read(&userDataLength, sizeof(u4))) break;
if (threadReqStop) return;
userDataLength = ntohl(userDataLength);
userData = NULL;
}
else if (channelID == CHANNEL_KEEPALIVE)
{
- ULONG KAreply = 0;
- if (!tcp.read(&KAreply, sizeof(ULONG))) break;
+ u4 KAreply = 0;
+ if (!tcp.read(&KAreply, sizeof(u4))) break;
if (threadReqStop) return;
KAreply = ntohl(KAreply);
if (KAreply == lastKAsent) // successful KA response
// Is vresp for vdrpr ?
- ULONG packetChannel = vresp->getChannelID();
+ u4 packetChannel = vresp->getChannelID();
//logger->debug(TAG, "Image debug {} {} {:#x}", vdrpr->receiverChannel,packetChannel,vdrpr);
if (vdrpr->receiverChannel != packetChannel) return false;
return vdrpr.save_vresp;
}
-bool VDR::sendKA(ULONG timeStamp)
+bool VDR::sendKA(u4 timeStamp)
{
char buffer[8];
int pos=0;
- ULONG ul=CHANNEL_KEEPALIVE;
+ u4 ul=CHANNEL_KEEPALIVE;
buffer[pos++]=(ul>>24)&0xff;
buffer[pos++]=(ul>>16)&0xff;
buffer[pos++]=(ul>>8)&0xff;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return false; }
- ULONG vdrTime = vresp->extractULONG();
+ u4 vdrTime = vresp->extractu4();
logger->debug(TAG, "vdrtime = {}", vdrTime);
long vdrTimeOffset = vresp->extractLONG();
logger->debug(TAG, "offset = {}", vdrTimeOffset);
- unsigned int version_min=vresp->extractULONG();
+ unsigned int version_min=vresp->extractu4();
*v_server_min=version_min;
- unsigned int version_max=vresp->extractULONG();
+ unsigned int version_max=vresp->extractu4();
*v_server_max=version_max;
*v_client=VOMP_PROTOCOL_VERSION;
if (0x00000302 <= version_max) {
- unsigned int numlangcodes = vresp->extractULONG();
- subtitles = vresp->extractULONG();
+ unsigned int numlangcodes = vresp->extractu4();
+ subtitles = vresp->extractu4();
list.clear();
for (unsigned int i=0; i<numlangcodes; i++) {
ASLPref newpref;
int packetLength = stringLength + 8;
char *buffer=new char[packetLength + 1];
int pos=0;
- ULONG ul=CHANNEL_NETLOG;
+ u4 ul=CHANNEL_NETLOG;
buffer[pos++]=(ul>>24)&0xff;
buffer[pos++]=(ul>>16)&0xff;
buffer[pos++]=(ul>>8)&0xff;
bool VDR::setCharset(int charset)
{
VDR_RequestPacket vrp;
- if (!vrp.init(VDR_SETCHARSET, true, sizeof(ULONG))) return false;
- if (!vrp.addULONG(charset)) return false;
+ if (!vrp.init(VDR_SETCHARSET, true, sizeof(u4))) return false;
+ if (!vrp.addu4(charset)) return false;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return false; }
- ULONG success = vresp->extractULONG();
+ u4 success = vresp->extractu4();
delete vresp;
if (!success) return false;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return false; }
- ULONG totalSpace = vresp->extractULONG();
- ULONG freeSpace = vresp->extractULONG();
- ULONG percent = vresp->extractULONG();
+ u4 totalSpace = vresp->extractu4();
+ u4 freeSpace = vresp->extractu4();
+ u4 percent = vresp->extractu4();
recman->setStats(totalSpace, freeSpace, percent);
- ULONG start;
+ u4 start;
UCHAR isNew;
char* name;
char* fileName;
while (!vresp->end())
{
- start = vresp->extractULONG();
+ start = vresp->extractu4();
isNew = vresp->extractUCHAR();
name = vresp->extractString();
fileName = vresp->extractString();
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
- int toReturn = static_cast<int>(vresp->extractULONG());
+ int toReturn = toi4(vresp->extractu4());
delete vresp;
return toReturn;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
- int toReturn = static_cast<int>(vresp->extractULONG());
+ int toReturn = toi4(vresp->extractu4());
delete vresp;
return toReturn;
if (vresp->noResponse()) { delete vresp; return NULL; }
char* toReturn = NULL;
- int success = static_cast<int>(vresp->extractULONG());
+ int success = toi4(vresp->extractu4());
if (success == 1)
{
toReturn = vresp->extractString();
return toReturn;
}
-std::shared_ptr<ChannelList> VDR::getChannelsList(ULONG type)
+std::shared_ptr<ChannelList> VDR::getChannelsList(u4 type)
{
VDR_RequestPacket vrp;
if (!vrp.init(VDR_GETCHANNELLIST, true, 0)) return NULL;
while (!vresp->end())
{
Channel* chan = new Channel();
- chan->number = vresp->extractULONG();
- chan->type = vresp->extractULONG();
+ chan->number = vresp->extractu4();
+ chan->type = vresp->extractu4();
chan->name = vresp->extractString();
- chan->vstreamtype = static_cast<UCHAR>(vresp->extractULONG());
+ chan->vstreamtype = static_cast<UCHAR>(vresp->extractu4());
if (chan->type == type && ((chan->vstreamtype==0x1b && h264support)|| (chan->vstreamtype!=0x1b &&mpeg2support)) )
{
return chanList;
}
-int VDR::streamChannel(ULONG number, StreamReceiver* tstreamReceiver)
+int VDR::streamChannel(u4 number, StreamReceiver* tstreamReceiver)
{
VDR_RequestPacket vrp;
- if (!vrp.init(VDR_STREAMCHANNEL, true, sizeof(ULONG))) return 0;
- if (!vrp.addULONG(number)) return 0;
+ if (!vrp.init(VDR_STREAMCHANNEL, true, sizeof(u4))) return 0;
+ if (!vrp.addu4(number)) return 0;
VDR_PacketReceiver* vdrpr = new VDR_PacketReceiver();
return 0;
}
- int toReturn = static_cast<int>(vresp->extractULONG());
+ int toReturn = toi4(vresp->extractu4());
logger->debug(TAG, "VDR said {} to start streaming request", toReturn);
delete vresp;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
- int toReturn = static_cast<int>(vresp->extractULONG());
+ int toReturn = toi4(vresp->extractu4());
delete vresp;
return toReturn;
}
-UCHAR* VDR::getBlock(ULLONG position, UINT maxAmount, UINT* amountReceived)
+UCHAR* VDR::getBlock(u8 position, UINT maxAmount, UINT* amountReceived)
{
VDR_RequestPacket vrp;
- if (!vrp.init(VDR_GETBLOCK, true, sizeof(ULLONG) + sizeof(ULONG))) return NULL;
- if (!vrp.addULLONG(position)) return NULL;
- if (!vrp.addULONG(maxAmount)) return NULL;
+ if (!vrp.init(VDR_GETBLOCK, true, sizeof(u8) + sizeof(u4))) return NULL;
+ if (!vrp.addu8(position)) return NULL;
+ if (!vrp.addu4(maxAmount)) return NULL;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return NULL; }
return toReturn;
}
-ULLONG VDR::streamRecording(char* fileName, ULONG* totalFrames, bool* IsPesRecording)
+u8 VDR::streamRecording(char* fileName, u4* totalFrames, bool* IsPesRecording)
{
VDR_RequestPacket vrp;
if (!vrp.init(VDR_STREAMRECORDING, true, strlen(fileName) + 1)) return 0;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
- ULLONG lengthBytes = vresp->extractULLONG();
- ULONG lengthFrames = vresp->extractULONG();
+ u8 lengthBytes = vresp->extractu8();
+ u4 lengthFrames = vresp->extractu4();
UCHAR isPesRecording = vresp->extractUCHAR();
delete vresp;
return lengthBytes;
}
-ULLONG VDR::positionFromFrameNumber(ULONG frameNumber)
+u8 VDR::positionFromFrameNumber(u4 frameNumber)
{
VDR_RequestPacket vrp;
- if (!vrp.init(VDR_POSFROMFRAME, true, sizeof(ULONG))) return 0;
- if (!vrp.addULONG(frameNumber)) return 0;
+ if (!vrp.init(VDR_POSFROMFRAME, true, sizeof(u4))) return 0;
+ if (!vrp.addu4(frameNumber)) return 0;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
- ULLONG position = vresp->extractULLONG();
+ u8 position = vresp->extractu8();
delete vresp;
logger->debug(TAG, "VDR said new position is: {}", position);
return position;
}
-ULONG VDR::frameNumberFromPosition(ULLONG position)
+u4 VDR::frameNumberFromPosition(u8 position)
{
VDR_RequestPacket vrp;
- if (!vrp.init(VDR_FRAMEFROMPOS, true, sizeof(ULLONG))) return 0;
- if (!vrp.addULLONG(position)) return 0;
+ if (!vrp.init(VDR_FRAMEFROMPOS, true, sizeof(u8))) return 0;
+ if (!vrp.addu8(position)) return 0;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
- ULONG framenumber = vresp->extractULONG();
+ u4 framenumber = vresp->extractu4();
delete vresp;
logger->debug(TAG, "VDR said new framenumber is: {}", framenumber);
return framenumber;
}
-bool VDR::getNextIFrame(ULONG frameNumber, ULONG direction, ULLONG* rfilePosition, ULONG* rframeNumber, ULONG* rframeLength)
+bool VDR::getNextIFrame(u4 frameNumber, u4 direction, u8* rfilePosition, u4* rframeNumber, u4* rframeLength)
{
VDR_RequestPacket vrp;
- if (!vrp.init(VDR_GETNEXTIFRAME, true, sizeof(ULONG)*2)) return false;
- if (!vrp.addULONG(frameNumber)) return false;
- if (!vrp.addULONG(direction)) return false;
+ if (!vrp.init(VDR_GETNEXTIFRAME, true, sizeof(u4)*2)) return false;
+ if (!vrp.addu4(frameNumber)) return false;
+ if (!vrp.addu4(direction)) return false;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return false; }
return false;
}
- *rfilePosition = vresp->extractULLONG();
- *rframeNumber = vresp->extractULONG();
- *rframeLength = vresp->extractULONG();
+ *rfilePosition = vresp->extractu8();
+ *rframeNumber = vresp->extractu4();
+ *rframeLength = vresp->extractu4();
delete vresp;
return true;
}
-EventList* VDR::getChannelSchedule(ULONG number)
+EventList* VDR::getChannelSchedule(u4 number)
{
time_t now;
time(&now);
return getChannelSchedule(number, now, 24 * 60 * 60);
}
-EventList* VDR::getChannelSchedule(ULONG number, time_t start, ULONG duration)
+EventList* VDR::getChannelSchedule(u4 number, time_t start, u4 duration)
{
// retrieve event list (vector of events) from vdr within filter window. duration is in seconds
VDR_RequestPacket vrp;
- if (!vrp.init(VDR_GETCHANNELSCHEDULE, true, sizeof(ULONG)*3)) return NULL;
- if (!vrp.addULONG(number)) return NULL;
- if (!vrp.addULONG(start)) return NULL;
- if (!vrp.addULONG(duration)) return NULL;
+ if (!vrp.init(VDR_GETCHANNELSCHEDULE, true, sizeof(u4)*3)) return NULL;
+ if (!vrp.addu4(number)) return NULL;
+ if (!vrp.addu4(start)) return NULL;
+ if (!vrp.addu4(duration)) return NULL;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return NULL; }
while (!vresp->end())
{
Event* event = new Event();
- event->id = vresp->extractULONG();
- event->time = vresp->extractULONG();
- event->duration = vresp->extractULONG();
+ event->id = vresp->extractu4();
+ event->time = vresp->extractu4();
+ event->duration = vresp->extractu4();
event->title = vresp->extractString();
event->subtitle = vresp->extractString();
event->description = vresp->extractString();
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
- int toReturn = static_cast<int>(vresp->extractULONG());
+ int toReturn = toi4(vresp->extractu4());
delete vresp;
return toReturn;
RecTimerList* recTimerList = new RecTimerList();
- ULONG numTimers = vresp->extractULONG();
+ u4 numTimers = vresp->extractu4();
if (numTimers > 0)
{
RecTimer* newRecTimer;
while (!vresp->end())
{
newRecTimer = new RecTimer();
- newRecTimer->active = vresp->extractULONG();
- newRecTimer->recording = vresp->extractULONG();
- newRecTimer->pending = vresp->extractULONG();
- newRecTimer->priority = vresp->extractULONG();
- newRecTimer->lifeTime = vresp->extractULONG();
- newRecTimer->channelNumber = vresp->extractULONG();
- newRecTimer->startTime = vresp->extractULONG();
- newRecTimer->stopTime = vresp->extractULONG();
- newRecTimer->day = vresp->extractULONG();
- newRecTimer->weekDays = vresp->extractULONG();
+ newRecTimer->active = vresp->extractu4();
+ newRecTimer->recording = vresp->extractu4();
+ newRecTimer->pending = vresp->extractu4();
+ newRecTimer->priority = vresp->extractu4();
+ newRecTimer->lifeTime = vresp->extractu4();
+ newRecTimer->channelNumber = vresp->extractu4();
+ newRecTimer->startTime = vresp->extractu4();
+ newRecTimer->stopTime = vresp->extractu4();
+ newRecTimer->day = vresp->extractu4();
+ newRecTimer->weekDays = vresp->extractu4();
tempString = vresp->extractString();
newRecTimer->setFile(tempString);
return recTimerList;
}
-ULONG VDR::setEventTimer(char* timerString)
+u4 VDR::setEventTimer(char* timerString)
{
VDR_RequestPacket vrp;
if (!vrp.init(VDR_SETTIMER, true, strlen(timerString) + 1)) return 0;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
- ULONG toReturn = vresp->extractULONG();
+ u4 toReturn = vresp->extractu4();
delete vresp;
return toReturn;
RecInfo* recInfo = new RecInfo();
- recInfo->timerStart = vresp->extractULONG();
- recInfo->timerEnd = vresp->extractULONG();
- recInfo->resumePoint = vresp->extractULONG();
+ recInfo->timerStart = vresp->extractu4();
+ recInfo->timerEnd = vresp->extractu4();
+ recInfo->resumePoint = vresp->extractu4();
recInfo->summary = vresp->extractString();
- ULONG numComponents = vresp->extractULONG();
+ u4 numComponents = vresp->extractu4();
if (numComponents)
{
recInfo->setNumComponents(numComponents);
- for (ULONG i = 0; i < numComponents; i++)
+ for (u4 i = 0; i < numComponents; i++)
{
recInfo->streams[i] = vresp->extractUCHAR();
recInfo->types[i] = vresp->extractUCHAR();
// New stuff
recInfo->channelName = vresp->extractString();
- recInfo->duration = vresp->extractULONG();
- recInfo->fileSize = vresp->extractULONG();
- recInfo->priority = vresp->extractULONG();
- recInfo->lifetime = vresp->extractULONG();
+ recInfo->duration = vresp->extractu4();
+ recInfo->fileSize = vresp->extractu4();
+ recInfo->priority = vresp->extractu4();
+ recInfo->lifetime = vresp->extractu4();
recInfo->print();
}
// FIXME obselete
-ULLONG VDR::rescanRecording(ULONG* totalFrames)
+u8 VDR::rescanRecording(u4* totalFrames)
{
VDR_RequestPacket vrp;
if (!vrp.init(VDR_RESCANRECORDING, true, 0)) return 0;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
- ULLONG lengthBytes = vresp->extractULLONG();
- ULONG lengthFrames = vresp->extractULONG();
+ u8 lengthBytes = vresp->extractu8();
+ u4 lengthFrames = vresp->extractu4();
delete vresp;
logger->debug(TAG, "VDR said length is: {} {}", lengthBytes, lengthFrames);
while (!vresp->end())
{
Mark* mark = new Mark();
- mark->pos = vresp->extractULONG();
+ mark->pos = vresp->extractu4();
markList->push_back(mark);
logger->debug(TAG, "Have added a mark to list. {}", mark->pos);
void VDR::getChannelPids(Channel* channel)
{
VDR_RequestPacket vrp;
- if (!vrp.init(VDR_GETCHANNELPIDS, true, sizeof(ULONG))) return ;
- if (!vrp.addULONG(channel->number)) return ;
+ if (!vrp.init(VDR_GETCHANNELPIDS, true, sizeof(u4))) return ;
+ if (!vrp.addu4(channel->number)) return ;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return ; }
// lang string
// }
- channel->vpid = vresp->extractULONG();
- channel->vstreamtype = static_cast<UCHAR>(vresp->extractULONG());
- channel->numAPids = vresp->extractULONG();
+ channel->vpid = vresp->extractu4();
+ channel->vstreamtype = static_cast<UCHAR>(vresp->extractu4());
+ channel->numAPids = vresp->extractu4();
- for (ULONG i = 0; i < channel->numAPids; i++)
+ for (u4 i = 0; i < channel->numAPids; i++)
{
apid newapid;
- newapid.pid = vresp->extractULONG();
+ newapid.pid = vresp->extractu4();
char * name=vresp->extractString();
strncpy(newapid.desc,name,9);
delete [] name;
channel->apids.push_back(newapid);
}
- channel->numDPids = vresp->extractULONG();
+ channel->numDPids = vresp->extractu4();
- for (ULONG i = 0; i < channel->numDPids; i++)
+ for (u4 i = 0; i < channel->numDPids; i++)
{
apid newdpid;
- newdpid.pid = vresp->extractULONG();
+ newdpid.pid = vresp->extractu4();
char * name=vresp->extractString();
strncpy(newdpid.desc,name,9);
delete [] name;
channel->dpids.push_back(newdpid);
}
- channel->numSPids = vresp->extractULONG();
+ channel->numSPids = vresp->extractu4();
- for (ULONG i = 0; i < channel->numSPids; i++)
+ for (u4 i = 0; i < channel->numSPids; i++)
{
apid newspid;
- newspid.pid = vresp->extractULONG();
+ newspid.pid = vresp->extractu4();
char * name=vresp->extractString();
strncpy(newspid.desc,name,9);
delete [] name;
channel->spids.push_back(newspid);
}
- channel->tpid = vresp->extractULONG();
+ channel->tpid = vresp->extractu4();
// extension
- for (ULONG i = 0; i < channel->numAPids; i++)
+ for (u4 i = 0; i < channel->numAPids; i++)
{
- channel->apids[i].type = vresp->extractULONG();
+ channel->apids[i].type = vresp->extractu4();
}
- for (ULONG i = 0; i < channel->numDPids; i++)
+ for (u4 i = 0; i < channel->numDPids; i++)
{
- channel->dpids[i].type = vresp->extractULONG();
+ channel->dpids[i].type = vresp->extractu4();
}
- for (ULONG i = 0; i < channel->numSPids; i++)
+ for (u4 i = 0; i < channel->numSPids; i++)
{
- channel->spids[i].type = vresp->extractULONG();
- channel->spids[i].data1 = vresp->extractULONG();
- channel->spids[i].data2 = vresp->extractULONG();
+ channel->spids[i].type = vresp->extractu4();
+ channel->spids[i].data1 = vresp->extractu4();
+ channel->spids[i].data2 = vresp->extractu4();
}
delete vresp;
}
MediaList *rt=new MediaList(NULL);
- ULONG rtflags=0;
+ u4 rtflags=0;
VDR_GetMediaListResponse resp(&rtflags,rt);
if (decodeResponse(vresp,&resp) != 0) {
return NULL;
* 4 flags
* 8 len of image
*/
-int VDR::openMedium(ULONG channel,const MediaURI *uri, ULLONG * size, ULONG x, ULONG y)
+int VDR::openMedium(u4 channel,const MediaURI *uri, u8 * size, u4 x, u4 y)
{
MediaURI remoteURI(uri);
VDR_OpenMediumRequest request(&channel,&remoteURI,&x,&y);
Control::getInstance()->connectionLost();
return -1;
}
- ULONG flags=0;
+ u4 flags=0;
VDR_OpenMediumResponse response(&flags,size);
if (decodeResponse(vresp,&response) != 0) {
return -1;
* resp
* packet
*/
-int VDR::getMediaBlock(ULONG channel, ULLONG position, ULONG maxAmount, ULONG* amountReceived, unsigned char **buffer)
+int VDR::getMediaBlock(u4 channel, u8 position, u4 maxAmount, u4* amountReceived, unsigned char **buffer)
{
*amountReceived=0;
VDR_GetMediaBlockRequest request(&channel,&position,&maxAmount);
}
// Special handling for getblock
- *amountReceived = (ULONG)(vresp->getEnd()-vresp->getStart());
+ *amountReceived = (u4)(vresp->getEnd()-vresp->getStart());
*buffer = vresp->steelBuffer();
delete vresp;
return 0;
* info
*/
-int VDR::getMediaInfo(ULONG channel, MediaInfo * result) {
+int VDR::getMediaInfo(u4 channel, MediaInfo * result) {
if (! result) return -1;
VDR_GetMediaInfoRequest request(&channel);
SerializeBuffer *vrp=prepareRequest(&request);
return -1;
}
- ULONG flags=0;
+ u4 flags=0;
VDR_GetMediaInfoResponse response(&flags,result);
if (decodeResponse(vresp,&response) != 0) {
return -1;
* flags
*/
-int VDR::closeMediaChannel(ULONG channel) {
+int VDR::closeMediaChannel(u4 channel) {
VDR_CloseMediaChannelRequest request(&channel);
SerializeBuffer *vrp=prepareRequest(&request);
if (!vrp) {
Control::getInstance()->connectionLost();
return -1;
}
- ULONG flags;
+ u4 flags;
VDR_CloseMediaChannelResponse response(&flags);
if (decodeResponse(vresp,&response) != 0) return -1;
return (flags != 0)?-1:0;
VDR_RequestPacket vrp;
if (!vrp.init(VDR_DELETETIMER, false, 0)) return 0;
- if (!vrp.addULONG(delTimer->channelNumber)) return 0;
- if (!vrp.addULONG(delTimer->weekDays)) return 0;
- if (!vrp.addULONG(delTimer->day)) return 0;
- if (!vrp.addULONG(delTimer->startTime)) return 0;
- if (!vrp.addULONG(delTimer->stopTime)) return 0;
+ if (!vrp.addu4(delTimer->channelNumber)) return 0;
+ if (!vrp.addu4(delTimer->weekDays)) return 0;
+ if (!vrp.addu4(delTimer->day)) return 0;
+ if (!vrp.addu4(delTimer->startTime)) return 0;
+ if (!vrp.addu4(delTimer->stopTime)) return 0;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
- int toReturn = static_cast<int>(vresp->extractULONG());
+ int toReturn = toi4(vresp->extractu4());
delete vresp;
return toReturn;
epgImage = 0;
VDR_RequestPacket vrp;
if (!vrp.init(VDR_GETEVENTSCRAPEREVENTTYPE, false, 0)) return;
- if (!vrp.addULONG(channelid)) return ;
- if (!vrp.addULONG(eventid)) return ;
+ if (!vrp.addu4(channelid)) return ;
+ if (!vrp.addu4(eventid)) return ;
logger->debug(TAG, "Before response");
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
logger->debug(TAG, "After response");
VDR_RequestPacket vrp;
if (!vrp.init(VDR_GETSCRAPERMOVIEINFO, false, 0)) return NULL;
- if (!vrp.addULONG(movieID)) return NULL;
+ if (!vrp.addu4(movieID)) return NULL;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return NULL; }
MovieInfo* movieinf = new MovieInfo;
movieinf->runtime = vresp->extractLONG();
movieinf->popularity = vresp->extractdouble();
movieinf->voteAverage = vresp->extractdouble();
- movieinf->poster.width = vresp->extractULONG();
- movieinf->poster.height = vresp->extractULONG();
+ movieinf->poster.width = vresp->extractu4();
+ movieinf->poster.height = vresp->extractu4();
imageGeneric1->setMovieInfo(movieinf);
imageGeneric1->setElement(0,0);
- movieinf->fanart.width = vresp->extractULONG();
- movieinf->fanart.height = vresp->extractULONG();
+ movieinf->fanart.width = vresp->extractu4();
+ movieinf->fanart.height = vresp->extractu4();
imageGeneric2->setMovieInfo(movieinf);
imageGeneric2->setElement(1,0);
- movieinf->collectionPoster.width = vresp->extractULONG();
- movieinf->collectionPoster.height = vresp->extractULONG();
+ movieinf->collectionPoster.width = vresp->extractu4();
+ movieinf->collectionPoster.height = vresp->extractu4();
imageGeneric3->setMovieInfo(movieinf);
imageGeneric3->setElement(2,0);
- movieinf->collectionFanart.width = vresp->extractULONG();
- movieinf->collectionFanart.height = vresp->extractULONG();
+ movieinf->collectionFanart.width = vresp->extractu4();
+ movieinf->collectionFanart.height = vresp->extractu4();
imageGeneric4->setMovieInfo(movieinf);
imageGeneric4->setElement(3,0);
- ULONG num_actors = vresp->extractULONG();
+ u4 num_actors = vresp->extractu4();
movieinf->actors.clear();
movieinf->actors.reserve(num_actors);
- for (ULONG acty=0; acty < num_actors; acty++)
+ for (u4 acty=0; acty < num_actors; acty++)
{
Actor new_act;
ImageGeneric newActImageGeneric = imageLoader->createGeneric();
new_act.name = vresp->extractStdString();
new_act.role = vresp->extractStdString();
- new_act.thumb.width = vresp->extractULONG();
- new_act.thumb.height = vresp->extractULONG();
+ new_act.thumb.width = vresp->extractu4();
+ new_act.thumb.height = vresp->extractu4();
newActImageGeneric->setMovieInfo(movieinf);
newActImageGeneric->setElement(4,acty);
movieinf->actors.push_back(new_act);
VDR_RequestPacket vrp;
if (!vrp.init(VDR_GETSCRAPERSERIESINFO, false, 0)) return NULL;
- if (!vrp.addULONG(seriesID)) return NULL;
- if (!vrp.addULONG(episodeID)) return NULL;
+ if (!vrp.addu4(seriesID)) return NULL;
+ if (!vrp.addu4(episodeID)) return NULL;
VDR_ResponsePacket* vresp = RequestResponse(&vrp);
if (vresp->noResponse()) { delete vresp; return 0; }
seriesinf->episode.guestStars = vresp->extractStdString();
seriesinf->episode.overview = vresp->extractStdString();
seriesinf->episode.rating = vresp->extractdouble();
- seriesinf->episode.image.width = vresp->extractULONG();
- seriesinf->episode.image.height = vresp->extractULONG();
+ seriesinf->episode.image.width = vresp->extractu4();
+ seriesinf->episode.image.height = vresp->extractu4();
imageGeneric1->setSeriesInfo(seriesinf);
imageGeneric1->setElement(0,0);
- ULONG num_actors = vresp->extractULONG();
+ u4 num_actors = vresp->extractu4();
seriesinf->actors.clear();
seriesinf->actors.reserve(num_actors);
- for (ULONG acty=0; acty < num_actors; acty++) {
+ for (u4 acty=0; acty < num_actors; acty++) {
Actor new_act;
new_act.name = vresp->extractStdString();
new_act.role = vresp->extractStdString();
- new_act.thumb.width = vresp->extractULONG();
- new_act.thumb.height = vresp->extractULONG();
+ new_act.thumb.width = vresp->extractu4();
+ new_act.thumb.height = vresp->extractu4();
ImageGeneric actorIG = imageLoader->createGeneric();
new_act.thumb.image = actorIG;
imageLoader->ensureLoaded(actorIG);
}
- ULONG num_posters = vresp->extractULONG();
- for (ULONG medias = 0; medias < num_posters; medias++ ) {
+ u4 num_posters = vresp->extractu4();
+ for (u4 medias = 0; medias < num_posters; medias++ ) {
TVMediaStruct media;
ImageGeneric mediaIG = imageLoader->createGeneric();
media.image = mediaIG;
mediaIG->setSeriesInfo(seriesinf);
mediaIG->setElement(2, medias);
- media.width = vresp->extractULONG();
- media.height = vresp->extractULONG();
+ media.width = vresp->extractu4();
+ media.height = vresp->extractu4();
seriesinf->posters.push_back(media);
imageLoader->ensureLoaded(mediaIG);
}
- ULONG num_banners = vresp->extractULONG();
- for (ULONG medias = 0; medias < num_banners; medias++ ) {
+ u4 num_banners = vresp->extractu4();
+ for (u4 medias = 0; medias < num_banners; medias++ ) {
TVMediaStruct media;
ImageGeneric mediaIG = imageLoader->createGeneric();
media.image = mediaIG;
mediaIG->setSeriesInfo(seriesinf);
mediaIG->setElement(3,medias);
- media.width = vresp->extractULONG();
- media.height = vresp->extractULONG();
+ media.width = vresp->extractu4();
+ media.height = vresp->extractu4();
seriesinf->banners.push_back(media);
imageLoader->ensureLoaded(mediaIG);
}
- ULONG num_fanarts = vresp->extractULONG();
- for (ULONG medias = 0; medias < num_fanarts; medias++ ) {
+ u4 num_fanarts = vresp->extractu4();
+ for (u4 medias = 0; medias < num_fanarts; medias++ ) {
TVMediaStruct media;
ImageGeneric mediaIG = imageLoader->createGeneric();
media.image = mediaIG;
mediaIG->setSeriesInfo(seriesinf);
mediaIG->setElement(4,medias);
- media.width = vresp->extractULONG();
- media.height = vresp->extractULONG();
+ media.width = vresp->extractu4();
+ media.height = vresp->extractu4();
seriesinf->fanart.push_back(media);
imageLoader->ensureLoaded(mediaIG);
}
- seriesinf->seasonposter.width = vresp->extractULONG();
- seriesinf->seasonposter.height = vresp->extractULONG();
+ seriesinf->seasonposter.width = vresp->extractu4();
+ seriesinf->seasonposter.height = vresp->extractu4();
imageGeneric2->setSeriesInfo(seriesinf);
imageGeneric2->setElement(5,0);
VDR_RequestPacket vrp;
if (!vrp.init(VDR_LOADTVMEDIA, false, 0)) return false;
- if (!vrp.addULONG(image->getType())) return false;
- if (!vrp.addULONG(image->primary_id)) return false;
- if (!vrp.addULONG(image->secondary_id)) return false;
- if (!vrp.addULONG(image->type_pict)) return false;
- if (!vrp.addULONG(image->container)) return false;
- if (!vrp.addULONG(image->container_member)) return false;
+ if (!vrp.addu4(image->getType())) return false;
+ if (!vrp.addu4(image->primary_id)) return false;
+ if (!vrp.addu4(image->secondary_id)) return false;
+ if (!vrp.addu4(image->type_pict)) return false;
+ if (!vrp.addu4(image->container)) return false;
+ if (!vrp.addu4(image->container_member)) return false;
logger->debug(TAG, "Image with ID {} {}; {} {} {} {};{}",
image->primary_id,image->secondary_id,image->type,image->type_pict,
image->container,image->container_member,vrp.getSerial());
VDR_RequestPacket vrp;
if (!vrp.init(VDR_LOADTVMEDIAEVENTTHUMB, false, 0)) return false;
- if (!vrp.addULONG(image->getChannel())) return false;
- if (!vrp.addULONG(image->getEvent())) return false;
+ if (!vrp.addu4(image->getChannel())) return false;
+ if (!vrp.addu4(image->getEvent())) return false;
image->setServerLoadingRef(vrp.getSerial());
VDR_PacketReceiver* vdrpr = new VDR_PacketReceiver();
VDR_RequestPacket vrp;
if (!vrp.init(VDR_LOADCHANNELLOGO, false, 0)) return false;
- if (!vrp.addULONG(image->getChannelID())) return false;
+ if (!vrp.addu4(image->getChannelID())) return false;
image->setServerLoadingRef(vrp.getSerial());
VDR_PacketReceiver* vdrpr = new VDR_PacketReceiver();
class StreamReceiver
{
public:
- virtual void streamReceive(ULONG, void*, ULONG)=0;
+ virtual void streamReceive(u4, void*, u4)=0;
};
class VDR_PacketReceiver : public EDReceiver // implementation in vdr.cc
friend class VDR;
protected:
-// ULONG requestTime;
- ULONG receiverChannel;
+// u4 requestTime;
+ u4 receiverChannel;
// If receiverChannel == 1:
- ULONG requestSerialNumber; // set by RequestResponse, used in ed_cb_find
+ u4 requestSerialNumber; // set by RequestResponse, used in ed_cb_find
VDR_ResponsePacket* save_vresp; // set by ed_cb_call, used in RequestResponse
// If receiverChannel == 2:
- ULONG streamID;
+ u4 streamID;
StreamReceiver* streamReceiver;
};
{
public:
- const static ULONG VIDEO = 1;
- const static ULONG RADIO = 2;
+ const static u4 VIDEO = 1;
+ const static u4 RADIO = 2;
- const static ULONG CHANNEL_REQUEST_RESPONSE = 1;
- const static ULONG CHANNEL_STREAM = 2;
- const static ULONG CHANNEL_KEEPALIVE = 3;
- const static ULONG CHANNEL_NETLOG = 4;
- const static ULONG CHANNEL_TVMEDIA = 5;
+ const static u4 CHANNEL_REQUEST_RESPONSE = 1;
+ const static u4 CHANNEL_STREAM = 2;
+ const static u4 CHANNEL_KEEPALIVE = 3;
+ const static u4 CHANNEL_NETLOG = 4;
+ const static u4 CHANNEL_TVMEDIA = 5;
VDR();
~VDR();
int deleteRecording(char* fileName);
int deleteRecResume(char* fileName);
char* moveRecording(char* fileName, char* newPath);
- ULLONG streamRecording(char* fileName, ULONG* lengthFrames, bool* IsPesRecording);
- ULLONG positionFromFrameNumber(ULONG frameNumber);
- ULONG frameNumberFromPosition(ULLONG position);
- bool getNextIFrame(ULONG frameNumber, ULONG direction, ULLONG* rfilePosition, ULONG* rframeNumber, ULONG* rframeLength);
+ u8 streamRecording(char* fileName, u4* lengthFrames, bool* IsPesRecording);
+ u8 positionFromFrameNumber(u4 frameNumber);
+ u4 frameNumberFromPosition(u8 position);
+ bool getNextIFrame(u4 frameNumber, u4 direction, u8* rfilePosition, u4* rframeNumber, u4* rframeLength);
// Direction: 0=backwards, 1=forwards
MarkList* getMarks(char* fileName);
int deleteTimer(RecTimer* delTimer);
- std::shared_ptr<ChannelList> getChannelsList(ULONG type);
- int streamChannel(ULONG number, StreamReceiver*);
- int streamChannel(ULONG number);
+ std::shared_ptr<ChannelList> getChannelsList(u4 type);
+ int streamChannel(u4 number, StreamReceiver*);
+ int streamChannel(u4 number);
void getChannelPids(Channel* channel);
- UCHAR* getBlock(ULLONG position, UINT maxAmount, UINT* amountReceived);
+ UCHAR* getBlock(u8 position, UINT maxAmount, UINT* amountReceived);
//get image blocks separate - we can do this in parallel
int stopStreaming();
- EventList* getChannelSchedule(ULONG number);
- EventList* getChannelSchedule(ULONG number, time_t start, ULONG duration);
+ EventList* getChannelSchedule(u4 number);
+ EventList* getChannelSchedule(u4 number, time_t start, u4 duration);
int configSave(const char* section, const char* key, const char* value);
char* configLoad(const char* section, const char* key);
- ULONG setEventTimer(char* timerString);
+ u4 setEventTimer(char* timerString);
RecTimerList* getRecTimersList();
bool LogExtern(const char* buffer);
*/
virtual MediaList* getRootList();
virtual MediaList* getMediaList(const MediaURI * parent);
- virtual int openMedium(ULONG channel,const MediaURI *uri,ULLONG * size, ULONG xsize,ULONG ysize);
- virtual int getMediaBlock(ULONG channel, unsigned long long offset, unsigned long len, unsigned long * outlen,
+ virtual int openMedium(u4 channel,const MediaURI *uri,u8 * size, u4 xsize,u4 ysize);
+ virtual int getMediaBlock(u4 channel, unsigned long long offset, unsigned long len, unsigned long * outlen,
unsigned char ** buffer);
- virtual int getMediaInfo(ULONG channel, struct MediaInfo * result);
- virtual int closeMediaChannel(ULONG channel);
+ virtual int getMediaInfo(u4 channel, struct MediaInfo * result);
+ virtual int closeMediaChannel(u4 channel);
#endif
//TV Scraper support
// obselete
- ULLONG rescanRecording(ULONG* lengthFrames); // FIXME obselete
+ u8 rescanRecording(u4* lengthFrames); // FIXME obselete
static VDR* instance;
VDR_ResponsePacket* RequestResponse(VDR_RequestPacket* request);
- UCHAR* getBlock(ULLONG position, UINT maxAmount, UINT* amountReceived, ULONG cmd);
+ UCHAR* getBlock(u8 position, UINT maxAmount, UINT* amountReceived, u4 cmd);
void connectionDied();
- bool sendKA(ULONG timeStamp);
+ bool sendKA(u4 timeStamp);
LogNT* logger;
int initted{};
TCP tcp;
char serverIP[40];
USHORT serverPort;
- ULONG maxChannelNumber{};
+ u4 maxChannelNumber{};
bool doVDRShutdown{};
int channelNumberWidth{1};
VDR_PacketReceiver* TEMP_SINGLE_VDR_PR;
bool threadReqStop{};
#ifdef VOMP_MEDIAPLAYER
- ULONG providerId;
- ULONG subRange;
+ u4 providerId;
+ u4 subRange;
SerializeBuffer * doRequestResponse(SerializeBuffer *in,int cmd);
#endif
protected:
//until we really have response - commands we simply take
//the request+this flag for responses
//not really necessary but for checks it's better to have a command ID at least in some responses
-const static ULONG VDR_RESPONSE_FLAG =0x1000000;
+const static u4 VDR_RESPONSE_FLAG =0x1000000;
//as this header is only included by vdr.cc the constants are this way private
//but can easily be used on the server side as well
-const static ULONG VDR_LOGIN = 1;
-const static ULONG VDR_GETRECORDINGLIST = 2;
-const static ULONG VDR_DELETERECORDING = 3;
-const static ULONG VDR_DELETERECRESUME = 4;
-const static ULONG VDR_GETCHANNELLIST = 5;
-const static ULONG VDR_STREAMCHANNEL = 6;
-const static ULONG VDR_GETBLOCK = 7;
-const static ULONG VDR_STOPSTREAMING = 8;
-const static ULONG VDR_STREAMRECORDING = 9;
-const static ULONG VDR_GETCHANNELSCHEDULE = 10;
-const static ULONG VDR_CONFIGSAVE = 11;
-const static ULONG VDR_CONFIGLOAD = 12;
-const static ULONG VDR_RESCANRECORDING = 13; // FIXME obselete
-const static ULONG VDR_GETTIMERS = 14;
-const static ULONG VDR_SETTIMER = 15;
-const static ULONG VDR_POSFROMFRAME = 16;
-const static ULONG VDR_FRAMEFROMPOS = 17;
-const static ULONG VDR_MOVERECORDING = 18;
-const static ULONG VDR_GETNEXTIFRAME = 19;
-// const static ULONG VDR_GETRECINFO = 20;
-const static ULONG VDR_GETRECINFO2 = 24;
-const static ULONG VDR_GETMARKS = 21;
-const static ULONG VDR_GETCHANNELPIDS = 22;
-const static ULONG VDR_DELETETIMER = 23;
-const static ULONG VDR_GETLANGUAGELIST = 33;
-const static ULONG VDR_GETLANGUAGECONTENT = 34;
-const static ULONG VDR_SETCHARSET = 37;
-const static ULONG VDR_GETMEDIALIST = 30;
-const static ULONG VDR_OPENMEDIA = 31;
-const static ULONG VDR_GETMEDIABLOCK = 32;
-const static ULONG VDR_GETMEDIAINFO = 35;
-const static ULONG VDR_CLOSECHANNEL = 36;
-const static ULONG VDR_GETRECSCRAPEREVENTTYPE = 38;
-const static ULONG VDR_GETSCRAPERMOVIEINFO = 39;
-const static ULONG VDR_GETSCRAPERSERIESINFO = 40;
-const static ULONG VDR_LOADTVMEDIA = 41;
-const static ULONG VDR_LOADTVMEDIARECTHUMB = 42;
-const static ULONG VDR_GETEVENTSCRAPEREVENTTYPE = 43;
-const static ULONG VDR_LOADTVMEDIAEVENTTHUMB = 44;
-const static ULONG VDR_LOADCHANNELLOGO = 45;
-const static ULONG VDR_SHUTDOWN = 666;
+const static u4 VDR_LOGIN = 1;
+const static u4 VDR_GETRECORDINGLIST = 2;
+const static u4 VDR_DELETERECORDING = 3;
+const static u4 VDR_DELETERECRESUME = 4;
+const static u4 VDR_GETCHANNELLIST = 5;
+const static u4 VDR_STREAMCHANNEL = 6;
+const static u4 VDR_GETBLOCK = 7;
+const static u4 VDR_STOPSTREAMING = 8;
+const static u4 VDR_STREAMRECORDING = 9;
+const static u4 VDR_GETCHANNELSCHEDULE = 10;
+const static u4 VDR_CONFIGSAVE = 11;
+const static u4 VDR_CONFIGLOAD = 12;
+const static u4 VDR_RESCANRECORDING = 13; // FIXME obselete
+const static u4 VDR_GETTIMERS = 14;
+const static u4 VDR_SETTIMER = 15;
+const static u4 VDR_POSFROMFRAME = 16;
+const static u4 VDR_FRAMEFROMPOS = 17;
+const static u4 VDR_MOVERECORDING = 18;
+const static u4 VDR_GETNEXTIFRAME = 19;
+// const static u4 VDR_GETRECINFO = 20;
+const static u4 VDR_GETRECINFO2 = 24;
+const static u4 VDR_GETMARKS = 21;
+const static u4 VDR_GETCHANNELPIDS = 22;
+const static u4 VDR_DELETETIMER = 23;
+const static u4 VDR_GETLANGUAGELIST = 33;
+const static u4 VDR_GETLANGUAGECONTENT = 34;
+const static u4 VDR_SETCHARSET = 37;
+const static u4 VDR_GETMEDIALIST = 30;
+const static u4 VDR_OPENMEDIA = 31;
+const static u4 VDR_GETMEDIABLOCK = 32;
+const static u4 VDR_GETMEDIAINFO = 35;
+const static u4 VDR_CLOSECHANNEL = 36;
+const static u4 VDR_GETRECSCRAPEREVENTTYPE = 38;
+const static u4 VDR_GETSCRAPERMOVIEINFO = 39;
+const static u4 VDR_GETSCRAPERSERIESINFO = 40;
+const static u4 VDR_LOADTVMEDIA = 41;
+const static u4 VDR_LOADTVMEDIARECTHUMB = 42;
+const static u4 VDR_GETEVENTSCRAPEREVENTTYPE = 43;
+const static u4 VDR_LOADTVMEDIAEVENTTHUMB = 44;
+const static u4 VDR_LOADCHANNELLOGO = 45;
+const static u4 VDR_SHUTDOWN = 666;
#ifdef VOMP_MEDIAPLAYER
class VDR_Command : public SerializableList {
public:
- VDR_Command(const ULONG cmd) {
+ VDR_Command(const u4 cmd) {
command=cmd;
addParam(&command);
}
virtual ~VDR_Command(){}
- ULONG command;
+ u4 command;
};
class VDR_GetMediaListRequest : public VDR_Command {
class VDR_GetMediaListResponse : public VDR_Command {
public:
- VDR_GetMediaListResponse(ULONG *flags,MediaList *m) : VDR_Command(VDR_GETMEDIALIST|VDR_RESPONSE_FLAG){
+ VDR_GetMediaListResponse(u4 *flags,MediaList *m) : VDR_Command(VDR_GETMEDIALIST|VDR_RESPONSE_FLAG){
addParam(flags);
addParam(m);
}
class VDR_OpenMediumRequest : public VDR_Command {
public:
- VDR_OpenMediumRequest(ULONG *channel,MediaURI *u,ULONG *xsize, ULONG *ysize) :
+ VDR_OpenMediumRequest(u4 *channel,MediaURI *u,u4 *xsize, u4 *ysize) :
VDR_Command(VDR_OPENMEDIA) {
addParam(channel);
addParam(u);
};
class VDR_OpenMediumResponse : public VDR_Command {
public:
- VDR_OpenMediumResponse(ULONG *flags,ULLONG *size) :
+ VDR_OpenMediumResponse(u4 *flags,u8 *size) :
VDR_Command(VDR_OPENMEDIA|VDR_RESPONSE_FLAG) {
addParam(flags);
addParam(size);
};
class VDR_GetMediaBlockRequest : public VDR_Command {
public:
- VDR_GetMediaBlockRequest(ULONG * channel, ULLONG *pos, ULONG *max):
+ VDR_GetMediaBlockRequest(u4 * channel, u8 *pos, u4 *max):
VDR_Command(VDR_GETMEDIABLOCK) {
addParam(channel);
addParam(pos);
class VDR_CloseMediaChannelRequest : public VDR_Command {
public:
- VDR_CloseMediaChannelRequest(ULONG * channel):
+ VDR_CloseMediaChannelRequest(u4 * channel):
VDR_Command(VDR_CLOSECHANNEL) {
addParam(channel);
}
class VDR_CloseMediaChannelResponse : public VDR_Command {
public:
- VDR_CloseMediaChannelResponse(ULONG * flags):
+ VDR_CloseMediaChannelResponse(u4 * flags):
VDR_Command(VDR_CLOSECHANNEL|VDR_RESPONSE_FLAG) {
addParam(flags);
}
class VDR_GetMediaInfoRequest : public VDR_Command {
public:
- VDR_GetMediaInfoRequest(ULONG * channel):
+ VDR_GetMediaInfoRequest(u4 * channel):
VDR_Command(VDR_GETMEDIAINFO) {
addParam(channel);
}
};
class VDR_GetMediaInfoResponse : public VDR_Command {
public:
- VDR_GetMediaInfoResponse(ULONG * flags,MediaInfo *info):
+ VDR_GetMediaInfoResponse(u4 * flags,MediaInfo *info):
VDR_Command(VDR_GETMEDIAINFO|VDR_RESPONSE_FLAG) {
addParam(flags);
addParam(info);
#include "vdr.h"
-ULONG VDR_RequestPacket::serialNumberCounter = 1;
+u4 VDR_RequestPacket::serialNumberCounter = 1;
VDR_RequestPacket::VDR_RequestPacket()
{
free(buffer);
}
-bool VDR_RequestPacket::init(ULONG topcode, bool setUserDataLength, ULONG userDataLength)
+bool VDR_RequestPacket::init(u4 topcode, bool setUserDataLength, u4 userDataLength)
{
if (buffer) return false;
buffer[pos++]=(userDataLength>>8)&0xff;
buffer[pos++]=userDataLength &0xff;
- /**(ULONG*)&buffer[4] = htonl(serialNumber);
- *(ULONG*)&buffer[8] = htonl(opcode);
- *(ULONG*)&buffer[userDataLenPos] = htonl(userDataLength);*/
+ /**(u4*)&buffer[4] = htonl(serialNumber);
+ *(u4*)&buffer[8] = htonl(opcode);
+ *(u4*)&buffer[userDataLenPos] = htonl(userDataLength);*/
bufUsed = headerLength;
return true;
}
-bool VDR_RequestPacket::copyin(const UCHAR* src, ULONG len)
+bool VDR_RequestPacket::copyin(const UCHAR* src, u4 len)
{
if (!checkExtend(len)) return false;
memcpy(buffer + bufUsed, src, len);
bufUsed += len;
if (!lengthSet) {
int pos=userDataLenPos;
- ULONG tocopy=bufUsed - headerLength;
+ u4 tocopy=bufUsed - headerLength;
buffer[pos++]=(tocopy>>24)&0xff;
buffer[pos++]=(tocopy>>16)&0xff;
buffer[pos++]=(tocopy>>8)&0xff;
bool VDR_RequestPacket::addString(const char* string)
{
- ULONG len = strlen(string) + 1;
+ u4 len = strlen(string) + 1;
if (!checkExtend(len)) return false;
memcpy(buffer + bufUsed, string, len);
bufUsed += len;
if (!lengthSet) {
int pos=userDataLenPos;
- ULONG tocopy=bufUsed - headerLength;
+ u4 tocopy=bufUsed - headerLength;
buffer[pos++]=(tocopy>>24)&0xff;
buffer[pos++]=(tocopy>>16)&0xff;
buffer[pos++]=(tocopy>>8)&0xff;
return true;
}
-bool VDR_RequestPacket::addULONG(ULONG ul)
+bool VDR_RequestPacket::addu4(u4 ul)
{
- if (!checkExtend(sizeof(ULONG))) return false;
-// *(ULONG*)&buffer[bufUsed] = htonl(ul);
+ if (!checkExtend(sizeof(u4))) return false;
+// *(u4*)&buffer[bufUsed] = htonl(ul);
buffer[bufUsed++]=(ul>>24)&0xff;
buffer[bufUsed++]=(ul>>16)&0xff;
if (!lengthSet) {
int pos=userDataLenPos;
- ULONG tocopy=bufUsed - headerLength;
+ u4 tocopy=bufUsed - headerLength;
buffer[pos++]=(tocopy>>24)&0xff;
buffer[pos++]=(tocopy>>16)&0xff;
buffer[pos++]=(tocopy>>8)&0xff;
return true;
}
-bool VDR_RequestPacket::addULLONG(ULLONG ull)
+bool VDR_RequestPacket::addu8(u8 ull)
{
- if (!checkExtend(sizeof(ULLONG))) return false;
+ if (!checkExtend(sizeof(u8))) return false;
buffer[bufUsed++]=(ull>>56)&0xff;
buffer[bufUsed++]=(ull>>48)&0xff;
buffer[bufUsed++]=(ull>>40)&0xff;
if (!lengthSet) {
int pos=userDataLenPos;
- ULONG tocopy=bufUsed - headerLength;
+ u4 tocopy=bufUsed - headerLength;
buffer[pos++]=(tocopy>>24)&0xff;
buffer[pos++]=(tocopy>>16)&0xff;
buffer[pos++]=(tocopy>>8)&0xff;
return true;
}
-bool VDR_RequestPacket::checkExtend(ULONG by)
+bool VDR_RequestPacket::checkExtend(u4 by)
{
if (lengthSet) return true;
if ((bufUsed + by) < bufSize) return true;
VDR_RequestPacket();
~VDR_RequestPacket();
- bool init(ULONG opcode, bool setUserDataLength, ULONG userDataLength);
- bool copyin(const UCHAR* src, ULONG len);
+ bool init(u4 opcode, bool setUserDataLength, u4 userDataLength);
+ bool copyin(const UCHAR* src, u4 len);
bool addString(const char* string);
- bool addULONG(ULONG ul);
- bool addULLONG(ULLONG ull);
+ bool addu4(u4 ul);
+ bool addu8(u8 ull);
UCHAR* getPtr() { return buffer; }
- ULONG getLen() { return bufUsed; }
- ULONG getChannel() { return channel; }
- ULONG getSerial() { return serialNumber; }
+ u4 getLen() { return bufUsed; }
+ u4 getChannel() { return channel; }
+ u4 getSerial() { return serialNumber; }
- ULONG getOpcode() { return opcode; }
+ u4 getOpcode() { return opcode; }
private:
- static ULONG serialNumberCounter;
+ static u4 serialNumberCounter;
UCHAR* buffer;
- ULONG bufSize;
- ULONG bufUsed;
+ u4 bufSize;
+ u4 bufUsed;
bool lengthSet;
- ULONG channel;
- ULONG serialNumber;
+ u4 channel;
+ u4 serialNumber;
- ULONG opcode;
+ u4 opcode;
- bool checkExtend(ULONG by);
+ bool checkExtend(u4 by);
- const static ULONG headerLength = 16;
- const static ULONG userDataLenPos = 12;
+ const static u4 headerLength = 16;
+ const static u4 userDataLenPos = 12;
};
#endif
if (userData) free(userData);
}
-void VDR_ResponsePacket::setResponse(ULONG trequestID, UCHAR* tuserData, ULONG tuserDataLength)
+void VDR_ResponsePacket::setResponse(u4 trequestID, UCHAR* tuserData, u4 tuserDataLength)
{
channelID = VDR::CHANNEL_REQUEST_RESPONSE;
requestID = trequestID;
userDataLength = tuserDataLength;
}
-void VDR_ResponsePacket::setStream(ULONG tstreamID, ULONG tflag, UCHAR* tuserData, ULONG tuserDataLength, ULONG tchannelID)
+void VDR_ResponsePacket::setStream(u4 tstreamID, u4 tflag, UCHAR* tuserData, u4 tuserDataLength, u4 tchannelID)
{
channelID = tchannelID;
streamID = tstreamID;
int VDR_ResponsePacket::serverError()
{
- if ((packetPos == 0) && (userDataLength == 4) && !ntohl(*(ULONG*)userData)) return 1;
+ if ((packetPos == 0) && (userDataLength == 4) && !ntohl(*(u4*)userData)) return 1;
else return 0;
}
return uc;
}
-ULONG VDR_ResponsePacket::extractULONG()
+u4 VDR_ResponsePacket::extractu4()
{
- if ((packetPos + sizeof(ULONG)) > userDataLength) return 0;
- ULONG ul = userData[packetPos++]<<24;
+ if ((packetPos + sizeof(u4)) > userDataLength) return 0;
+ u4 ul = userData[packetPos++]<<24;
ul|= userData[packetPos++]<<16;
ul|= userData[packetPos++]<<8;
ul|= userData[packetPos++];
- //packetPos += sizeof(ULONG);
+ //packetPos += sizeof(u4);
return ul;
}
-ULLONG VDR_ResponsePacket::extractULLONG()
+u8 VDR_ResponsePacket::extractu8()
{
- if ((packetPos + sizeof(ULLONG)) > userDataLength) return 0;
- ULLONG ull= ((ULLONG)userData[packetPos++])<<56;
- ull|= ((ULLONG)userData[packetPos++])<<48;
- ull|= ((ULLONG)userData[packetPos++])<<40;
- ull|= ((ULLONG)userData[packetPos++])<<32;
- ull|= ((ULLONG)userData[packetPos++])<<24;
- ull|= ((ULLONG)userData[packetPos++])<<16;
- ull|= ((ULLONG)userData[packetPos++])<<8;
- ull|= ((ULLONG)userData[packetPos++]);
+ if ((packetPos + sizeof(u8)) > userDataLength) return 0;
+ u8 ull= ((u8)userData[packetPos++])<<56;
+ ull|= ((u8)userData[packetPos++])<<48;
+ ull|= ((u8)userData[packetPos++])<<40;
+ ull|= ((u8)userData[packetPos++])<<32;
+ ull|= ((u8)userData[packetPos++])<<24;
+ ull|= ((u8)userData[packetPos++])<<16;
+ ull|= ((u8)userData[packetPos++])<<8;
+ ull|= ((u8)userData[packetPos++]);
return ull;
}
double VDR_ResponsePacket::extractdouble()
{
- if ((packetPos + sizeof(ULLONG)) > userDataLength) return 0;
- ULLONG ull = extractULLONG();
+ if ((packetPos + sizeof(u8)) > userDataLength) return 0;
+ u8 ull = extractu8();
double d;
memcpy(&d,&ull,sizeof(double));
return d;
VDR_ResponsePacket();
~VDR_ResponsePacket();
- void setResponse(ULONG requestID, UCHAR* packet, ULONG packetLength);
- void setStream(ULONG streamID, ULONG flag, UCHAR* packet, ULONG packetLength, ULONG tchannelID);
+ void setResponse(u4 requestID, UCHAR* packet, u4 packetLength);
+ void setStream(u4 streamID, u4 flag, UCHAR* packet, u4 packetLength, u4 tchannelID);
bool noResponse() { return (userData == NULL); };
int serverError();
- ULONG getUserDataLength() { return userDataLength; }
- ULONG getChannelID() { return channelID; }
- ULONG getRequestID() { return requestID; }
- ULONG getStreamID() { return streamID; }
- ULONG getFlag() { return flag; }
+ u4 getUserDataLength() { return userDataLength; }
+ u4 getChannelID() { return channelID; }
+ u4 getRequestID() { return requestID; }
+ u4 getStreamID() { return streamID; }
+ u4 getFlag() { return flag; }
char* extractString();
std::string extractStdString();
UCHAR extractUCHAR();
- ULONG extractULONG();
- ULLONG extractULLONG();
+ u4 extractu4();
+ u8 extractu8();
long extractLONG();
double extractdouble();
private:
UCHAR* userData;
- ULONG userDataLength;
- ULONG packetPos;
+ u4 userDataLength;
+ u4 packetPos;
- ULONG channelID;
+ u4 channelID;
- ULONG requestID;
- ULONG streamID;
+ u4 requestID;
+ u4 streamID;
- ULONG flag; // stream only
+ u4 flag; // stream only
bool ownBlock;
};
static const char* TAG = "VEpgListAdvanced";
-VEpgListAdvanced::VEpgListAdvanced(MessageReceiver* tvideolive, std::shared_ptr<ChannelList> tchanList, ULONG initialChannelNumber)
+VEpgListAdvanced::VEpgListAdvanced(MessageReceiver* tvideolive, std::shared_ptr<ChannelList> tchanList, u4 initialChannelNumber)
{
channelNumber = initialChannelNumber;
chanList = tchanList;
void VEpgListAdvanced::doNext()
{
LogNT::getInstance()->debug(TAG, "doNext");
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ u4 slCurrentOption = reinterpret_cast<u4>(sl.getCurrentOptionData());
if (mode != OneChannel)
{
void VEpgListAdvanced::doNow()
{
LogNT::getInstance()->debug(TAG, "doNow");
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ u4 slCurrentOption = reinterpret_cast<u4>(sl.getCurrentOptionData());
if (mode != OneChannel)
{
{
LogNT::getInstance()->debug(TAG, "doProgram");
mode = OneChannel;
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ u4 slCurrentOption = reinterpret_cast<u4>(sl.getCurrentOptionData());
Channel* chan = (*chanList)[slCurrentOption];
channelNumber = chan->number;
updateEpgDataChannel();
{
if (mode != OneChannel)
{
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ u4 slCurrentOption = reinterpret_cast<u4>(sl.getCurrentOptionData());
Channel* chan = (*chanList)[slCurrentOption];
channelNumber = chan->number;
}
void VEpgListAdvanced::doRecord()
{
- ULONG channel;
+ u4 channel;
Event* current = getCurrentOptionEvent(channel);
if (current)
{
if (mode != OneChannel)
{
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ u4 slCurrentOption = reinterpret_cast<u4>(sl.getCurrentOptionData());
Channel* chan = (*chanList)[slCurrentOption];
channelNumber = chan->number;
}
for (int listIndex = startupdate; listIndex < endupdate; listIndex++)
{
if (listIndex < 0) continue;
- if (listIndex >= static_cast<int>(chanlistsize)) continue;
+ if (listIndex >= toi4(chanlistsize)) continue;
chan = (*chanList)[listIndex];
// All static stuff done
}
-Event* VEpgListAdvanced::getCurrentOptionEvent(ULONG& channel)
+Event* VEpgListAdvanced::getCurrentOptionEvent(u4& channel)
{
if (mode == OneChannel)
{
}
else if ((mode == Now) || (mode == Next))
{
- ULONG slCurrentOptionData = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ u4 slCurrentOptionData = reinterpret_cast<u4>(sl.getCurrentOptionData());
EventList* eventList = eventLista[slCurrentOptionData];
if (!eventList) return NULL;
channel = (*chanList)[slCurrentOptionData]->number;
void VEpgListAdvanced::updateSelection()
{
- ULONG channel = 0;
+ u4 channel = 0;
if (mode == OneChannel)
{
{
if (sl.getNumOptions() == 0) return 2;
- ULONG channel;
+ u4 channel;
Event* current = getCurrentOptionEvent(channel);
if (current)
class VEpgListAdvanced : public TBBoxx, public MessageReceiver
{
public:
- VEpgListAdvanced(MessageReceiver* tvideolive, std::shared_ptr<ChannelList> tchanList, ULONG initialChannelNumber);
+ VEpgListAdvanced(MessageReceiver* tvideolive, std::shared_ptr<ChannelList> tchanList, u4 initialChannelNumber);
virtual ~VEpgListAdvanced();
void draw() { draw(false); }
WSelectList sl;
- Event* getCurrentOptionEvent(ULONG& channel);
+ Event* getCurrentOptionEvent(u4& channel);
std::shared_ptr<ChannelList> chanList;
- ULONG channelNumber;
+ u4 channelNumber;
MessageReceiver* videolive;
Boxx boxRed;
char* timerString = genTimerString();
logger->debug(TAG, "{}", timerString);
- ULONG ret = vdr->setEventTimer(timerString);
+ u4 ret = vdr->setEventTimer(timerString);
delete[] timerString;
if (!vdr->isConnected())
int x = m->parameter - getScreenX();
int y = m->tag - getScreenY();
- if ((boxRed.getX() <= x) && (boxRed.getX() + static_cast<int>(boxRed.getWidth()) >= x) &&
- (boxRed.getY() <= y) && (boxRed.getY() + static_cast<int>(boxRed.getHeight()) >= y)) {
+ if ((boxRed.getX() <= x) && (boxRed.getX() + toi4(boxRed.getWidth()) >= x) &&
+ (boxRed.getY() <= y) && (boxRed.getY() + toi4(boxRed.getHeight()) >= y)) {
BoxStack::getInstance()->handleCommand(Input::RED);
cancel = false;
}
}
else if (m->message == Message::MOUSE_SCROLL)
{
- if (tabbar.mouseAndroidScroll(m->parameter - getScreenX(), m->tag - getScreenY(), 0, reinterpret_cast<ULONG>(m->data)))
+ if (tabbar.mouseAndroidScroll(m->parameter - getScreenX(), m->tag - getScreenY(), 0, reinterpret_cast<u4>(m->data)))
{
BoxStack::getInstance()->update(this);
return;
}*/
/*
-hmsf Video::framesToHMSF(ULONG frames, double fps)
+hmsf Video::framesToHMSF(u4 frames, double fps)
{
hmsf ret;
/ * from vdr *
virtual int signalOn()=0;
virtual int signalOff()=0;
virtual int attachFrameBuffer()=0; // What does this do?
-// virtual ULONG timecodeToFrameNumber(ULLONG timecode)=0; //Obsolete and not HD compatible
- virtual ULLONG getCurrentTimestamp()=0;
+// virtual u4 timecodeToFrameNumber(u8 timecode)=0; //Obsolete and not HD compatible
+ virtual u8 getCurrentTimestamp()=0;
virtual bool displayIFrame(const UCHAR* buffer, UINT length)=0;
virtual int EnterIframePlayback() {return 1;}; // Must not be implemented
virtual void turnVideoOn() {};
virtual void turnVideoOff() {};
-// virtual ULLONG frameNumberToTimecode(ULONG timecode) { return 0; };//Obsolete and not HD compatible
+// virtual u8 frameNumberToTimecode(u4 timecode) { return 0; };//Obsolete and not HD compatible
#ifdef DEV
virtual int test() { return 0; }
port_def_type.bBuffersContiguous,port_def_type.nBufferAlignment);*/
port_def_type.nBufferCountActual=100;
- port_def_type.nBufferSize=std::max(static_cast<int>(port_def_type.nBufferSize),150000); // for transcoder important
+ port_def_type.nBufferSize=std::max(toi4(port_def_type.nBufferSize),150000); // for transcoder important
error=OMX_SetParameter(omx_vid_dec,OMX_IndexParamPortDefinition, &port_def_type);
return 1;
}
-ULLONG VideoOMX::getCurrentTimestamp() {
+u8 VideoOMX::getCurrentTimestamp() {
if (iframemode)
return 0;
long long ncur_clock_time = cur_clock_time;
// to be removed
/*
-ULONG VideoOMX::timecodeToFrameNumber(ULLONG timecode)
+u4 VideoOMX::timecodeToFrameNumber(u8 timecode)
{
- if (format == PAL) return (ULONG)(((double)timecode / (double)90000) * (double)25);
- else return (ULONG)(((double)timecode / (double)90000) * (double)30);
+ if (format == PAL) return (u4)(((double)timecode / (double)90000) * (double)25);
+ else return (u4)(((double)timecode / (double)90000) * (double)30);
}
*/
{
return 0;
-// ULLONG stc = 0;
+// u8 stc = 0;
// return ioctl(fdVideo, AV_SET_VID_STC, &stc);
/*
// reset();
int signalOn();
int signalOff();
int attachFrameBuffer(); // What does this do?
- ULONG timecodeToFrameNumber(ULLONG timecode);
- ULLONG getCurrentTimestamp();
+ u4 timecodeToFrameNumber(u8 timecode);
+ u8 getCurrentTimestamp();
bool displayIFrame(const UCHAR* bulibaver, UINT length);
virtual bool dtsTimefix(){return false;} //please we need dts time values
long long lastrefaudiotime;
// long long cur_pts;
long long lastreftimeOMX;
- ULLONG lastreftimePTS;
+ u8 lastreftimePTS;
// long long playbacktimeoffset; //this is the offset between the media time and system clock
// long long pausetimecode;
Log::getInstance()->log("VideoWin", Log::ERR , "Unable to enum Filters!");
return;
}
- ULONG gethowmany;
+ u4 gethowmany;
IMoniker * moni;
while(myenum->Next(1,&moni,&gethowmany)==S_OK)
{
Log::getInstance()->log("VideoWin", Log::ERR , "Unable to enum Filters!");
return;
}
- ULONG gethowmany;
+ u4 gethowmany;
IMoniker * moni;
while(myenum->Next(1,&moni,&gethowmany)==S_OK)
{
if (CreateBindCtx(0,&bindctx)!=S_OK) return NULL;
LPCOLESTR name=(LPCOLESTR)new WCHAR[strlen(videofilterlist[i].displayname)+1];
mbstowcs((wchar_t*)name,videofilterlist[i].displayname,strlen(videofilterlist[i].displayname)+1);
- ULONG eater=0;
+ u4 eater=0;
if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK)
LPCOLESTR name=new WCHAR[strlen(videofilterlist[videofilterselected].displayname)+1];
mbstowcs((wchar_t*)name,videofilterlist[videofilterselected].displayname,
strlen(videofilterlist[videofilterselected].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)
if (CreateBindCtx(0,&bindctx)!=S_OK) return NULL;
LPCOLESTR name=(LPCOLESTR)new WCHAR[strlen(videoH264filterlist[i].displayname)+1];
mbstowcs((wchar_t*)name,videoH264filterlist[i].displayname,strlen(videoH264filterlist[i].displayname)+1);
- ULONG eater=0;
+ u4 eater=0;
Log::getInstance()->log("VideoWin", Log::DEBUG ,"Creating filter: %s",videoH264filterlist[i].friendlyname);
LPCOLESTR name=new WCHAR[strlen(videoH264filterlist[videoH264filterselected].displayname)+1];
mbstowcs((wchar_t*)name,videoH264filterlist[videoH264filterselected].displayname,
strlen(videoH264filterlist[videoH264filterselected].displayname)+1);
- ULONG eater;
+ u4 eater;
Log::getInstance()->log("VideoWin", Log::DEBUG ,"Creating filter: %s",videoH264filterlist[videoH264filterselected].friendlyname);
if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK)
{
LPCOLESTR name=new WCHAR[strlen(videofilterlist[filter].displayname)+1];
mbstowcs((wchar_t*)name,videofilterlist[filter].displayname,
strlen(videofilterlist[filter].displayname)+1);
- ULONG eater;
+ u4 eater;
bool success=false;
if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK)
{
LPCOLESTR name=new WCHAR[strlen(videoH264filterlist[filter].displayname)+1];
mbstowcs((wchar_t*)name,videoH264filterlist[filter].displayname,
strlen(videoH264filterlist[filter].displayname)+1);
- ULONG eater;
+ u4 eater;
bool success=false;
if (MkParseDisplayName(bindctx,name,&eater,&moni)==S_OK)
{
if (videofilter->EnumPins(&pinenum) == S_OK)
{
IPin *current=NULL;
- ULONG fetch=0;
+ u4 fetch=0;
bool firststep=false;
while (pinenum->Next(1,¤t,&fetch)==S_OK)
return 1;
}
-ULLONG VideoWin::getCurrentTimestamp()
+u8 VideoWin::getCurrentTimestamp()
{
REFERENCE_TIME startoffset;
REFERENCE_TIME ncr_time;
if (startoffset==0) return 0;
ncr_time-=startoffset;
ncr_time-=lastreftimeRT;
- /* ULLONG result=frameNumberToTimecode(
+ /* u8 result=frameNumberToTimecode(
VDR::getInstance()->frameNumberFromPosition(lastreftimeBYTE));*/
long long result=lastreftimePTS;
- result+=(ULLONG)(ncr_time/10000LL*90LL);
+ result+=(u8)(ncr_time/10000LL*90LL);
if (result<0) result=(1LL << 33)-result;
return result;
/* //to beremoved
-ULONG VideoWin::timecodeToFrameNumber(ULLONG timecode)
+u4 VideoWin::timecodeToFrameNumber(u8 timecode)
{
- if (format == PAL) return (ULONG)(((double)timecode / (double)90000) * (double)25);
- else return (ULONG)(((double)timecode / (double)90000) * (double)30);
+ if (format == PAL) return (u4)(((double)timecode / (double)90000) * (double)25);
+ else return (u4)(((double)timecode / (double)90000) * (double)30);
}
-ULLONG VideoWin::frameNumberToTimecode(ULONG framenumber)
+u8 VideoWin::frameNumberToTimecode(u4 framenumber)
{
- if (format == PAL) return (ULLONG)(((double)framenumber * (double)90000) / (double)25);
- else return (ULLONG)(((double)framenumber * (double)90000) / (double)30);
+ if (format == PAL) return (u8)(((double)framenumber * (double)90000) / (double)25);
+ else return (u8)(((double)framenumber * (double)90000) / (double)30);
}
*/
void VideoWin::CleanupDS()
int signalOn();
int signalOff();
int attachFrameBuffer(); // What does this do?
-// ULONG timecodeToFrameNumber(ULLONG timecode);
-// ULLONG frameNumberToTimecode(ULONG framenumber);
- ULLONG getCurrentTimestamp();
+// u4 timecodeToFrameNumber(u8 timecode);
+// u8 frameNumberToTimecode(u4 framenumber);
+ u8 getCurrentTimestamp();
bool loadOptionsFromServer(VDR* vdr);
bool saveOptionstoServer();
bool iframemode;
UCHAR pseudotvsize;
REFERENCE_TIME lastreftimeRT;
- ULLONG lastreftimePTS;
+ u8 lastreftimePTS;
int lastaudiomode;
int audiovolume;
UCHAR aud_type;
MediaURI *uri;
int selection;
int sortorder;
- ULONG mtype;
+ u4 mtype;
MediaListHolder *holder;
public:
- void setMediaType(ULONG n) {mtype=n;}
+ void setMediaType(u4 n) {mtype=n;}
void setSortorder(int s) {
sortorder=s;
}
int getSelection() {
return selection;
}
- bool move(ULONG mv) {
+ bool move(u4 mv) {
if (! holder) return false;
switch(mv) {
case VMediaList::MV_NEXT:
return false;
}
- ULONG getMediaType(){return mtype;}
+ u4 getMediaType(){return mtype;}
int getSortorder() {
return sortorder;
}
-int VMediaList::getNumEntries(ULONG mediaType,int lowerThen,bool noAudioList) {
+int VMediaList::getNumEntries(u4 mediaType,int lowerThen,bool noAudioList) {
MediaListHolder *h=dirlist->getCurrent()->getHolder();
Log::getInstance()->log("VMediaList",Log::DEBUG,"getNumEntries type=%lu,lt=%d,na=%d,h=%p,l=%p",
mediaType,lowerThen,(int)noAudioList,h,(h?h->list():0));
Log::getInstance()->log("VMediaList::updateSelectList", Log::DEBUG, "media=%p",h);
if (! h) return;
- ULONG currentSelection=0;
+ u4 currentSelection=0;
if (sl.getNumOptions() >= 1 && currentNumber < 0) {
currentSelection=sl.getCurrentOptionData();
}
if (media->getMediaType() == MEDIA_TYPE_DIR) {
sprintf(str, "%04u %s [%s]", i,media->getTimeString(tempA), media->getDisplayName());
//Log::getInstance()->log("VMediaList", Log::DEBUG, "add to select list %s",str);
- media->index = sl.addOption(str, (ULONG)media, first);
+ media->index = sl.addOption(str, (u4)media, first);
}
else {
sprintf(str, "%04u %s %s", i,media->getTimeString(tempA), media->getDisplayName());
//Log::getInstance()->log("VMediaList", Log::DEBUG, "add to select list %s",str);
- media->index = sl.addOption(str, (ULONG)media, first);
+ media->index = sl.addOption(str, (u4)media, first);
}
first = 0;
}
//find the next entry in the media list
//return the index in the list (starting with 0)
//return -1 if none found
-int VMediaList::findNextEntry(int current, MediaList *list,ULONG ltype, ULONG move,bool wrap) {
+int VMediaList::findNextEntry(int current, MediaList *list,u4 ltype, u4 move,bool wrap) {
if (! list) return -1;
if (current < 0) current=0;
if (current >= (int)list->size()) current=list->size()-1;
-Media * VMediaList::getMedia(ULONG ltype,ULONG move) {
+Media * VMediaList::getMedia(u4 ltype,u4 move) {
Media *rt=NULL;
MediaList *list=NULL;
MediaListHolder *h=NULL;
return 1;
}
-const char * VMediaList::getDirname(ULONG mtype) const {
+const char * VMediaList::getDirname(u4 mtype) const {
if (mtype == MEDIA_TYPE_AUDIO && audiodirlist) {
return audiodirlist->getCurrent()->getDisplayName();
}
static int createList();
//move functions for getMedia
- const static ULONG MV_NEXT=1;
- const static ULONG MV_PREV=2;
- const static ULONG MV_RND=3;
- const static ULONG MV_NONE=0;
+ const static u4 MV_NEXT=1;
+ const static u4 MV_PREV=2;
+ const static u4 MV_RND=3;
+ const static u4 MV_NONE=0;
//move selection to the next matching media
//with the given move
//return NULL if none found
//the returned Media is a copy and must contain an URI!
- Media * getMedia(ULONG type,ULONG move=MV_NONE);
+ Media * getMedia(u4 type,u4 move=MV_NONE);
//get the number of media entries of particular types in this list
//if lowerThen is set, only count entries lt this one
- int getNumEntries(ULONG mediaType,int lowerThen=-1,bool noAudiolist=false);
+ int getNumEntries(u4 mediaType,int lowerThen=-1,bool noAudiolist=false);
//get the directory of the current medium (display only)
- const char * getDirname(ULONG mediaType) const;
+ const char * getDirname(u4 mediaType) const;
//update all viewers/players
void updateSelection(bool toSelectList=false);
//find the next entry in a media list
//return -1 if none found, otherwise index in list
- int findNextEntry(int current, MediaList *list,ULONG ltype, ULONG move,bool wrap);
+ int findNextEntry(int current, MediaList *list,u4 ltype, u4 move,bool wrap);
//get the currently selected media fro a list
Media * getCurrentMedia(DirList *dl);
DirList* dirlist;
private:
ImageReader *reader;
VMediaView * parent;
- ULLONG size;
+ u8 size;
bool dobreak;;
public:
VPreader(VMediaView *p,ImageReader *r){
reader=r;
dobreak=false;
};
- virtual ULONG readChunk(ULONG offset,ULONG len,char ** buf) {
+ virtual u4 readChunk(u4 offset,u4 len,char ** buf) {
Log::getInstance()->log("VMediaView::jpegReader", Log::DEBUG, "read chunk o=%d,len=%d,buf=%p",
offset,len,*buf);
UINT numrec=0;
rt=-1;
}
else {
- rt=reader->getImageChunk((ULLONG)offset,(UINT)len,&numrec,(UCHAR **)buf);
+ rt=reader->getImageChunk((u8)offset,(UINT)len,&numrec,(UCHAR **)buf);
}
}
Log::getInstance()->log("VMediaView::jpegReader", Log::DEBUG, "got n=%d,buf=%p,rt=%d",
numrec,*buf,rt);
return numrec;
}
- virtual int initRead(const MediaURI *uri,ULLONG *sz,ULONG factor=100) {
+ virtual int initRead(const MediaURI *uri,u8 *sz,u4 factor=100) {
Log::getInstance()->log("VMediaView::jpegReader", Log::DEBUG, "load image %s",uri->getDisplayName());
Video* video = Video::getInstance();
dobreak=false;
Log::getInstance()->log("VMediaView::jpegReader", Log::DEBUG, "load image %s returned %llu",uri->getDisplayName(),size);
return rt;
}
- virtual ULONG getSize() {return size;}
+ virtual u4 getSize() {return size;}
//seems to be thread safe (more or less...)
void setBreak() {
dobreak=true;
}
-void VMediaView::showPicture(ULONG move,bool bslideshow,bool activateBanner) {
+void VMediaView::showPicture(u4 move,bool bslideshow,bool activateBanner) {
pictureShowing=true;
setPictureMode(true);
stopSlideshow(true);
showPictureBanner(true);
#endif
ireader->stop();
- ULLONG size=0;
+ u8 size=0;
int rtok=reader->initRead(md->getURI(),&size,ctl.scaleAmount); //scaleAmount is the same for both...
if (rtok == 0) {
//now we can really draw
m->message = Message::CLOSE_ME;
m->p_to = Message::BOXSTACK;
m->from = v;
- m->parameter=(ULONG)v;
+ m->parameter=(u4)v;
MessageQueue::getInstance()->postMessage(m);
}
void VMediaView::sendCommandMsg(int command) {
-int VMediaView::play(bool all,bool activate,ULONG move,bool showInfo) {
+int VMediaView::play(bool all,bool activate,u4 move,bool showInfo) {
int rt=0;
if (getPlayer(false)) getPlayer(false)->stop();
justPlaying=false;
static VMediaView *createViewer(VMediaList * parent);
//show the picture currently selected in the parent
//potentially moving to next/previous one
- void showPicture(ULONG move,bool bslideshow,bool forceBanner);
+ void showPicture(u4 move,bool bslideshow,bool forceBanner);
void enableBanner(bool enable);
//play audio
//if activate is false no info will be shown
- int play(bool all,bool activate,ULONG move=VMediaList::MV_NONE,bool showInfo=false);
+ int play(bool all,bool activate,u4 move=VMediaList::MV_NONE,bool showInfo=false);
//check if the audio player is still running
//to decide wether to shutdown or not
{
Input::sendInputKey(Input::BACK);
}
- else if (y >= (static_cast<int>(area.h) - 24) && y <= static_cast<int>(area.h) - 6)
+ else if (y >= (toi4(area.h) - 24) && y <= toi4(area.h) - 6)
{
//y coordinate is right!
if (x>=7 &&x<=25)
void VRadioRec::go(bool resume)
{
- ULONG startFrameNum;
+ u4 startFrameNum;
if (resume)
startFrameNum = myRec->recInfo->resumePoint;
else
startFrameNum = 0;
LogNT::getInstance()->debug(TAG, "Starting stream: {}", myRec->getFileName());
- ULONG lengthFrames = 0;
+ u4 lengthFrames = 0;
bool isPesRecording;
- ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
+ u8 lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
myRec->IsPesRecording = isPesRecording;
bool cantStart = false;
rectangle(clocksRegion, barBlue);
- ULONG currentSeconds = player->getCurrentSeconds();
- ULONG lengthSeconds = player->getLengthSeconds();
+ u4 currentSeconds = player->getCurrentSeconds();
+ u4 lengthSeconds = player->getLengthSeconds();
char buffer[100];
if (lengthSeconds && (currentSeconds < lengthSeconds))
{
- ULONG dcurrentSeconds = currentSeconds;
- ULONG dlengthSeconds = lengthSeconds;
+ u4 dcurrentSeconds = currentSeconds;
+ u4 dlengthSeconds = lengthSeconds;
- ULONG currentHours = dcurrentSeconds / 3600;
+ u4 currentHours = dcurrentSeconds / 3600;
dcurrentSeconds %= 3600;
- ULONG currentMinutes = dcurrentSeconds / 60;
+ u4 currentMinutes = dcurrentSeconds / 60;
dcurrentSeconds %= 60;
- ULONG lengthHours = dlengthSeconds / 3600;
+ u4 lengthHours = dlengthSeconds / 3600;
dlengthSeconds %= 3600;
- ULONG lengthMinutes = dlengthSeconds / 60;
+ u4 lengthMinutes = dlengthSeconds / 60;
dlengthSeconds %= 60;
SNPRINTF(buffer, 99, "%01lu:%02lu:%02lu / %01lu:%02lu:%02lu", currentHours, currentMinutes, dcurrentSeconds, lengthHours, lengthMinutes, dlengthSeconds);
Message* m = new Message();
m->message = Message::MOVE_RECORDING;
m->to = parent;
- m->parameter = reinterpret_cast<ULONG>(sl.getCurrentOptionData()); // FIXME move to m->data
+ m->parameter = reinterpret_cast<u4>(sl.getCurrentOptionData()); // FIXME move to m->data
MessageQueue::getInstance()->postMessage(m);
return BoxStack::DELETE_ME;
}
else if (m->message == Message::MOUSE_SCROLL)
{
- if (tabbar.mouseAndroidScroll(m->parameter - getScreenX(), m->tag - getScreenY(), 0, reinterpret_cast<ULONG>(m->data)))
+ if (tabbar.mouseAndroidScroll(m->parameter - getScreenX(), m->tag - getScreenY(), 0, reinterpret_cast<u4>(m->data)))
{
BoxStack::getInstance()->update(this);
return;
}
case Input::OK:
{
- ULONG slCurrentOption = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ u4 slCurrentOption = reinterpret_cast<u4>(sl.getCurrentOptionData());
if (slCurrentOption == 1)
{
Message* m = new Message(); // Must be done after this view deleted
}
else if (m->message == Message::QUESTION_YES)
{
- if (reinterpret_cast<ULONG>(sl.getCurrentOptionData()) == 5)
+ if (reinterpret_cast<u4>(sl.getCurrentOptionData()) == 5)
{
Message* m2 = new Message(); // Delete self
m2->from = this;
if (fy < 0) fy += screenHeight;
if (fy >= screenHeight) fy -= screenHeight;
- x[head] = static_cast<int>(fx);
- y[head] = static_cast<int>(fy);
+ x[head] = toi4(fx);
+ y[head] = toi4(fy);
surface->drawPoint(x[head], y[head], DrawStyle::SELECTHIGHLIGHT); // was rgba
LogNT::getInstance()->debug(TAG, "Got timer to delete");
- ULONG retval = VDR::getInstance()->deleteTimer(recTimer);
+ u4 retval = VDR::getInstance()->deleteTimer(recTimer);
if (!VDR::getInstance()->isConnected()) { Control::getInstance()->connectionLost(); return; }
LogNT::getInstance()->debug(TAG, "Got return fron delete timer: {}", retval);
static const char* TAG = "VVideoLiveTV";
-VVideoLiveTV::VVideoLiveTV(std::shared_ptr<ChannelList> tchanList, ULONG initialChannelNumber, VChannelList* tvchannelList)
+VVideoLiveTV::VVideoLiveTV(std::shared_ptr<ChannelList> tchanList, u4 initialChannelNumber, VChannelList* tvchannelList)
: chanList(tchanList), vchannelList(tvchannelList)
{
vdr = VDR::getInstance();
if (keying)
{
UINT newChannel = 0;
- for(int i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * static_cast<int>(pow(10.f, i));
+ for(int i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * toi4(pow(10.f, i));
channelChange(NUMBER, newChannel);
osdChannelIndex = currentChannelIndex;
if (keying == numberWidth)
{
UINT newChannel = 0;
- for(i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * static_cast<int>(pow(10.f, i));
+ for(i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * toi4(pow(10.f, i));
channelChange(NUMBER, newChannel);
osdChannelIndex = currentChannelIndex;
{
LogNT::getInstance()->debug(TAG, "Timer Call 1 key start.");
UINT newChannel = 0;
- for(int i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * static_cast<int>(pow(10.f, i));
+ for(int i = keying - 1; i >= 0; i--) newChannel += keyingInput[i] * toi4(pow(10.f, i));
Message* m = new Message();
m->message = Message::CHANNEL_CHANGE;
int y = m->tag - osd.getScreenY();
if (osd.getVisible())
{
- if ((boxRed.getX() <= x) && (boxRed.getX() + static_cast<int>(boxRed.getWidth()) >= x) &&
- (boxRed.getY() <= y) && (boxRed.getY() + static_cast<int>(boxRed.getHeight()) >= y))
+ if ((boxRed.getX() <= x) && (boxRed.getX() + toi4(boxRed.getWidth()) >= x) &&
+ (boxRed.getY() <= y) && (boxRed.getY() + toi4(boxRed.getHeight()) >= y))
{
BoxStack::getInstance()->handleCommand(Input::RED);
}
- else if ((boxGreen.getX() <= x) && (boxGreen.getX() + static_cast<int>(boxGreen.getWidth()) >= x) &&
- (boxGreen.getY() <= y) && (boxGreen.getY() + static_cast<int>(boxGreen.getHeight()) >= y))
+ else if ((boxGreen.getX() <= x) && (boxGreen.getX() + toi4(boxGreen.getWidth()) >= x) &&
+ (boxGreen.getY() <= y) && (boxGreen.getY() + toi4(boxGreen.getHeight()) >= y))
{
BoxStack::getInstance()->handleCommand(Input::GREEN);
}
- else if ((boxYellow.getX() <= x) && (boxYellow.getX() + static_cast<int>(boxYellow.getWidth()) >= x) &&
- (boxYellow.getY() <= y) && (boxYellow.getY() + static_cast<int>(boxYellow.getHeight()) >= y))
+ else if ((boxYellow.getX() <= x) && (boxYellow.getX() + toi4(boxYellow.getWidth()) >= x) &&
+ (boxYellow.getY() <= y) && (boxYellow.getY() + toi4(boxYellow.getHeight()) >= y))
{
BoxStack::getInstance()->handleCommand(Input::YELLOW);
}
- else if ((boxBlue.getX() <= x) && (boxBlue.getX() + static_cast<int>(boxBlue.getWidth()) >= x) &&
- (boxBlue.getY() <= y) && (boxBlue.getY() + static_cast<int>(boxBlue.getHeight()) >= y))
+ else if ((boxBlue.getX() <= x) && (boxBlue.getX() + toi4(boxBlue.getWidth()) >= x) &&
+ (boxBlue.getY() <= y) && (boxBlue.getY() + toi4(boxBlue.getHeight()) >= y))
{
BoxStack::getInstance()->handleCommand(Input::BLUE);
}
class VVideoLiveTV : public Boxx, public MessageReceiver, public TimerReceiver, public OSDReceiver
{
public:
- VVideoLiveTV(std::shared_ptr<ChannelList> chanList, ULONG initialChannelNumber, VChannelList* vchannelList);
+ VVideoLiveTV(std::shared_ptr<ChannelList> chanList, u4 initialChannelNumber, VChannelList* vchannelList);
virtual ~VVideoLiveTV();
void preDelete();
int handleCommand(int command);
EventList* eventList;
int numberWidth;
int videoMode;
- ULONG streamType;
- ULONG preBuffering;
+ u4 streamType;
+ u4 preBuffering;
UINT currentChannelIndex;
UINT previousChannelIndex;
void VVideoMedia::go(bool resume)
{
- ULONG startFrameNum=0;
+ u4 startFrameNum=0;
Log::getInstance()->log("VVideoMedia", Log::DEBUG, "Starting stream: %s at frame: %lu", myMedia->getFileName(), startFrameNum);
strftime(timeString, 19, "%H:%M", &tms);
drawText(timeString, barRegion.x + 624, barRegion.y + 12, DrawStyle::LIGHTTEXT);
- ULLONG lenPTS=player->getLenPTS();
+ u8 lenPTS=player->getLenPTS();
// Draw clocks
rectangle(clocksRegion, barBlue);
- ULLONG currentPTS = player->getCurrentPTS();
+ u8 currentPTS = player->getCurrentPTS();
hmsf currentFrameHMSF = ptsToHMS(currentPTS);
hmsf lengthHMSF = ptsToHMS(lenPTS);
}
-hmsf VVideoMedia::ptsToHMS(ULLONG pts) {
- ULLONG secs=pts/90000;
+hmsf VVideoMedia::ptsToHMS(u8 pts) {
+ u8 secs=pts/90000;
hmsf rt;
rt.frames=0;
rt.seconds=secs%60;
//buffer must be len(title,intext)+3
//returns buffer
char * shortendedText(const char *title,const char *title2,const char *intext,char *buffer,UINT width);
- hmsf ptsToHMS(ULLONG pts);
+ hmsf ptsToHMS(u8 pts);
Region barRegion;
Region clocksRegion;
VInfo* vsummary;
VMediaList *lparent;
- ULLONG lengthBytes;
+ u8 lengthBytes;
};
#endif
void VVideoRec::go(bool resume)
{
- ULONG startFrameNum;
+ u4 startFrameNum;
if (resume)
startFrameNum = myRec->recInfo->resumePoint;
else
startFrameNum = 0;
LogNT::getInstance()->debug(TAG, "Starting stream: {} at frame: {}", myRec->getFileName(), startFrameNum);
- ULONG lengthFrames = 0;
+ u4 lengthFrames = 0;
bool isPesRecording;
- ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
+ u8 lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
myRec->IsPesRecording = isPesRecording;
if (lengthBytes)
{
// skip to previous mark
LogNT* logger = LogNT::getInstance();
int currentFrame = (player->getCurrentFrameNum()); // get current Frame
- currentFrame -= static_cast<int>(5 * myRec->recInfo->fps); // subtrack 5 seconds, else you cannot skip more than once back ..
+ currentFrame -= toi4(5 * myRec->recInfo->fps); // subtrack 5 seconds, else you cannot skip more than once back ..
int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame
if (prevMark)
MarkList::iterator i;
Mark* loopMark = NULL;
int posPix;
- ULONG lengthFrames;
+ u4 lengthFrames;
if (myRec->recInfo->timerEnd > time(NULL))
{
// chasing playback
// Work out an approximate length in frames (good to 1s...)
- lengthFrames = static_cast<ULONG>((myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
+ lengthFrames = static_cast<u4>((myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
}
else
{
// RecInfo *cur_info= myRec->recInfo;
/* unsigned char numchan_recinfo = cur_info->numComponents;
unsigned char numchan_subtitles_siz = temp_channel.numSPids;
- ULONG mp_audcounter = 0;
- ULONG ac3_counter = 0;
+ u4 mp_audcounter = 0;
+ u4 ac3_counter = 0;
int dvb_subcounter = 1;*/
- ULONG i;
+ u4 i;
/*unsigned char type;
char* lang;
rectangle(clocksRegion, barBlue);
#endif
- ULONG currentFrameNum = player->getCurrentFrameNum();
- ULONG lengthFrames;
+ u4 currentFrameNum = player->getCurrentFrameNum();
+ u4 lengthFrames;
if (myRec->recInfo->timerEnd > time(NULL))
{
// chasing playback
// Work out an approximate length in frames (good to 1s...)
- lengthFrames = static_cast<ULONG>((myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
+ lengthFrames = static_cast<u4>((myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
}
else
{
{
// Draw blips where start and end margins probably are
- posPix = static_cast<int>(302 * startMargin * myRec->recInfo->fps / lengthFrames);
+ posPix = toi4(302 * startMargin * myRec->recInfo->fps / lengthFrames);
rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
- posPix = static_cast<int>(302 * (lengthFrames - endMargin * myRec->recInfo->fps) / lengthFrames);
+ posPix = toi4(302 * (lengthFrames - endMargin * myRec->recInfo->fps) / lengthFrames);
rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
}
case Input::OK:
{
- ULONG option = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
+ u4 option = reinterpret_cast<u4>(sl.getCurrentOptionData());
if (option == 1)
{
doChannelsList();
{
if ( (x - getRootBoxOffsetX()) >= 0
&& (y - getRootBoxOffsetY()) >= 0
- && (x - getRootBoxOffsetX()) <= static_cast<int>(area.w)
- && (y - getRootBoxOffsetY()) <= static_cast<int>(area.h)
+ && (x - getRootBoxOffsetX()) <= toi4(area.w)
+ && (y - getRootBoxOffsetY()) <= toi4(area.h)
&& !active
)
{
{
if ( (x - getRootBoxOffsetX()) >= 0
&& (y - getRootBoxOffsetY()) >= 0
- && (x - getRootBoxOffsetX()) <= static_cast<int>(area.w)
- && (y - getRootBoxOffsetY()) <= static_cast<int>(area.h)
+ && (x - getRootBoxOffsetX()) <= toi4(area.w)
+ && (y - getRootBoxOffsetY()) <= toi4(area.h)
&& active
)
{
-void CalculateWindowSize(RECT * size,ULONG size_mode) {
+void CalculateWindowSize(RECT * size,u4 size_mode) {
DWORD width, height;
DWORD adjheight,adjwidth;
case WMSZ_BOTTOMRIGHT:
case WMSZ_TOP:
case WMSZ_TOPRIGHT:
- width=(ULONG)(((double)height)*aspectrt);
+ width=(u4)(((double)height)*aspectrt);
size->right=size->left+width+adjwidth;
break;
case WMSZ_BOTTOMLEFT:
case WMSZ_TOPLEFT:
- width=(ULONG)(((double)height)*aspectrt);
+ width=(u4)(((double)height)*aspectrt);
size->left=size->right-width-adjwidth;
break;
case WMSZ_LEFT:
case WMSZ_RIGHT:
- height=(ULONG)(((double)width)/aspectrt);
+ height=(u4)(((double)width)/aspectrt);
size->bottom=size->top+height+adjheight;
break;
}
} else {
RECT newrect={0,0,width,height};
DWORD newlength;
- if ((ULONG)(((double)height)*aspectrt)>width) {
- newlength=(ULONG)(((double)width)/aspectrt);
+ if ((u4)(((double)height)*aspectrt)>width) {
+ newlength=(u4)(((double)width)/aspectrt);
newrect.top+=(height-newlength)/2;
newrect.bottom-=(height-newlength);
} else {
- newlength=(ULONG)(((double)height)*aspectrt);
+ newlength=(u4)(((double)height)*aspectrt);
newrect.left+=(width-newlength)/2;
newrect.right-=(width-newlength);
}
#define LocalReader WindowsResourceJpegReader
class WindowsResourceJpegReader: public JpegReader {
public:
- virtual ULONG initRead(const char *filename);
- virtual ULONG readChunk(ULONG offset,ULONG len,char **buf);
- virtual ULONG getSize();
+ virtual u4 initRead(const char *filename);
+ virtual u4 readChunk(u4 offset,u4 len,char **buf);
+ virtual u4 getSize();
virtual ~WindowsResourceJpegReader();
protected:
HGLOBAL hres;
DWORD size;
};
-ULONG WindowsResourceJpegReader::initRead(const char *filename)
+u4 WindowsResourceJpegReader::initRead(const char *filename)
{
HRSRC res=FindResource(NULL,filename,RT_RCDATA);
hres=LoadResource(NULL,res);
return size;
}
- ULONG WindowsResourceJpegReader::readChunk(ULONG offset,ULONG len,char **buf)
+ u4 WindowsResourceJpegReader::readChunk(u4 offset,u4 len,char **buf)
{
if (offset>size) return 0;
- ULONG toread=min(size-offset,len);
+ u4 toread=min(size-offset,len);
char* buffy=(char*)malloc(toread);
memcpy(buffy,((char*)buffer)+offset,toread);
*buf=buffy;
FreeResource(hres);
}
- ULONG WindowsResourceJpegReader::getSize(){
- return (ULONG)size;
+ u4 WindowsResourceJpegReader::getSize(){
+ return (u4)size;
}
#else
#define LocalReader LocalJpegReader
class LocalJpegReader: public JpegReader {
public:
- virtual ULONG initRead(const char *filename);
- virtual ULONG readChunk(ULONG offset,ULONG len,char **buf);
+ virtual u4 initRead(const char *filename);
+ virtual u4 readChunk(u4 offset,u4 len,char **buf);
virtual ~LocalJpegReader();
- virtual ULONG getSize();
+ virtual u4 getSize();
LocalJpegReader();
protected:
FILE *file;
- ULONG size;
+ u4 size;
};
LocalJpegReader::LocalJpegReader(){
size=0;
}
-ULONG LocalJpegReader::initRead(const char *filename)
+u4 LocalJpegReader::initRead(const char *filename)
{
if (file) fclose(file);
size=0;
return 0;
}
-ULONG LocalJpegReader::readChunk(ULONG offset,ULONG len,char **buf)
+u4 LocalJpegReader::readChunk(u4 offset,u4 len,char **buf)
{
*buf=NULL;
- ULONG bread=0;
+ u4 bread=0;
if (file) {
- ULLONG cpos=ftell(file);
+ u8 cpos=ftell(file);
if (offset != cpos) {
fseek(file,offset-cpos,SEEK_CUR);
}
- if (offset != (ULONG)ftell(file)) {
+ if (offset != (u4)ftell(file)) {
Log::getInstance()->log("WJepg", Log::ERR, "readChunk pos = %lu not available", offset);
}
else {
if (file) fclose(file);
file=NULL;
}
-ULONG LocalJpegReader::getSize(){
+u4 LocalJpegReader::getSize(){
return size;
}
#endif
longjmp(myerr->setjmp_buffer, 1);
}
-ULONG jpeg_call_reader(ULONG offset,ULONG size,char ** buf,void *cb) {
+u4 jpeg_call_reader(u4 offset,u4 size,char ** buf,void *cb) {
jpegUserData *user=(jpegUserData *)cb;
return user->reader->readChunk(offset,size,buf);
}
JOCTET * buffer; /* start of buffer */
boolean start_of_file; /* have we gotten any data yet? */
void * userdata; /* used for callback */
- ULONG offset;
+ u4 offset;
} my_source_mgr;
typedef my_source_mgr * my_src_ptr;
LocalReader *myreader=new LocalReader();
reader=myreader;
owningReader=true;
- ULONG psize=myreader->initRead(tfileName);
+ u4 psize=myreader->initRead(tfileName);
if (psize == 0) {
delete reader;
reader=NULL;
//len I buf len (max bytes to read)
//return read len, 0 on EOF, -1 on error, *buf set to buffer
//will be released with free(!!!) after decoding
- virtual ULONG readChunk(ULONG offset,ULONG len,char **buf)=0;
+ virtual u4 readChunk(u4 offset,u4 len,char **buf)=0;
//a callback when the drawing is complete
//the implementation is optional
virtual void drawingDone(){};
//get the size of the current picture
- virtual ULONG getSize(){ return 0;}
+ virtual u4 getSize(){ return 0;}
virtual ~JpegReader(){};
};
class WJpegComplex : public WJpeg
char error[100];
UINT picw;
UINT pich;
- ULONG compressedSize;
+ u4 compressedSize;
//parameters computed to display picture
enum Rotation finalRotation;
WSAStringToAddress(const_cast<LPSTR>(name),AF_INET,NULL,(sockaddr*)&sock_address,&sockname_len);
DWORD ip=sock_address.sin_addr.s_addr;;
- ULONG size=0;
+ u4 size=0;
PMIB_IPNETTABLE table;
GetIpNetTable(NULL,&size,TRUE);
{
if ( (x - getRootBoxOffsetX()) >= 0
&& (y - getRootBoxOffsetY()) >= 0
- && (x - getRootBoxOffsetX()) <= static_cast<int>(area.w)
- && (y - getRootBoxOffsetY()) <= static_cast<int>(area.h)
+ && (x - getRootBoxOffsetX()) <= toi4(area.w)
+ && (y - getRootBoxOffsetY()) <= toi4(area.h)
&& !active
)
{
{
if ( (x - getRootBoxOffsetX()) >= 0
&& (y - getRootBoxOffsetY()) >= 0
- && (x - getRootBoxOffsetX()) <= static_cast<int>(area.w)
- && (y - getRootBoxOffsetY()) <= static_cast<int>(area.h)
+ && (x - getRootBoxOffsetX()) <= toi4(area.w)
+ && (y - getRootBoxOffsetY()) <= toi4(area.h)
&& active)
{
return true;
bool WOptionPane::mouseMove(int x, int y)
{
- for (int i = 0; i < static_cast<int>(optionBoxes.size()); i++)
+ for (int i = 0; i < toi4(optionBoxes.size()); i++)
{
if (optionBoxes[i]->mouseMove(x, y))
{
bool WOptionPane::mouseLBDOWN(int x, int y)
{
- for (int i = 0; i < static_cast<int>(optionBoxes.size()); i++)
+ for (int i = 0; i < toi4(optionBoxes.size()); i++)
{
if (optionBoxes[i]->mouseLBDOWN(x, y))
{
{
InputMan* inputMan = InputMan::getInstance();
- ULONG selection = 0;
- ULONG top = 0;
+ u4 selection = 0;
+ u4 top = 0;
if (!startup)
{
case Input::OK:
{
learnmode = true;
- // Two casts to get from void* to UCHAR. Wow. First reinterpret from void* to ULONG, then static to UCHAR
+ // Two casts to get from void* to UCHAR. Wow. First reinterpret from void* to u4, then static to UCHAR
InputMan::getInstance()->EnterLearningMode(
- static_cast<UCHAR>(reinterpret_cast<ULONG>(sl.getCurrentOptionData())));
+ static_cast<UCHAR>(reinterpret_cast<u4>(sl.getCurrentOptionData())));
return 1;
}
case Input::BACK:
void WSelectList::hintSetCurrent(int idx)
{
selectedOption = idx;
- if (selectedOption >= static_cast<int>(options.size())) selectedOption = options.size() - 1;
+ if (selectedOption >= toi4(options.size())) selectedOption = options.size() - 1;
}
void WSelectList::hintSetTop(int idx)
void WSelectList::draw()
{
int fontHeight = getFontHeight();
- int ySeparation = static_cast<int>(static_cast<float>(fontHeight) * linesPerOption) + gap;
+ int ySeparation = toi4(static_cast<float>(fontHeight) * linesPerOption) + gap;
numOptionsDisplayable = (area.h - 5) / ySeparation;
UINT ypos = 5;
for (int i = topOption; i < (topOption + numOptionsDisplayable); i++)
{
- if (i == static_cast<int>(options.size())) return;
+ if (i == toi4(options.size())) return;
if ((ypos + ySeparation) > area.h) break;
if (i == selectedOption && showseloption)
pointer = STRTOKR(buffer, "\t\n", &savepointer);
while(pointer)
{
- drawText(pointer, xposmod + columns[currentColumn], (fontHeight * curline) + static_cast<int>(ypos_mod), width - columns[currentColumn], colour);
+ drawText(pointer, xposmod + columns[currentColumn], (fontHeight * curline) + toi4(ypos_mod), width - columns[currentColumn], colour);
pointer = STRTOKR(NULL, "\t\n", &savepointer);
if (pointer)
void WSelectList::down()
{
- if (selectedOption < (static_cast<int>(options.size()) - 1))
+ if (selectedOption < (toi4(options.size()) - 1))
{
selectedOption++;
}
void WSelectList::pageDown()
{
- if ((topOption + numOptionsDisplayable) >= static_cast<int>(options.size()))
+ if ((topOption + numOptionsDisplayable) >= toi4(options.size()))
{
selectedOption = options.size() - 1;
}
int WSelectList::getMouseLine(int x, int y)
{
int fontHeight = getFontHeight();
- int ySeparation = static_cast<int>(static_cast<float>(fontHeight) * linesPerOption) + gap;
+ int ySeparation = toi4(static_cast<float>(fontHeight) * linesPerOption) + gap;
if (y < 0) return -1;
- if (x < 0 || x > static_cast<int>(area.w)) return -1;
+ if (x < 0 || x > toi4(area.w)) return -1;
if (y > (10 + numOptionsDisplayable * ySeparation)) return -1;
int cy = y - 5;
}
if (topOption < 0) topOption = 0;
- if ((selected + topOption >= static_cast<int>(options.size())) || (selected + topOption < 0)) return -1;
+ if ((selected + topOption >= toi4(options.size())) || (selected + topOption < 0)) return -1;
return selected + topOption;
}
{
if ( (x - getRootBoxOffsetX()) >= 0
&& (y - getRootBoxOffsetY()) >= 0
- && (x - getRootBoxOffsetX()) <= static_cast<int>(area.w)
- && (y - getRootBoxOffsetY()) <= static_cast<int>(area.h)
+ && (x - getRootBoxOffsetX()) <= toi4(area.w)
+ && (y - getRootBoxOffsetY()) <= toi4(area.h)
)
{
int change = -sy /120;
void WWinAudioFilter::initSelectList(bool startup)
{
- ULONG selection=0;
- ULONG top=0;
+ u4 selection=0;
+ u4 top=0;
if (!startup)
{
selection=sl.getCurrentOption();
}
sl.addColumn(0);
- ULONG i;
+ u4 i;
AudioWin *aw=(AudioWin*) Audio::getInstance();
int filselected;
const AudioFilterDescList *list=aw->getAudioFilterList(filselected);
case Input::OK:
{
AudioWin*aw=(AudioWin*)Audio::getInstance();
- aw->selectAudioFilter(reinterpret_cast<ULONG>(sl.getCurrentOptionData()));
+ aw->selectAudioFilter(reinterpret_cast<u4>(sl.getCurrentOptionData()));
return 1;
}
void WWinMp3AudioFilter::initSelectList(bool startup)
{
- ULONG selection=0;
- ULONG top=0;
+ u4 selection=0;
+ u4 top=0;
if (!startup)
{
selection=sl.getCurrentOption();
}
sl.addColumn(0);
- ULONG i;
+ u4 i;
AudioWin *aw=(AudioWin*) Audio::getInstance();
int filselected;
const AudioFilterDescList *list=aw->getMp3AudioFilterList(filselected);
case Input::OK:
{
AudioWin*aw=(AudioWin*)Audio::getInstance();
- aw->selectMp3AudioFilter(reinterpret_cast<ULONG>(sl.getCurrentOptionData()));
+ aw->selectMp3AudioFilter(reinterpret_cast<u4>(sl.getCurrentOptionData()));
return 1;
}
void WWinVideoFilter::initSelectList(bool startup)
{
- ULONG selection=0;
- ULONG top=0;
+ u4 selection=0;
+ u4 top=0;
if (!startup)
{
selection=sl.getCurrentOption();
sl.addColumn(0);
- ULONG i;
+ u4 i;
VideoWin *vw=(VideoWin*) Video::getInstance();
int filselected;
const VideoFilterDescList *list=vw->getVideoFilterList(filselected);
if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,DrawStyle::LIGHTTEXT);
sl.draw();
- if (!(*list)[reinterpret_cast<ULONG>(sl.getCurrentOptionData())].vmr9tested)
+ if (!(*list)[reinterpret_cast<u4>(sl.getCurrentOptionData())].vmr9tested)
{
rectangle(area.w - 220, 160, 200, 20, DrawStyle::YELLOW);
drawText(tr("VMR 9 support: ?"), area.w - 220, 160, DrawStyle::DARKTEXT);
}
- else if ((*list)[reinterpret_cast<ULONG>(sl.getCurrentOptionData())].vmr9)
+ else if ((*list)[reinterpret_cast<u4>(sl.getCurrentOptionData())].vmr9)
{
rectangle(area.w - 220, 160, 200, 20, DrawStyle::GREEN);
drawText(tr("VMR 9 support: yes"), area.w - 220, 160, DrawStyle::DARKTEXT);
case Input::OK:
{
VideoWin*vw=(VideoWin*)Video::getInstance();
- vw->selectVideoFilter(reinterpret_cast<ULONG>(sl.getCurrentOptionData()));
+ vw->selectVideoFilter(reinterpret_cast<u4>(sl.getCurrentOptionData()));
return 1;
}
case Input::BACK:
void WWinVideoH264Filter::initSelectList(bool startup)
{
- ULONG selection=0;
- ULONG top=0;
+ u4 selection=0;
+ u4 top=0;
if (!startup)
{
selection=sl.getCurrentOption();
sl.addColumn(0);
- ULONG i;
+ u4 i;
VideoWin *vw=(VideoWin*) Video::getInstance();
int filselected;
const VideoFilterDescList *list=vw->getVideoH264FilterList(filselected);
if (filselected!=-1) drawText((*list)[filselected].friendlyname,215,15,DrawStyle::LIGHTTEXT);
sl.draw();
- if (!(*list)[reinterpret_cast<ULONG>(sl.getCurrentOptionData())].vmr9tested)
+ if (!(*list)[reinterpret_cast<u4>(sl.getCurrentOptionData())].vmr9tested)
{
rectangle(area.w - 220, 160, 200, 20, DrawStyle::YELLOW);
drawText(tr("VMR 9 support: ?"), area.w - 220, 160, DrawStyle::DARKTEXT);
}
- else if ((*list)[reinterpret_cast<ULONG>(sl.getCurrentOptionData())].vmr9)
+ else if ((*list)[reinterpret_cast<u4>(sl.getCurrentOptionData())].vmr9)
{
rectangle(area.w - 220, 160, 200, 20, DrawStyle::GREEN);
drawText(tr("VMR 9 support: yes"), area.w - 220, 160, DrawStyle::DARKTEXT);
case Input::OK:
{
VideoWin*vw=(VideoWin*)Video::getInstance();
- vw->selectVideoH264Filter(reinterpret_cast<ULONG>(sl.getCurrentOptionData()));
+ vw->selectVideoH264Filter(reinterpret_cast<u4>(sl.getCurrentOptionData()));
return 1;
}
case Input::BACK: