Added force parameter to DTSCFix, various fixes in smooth connector.
This commit is contained in:
		
							parent
							
								
									a7edacd720
								
							
						
					
					
						commit
						48fad86c26
					
				
					 2 changed files with 23 additions and 9 deletions
				
			
		|  | @ -94,7 +94,7 @@ namespace Connector_HTTP { | |||
|       for (unsigned int i = 0; i < allAudio.ObjBegin()->second["keylen"].size(); i++){ | ||||
|         Result << "<c "; | ||||
|         if (i == 0){ | ||||
|           Result << "t=\"" << allAudio.ObjBegin()->second["keytime"][i].asInt() * 10000 << "\" "; | ||||
|           Result << "t=\"" << allAudio.ObjBegin()->second["keytime"][0u].asInt() * 10000 << "\" "; | ||||
|         } | ||||
|         Result << "d=\"" << allAudio.ObjBegin()->second["keylen"][i].asInt() * 10000 << "\" />\n"; | ||||
|       } | ||||
|  | @ -318,10 +318,17 @@ namespace Connector_HTTP { | |||
|                  | ||||
|                 //Wrap everything in mp4 boxes
 | ||||
|                 MP4::MFHD mfhd_box; | ||||
|                 for (int i = 0; i < Strm.metadata["keytime"].size(); i++){ | ||||
|                   if (Strm.metadata["keytime"][i].asInt() >= (requestedTime / 10000)){ | ||||
|                     mfhd_box.setSequenceNumber(Strm.metadata["keynum"][i].asInt()); | ||||
|                     myDuration = Strm.metadata["keylen"][i].asInt() * 10000; | ||||
|                 JSON::Value trackRef; | ||||
|                 if (wantsVideo){ | ||||
|                   trackRef = allVideo.ObjBegin()->second; | ||||
|                 } | ||||
|                 if (wantsAudio){ | ||||
|                   trackRef = allAudio.ObjBegin()->second; | ||||
|                 } | ||||
|                 for (int i = 0; i < trackRef["keytime"].size(); i++){ | ||||
|                   if (trackRef["keytime"][i].asInt() >= (requestedTime / 10000)){ | ||||
|                     mfhd_box.setSequenceNumber(trackRef["keynum"][i].asInt()); | ||||
|                     myDuration = trackRef["keylen"][i].asInt() * 10000; | ||||
|                     break; | ||||
|                   } | ||||
|                 } | ||||
|  | @ -391,11 +398,12 @@ namespace Connector_HTTP { | |||
|                   conn.SendNow(dataBuffer.front()); | ||||
|                   dataBuffer.pop_front(); | ||||
|                 } | ||||
|                 conn.SendNow("\r\n",2); | ||||
|               } | ||||
|               dataBuffer.clear(); | ||||
|               dataSize = 0; | ||||
|             } | ||||
|             if ((wantsAudio && Strm.lastType() == DTSC::AUDIO) || (wantsVideo && Strm.lastType() == DTSC::VIDEO)){ | ||||
|             if (Strm.lastType() == DTSC::AUDIO || Strm.lastType() == DTSC::VIDEO){ | ||||
|               //Select only the data that the client has requested.
 | ||||
|               dataBuffer.push_back(Strm.lastData()); | ||||
|               dataSize += Strm.lastData().size(); | ||||
|  |  | |||
|  | @ -33,7 +33,7 @@ namespace Converters { | |||
|       std::cerr << "This file is too old to fix - please reconvert." << std::endl; | ||||
|       return 1; | ||||
|     } | ||||
|     if (oriheader["moreheader"].asInt() > 0){ | ||||
|     if (oriheader["moreheader"].asInt() > 0 && !conf.getBool("force")){ | ||||
|       if (meta.isMember("tracks") && meta["tracks"].size() > 0){ | ||||
|         bool isFixed = true; | ||||
|         for ( JSON::ObjIter trackIt = meta["tracks"].ObjBegin(); trackIt != meta["tracks"].ObjEnd(); trackIt ++) { | ||||
|  | @ -71,6 +71,11 @@ namespace Converters { | |||
|       if (it->second["trackid"].asInt() >= nextFreeID){ | ||||
|         nextFreeID = it->second["trackid"].asInt() + 1; | ||||
|       } | ||||
|       it->second.removeMember("keylen"); | ||||
|       it->second.removeMember("keybpos"); | ||||
|       it->second.removeMember("frags"); | ||||
|       it->second.removeMember("keytime"); | ||||
|       it->second.removeMember("keynum"); | ||||
|     } | ||||
| 
 | ||||
|     F.selectTracks(tmp); | ||||
|  | @ -139,7 +144,7 @@ namespace Converters { | |||
|           } | ||||
|         } | ||||
|       }else{ | ||||
|         if ((F.getJSON()["time"].asInt() - trackData[currentID].lastKeyTime) > 1000){ | ||||
|         if ((F.getJSON()["time"].asInt() - trackData[currentID].lastKeyTime) > 5000){ | ||||
|           trackData[currentID].lastKeyTime = F.getJSON()["time"].asInt(); | ||||
|           meta["tracks"][currentID]["keytime"].append(F.getJSON()["time"]); | ||||
|           meta["tracks"][currentID]["keybpos"].append(F.getLastReadPos()); | ||||
|  | @ -188,7 +193,7 @@ namespace Converters { | |||
|           currFrag = meta["tracks"][it->first]["keytime"][i].asInt() / 10000; | ||||
|           long long int fragLen = 1; | ||||
|           long long int fragDur = meta["tracks"][it->first]["keylen"][i].asInt(); | ||||
|           for (unsigned int j = i; j < meta["tracks"][it->first]["keytime"].size(); j++){ | ||||
|           for (unsigned int j = i + 1; j < meta["tracks"][it->first]["keytime"].size(); j++){ | ||||
|             if (meta["tracks"][it->first]["keytime"][j].asInt() / 10000 > currFrag || j == meta["tracks"][it->first]["keytime"].size() - 1){ | ||||
|               JSON::Value thisFrag; | ||||
|               thisFrag["num"] = meta["tracks"][it->first]["keynum"][i]; | ||||
|  | @ -233,6 +238,7 @@ namespace Converters { | |||
| int main(int argc, char ** argv){ | ||||
|   Util::Config conf = Util::Config(argv[0], PACKAGE_VERSION); | ||||
|   conf.addOption("filename", JSON::fromString("{\"arg_num\":1, \"arg\":\"string\", \"help\":\"Filename of the file to attempt to fix.\"}")); | ||||
|   conf.addOption("force", JSON::fromString("{\"short\":\"f\", \"long\":\"force\", \"default\":0, \"help\":\"Force fixing.\"}")); | ||||
|   conf.parseArgs(argc, argv); | ||||
|   return Converters::DTSCFix(conf); | ||||
| } //main
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Erik Zandvliet
						Erik Zandvliet