Changeset 12456


Ignore:
Timestamp:
12/20/11 18:59:32 (12 years ago)
Author:
gost
Message:

[titan] optimize TS seek

Location:
titan/titan
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/infobar.h

    r12389 r12456  
    103103                        {
    104104                                if(status.playing == 1) {
    105                                         if(status.timeshiftseek > 102) {
    106                                                 timeshiftseek((status.timeshiftseek - 100) / 2 + 100);
    107                                         }
    108                                         else if(status.timeshiftseek == 102) {
     105                                        if(status.timeshiftseek > 102)
    109106                                                timeshiftplay();
    110                                         }
    111                                         else
    112                                                 timeshiftseek(-10);
     107                                        timeshiftseek(-10);
    113108                                }
    114109                                continue;
  • titan/titan/record.h

    r12387 r12456  
    961961{
    962962        off64_t offset;
     963        off64_t bufferoffset;
    963964        off64_t endoffile;
    964965        off64_t currentpos;
     
    981982                return 1;
    982983        }
     984       
     985        m_lock(&status.tsseekmutex, 15);
    983986        if(gettsinfo(dupfd, &pts, &bitrate) != 0)
    984987        {
    985988                err("cant read bitrate");
     989                m_unlock(&status.tsseekmutex, 15);
    986990                return 1;
    987991        }
    988 
    989         endoffile = lseek64(dupfd , 0, SEEK_END);
    990         endoffile = endoffile - RECPLAYBSIZE;
    991         close(dupfd);
    992         m_lock(&status.tsseekmutex, 15);
     992        endoffile = lseek64(dupfd , -188*2, SEEK_END);
     993        close(dupfd);
     994        currentpos = lseek64(servicenode->recsrcfd, 0, SEEK_CUR);
    993995        ret = videoclearbuffer(status.aktservice->videodev);
    994996        ret = audioclearbuffer(status.aktservice->audiodev);
    995         currentpos = lseek64(servicenode->recsrcfd, 0, SEEK_CUR);
    996        
     997
    997998        if(sekunden >= 0) {
    998                 offset = (bitrate / 8) * sekunden;
     999                offset = (bitrate / 8) * sekunden - 5000000;
    9991000                offset = offset - (offset % 188);
    10001001                if(currentpos + offset > endoffile) {
     
    10041005        } else {
    10051006                sekunden = sekunden * -1;
    1006                 offset = (bitrate / 8) * sekunden;
     1007                offset = (bitrate / 8) * sekunden + 5000000;
    10071008                offset = offset - (offset % 188);
    10081009                if(currentpos - offset < 0) {
    1009                         offset = currentpos - RECPLAYBSIZE;
     1010                        offset = currentpos - 188;
    10101011                        offset = offset - (offset % 188);
    10111012                        if(offset < 0)
     
    10151016        }
    10161017        currentpos = lseek64(servicenode->recsrcfd, offset, SEEK_CUR);
    1017        
    10181018        m_unlock(&status.tsseekmutex, 15);
     1019        usleep(500000);
    10191020        status.timeshiftseek = 0;
    1020 
    10211021        return 0;
    10221022}
  • titan/titan/timeshift.h

    r12389 r12456  
    114114                endoffile = lseek64(fd , 0, SEEK_END);
    115115                currentpos = lseek64(servicenode->recsrcfd, 0, SEEK_CUR);
     116                currentpos = currentpos - 5000000;
    116117                timeshiftbar->progresssize = currentpos * 100 / endoffile;
    117118                if(status.timeshiftseek > 100) {
     
    122123                        free(tmpstr); tmpstr = NULL;
    123124                }
    124                 if(status.timeshiftseek < 0) {
    125                         tmpstr = ostrcat(tmpstr,_("skip back"), 1, 0);
     125                if(status.timeshiftseek < 100 && status.timeshiftseek > -100) {
     126                        tmpstr = oitoa(status.timeshiftseek);
     127                        tmpstr = ostrcat(_("skip "), tmpstr, 0, 1);
     128                        tmpstr = ostrcat(tmpstr," sec", 1, 0);
    126129                        changetext(seek, tmpstr);
    127130                        free(tmpstr); tmpstr = NULL;
     
    145148        if(snode != 0) {
    146149                if(sekunden > 100) {
     150                        if(sekunden >= 132) {
     151                                status.timeshiftseek = 116;
     152                                return;
     153                        }
    147154                        status.timeshiftseek = sekunden;
    148155                        sekunden = sekunden - 100;
Note: See TracChangeset for help on using the changeset viewer.