diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Input/in_flv/FLVStreamHeader.cpp | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Plugins/Input/in_flv/FLVStreamHeader.cpp')
-rw-r--r-- | Src/Plugins/Input/in_flv/FLVStreamHeader.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Src/Plugins/Input/in_flv/FLVStreamHeader.cpp b/Src/Plugins/Input/in_flv/FLVStreamHeader.cpp new file mode 100644 index 00000000..8f1ef49e --- /dev/null +++ b/Src/Plugins/Input/in_flv/FLVStreamHeader.cpp @@ -0,0 +1,36 @@ +#include "FLVStreamHeader.h" +#include "FLVUtil.h" +/* +(c) 2006 Nullsoft, Inc. +Author: Ben Allison benski@nullsoft.com +*/ + +/* +PreviousTagSize - uint32 - total size of previous tag, presumably for stream continuity checking. big endian +Type - uint8 - what does this frame contain? 0x12=meta, 0x8=audio, 0x9=video +BodyLength - uint24 - size of the data following this header. big endian +Timestamp - uint24 - timestamp (milliseconds). big endian +Timestamp High - uint8 - high 8 bits of timestamp (to form 32bit timestamp) +Stream ID - uint24 - always zero +*/ + +bool FLVStreamHeader::Read(uint8_t *data, size_t size) +{ + if (size < 15) + return false; // header size too small + + previousSize = FLV::Read32(&data[0]); + type = data[4]; + dataSize = FLV::Read24(&data[5]); + timestamp = FLV::Read24(&data[8]); + uint8_t timestampHigh = FLV::Read8(&data[11]); + timestamp |= (timestampHigh << 24); + streamID = FLV::Read24(&data[12]); + + if (streamID != 0) + return false; + + return true; + + +}
\ No newline at end of file |