diff options
author | Jochen Dolze <vdr@dolze.de> | 2010-03-30 18:49:58 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2010-03-30 18:49:58 +0200 |
commit | 74cdd9ffa1d0e5f74942051e7e22e07542929c03 (patch) | |
tree | e59472547b1ed3543b8e2d1d0e2a7c52fcb24c04 /command/streaminfo.h | |
parent | 6446f24dce1b30fa341b7de078ca4385d1378457 (diff) | |
download | vdr-plugin-markad-74cdd9ffa1d0e5f74942051e7e22e07542929c03.tar.gz vdr-plugin-markad-74cdd9ffa1d0e5f74942051e7e22e07542929c03.tar.bz2 |
Changed directory structure, added Makefiles
Diffstat (limited to 'command/streaminfo.h')
-rw-r--r-- | command/streaminfo.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/command/streaminfo.h b/command/streaminfo.h new file mode 100644 index 0000000..e08ac7f --- /dev/null +++ b/command/streaminfo.h @@ -0,0 +1,112 @@ +/* + * streaminfo.h: A program for the Video Disk Recorder + * + * See the README file for copyright information and how to reach the author. + * + */ + +#ifndef __streaminfo_h_ +#define __streaminfo_h_ + +#include <stdint.h> +#include <string.h> +#include <stdlib.h> + +#include "global.h" + +class cMarkAdStreamInfo +{ +private: + // taken from ffmpeg + enum + { + NAL_SLICE = 0x01, // Slice + NAL_IDR_SLICE = 0x05, // IDR-Slice + NAL_SEI = 0x06, // Supplemental Enhancement Information + NAL_SPS = 0x07, // Sequence Parameter Set + NAL_PPS = 0x08, // Picture Parameter Set + NAL_AUD = 0x09, // Access Unit Delimiter + NAL_END_SEQ = 0x0A, // End of Sequence + NAL_SPS_EXT = 0x0D, // Sequence Parameter Set Extension + NAL_AUX_SLICE = 0x19 // Auxilary Slice + }; + + struct H264 + { + bool primary_pic_typeI; + bool separate_colour_plane_flag; + int log2_max_frame_num; + int frame_num; + } H264; + + int nalUnescape(uint8_t *dst, const uint8_t *src, int len); + const uint8_t *nextStartCode(const uint8_t *start, const uint8_t *end); + bool FindH264VideoInfos(MarkAdContext *maContext, uchar *pkt, int len); + bool FindH262VideoInfos(MarkAdContext *maContext, uchar *pkt, int len); +public: + cMarkAdStreamInfo(); + bool FindVideoInfos(MarkAdContext *maContext, uchar *pkt, int len); + bool FindAC3AudioInfos(MarkAdContext *maContext, uchar *espkt, int eslen); +}; + +// taken from femon +class cBitStream +{ +private: + const uint8_t *data; + int count; // in bits + int index; // in bits + +public: + cBitStream(const uint8_t *buf, const int len); + ~cBitStream(); + + int getBit(); + uint32_t getBits(uint32_t n); + void skipBits(uint32_t n); + uint32_t getUeGolomb(); + int32_t getSeGolomb(); + void skipGolomb(); + void skipUeGolomb(); + void skipSeGolomb(); + void byteAlign(); + + void skipBit() + { + skipBits(1); + } + uint32_t getU8() + { + return getBits(8); + } + uint32_t getU16() + { + return ((getBits(8) << 8) | getBits(8)); + } + uint32_t getU24() + { + return ((getBits(8) << 16) | (getBits(8) << 8) | getBits(8)); + } + uint32_t getU32() + { + return ((getBits(8) << 24) | (getBits(8) << 16) | (getBits(8) << 8) | getBits(8)); + } + bool isEOF() + { + return (index >= count); + } + void reset() + { + index = 0; + } + int getIndex() + { + return (isEOF() ? count : index); + } + const uint8_t *getData() + { + return (isEOF() ? NULL : data + (index / 8)); + } +}; + +#endif |