Changeset 25462
- Timestamp:
- 01/05/14 15:19:09 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/tsSchnitt/tsSchnitt.c
r25459 r25462 14 14 char* recname = NULL; 15 15 char* cutfile = NULL; 16 int zielsec = 0; 16 17 17 18 struct stimerthread* tsSchnittThread = NULL; … … 36 37 char* tmpstr = NULL; 37 38 char* tmpstr2 = NULL; 38 char* tmpstr3 = NULL; 39 char* epgfile = NULL; 40 char* epgcutfile = NULL; 39 41 int z = 0; 40 42 int rc; 41 unsigned int buf[3];42 43 43 44 tsSchnittThreadKill = addtimer(&tsSchnitt_thread_kill, START, 10000, 1, NULL, NULL, NULL); … … 49 50 off64_t pos; 50 51 off64_t time; 51 off64_t mtime; 52 off64_t mtime = 0; 53 epgfile = changefilenameext(recfile, ".epg"); 54 tmpstr = changefilenameext(epgfile, ".cut"); 55 epgcutfile = ostrcat(tmpstr, ".epg", 0, 0); 56 free(tmpstr); tmpstr=NULL; 52 57 tmpstr2 = changefilenameext(recfile, ".ma"); 53 58 //tmpstr2 = ostrcat("\"",tmpstr2, 0, 0); … … 68 73 tmpstr = ostrcat(tmpstr, " -ss ", 0, 0); 69 74 tmpstr = ostrcat(tmpstr, convert_timesec(time), 0, 0); 70 71 75 tmpstr = ostrcat(tmpstr, " -i \"",0, 0); 72 76 tmpstr = ostrcat(tmpstr, recfile, 0, 0); … … 80 84 tmpstr = ostrcat(tmpstr, " -t ", 0, 0); 81 85 tmpstr = ostrcat(tmpstr, convert_timesec(time - mtime), 0, 0); 86 zielsec= time - mtime; 82 87 tmpstr = ostrcat(tmpstr, " \"", 0, 0); 83 88 tmpstr = ostrcat(tmpstr, cutfile, 0, 0); … … 102 107 { 103 108 ischnitt = 2; 109 tmpstr = ostrcat(tmpstr, "cp \"", 0, 0); 110 tmpstr = ostrcat(tmpstr, epgfile, 0, 0); 111 tmpstr = ostrcat(tmpstr, "\" \"", 0, 0); 112 tmpstr = ostrcat(tmpstr, epgcutfile, 0, 0); 113 tmpstr = ostrcat(tmpstr, "\"", 0, 0); 114 rc = system(tmpstr); 115 free(tmpstr);tmpstr= NULL; 104 116 textbox(_("INFO"), _("Schnitt erfolgreich beendet"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); 105 117 } … … 112 124 } 113 125 free(tmpstr); tmpstr = NULL; 126 free(epgfile); epgfile=NULL; 127 free(epgcutfile); epgcutfile=NULL; 114 128 } 115 129 … … 148 162 free(recfile); recfile=NULL; 149 163 free(recname); recname=NULL; 164 150 165 delmarkedscreen(122); 151 166 pluginaktiv = 0; … … 156 171 void start(void) 157 172 { 173 174 long long unsigned int lenpts = 0; 175 long long unsigned int startpts1 = 0; 176 long long unsigned int endpts = 0; 177 long long unsigned int aktbitrate = 0; 178 int recfd = -1; 179 158 180 char* tmpstr = NULL; 159 181 char* tmpstr2 = NULL; 160 182 int rcret; 161 int rcm;162 183 int help; 163 184 struct stat64 rdat; … … 175 196 while(1) 176 197 { 177 198 178 199 if(recfile == NULL) 179 200 recfile = ostrcat(recfile, getconfig("tsSchnitt_recfile", NULL), 0, 0); 180 181 201 if(recfile == NULL && tsSchnittThread == NULL) 202 { 182 203 imarker = 0; 183 204 ischnitt = 0; … … 190 211 else 191 212 imarker = 2; 192 free(tmpstr); tmpstr=NULL; 193 tmpstr = changefilenameext(recfile, ".cut"); 194 cutfile = ostrcat(tmpstr, ".ts", 0, 0); 195 free(tmpstr); tmpstr=NULL; 196 if(isfile(cutfile) == 1 && tsSchnittThread == NULL) 213 free(tmpstr); tmpstr=NULL; 214 if(cutfile == NULL) 215 { 216 tmpstr = changefilenameext(recfile, ".cut"); 217 cutfile = ostrcat(tmpstr, ".ts", 0, 0); 218 free(tmpstr); tmpstr=NULL; 219 } 220 if(isfile(cutfile) == 1 && tsSchnittThread == NULL) 197 221 ischnitt = 2; 198 222 else if(tsSchnittThread == NULL && ischnitt != 3) … … 223 247 if(ischnitt == 0) 224 248 { 225 changetext(schnitt, "gestop t");249 changetext(schnitt, "gestoppt"); 226 250 changetext(schnittprog, "0.0%"); 227 251 schnittprog->progresssize = 0; … … 235 259 if(stat64(recfile, &rdat) == 0) 236 260 { 261 rdat.st_size = (rdat.st_size * zielsec) / getconfigint("tsSchnitt_lenrec", NULL); 237 262 help = (100 * cdat.st_size) / rdat.st_size; 238 263 schnittprog->progresssize = help; … … 277 302 recfile = screendir("/var/media/hdd/movie", "*.ts", NULL, NULL, NULL, NULL, 0, "SELECT", 0, NULL, 0, NULL, 0, 1200, 0, 600, 0, 0); 278 303 addconfig("tsSchnitt_recfile", recfile); 304 recfd = open(recfile, O_RDONLY | O_LARGEFILE); 305 gettsinfo(recfd, &lenpts, &startpts1, &endpts, &aktbitrate, 188); 306 lenpts = lenpts / 90000; 307 addconfigint("tsSchnitt_lenrec", lenpts); 308 close(recfd); 279 309 free(recfile);recfile=NULL; 280 310 free(recname);recname=NULL; 311 free(cutfile); cutfile=NULL; 281 312 break; 282 313 } … … 292 323 drawscreen(load, 0, 0); 293 324 tsSchnittThread = addtimer(&tsSchnitt_thread, START, 10000, 1, NULL, NULL, NULL); 294 sleep( 1);325 sleep(4); 295 326 clearscreen(load); 296 327 break; … … 319 350 if(stat64(recfile, &rdat) == 0) 320 351 { 352 rdat.st_size = (rdat.st_size * zielsec) / getconfigint("tsSchnitt_lenrec", NULL); 321 353 help = (100 * cdat.st_size) / rdat.st_size; 322 354 schnittprog->progresssize = help;
Note: See TracChangeset
for help on using the changeset viewer.