Fixed a bug in player CPU Usage, added language option to SRT2DTSC.

This commit is contained in:
Erik Zandvliet 2013-09-03 09:47:43 +02:00 committed by Thulinma
parent 4fb1a65fa1
commit 6ea6f91795
2 changed files with 6 additions and 2 deletions

View file

@ -181,6 +181,7 @@ int main(int argc, char** argv){
in_out.setBlocking(false); in_out.setBlocking(false);
if (in_out.Received().get().size() >= 2){ if (in_out.Received().get().size() >= 2){
playUntil = atoi(in_out.Received().get().substr(2).c_str()); playUntil = atoi(in_out.Received().get().substr(2).c_str());
lastTime = 0;
bench = Util::getMS(); bench = Util::getMS();
}else{ }else{
playUntil = 0; playUntil = 0;

View file

@ -21,7 +21,7 @@ namespace Converters {
///\brief Converts FLV from stdin to DTSC on stdout. ///\brief Converts FLV from stdin to DTSC on stdout.
///\return The return code for the converter. ///\return The return code for the converter.
int SRT2DTSC(){ int SRT2DTSC(Util::Config & conf){
int lineNum; int lineNum;
int beginH, beginM, beginS, beginMs; int beginH, beginM, beginS, beginMs;
int endH, endM, endS, endMs; int endH, endM, endS, endMs;
@ -32,6 +32,7 @@ namespace Converters {
meta["tracks"]["track3"]["trackid"] = 3ll; meta["tracks"]["track3"]["trackid"] = 3ll;
meta["tracks"]["track3"]["type"] = "meta"; meta["tracks"]["track3"]["type"] = "meta";
meta["tracks"]["track3"]["codec"] = "srt"; meta["tracks"]["track3"]["codec"] = "srt";
meta["tracks"]["track3"]["language"] = conf.getString("language");
std::cout << meta.toNetPacked(); std::cout << meta.toNetPacked();
JSON::Value newPack; JSON::Value newPack;
while (std::cin.good()){ while (std::cin.good()){
@ -59,6 +60,8 @@ namespace Converters {
///\brief Entry point for SRT2DTSC, simply calls Converters::SRT2DTSC(). ///\brief Entry point for SRT2DTSC, simply calls Converters::SRT2DTSC().
int main(int argc, char ** argv){ int main(int argc, char ** argv){
Util::Config conf = Util::Config(argv[0], PACKAGE_VERSION); Util::Config conf = Util::Config(argv[0], PACKAGE_VERSION);
conf.addOption("language",
JSON::fromString("{\"arg_num\":1,\"value\":[\"?\"], \"help\": \"The language of these subtitles.\"}"));
conf.parseArgs(argc, argv); conf.parseArgs(argc, argv);
return Converters::SRT2DTSC(); return Converters::SRT2DTSC(conf);
} //main } //main