22 #ifndef MEDIASTATION_DATAFILE_H 23 #define MEDIASTATION_DATAFILE_H 25 #include "common/file.h" 26 #include "common/stream.h" 27 #include "common/path.h" 28 #include "common/rect.h" 29 #include "common/str.h" 52 kDatumTypeEmpty = 0x00,
53 kDatumTypeUint8 = 0x02,
54 kDatumTypeUint16 = 0x03,
55 kDatumTypeUint32 = 0x04,
56 kDatumTypeInt8 = 0x05,
57 kDatumTypeInt16 = 0x06,
58 kDatumTypeInt32 = 0x07,
59 kDatumTypeFloat = 0x08,
60 kDatumTypeDouble = 0x09,
61 kDatumTypeFilename = 0x0a,
62 kDatumTypeRect = 0x0d,
63 kDatumTypePoint = 0x0e,
64 kDatumTypeGraphicSize = 0x0f,
65 kDatumTypeGraphicUnit = 0x10,
66 kDatumTypeTime = 0x11,
67 kDatumTypeString = 0x12,
68 kDatumTypeVersion = 0x13,
69 kDatumTypeChannelIdent = 0x1b,
70 kDatumTypePolygon = 0x1d,
80 uint16 readTypedUint16();
81 uint32 readTypedUint32();
82 int8 readTypedSByte();
83 int16 readTypedSint16();
84 int32 readTypedSint32();
85 float readTypedFloat();
86 double readTypedDouble();
91 int16 readTypedGraphicUnit();
92 double readTypedTime();
95 uint32 readTypedChannelIdent();
96 Polygon readTypedPolygon();
99 void readAndVerifyType(DatumType type);
107 uint32 bytesRemaining();
108 uint32 startPos()
const {
return _dataStartOffset; }
114 virtual bool eos()
const {
return _parentStream->eos(); };
115 virtual bool err()
const {
return _parentStream->err(); };
116 virtual void clearErr() { _parentStream->clearErr(); };
117 virtual uint32 read(
void *dataPtr, uint32 dataSize);
118 virtual int64
pos()
const {
return _parentStream->pos(); };
119 virtual int64
size()
const {
return _parentStream->size(); };
120 virtual bool skip(uint32 offset) {
return seek(offset, SEEK_CUR); };
121 virtual bool seek(int64 offset,
int whence = SEEK_SET);
125 uint32 _dataStartOffset = 0;
126 uint32 _dataEndOffset = 0;
149 typedef uint32 ChannelIdent;
154 void openStream(uint streamId);
155 void closeStream() { close(); }
167 void setChannelIdent(ChannelIdent channelIdent) { _channelIdent = channelIdent; }
168 ChannelIdent channelIdent()
const {
return _channelIdent; }
170 virtual void readChunk(
Chunk &chunk) {};
172 void registerWithStreamManager();
173 void unregisterWithStreamManager();
176 ChannelIdent _channelIdent = 0;
184 virtual void openFeed(uint streamId, uint startOffset) = 0;
189 virtual void closeFeed() = 0;
190 virtual void stopFeed() = 0;
191 virtual void readData() = 0;
204 virtual void openFeed(uint streamId, uint startOffset)
override;
205 virtual void closeFeed()
override;
207 virtual void stopFeed()
override {};
208 virtual void readData()
override;
217 ChannelClient *channelClientForChannel(uint clientId) {
return _channelClients.getValOrDefault(clientId); }
219 ImtStreamFeed *openStreamFeed(uint streamId, uint offsetInStream = 0, uint maxBytesToRead = 0);