Fixed messed up merge. Really, guys?
This commit is contained in:
		
							parent
							
								
									80f3588b56
								
							
						
					
					
						commit
						6890632e9d
					
				
					 3 changed files with 36 additions and 30 deletions
				
			
		src/output
| 
						 | 
				
			
			@ -112,8 +112,37 @@ namespace Mist {
 | 
			
		|||
    cfg->addBasicConnectorOptions(capa);
 | 
			
		||||
    config = cfg;
 | 
			
		||||
  }
 | 
			
		||||
  //HIER
 | 
			
		||||
  
 | 
			
		||||
  ///this function generates the PMT packet
 | 
			
		||||
  std::string OutHLS::createPMT(){
 | 
			
		||||
    TS::ProgramMappingTable PMT;
 | 
			
		||||
    PMT.PID(4096);
 | 
			
		||||
    PMT.setTableId(2);
 | 
			
		||||
    PMT.setSectionLength(0xB017);
 | 
			
		||||
    PMT.setProgramNumber(1);
 | 
			
		||||
    PMT.setVersionNumber(0);
 | 
			
		||||
    PMT.setCurrentNextIndicator(0);
 | 
			
		||||
    PMT.setSectionNumber(0);
 | 
			
		||||
    PMT.setLastSectionNumber(0);
 | 
			
		||||
    PMT.setPCRPID(0x100 + (*(selectedTracks.begin())) - 1);
 | 
			
		||||
    PMT.setProgramInfoLength(0);
 | 
			
		||||
    short id = 0;
 | 
			
		||||
    //for all selected tracks
 | 
			
		||||
    for (std::set<long unsigned int>::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
 | 
			
		||||
      if (myMeta.tracks[*it].codec == "H264"){
 | 
			
		||||
        PMT.setStreamType(0x1B,id);
 | 
			
		||||
      }else if (myMeta.tracks[*it].codec == "AAC"){
 | 
			
		||||
        PMT.setStreamType(0x0F,id);
 | 
			
		||||
      }else if (myMeta.tracks[*it].codec == "MP3"){
 | 
			
		||||
        PMT.setStreamType(0x03,id);
 | 
			
		||||
      }
 | 
			
		||||
      PMT.setElementaryPID(0x100 + (*it) - 1, id);
 | 
			
		||||
      PMT.setESInfoLength(0,id);
 | 
			
		||||
      id++;
 | 
			
		||||
    }
 | 
			
		||||
    PMT.calcCRC();
 | 
			
		||||
    return PMT.getStrBuf();
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  void OutHLS::fillPacket(bool & first, const char * data, size_t dataLen, char & ContCounter){
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -123,7 +152,8 @@ namespace Mist {
 | 
			
		|||
      PackData.Clear();
 | 
			
		||||
      if (PacketNumber % 42 == 0){
 | 
			
		||||
        HTTP_S.Chunkify(TS::PAT, 188, myConn);
 | 
			
		||||
        HTTP_S.Chunkify(TS::PMT, 188, myConn);
 | 
			
		||||
        std::string PMT = createPMT();
 | 
			
		||||
        HTTP_S.Chunkify(PMT, myConn);
 | 
			
		||||
        PacketNumber += 2;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -131,11 +161,7 @@ namespace Mist {
 | 
			
		|||
    if (!dataLen){return;}
 | 
			
		||||
    
 | 
			
		||||
    if (PackData.BytesFree() == 184){
 | 
			
		||||
      if (myMeta.tracks[currentPacket.getTrackId()].type == "video"){
 | 
			
		||||
        PackData.PID(0x100);
 | 
			
		||||
      }else{
 | 
			
		||||
        PackData.PID(0x101);
 | 
			
		||||
      }
 | 
			
		||||
      PackData.PID(0x100 - 1 + currentPacket.getTrackId());
 | 
			
		||||
      PackData.ContinuityCounter(ContCounter++);
 | 
			
		||||
      if (first){
 | 
			
		||||
        PackData.UnitStart(1);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,13 +10,13 @@ namespace Mist {
 | 
			
		|||
      OutHLS(Socket::Connection & conn);
 | 
			
		||||
      ~OutHLS();
 | 
			
		||||
      static void init(Util::Config * cfg);
 | 
			
		||||
      
 | 
			
		||||
      void onRequest();
 | 
			
		||||
      void onFail();
 | 
			
		||||
      void sendNext();
 | 
			
		||||
    protected:
 | 
			
		||||
      HTTP::Parser HTTP_S;
 | 
			
		||||
      HTTP::Parser HTTP_R;      
 | 
			
		||||
      HTTP::Parser HTTP_R;
 | 
			
		||||
      std::string createPMT();
 | 
			
		||||
      void fillPacket(bool & first, const char * data, size_t dataLen, char & ContCounter);
 | 
			
		||||
      std::string liveIndex();
 | 
			
		||||
      std::string liveIndex(int tid);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,11 +67,7 @@ namespace Mist {
 | 
			
		|||
    if (!dataLen){return;}
 | 
			
		||||
    
 | 
			
		||||
    if (PackData.BytesFree() == 184){
 | 
			
		||||
      if (myMeta.tracks[currentPacket.getTrackId()].type == "video"){
 | 
			
		||||
        PackData.PID(0x100);
 | 
			
		||||
      }else{
 | 
			
		||||
        PackData.PID(0x101);
 | 
			
		||||
      }
 | 
			
		||||
      PackData.PID(0x100 - 1 + currentPacket.getTrackId());
 | 
			
		||||
      PackData.ContinuityCounter(ContCounter++);
 | 
			
		||||
      if (first){
 | 
			
		||||
        PackData.UnitStart(1);
 | 
			
		||||
| 
						 | 
				
			
			@ -138,21 +134,6 @@ namespace Mist {
 | 
			
		|||
 | 
			
		||||
  ///this function generates the PMT packet
 | 
			
		||||
  std::string OutTS::createPMT(){
 | 
			
		||||
    //0x02 = table ID = 2 = PMT
 | 
			
		||||
    //0xB017 = section syntax(1) = 1, 0(1)=0, reserved(2) = 3, section_len(12) = 23
 | 
			
		||||
    //0x0001 = ProgNo = 1
 | 
			
		||||
    //0xC1 = reserved(2) = 3, version(5)=0, curr_next_indi(1) = 1
 | 
			
		||||
    //0x00 = section_number = 0
 | 
			
		||||
    //0x00 = last_section_no = 0
 | 
			
		||||
    //0xE100 = reserved(3) = 7, PCR_PID(13) = 0x100
 | 
			
		||||
    //0xF000 = reserved(4) = 15, proginfolen = 0
 | 
			
		||||
    //0x1B = streamtype = 27 = H264
 | 
			
		||||
    //0xE100 = reserved(3) = 7, elem_ID(13) = 0x100
 | 
			
		||||
    //0xF000 = reserved(4) = 15, es_info_len = 0
 | 
			
		||||
    //0x0F = streamtype = 15 = audio with ADTS transport syntax
 | 
			
		||||
    //0xE101 = reserved(3) = 7, elem_ID(13) = 0x101
 | 
			
		||||
    //0xF000 = reserved(4) = 15, es_info_len = 0
 | 
			
		||||
    //0x2F44B99B = CRC32
 | 
			
		||||
    TS::ProgramMappingTable PMT;
 | 
			
		||||
    PMT.PID(4096);
 | 
			
		||||
    PMT.setTableId(2);
 | 
			
		||||
| 
						 | 
				
			
			@ -179,7 +160,6 @@ namespace Mist {
 | 
			
		|||
      id++;
 | 
			
		||||
    }
 | 
			
		||||
    PMT.calcCRC();
 | 
			
		||||
    INFO_MSG("stringsize: %d %s", PMT.getStrBuf().size(), PMT.toPrettyString(0).c_str());
 | 
			
		||||
    return PMT.getStrBuf();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue