Fixed a bug in determining when to seek.
This commit is contained in:
parent
a2b70298fc
commit
0c50862344
1 changed files with 7 additions and 7 deletions
14
lib/dtsc.cpp
14
lib/dtsc.cpp
|
@ -734,6 +734,7 @@ void DTSC::File::seekNext(){
|
||||||
jsonbuffer.null();
|
jsonbuffer.null();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
clearerr(F);
|
||||||
seek_time(currentPositions.begin()->seekTime + 1, currentPositions.begin()->trackID);
|
seek_time(currentPositions.begin()->seekTime + 1, currentPositions.begin()->trackID);
|
||||||
fseek(F,currentPositions.begin()->seekPos, SEEK_SET);
|
fseek(F,currentPositions.begin()->seekPos, SEEK_SET);
|
||||||
currentPositions.erase(currentPositions.begin());
|
currentPositions.erase(currentPositions.begin());
|
||||||
|
@ -811,19 +812,18 @@ JSON::Value & DTSC::File::getJSON(){
|
||||||
bool DTSC::File::seek_time(int ms, int trackNo){
|
bool DTSC::File::seek_time(int ms, int trackNo){
|
||||||
seekPos tmpPos;
|
seekPos tmpPos;
|
||||||
tmpPos.trackID = trackNo;
|
tmpPos.trackID = trackNo;
|
||||||
//if (jsonbuffer && ms > jsonbuffer["time"].asInt()){
|
if (jsonbuffer && ms > jsonbuffer["time"].asInt() && trackNo >= jsonbuffer["trackid"].asInt()){
|
||||||
// tmpPos.seekTime = jsonbuffer["time"].asInt();
|
tmpPos.seekTime = jsonbuffer["time"].asInt();
|
||||||
// tmpPos.seekPos = getBytePos();
|
tmpPos.seekPos = getBytePos();
|
||||||
//}else{
|
}else{
|
||||||
tmpPos.seekTime = 0;
|
tmpPos.seekTime = 0;
|
||||||
tmpPos.seekPos = 0;
|
tmpPos.seekPos = 0;
|
||||||
// jsonbuffer["time"] = 0u;
|
}
|
||||||
//}
|
|
||||||
for (JSON::ArrIter keyIt = metadata["tracks"][trackMapping[trackNo]]["keys"].ArrBegin(); keyIt != metadata["tracks"][trackMapping[trackNo]]["keys"].ArrEnd(); keyIt++){
|
for (JSON::ArrIter keyIt = metadata["tracks"][trackMapping[trackNo]]["keys"].ArrBegin(); keyIt != metadata["tracks"][trackMapping[trackNo]]["keys"].ArrEnd(); keyIt++){
|
||||||
if ((*keyIt)["time"].asInt() > ms){
|
if ((*keyIt)["time"].asInt() > ms){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((*keyIt)["time"].asInt() > jsonbuffer["time"].asInt()){
|
if ((*keyIt)["time"].asInt() > tmpPos.seekTime){
|
||||||
tmpPos.seekTime = (*keyIt)["time"].asInt();
|
tmpPos.seekTime = (*keyIt)["time"].asInt();
|
||||||
tmpPos.seekPos = (*keyIt)["bpos"].asInt();
|
tmpPos.seekPos = (*keyIt)["bpos"].asInt();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue