void ofxTLSubtitleTrack::reloadSRT(){ loadSRT(subtitles.getFilepath()); }
uint8_t ADMVideoSubtitle::loadSubtitle( void ) { unsigned char c,d; _fd=fopen((char *)_conf->_subname,"rt"); if(!_fd) { GUI_Error_HIG(QT_TR_NOOP("Could not open subtitle file"), NULL); return 0; } // Try to detect utf16 files c=fgetc(_fd); // Skip utf identifier if any if( (c&0xef)==0xef) { int count=4; while(count-- && c&0x80) c=fgetc(_fd); } switch(c) { case '{' : loadSubTitle(); break; case '1' : loadSRT(); break; default: GUI_Error_HIG(QT_TR_NOOP("Cannot identify subtitle format"), NULL); } // Apply delay to subtitles aprintf("[debug] DELAY %d\n", _conf->_delay); if(_conf->_delay) { int32_t newStartTime; int32_t newEndTime; for(uint32_t i=0;i<_line;i++) { aprintf("[debug] BEFORE DELAY (%d) %d %d\n",i, _subs[i].startTime,_subs[i].endTime); newStartTime=_subs[i].startTime; newStartTime+=_conf->_delay; _subs[i].startTime=(newStartTime); newEndTime=_subs[i].endTime; newEndTime+=_conf->_delay; _subs[i].endTime=(newEndTime); // put them at infinit display time // should get rid of them if(newEndTime<0 || newStartTime<0) { _subs[i].startTime=_subs[i].endTime=0; } aprintf("[debug] AFTER DELAY (%d) %d %d\n",i, _subs[i].startTime,_subs[i].endTime); } } fclose(_fd); _fd=NULL; _bitmap=0xffffffff; if(_line) // that way we will have the first sub _oldline=_line-1; return 1; }