OSDN Git Service

fix logo parse func
[rec10/rec10-git.git] / epgdump / sdtt.c
index cdb2fdd..eeeecbd 100644 (file)
@@ -140,24 +140,24 @@ int parseSDTTdesc(unsigned char *data, SDTTdesc *sdts) {
 }
 
 // STD-B21 p193 (209)
-int parseSDTTdata(unsigned char *data, SDTTdata *cdtd) {
+int parseSDTTdata(unsigned char *data, SDTTdata *sdtd) {
        int boff = 0, i, j;
        SDTTdataLoop *loop;
        SDTTdataService *service;
 
-       memset(cdtd, 0, sizeof(SDTTdata));
+       memset(sdtd, 0, sizeof(SDTTdata));
 
-       cdtd->logo_type = getBit(data, &boff, 8);
-       cdtd->number_of_loop = getBit(data, &boff, 16);
-       cdtd->loop = calloc(1, sizeof(SDTTdataLoop) * cdtd->number_of_loop);
+       sdtd->logo_type = getBit(data, &boff, 8);
+       sdtd->number_of_loop = getBit(data, &boff, 16);
+       sdtd->loop = calloc(1, ( sizeof(SDTTdataLoop) + 5000 ) * sdtd->number_of_loop);
 
-       for (i=0; i<cdtd->number_of_loop; i++) {
-               loop = cdtd->loop + sizeof(SDTTdataLoop) * i;
+       for (i=0; i<sdtd->number_of_loop; i++) {
+               loop = sdtd->loop + sizeof(SDTTdataLoop) * i;
 
                loop->reserved_future_use1 = getBit(data, &boff, 7);
                loop->logo_id = getBit(data, &boff, 9);
                loop->number_of_services = getBit(data, &boff, 8);
-               loop->services = calloc(1, sizeof(SDTTdataService) * loop->number_of_services);
+               loop->services = calloc(1, ( sizeof(SDTTdataService) + 5000 )* loop->number_of_services);
 
                for (j=0; j<loop->number_of_services; j++) {
                        service = loop->services + sizeof(SDTTdataService) * j;
@@ -237,7 +237,7 @@ void dumpSDTT(unsigned char *ptr, STATION *station, int station_count)
                                len = parseSDTTdesc(ptr, &sdts);
                                ptr += len;
                                desc_len -= len;
-#if 1
+#if 0
                                printf("SDTTdesc %d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%s\n",
                                        sdts.descriptor_tag, sdts.descriptor_length, 
                                        sdts.reboot, sdts.add_on, 
@@ -255,7 +255,7 @@ void dumpSDTT(unsigned char *ptr, STATION *station, int station_count)
                                                printf("sdts.Name %s id:%d\n", module->Name, sdts.download_id);
 
                                                if ( strstr( module->Name, "CS_LOGO" ) ) {
-                                                       station[0].logo_download_data_id = sdts.download_id;
+                                                       //station[0].logo_download_data_id = sdts.download_id;
                                                }
                                                else if ( strstr( module->Name, "LOGO" ) ) {
                                                        station[0].logo_download_data_id = sdts.download_id;
@@ -279,8 +279,8 @@ void dumpSDTT(unsigned char *ptr, STATION *station, int station_count)
                                cdth.original_network_id, cdth.data_type, 
                                cdth.section_length, cdth.descriptors_loop_length, 
 
-                               cdtdte.logo_type, cdtdte.logo_id, cdtdte.logo_version,
-                               cdtdte.data_size);
+                               sdtdte.logo_type, sdtdte.logo_id, sdtdte.logo_version,
+                               sdtdte.data_size);
 #endif
                        }
                }