Merge branch 'development' into LTS_development
# Conflicts: # src/output/output_progressive_flv.cpp # src/output/output_rtmp.cpp
This commit is contained in:
		
						commit
						de4fea643a
					
				
					 5 changed files with 134 additions and 71 deletions
				
			
		|  | @ -182,7 +182,11 @@ const char * FLV::Tag::getVideoCodec() { | |||
| const char * FLV::Tag::getAudioCodec() { | ||||
|   switch (data[11] & 0xF0) { | ||||
|     case 0x00: | ||||
|       return "PCMPE"; | ||||
|       if (data[11] & 0x02){ | ||||
|         return "PCMPE";//unknown endianness
 | ||||
|       }else{ | ||||
|         return "PCM";//8 bit is always regular PCM
 | ||||
|       } | ||||
|     case 0x10: | ||||
|       return "ADPCM"; | ||||
|     case 0x20: | ||||
|  |  | |||
|  | @ -132,6 +132,18 @@ namespace Mist { | |||
|       return getNext(); | ||||
|     } | ||||
|     thisPacket.genericFill(tmpTag.tagTime(), tmpTag.offset(), tmpTag.getTrackID(), tmpTag.getData(), tmpTag.getDataLen(), lastBytePos, tmpTag.isKeyframe); //init packet from tmpTags data
 | ||||
| 
 | ||||
|     DTSC::Track & trk = myMeta.tracks[tmpTag.getTrackID()]; | ||||
|     if (trk.codec == "PCM" && trk.size == 16){ | ||||
|       char * ptr = 0; | ||||
|       uint32_t ptrSize = 0; | ||||
|       thisPacket.getString("data", ptr, ptrSize); | ||||
|       for (uint32_t i = 0; i < ptrSize; i+=2){ | ||||
|         char tmpchar = ptr[i]; | ||||
|         ptr[i] = ptr[i+1]; | ||||
|         ptr[i+1] = tmpchar; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   void inputFLV::seek(int seekTime) { | ||||
|  |  | |||
|  | @ -174,7 +174,17 @@ namespace Mist { | |||
|       H.Chunkify("", 0, myConn); | ||||
|       return; | ||||
|     } | ||||
|     tag.DTSCLoader(thisPacket, myMeta.tracks[thisPacket.getTrackId()]); | ||||
|     DTSC::Track & trk = myMeta.tracks[thisPacket.getTrackId()]; | ||||
|     tag.DTSCLoader(thisPacket, trk); | ||||
|     if (trk.codec == "PCM" && trk.size == 16){ | ||||
|       char * ptr = tag.getData(); | ||||
|       uint32_t ptrSize = tag.getDataLen(); | ||||
|       for (uint32_t i = 0; i < ptrSize; i+=2){ | ||||
|         char tmpchar = ptr[i]; | ||||
|         ptr[i] = ptr[i+1]; | ||||
|         ptr[i+1] = tmpchar; | ||||
|       } | ||||
|     } | ||||
|     if (tag.len){ | ||||
|       H.Chunkify(tag.data, tag.len, myConn); | ||||
|     } | ||||
|  |  | |||
|  | @ -103,7 +103,17 @@ namespace Mist { | |||
|       } | ||||
|     } | ||||
| 
 | ||||
|     tag.DTSCLoader(thisPacket, myMeta.tracks[thisPacket.getTrackId()]); | ||||
|     DTSC::Track & trk = myMeta.tracks[thisPacket.getTrackId()]; | ||||
|     tag.DTSCLoader(thisPacket, trk); | ||||
|     if (trk.codec == "PCM" && trk.size == 16){ | ||||
|       char * ptr = tag.getData(); | ||||
|       uint32_t ptrSize = tag.getDataLen(); | ||||
|       for (uint32_t i = 0; i < ptrSize; i+=2){ | ||||
|         char tmpchar = ptr[i]; | ||||
|         ptr[i] = ptr[i+1]; | ||||
|         ptr[i+1] = tmpchar; | ||||
|       } | ||||
|     } | ||||
|     myConn.SendNow(tag.data, tag.len);  | ||||
|     if (config->getBool("keyframeonly")){ | ||||
|       config->is_active = false; | ||||
|  |  | |||
|  | @ -293,6 +293,8 @@ namespace Mist { | |||
|                          0, 0, 0, 0}; //bytes 12-15 = extended timestamp
 | ||||
|     char dataheader[] ={0, 0, 0, 0, 0}; | ||||
|     unsigned int dheader_len = 1; | ||||
|     static char * swappyPointer = 0; | ||||
|     static uint32_t swappySize = 0; | ||||
|     char * tmpData = 0;//pointer to raw media data
 | ||||
|     unsigned int data_len = 0;//length of processed media data
 | ||||
|     thisPacket.getString("data", tmpData, data_len); | ||||
|  | @ -344,6 +346,22 @@ namespace Mist { | |||
|         dataheader[0] |= 0x10; | ||||
|       } | ||||
|       if (track.codec == "PCM"){ | ||||
|         if (track.size == 16){ | ||||
|           if (swappySize < data_len){ | ||||
|             char * tmp = (char*)realloc(swappyPointer, data_len); | ||||
|             if (!tmp){ | ||||
|               FAIL_MSG("Could not allocate data for PCM endianness swap!"); | ||||
|               return; | ||||
|             } | ||||
|             swappyPointer = tmp; | ||||
|             swappySize = data_len; | ||||
|           } | ||||
|           for (uint32_t i = 0; i < data_len; i+=2){ | ||||
|             swappyPointer[i] = tmpData[i+1]; | ||||
|             swappyPointer[i+1] = tmpData[i]; | ||||
|           } | ||||
|           tmpData = swappyPointer; | ||||
|         } | ||||
|         dataheader[0] |= 0x30; | ||||
|       } | ||||
|       if (track.codec == "Nellymoser"){ | ||||
|  | @ -1127,6 +1145,15 @@ namespace Mist { | |||
|               onFinish(); | ||||
|               break; | ||||
|             } | ||||
|             if (myMeta.tracks[reTrack].codec == "PCM" && myMeta.tracks[reTrack].size == 16){ | ||||
|               char * ptr = F.getData(); | ||||
|               uint32_t ptrSize = F.getDataLen(); | ||||
|               for (uint32_t i = 0; i < ptrSize; i+=2){ | ||||
|                 char tmpchar = ptr[i]; | ||||
|                 ptr[i] = ptr[i+1]; | ||||
|                 ptr[i+1] = tmpchar; | ||||
|               } | ||||
|             } | ||||
|             thisPacket.genericFill(tagTime, F.offset(), reTrack, F.getData(), F.getDataLen(), 0, F.isKeyframe); | ||||
|             ltt = tagTime; | ||||
|             if (!nProxy.userClient.getData()){ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma