| 324 | } |
| 325 | |
| 326 | PacketDataFormat AVPacketWrapper::guessDataFormatFromData() |
| 327 | { |
| 328 | if (this->packetFormat != PacketDataFormat::Unknown) |
| 329 | return this->packetFormat; |
| 330 | |
| 331 | auto avpacketData = QByteArray::fromRawData((const char *)(getData()), getDataSize()); |
| 332 | if (avpacketData.length() < 4) |
| 333 | { |
| 334 | this->packetFormat = PacketDataFormat::Unknown; |
| 335 | return this->packetFormat; |
| 336 | } |
| 337 | |
| 338 | // AVPacket data can be in one of two formats: |
| 339 | // 1: The raw annexB format with start codes (0x00000001 or 0x000001) |
| 340 | // 2: ISO/IEC 14496-15 mp4 format: The first 4 bytes determine the size of the NAL unit followed |
| 341 | // by the payload We will try to guess the format of the data from the data in this AVPacket. This |
| 342 | // should always work unless a format is used which we did not encounter so far (which is not |
| 343 | // listed above) Also I think this should be identical for all packets in a bitstream. |
| 344 | if (checkForRawNALFormat(avpacketData, false)) |
| 345 | this->packetFormat = PacketDataFormat::RawNAL; |
| 346 | else if (checkForMp4Format(avpacketData)) |
| 347 | this->packetFormat = PacketDataFormat::MP4; |
| 348 | else if (checkForObuFormat(avpacketData)) |
| 349 | this->packetFormat = PacketDataFormat::OBU; |
| 350 | else if (checkForRawNALFormat(avpacketData, true)) |
| 351 | this->packetFormat = PacketDataFormat::RawNAL; |
| 352 | |
| 353 | return this->packetFormat; |
| 354 | } |
| 355 | |
| 356 | void AVPacketWrapper::update() |
| 357 | { |
no test coverage detected