Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SPEGPacket.h

Go to the documentation of this file.
00001 #ifndef SPEGPACKET_H 00002 #define SPEGPACKET_H 00003 00004 #include <sys/types.h> 00005 00006 #include "MNRTPDecoderCommon.h" 00007 00008 extern "C" { 00009 #include "dbuf.h" 00010 } 00011 00012 typedef struct { 00013 u_int16_t len; 00014 u_int16_t seq; 00015 u_int32_t flags; 00016 } pack_head; 00017 00018 #define PACK_FAKE_CHUNK 0x80000000 00019 #define PACK_PRIO_MASK 0x78000000 00020 #define PACK_PRIO_SHIFT 27 00021 #define PACK_TEMP_REF_MASK 0x07c00000 00022 #define PACK_TEMP_REF_SHIFT 22 00023 #define PACK_FFV 0x00200000 00024 #define PACK_FFC_MASK 0x001c0000 00025 #define PACK_FFC_SHIFT 18 00026 #define PACK_FBV 0x00020000 00027 #define PACK_BFC_MASK 0x0001c000 00028 #define PACK_BFC_SHIFT 14 00029 #define PACK_EXT_LEV_MASK 0x00003000 00030 #define PACK_EXT_LEV_SHIFT 12 00031 00032 #define PACK_RESERVED 0x00000f00 00033 00034 #define PACK_PIC_HDR 0x00000080 00035 #define PACK_GOP_HDR 0x00000040 00036 #define PACK_SEQ_HDR 0x00000020 00037 #define PACK_CHUNK_CTD 0x00000010 00038 #define PACK_NEW_CHUNK 0x00000008 00039 #define PACK_PIC_TYPE_MASK 0x00000007 00040 #define PACK_PIC_TYPE_SHIFT 0 00041 00042 #define PACK_MOT_VEC_MASK (PACK_FFV | PACK_FFC_MASK | PACK_FBV | PACK_BFC_MASK) 00043 #define PACK_MOT_VEC_SHIFT PACK_BFC_SHIFT 00044 00045 #define PACK(type, x) (((x) << PACK_##type##_SHIFT) & PACK_##type##_MASK) 00046 #define UNPACK(type, x) (((x) & PACK_##type##_MASK) >> PACK_##type##_SHIFT) 00047 00048 const int P_prio = 14; 00049 const int B_prio = 13; 00050 const int x1_I_prio = 12; 00051 const int x1_P_prio = 11; 00052 const int x1_B_prio = 10; 00053 const int x2_I_prio = 9; 00054 const int x2_P_prio = 8; 00055 const int x2_B_prio = 7; 00056 const int x3_I_prio = 6; 00057 const int x3_P_prio = 5; 00058 const int x3_B_prio = 4; 00059 00060 typedef struct { 00061 size_t pos; 00062 size_t len; 00063 } fake_ent; 00064 00065 typedef struct { 00066 dbuf *items; 00067 //channel_dst *dest; 00068 u_int32_t flags; 00069 u_int32_t sav_flags; 00070 u_int16_t sequence; 00071 u_int16_t length; 00072 int type; 00073 int mtu; 00074 } clumper; 00075 00076 class SPEGPacket { 00077 00078 public: 00079 SPEGPacket (int packetsize); 00080 // creates empty packets 00081 dbuf *packetize (size_t mtu, MNRope*& indata); 00082 // fills empty packets 00083 dbuf *fillpacket (FILE *sourcefile); 00084 // extracts data from packets 00085 dbuf *unpacketize (bool& more); 00086 // indicates if there are more empty packets in the fillpacket-buffer 00087 bool hasEmptyPackets (); 00088 // adds data to the empty-packet-buffer 00089 void addEmptyPackets (dbuf *pack); 00090 // returns 'true' if there are more filled packets in 00091 // the filled-packet-buffer 00092 bool hasFilledPackets (); 00093 // adds data to the filled-packet-buffer 00094 void addFilledPackets (dbuf *pack); 00095 00096 static int assignPrio( dbuf*& packet ); 00097 static void appendToDbuf( dbuf*& dest, dbuf *src ); 00098 00099 private: 00100 MNRope *inBufferUnPacket; 00101 MNRope *inBufferFillPacket; 00102 MNRope *inBufferPacketize; 00103 dbuf *retbufUnPacket; 00104 dbuf *retbufFillPacket; 00105 dbuf *retbufPacketize; 00106 dbuf *workbufPacketize; 00107 dbuf *gather; 00108 dbuf *emptyPacketBuffer; 00109 dbuf *filledPacketBuffer; 00110 clumper clump; 00111 int pic_type_packetize; 00112 int packetsize; 00113 00114 int itemcount; 00115 00116 // all packets with lower priority are dropped 00117 int dropPrio; 00118 00119 // int assignPrio (dbuf*& packet); 00120 size_t fillDbuf (dbuf* db, MNRope*& data); 00121 void send_fake_ents(); 00122 void add_fake_ent(size_t pos, size_t len); 00123 00124 }; 00125 00126 #endif /* SPEGPACKET_H */

Generated on Sun Mar 6 13:35:50 2005 for Komssys by doxygen 1.3.8