Changeset 25462


Ignore:
Timestamp:
01/05/14 15:19:09 (9 years ago)
Author:
gost
Message:

[plugins] fix tsSchnitt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/tsSchnitt/tsSchnitt.c

    r25459 r25462  
    1414char* recname = NULL;
    1515char* cutfile = NULL;
     16int zielsec = 0;
    1617
    1718struct stimerthread* tsSchnittThread = NULL;
     
    3637        char* tmpstr = NULL;
    3738        char* tmpstr2 = NULL;
    38         char* tmpstr3 = NULL;
     39        char* epgfile = NULL;
     40        char* epgcutfile = NULL;
    3941        int z = 0;
    4042        int rc;
    41         unsigned int buf[3];
    4243
    4344        tsSchnittThreadKill = addtimer(&tsSchnitt_thread_kill, START, 10000, 1, NULL, NULL, NULL);
     
    4950                off64_t pos;
    5051                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;
    5257                tmpstr2 = changefilenameext(recfile, ".ma");
    5358                //tmpstr2 = ostrcat("\"",tmpstr2, 0, 0);
     
    6873                                        tmpstr = ostrcat(tmpstr, " -ss ", 0, 0);
    6974                                        tmpstr = ostrcat(tmpstr, convert_timesec(time), 0, 0);
    70 
    7175                                        tmpstr = ostrcat(tmpstr, " -i \"",0, 0);
    7276                                        tmpstr = ostrcat(tmpstr, recfile, 0, 0);
     
    8084                                        tmpstr = ostrcat(tmpstr, " -t ", 0, 0);
    8185                                        tmpstr = ostrcat(tmpstr, convert_timesec(time - mtime), 0, 0);
     86                                        zielsec= time - mtime;
    8287                                        tmpstr = ostrcat(tmpstr, " \"", 0, 0);
    8388                                        tmpstr = ostrcat(tmpstr, cutfile, 0, 0);
     
    102107                        {
    103108                                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;
    104116                                textbox(_("INFO"), _("Schnitt erfolgreich beendet"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
    105117                        }
     
    112124                }
    113125                free(tmpstr); tmpstr = NULL;
     126                free(epgfile); epgfile=NULL;
     127                free(epgcutfile); epgcutfile=NULL;
    114128        }
    115129
     
    148162        free(recfile); recfile=NULL;
    149163        free(recname); recname=NULL;
     164
    150165        delmarkedscreen(122);
    151166        pluginaktiv = 0;
     
    156171void start(void)
    157172{
     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       
    158180        char* tmpstr = NULL;
    159181        char* tmpstr2 = NULL;
    160182        int rcret;
    161         int rcm;
    162183        int help;
    163184        struct stat64 rdat;
     
    175196        while(1)
    176197        {
    177 
     198               
    178199                if(recfile == NULL)
    179200                        recfile = ostrcat(recfile, getconfig("tsSchnitt_recfile", NULL), 0, 0);
    180                 if(recfile == NULL && tsSchnittThread == NULL)
    181                 {
     201                if(recfile == NULL && tsSchnittThread == NULL)
     202                {
    182203                        imarker = 0;
    183204                        ischnitt = 0;
     
    190211                  else
    191212                        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)
    197221                        ischnitt = 2;
    198222                else if(tsSchnittThread == NULL && ischnitt != 3)
     
    223247                if(ischnitt == 0)
    224248                {
    225                         changetext(schnitt, "gestopt");
     249                        changetext(schnitt, "gestoppt");
    226250                        changetext(schnittprog, "0.0%");
    227251                        schnittprog->progresssize = 0;
     
    235259                                if(stat64(recfile, &rdat) == 0)
    236260                                {
     261                                        rdat.st_size = (rdat.st_size * zielsec) / getconfigint("tsSchnitt_lenrec", NULL);
    237262                                        help = (100 * cdat.st_size) / rdat.st_size;
    238263                                                schnittprog->progresssize = help;
     
    277302                                        recfile = screendir("/var/media/hdd/movie", "*.ts", NULL, NULL, NULL, NULL, 0, "SELECT", 0, NULL, 0, NULL, 0, 1200, 0, 600, 0, 0);
    278303                                        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);
    279309                                        free(recfile);recfile=NULL;
    280310                                        free(recname);recname=NULL;
     311                                        free(cutfile); cutfile=NULL;
    281312                                        break;
    282313                                }
     
    292323                                        drawscreen(load, 0, 0);
    293324                                        tsSchnittThread = addtimer(&tsSchnitt_thread, START, 10000, 1, NULL, NULL, NULL);
    294                                         sleep(1);
     325                                        sleep(4);
    295326                                        clearscreen(load);
    296327                                        break;
     
    319350                                        if(stat64(recfile, &rdat) == 0)
    320351                                        {
     352                                        rdat.st_size = (rdat.st_size * zielsec) / getconfigint("tsSchnitt_lenrec", NULL);
    321353                                        help = (100 * cdat.st_size) / rdat.st_size;
    322354                                                schnittprog->progresssize = help;
Note: See TracChangeset for help on using the changeset viewer.