alc_hdr.c

Go to the documentation of this file.
00001 
00034 #include <stdio.h>
00035 
00036 #ifdef _MSC_VER
00037 #include <winsock2.h>
00038 #else
00039 #include <arpa/inet.h>
00040 #endif
00041 
00042 #include "alc_hdr.h"
00043 
00044 int add_alc_fpi_2_128(def_lct_hdr_t *def_lct_hdr, int hdrlen, unsigned int sbn, unsigned int es_id) {
00045 
00046         int len = 0;
00047 
00048         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen) = htonl(sbn);
00049         len += 4;
00050         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl(es_id);    
00051         len += 4;
00052         
00053         return len;
00054 }
00055 
00056 int add_alc_fpi_129(def_lct_hdr_t *def_lct_hdr, int hdrlen, unsigned int sbn, 
00057                                         unsigned short sbl, unsigned short es_id) {
00058 
00059         int len = 0;
00060         unsigned int word = 0;
00061 
00062         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen) = htonl(sbn);
00063 
00064         len += 4;
00065         word = ((sbl << 16) | (es_id & 0xFFFF));
00066         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen + len) = htonl(word);     
00067         len += 4;
00068 
00069         return len;
00070 }
00071 
00072 int add_alc_fpi_0_130(def_lct_hdr_t *def_lct_hdr, int hdrlen, unsigned short sbn, unsigned short es_id) {
00073 
00074         int len = 0;
00075         unsigned int word = 0;
00076 
00077         word = ((sbn << 16) | (es_id & 0xFFFF));
00078 
00079         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen) = htonl(word);   
00080         len += 4;
00081 
00082         return len;
00083 }
00084 
00085 int add_alc_fpi_3(def_lct_hdr_t *def_lct_hdr, int hdrlen, unsigned int sbn,
00086                   unsigned int es_id, unsigned char m) {
00087 
00088         int len = 0;
00089         unsigned int word = 0;
00090 
00091         word = ((sbn << m) | (es_id & ((1 << m) - 1)));
00092 
00093         *(unsigned int*)((unsigned char*)def_lct_hdr + hdrlen) = htonl(word);   
00094         len += 4;
00095 
00096         return len;
00097 }
00098 
00099 

Generated on Fri Mar 9 19:59:51 2007 for MAD-FCL by  doxygen 1.5.0