Merge branch 'development' into LTS_development
This commit is contained in:
		
						commit
						84de51ab8c
					
				
					 3 changed files with 23 additions and 3 deletions
				
			
		|  | @ -847,7 +847,8 @@ namespace Mist{ | |||
|   } | ||||
| 
 | ||||
|   /// Prepares all tracks from selectedTracks for seeking to the specified ms position.
 | ||||
|   void Output::seek(unsigned long long pos){ | ||||
|   /// If toKey is true, clips the seek to the nearest keyframe if the main track is a video track.
 | ||||
|   void Output::seek(unsigned long long pos, bool toKey){ | ||||
|     sought = true; | ||||
|     if (!isInitialized){ | ||||
|       initialize(); | ||||
|  | @ -857,6 +858,25 @@ namespace Mist{ | |||
|     if (myMeta.live){ | ||||
|       updateMeta(); | ||||
|     } | ||||
|     if (toKey){ | ||||
|       long unsigned int mainTrack = getMainSelectedTrack(); | ||||
|       //abort toKey if there are no keys in the main track
 | ||||
|       if (!myMeta.tracks.count(mainTrack) || !myMeta.tracks[mainTrack].keys.size()){ | ||||
|         WARN_MSG("Sync-seeking impossible (main track invalid); performing regular seek instead"); | ||||
|         seek(pos); | ||||
|         return; | ||||
|       } | ||||
|       DTSC::Track & Trk = myMeta.tracks[mainTrack]; | ||||
|       if (Trk.type == "video"){ | ||||
|         unsigned long long seekPos = 0; | ||||
|         for (std::deque<DTSC::Key>::iterator it = Trk.keys.begin(); it != Trk.keys.end(); ++it){ | ||||
|           unsigned long long currPos = it->getTime(); | ||||
|           if (currPos > pos){break;}//stop if we're past the point we wanted
 | ||||
|           seekPos = currPos; | ||||
|         } | ||||
|         pos = seekPos; | ||||
|       } | ||||
|     } | ||||
|     MEDIUM_MSG("Seeking to %llums", pos); | ||||
|     std::set<long unsigned int> seekTracks = selectedTracks; | ||||
|     for (std::set<long unsigned int>::iterator it = seekTracks.begin(); it != seekTracks.end(); it++){ | ||||
|  |  | |||
|  | @ -46,7 +46,7 @@ namespace Mist { | |||
|       //non-virtual generic functions
 | ||||
|       virtual int run(); | ||||
|       virtual void stats(bool force = false); | ||||
|       void seek(unsigned long long pos); | ||||
|       void seek(unsigned long long pos, bool toKey = false); | ||||
|       bool seek(unsigned int tid, unsigned long long pos, bool getNextKey = false); | ||||
|       void stop(); | ||||
|       uint64_t currentTime(); | ||||
|  |  | |||
|  | @ -837,7 +837,7 @@ namespace Mist{ | |||
|       amfReply.getContentP(3)->addContent(AMF::Object("details", "DDV")); | ||||
|       amfReply.getContentP(3)->addContent(AMF::Object("clientid", (double)1337)); | ||||
|       sendCommand(amfReply, playMessageType, playStreamId); | ||||
|       seek((long long int)amfData.getContentP(3)->NumValue()); | ||||
|       seek((long long int)amfData.getContentP(3)->NumValue(), true); | ||||
| 
 | ||||
|       //send a status reply
 | ||||
|       AMF::Object amfreply("container", AMF::AMF0_DDV_CONTAINER); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma