Fixed bugs in dtsc and theora libs.

This commit is contained in:
Erik Zandvliet 2013-08-27 15:01:48 +02:00
parent 6675b647b8
commit 6cf42561a6
3 changed files with 8 additions and 7 deletions

View file

@ -811,6 +811,7 @@ void DTSC::File::seekNext(){
if ((*it)["time"].asInt() > jsonbuffer["time"].asInt()){ if ((*it)["time"].asInt() > jsonbuffer["time"].asInt()){
tmpPos.seekTime = (*it)["time"].asInt(); tmpPos.seekTime = (*it)["time"].asInt();
tmpPos.seekPos = (*it)["bpos"].asInt(); tmpPos.seekPos = (*it)["bpos"].asInt();
tmpPos.trackID = jsonbuffer["trackid"].asInt();
break; break;
} }
} }
@ -826,7 +827,7 @@ void DTSC::File::seekNext(){
if (insert){ if (insert){
currentPositions.insert(tmpPos); currentPositions.insert(tmpPos);
}else{ }else{
seek_time(jsonbuffer["time"].asInt() + 1, jsonbuffer["trackid"].asInt()); seek_time(jsonbuffer["time"].asInt() + 1, jsonbuffer["trackid"].asInt(), true);
} }
} }
} }
@ -913,10 +914,10 @@ JSON::Value & DTSC::File::getTrackById(int trackNo){
return empty; return empty;
} }
bool DTSC::File::seek_time(int ms, int trackNo){ bool DTSC::File::seek_time(int ms, int trackNo, bool forceSeek){
seekPos tmpPos; seekPos tmpPos;
tmpPos.trackID = trackNo; tmpPos.trackID = trackNo;
if (jsonbuffer && ms > jsonbuffer["time"].asInt() && trackNo >= jsonbuffer["trackid"].asInt()){ if (!forceSeek && 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{

View file

@ -110,7 +110,7 @@ namespace DTSC {
JSON::Value & getJSON(); JSON::Value & getJSON();
JSON::Value & getTrackById(int trackNo); JSON::Value & getTrackById(int trackNo);
bool seek_time(int seconds); bool seek_time(int seconds);
bool seek_time(int seconds, int trackNo); bool seek_time(int seconds, int trackNo, bool forceSeek = false);
bool seek_bpos(int bpos); bool seek_bpos(int bpos);
void writePacket(std::string & newPacket); void writePacket(std::string & newPacket);
void writePacket(JSON::Value & newPacket); void writePacket(JSON::Value & newPacket);

View file

@ -1,4 +1,4 @@
#include<theora.h> #include "theora.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <arpa/inet.h> #include <arpa/inet.h>