Changeset 21072
- Timestamp:
- 04/16/13 22:37:05 (11 years ago)
- Location:
- titan/titan
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/eit.h
r19319 r21072 776 776 } 777 777 m_unlock(&status.epgmutex, 4); 778 779 deloldlinkedchannel(); 778 780 } 779 781 … … 953 955 transponderid = transponderid | ((uint64_t)2 << 32); 954 956 955 if(getlinkedchannel(chnode, serviceid, transponderid ) == NULL)956 addlinkedchannel(chnode, serviceid, transponderid, NULL);957 if(getlinkedchannel(chnode, serviceid, transponderid, epgnode->starttime, epgnode->endtime) == NULL) 958 addlinkedchannel(chnode, serviceid, transponderid, epgnode->starttime, epgnode->endtime, NULL); 957 959 } 958 960 } -
titan/titan/header.h
r20952 r21072 807 807 808 808 //linkedchannel.h 809 struct linkedchannel* addlinkedchannel(struct channel* chnode, int serviceid, uint64_t transponderid, struct linkedchannel* last);809 struct linkedchannel* addlinkedchannel(struct channel* chnode, int serviceid, uint64_t transponderid, time_t starttime, time_t endtime, struct linkedchannel* last); 810 810 void freelinkedchannel(struct channel* chnode); 811 811 void screenlinkedchannel(); 812 struct linkedchannel* getlinkedchannel(struct channel* chnode, int serviceid, uint64_t transponderid); 812 struct linkedchannel* getlinkedchannel(struct channel* chnode, int serviceid, uint64_t transponderid, time_t starttime, time_t endtime); 813 void dellinkedchannel(struct channel* chnode, struct linkedchannel* lnode, int flag); 814 void deloldlinkedchannel(); 813 815 814 816 //zap.h -
titan/titan/linkedchannel.h
r18431 r21072 2 2 #define LINKEDCHANNEL_H 3 3 4 struct linkedchannel* getlinkedchannel(struct channel* chnode, int serviceid, uint64_t transponderid )4 struct linkedchannel* getlinkedchannel(struct channel* chnode, int serviceid, uint64_t transponderid, time_t starttime, time_t endtime) 5 5 { 6 6 if(chnode == NULL) return NULL; … … 11 11 while(node != NULL) 12 12 { 13 if(node->serviceid == serviceid && node->transponderid == transponderid )13 if(node->serviceid == serviceid && node->transponderid == transponderid && node->starttime == starttime && node->endtime == endtime) 14 14 { 15 15 m_unlock(&status.linkedchannelmutex, 14); … … 42 42 void screenlinkedchannel() 43 43 { 44 int rcret = 0, treffer = 0 ;44 int rcret = 0, treffer = 0, akttime = 0; 45 45 struct skin* linkedchannel = getscreen("linkedchannel"); 46 46 struct skin* listbox = getscreennode(linkedchannel, "listbox"); … … 59 59 addscreenrc(linkedchannel, listbox); 60 60 start: 61 akttime = time(NULL); 61 62 tmp = NULL; 62 63 chnode = channel; … … 64 65 if(status.aktservice->channel != NULL) 65 66 { 66 m_lock(&status.linkedchannelmutex, 14); 67 if(status.aktservice->channel->linkedchannel == NULL) 68 { 69 while(chnode != NULL) 67 m_lock(&status.linkedchannelmutex, 14); 68 while(chnode != NULL) 69 { 70 node = chnode->linkedchannel; 71 while(node != NULL) 70 72 { 71 node = chnode->linkedchannel; 72 while(node != NULL) 73 if(node->serviceid == status.aktservice->channel->serviceid && node->transponderid == status.aktservice->channel->transponderid && akttime >= node->starttime && akttime < node->endtime) 73 74 { 74 if(node->serviceid == status.aktservice->channel->serviceid && node->transponderid == status.aktservice->channel->transponderid) 75 { 76 node = chnode->linkedchannel; 77 break; 78 } 79 node = node->next; 75 node = chnode->linkedchannel; 76 break; 80 77 } 81 if(node != NULL) break; 82 chnode = chnode->next; 78 node = node->next; 83 79 } 80 if(node != NULL) break; 81 chnode = chnode->next; 84 82 } 85 83 … … 88 86 while(node != NULL) 89 87 { 90 chnode = getchannel(node->serviceid, node->transponderid); 91 if(chnode != NULL) 88 if(akttime >= node->starttime && akttime < node->endtime) 92 89 { 93 epgnode = getepgakt(chnode); 94 //don't show linked channel with start/end 1day 95 if(epgnode != NULL && epgnode->endtime - epgnode->starttime >= 86400) 90 chnode = getchannel(node->serviceid, node->transponderid); 91 if(chnode != NULL) 96 92 { 97 node = node->next; 98 continue; 99 } 100 tmp = addlistbox(linkedchannel, listbox, tmp, 1); 101 if(tmp != NULL) 102 { 103 if(chnode == status.aktservice->channel) 104 treffer = 1; 105 if(treffer == 0) 106 listbox->aktline++; 107 tmpstr = ostrcat(tmpstr, chnode->name, 1, 0); 108 if(epgnode != NULL) 93 epgnode = getepgakt(chnode); 94 //don't show linked channel with start/end 1day 95 if(epgnode != NULL && epgnode->endtime - epgnode->starttime >= 86400) 109 96 { 110 tmpstr = ostrcat(tmpstr, " - ", 1, 0); 111 if(buf != NULL) 97 node = node->next; 98 continue; 99 } 100 tmp = addlistbox(linkedchannel, listbox, tmp, 1); 101 if(tmp != NULL) 102 { 103 if(chnode == status.aktservice->channel) 104 treffer = 1; 105 if(treffer == 0) 106 listbox->aktline++; 107 tmpstr = ostrcat(tmpstr, chnode->name, 1, 0); 108 if(epgnode != NULL) 112 109 { 113 loctime = olocaltime(&epgnode->starttime); 114 ostrftime(buf, MINMALLOC, "%H:%M ", loctime); 115 free(loctime); loctime = NULL; 116 tmpstr = ostrcat(tmpstr, buf, 1, 0); 110 tmpstr = ostrcat(tmpstr, " - ", 1, 0); 111 if(buf != NULL) 112 { 113 loctime = olocaltime(&epgnode->starttime); 114 ostrftime(buf, MINMALLOC, "%H:%M ", loctime); 115 free(loctime); loctime = NULL; 116 tmpstr = ostrcat(tmpstr, buf, 1, 0); 117 } 118 tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0); 117 119 } 118 tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0); 120 changetext(tmp, tmpstr); 121 free(tmpstr); tmpstr = NULL; 122 tmp->handle = (char*)chnode; 119 123 } 120 changetext(tmp, tmpstr);121 free(tmpstr); tmpstr = NULL;122 tmp->handle = (char*)chnode;123 124 } 124 125 } … … 128 129 } 129 130 130 if(treffer == 0) listbox->aktline = 1; 131 if(treffer == 0) 132 { 133 listbox->aktline = 1; 134 treffer = 1; 135 } 131 136 132 137 drawscreen(linkedchannel, 0, 0); … … 153 158 } 154 159 155 struct linkedchannel* addlinkedchannel(struct channel* chnode, int serviceid, uint64_t transponderid, struct linkedchannel* last)160 struct linkedchannel* addlinkedchannel(struct channel* chnode, int serviceid, uint64_t transponderid, time_t starttime, time_t endtime, struct linkedchannel* last) 156 161 { 157 162 debug(1000, "in"); … … 173 178 newnode->serviceid = serviceid; 174 179 newnode->transponderid = transponderid; 180 newnode->starttime = starttime; 181 newnode->endtime = endtime; 175 182 176 183 m_lock(&status.linkedchannelmutex, 14); … … 202 209 } 203 210 211 //flag 0: lock 212 //flag 1: nolock 213 void dellinkedchannel(struct channel* chnode, struct linkedchannel* lnode, int flag) 214 { 215 if(chnode == NULL) 216 { 217 debug(1000, "out-> NULL detect"); 218 return; 219 } 220 221 if(flag == 0) m_lock(&status.linkedchannelmutex, 14); 222 223 struct linkedchannel *node = chnode->linkedchannel, *prev = chnode->linkedchannel; 224 225 while(node != NULL) 226 { 227 if(node == lnode) 228 { 229 if(node == chnode->linkedchannel) 230 chnode->linkedchannel = node->next; 231 else 232 prev->next = node->next; 233 234 free(node); 235 node = NULL; 236 break; 237 } 238 239 prev = node; 240 node = node->next; 241 } 242 if(flag == 0) m_unlock(&status.linkedchannelmutex, 14); 243 } 244 204 245 void freelinkedchannel(struct channel* chnode) 205 246 { … … 225 266 free(prev); 226 267 prev = NULL; 227 228 268 } 229 269 m_unlock(&status.linkedchannelmutex, 14); … … 231 271 } 232 272 273 void deloldlinkedchannel() 274 { 275 struct channel* chnode = channel; 276 struct linkedchannel* node = NULL; 277 278 m_lock(&status.linkedchannelmutex, 14); 279 while(chnode != NULL) 280 { 281 if(chnode->linkedchannel != NULL) 282 { 283 node = channel->linkedchannel; 284 while(node != NULL) 285 { 286 if(node->endtime + 60 < time(NULL)) 287 dellinkedchannel(chnode, node, 1); 288 node = node->next; 289 } 290 } 291 chnode = chnode->next; 292 } 293 m_unlock(&status.linkedchannelmutex, 14); 294 } 295 233 296 #endif -
titan/titan/service.h
r20871 r21072 30 30 freeaudiotrack(chnode); 31 31 freesubtitle(chnode); 32 freelinkedchannel(chnode);33 32 freepmt(chnode); 34 33 freecadesc(chnode); -
titan/titan/struct.h
r20981 r21072 1033 1033 uint64_t transponderid; 1034 1034 int serviceid; 1035 time_t starttime; 1036 time_t endtime; 1035 1037 struct linkedchannel* next; 1036 1038 };
Note: See TracChangeset
for help on using the changeset viewer.