/** \fn detectTs \brief returns true if the file seems to be mpeg PS */ bool detectTs(const char *file) { uint8_t buffer[PROBE_SIZE]; uint32_t bufferSize; uint32_t nbPacket,nbMatch=0; FILE *f=ADM_fopen(file,"rb"); if(!f) return false; bufferSize=fread(buffer,1,PROBE_SIZE,f); fclose(f); // Do a simple check by checking we have 0x47....0x47 several time in a raw if(true==checkMarker(buffer,bufferSize,TS_PACKET_LEN)) { ADM_info("[TS Demuxer] 188 bytes packet detected\n"); return true; } // Do a simple check by checking we have 0x47....0x47 several time in a raw if(true==checkMarker(buffer,bufferSize,TS_PACKET_LEN+4)) { ADM_info("[TS Demuxer] 192 bytes packet detected\n"); return true; } ADM_info("[TS Demuxer] Not a TS file\n"); return false; }
void InputPersistenceBlock::read(uint &value) { if (checkMarker(UINT_MARKER)) { value = READ_LE_UINT32(_iter); _iter += 4; } else { value = 0; } }
void InputPersistenceBlock::read(float &value) { if (checkMarker(FLOAT_MARKER)) { rawRead(&value, sizeof(float)); value = convertEndianessFromStorageToSystem(value); } else { value = 0.0f; } }
void InputPersistenceBlock::read(uint &value) { if (checkMarker(UINT_MARKER)) { rawRead(&value, sizeof(uint)); value = convertEndianessFromStorageToSystem(value); } else { value = 0; } }
void InputPersistenceBlock::read(bool &value) { if (checkMarker(BOOL_MARKER)) { uint uintBool = READ_LE_UINT32(_iter); _iter += 4; value = uintBool == 0 ? false : true; } else { value = false; } }
void InputPersistenceBlock::read(float &value) { if (checkMarker(FLOAT_MARKER)) { uint32 tmp[1]; tmp[0] = READ_LE_UINT32(_iter); value = ((float *)tmp)[0]; _iter += 4; } else { value = 0.0f; } }
void InputPersistenceBlock::read(bool &value) { if (checkMarker(BOOL_MARKER)) { uint uintBool; rawRead(&uintBool, sizeof(float)); uintBool = convertEndianessFromStorageToSystem(uintBool); value = uintBool == 0 ? false : true; } else { value = 0.0f; } }
void InputPersistenceBlock::readByteArray(Common::Array<byte> &value) { if (checkMarker(BLOCK_MARKER)) { uint size; read(size); if (checkBlockSize(size)) { value = Common::Array<byte>(_iter, size); _iter += size; } } }
void InputPersistenceBlock::readString(Common::String &value) { value = ""; if (checkMarker(STRING_MARKER)) { uint size; read(size); if (checkBlockSize(size)) { value = Common::String(reinterpret_cast<const char *>(&*_iter), size); _iter += size; } } }