home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Language specific support
Deutsches MediaPortal Forum
Allgemein
Einsteigerforum
TS Packet Checker
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="KayDiefenthal" data-source="post: 1261298" data-attributes="member: 22825"><p>ok sah halt ein wenig aus wie visual basic</p><p></p><p>[code] </p><p>private void RtpListenerThread()</p><p> {</p><p> try</p><p> {</p><p> try</p><p> { </p><p> </p><p> while (!_rtpListenerThreadStopEvent.WaitOne(1))</p><p> {</p><p> byte[] receivedbytes = _udpClient.Receive(ref _serverEndPoint);</p><p> //Decode the RTPPacket</p><p> RtpPacket packet = RtpPacket.Decode(receivedbytes);</p><p> // Check if RTPPacket has Payload and the PayloadType is M2TS</p><p> if((packet.HasPayload)&&(packet.PayloadType==33))</p><p> {</p><p> //Callculate how many TsPackets are in the RTPPacket Payload</p><p> double numberOfTsPackets = (packet.Payload.Length / 188.0) - 1.0;</p><p> for (double j = 0.0; j <= numberOfTsPackets; j++)</p><p> {</p><p> // Create an Byte[] where we can store the TransportStream Packet Bytes</p><p> byte[] tspacketBuffer = (byte[])Array.CreateInstance(typeof(byte), 188);</p><p> Array.Copy(packet.Payload, (int)Math.Round((double)((j * 188))), tspacketBuffer, 0, 188);</p><p> // Read the TSPacket Header</p><p> var header = TsHeader.Decode(tspacketBuffer);</p><p> // Check that the Header is not Null and that tere is no Transport Error</p><p> if((header != null) && (!header.TransportErrorIndicator))</p><p> {</p><p> _filestream.Write(tspacketBuffer, 0, tspacketBuffer.Length);</p><p> _filestream.Flush();</p><p> }</p><p> } </p><p> } </p><p> }</p><p> }</p><p> finally</p><p> {</p><p> switch (_transmissionMode)</p><p> {</p><p> case TransmissionMode.Multicast:</p><p> _udpClient.DropMulticastGroup(_multicastEndPoint.Address);</p><p> _udpClient.Close();</p><p> break;</p><p> case TransmissionMode.Unicast:</p><p> _udpClient.Close();</p><p> break;</p><p> } </p><p> }</p><p> }</p><p> catch (ThreadAbortException)</p><p> {</p><p> }</p><p> catch (Exception ex)</p><p> {</p><p> Logger.Error(string.Format("SAT>IP : RTP listener thread exception"), ex);</p><p> return;</p><p> }</p><p> Logger.Warn("SAT>IP : RTP listener thread stopping");</p><p> }</p><p></p><p></p><p>[/code]</p><p></p><p>denke damit sollten so manche TsPackete ausgefiltert werden bevor sie im file landen</p></blockquote><p></p>
[QUOTE="KayDiefenthal, post: 1261298, member: 22825"] ok sah halt ein wenig aus wie visual basic [code] private void RtpListenerThread() { try { try { while (!_rtpListenerThreadStopEvent.WaitOne(1)) { byte[] receivedbytes = _udpClient.Receive(ref _serverEndPoint); //Decode the RTPPacket RtpPacket packet = RtpPacket.Decode(receivedbytes); // Check if RTPPacket has Payload and the PayloadType is M2TS if((packet.HasPayload)&&(packet.PayloadType==33)) { //Callculate how many TsPackets are in the RTPPacket Payload double numberOfTsPackets = (packet.Payload.Length / 188.0) - 1.0; for (double j = 0.0; j <= numberOfTsPackets; j++) { // Create an Byte[] where we can store the TransportStream Packet Bytes byte[] tspacketBuffer = (byte[])Array.CreateInstance(typeof(byte), 188); Array.Copy(packet.Payload, (int)Math.Round((double)((j * 188))), tspacketBuffer, 0, 188); // Read the TSPacket Header var header = TsHeader.Decode(tspacketBuffer); // Check that the Header is not Null and that tere is no Transport Error if((header != null) && (!header.TransportErrorIndicator)) { _filestream.Write(tspacketBuffer, 0, tspacketBuffer.Length); _filestream.Flush(); } } } } } finally { switch (_transmissionMode) { case TransmissionMode.Multicast: _udpClient.DropMulticastGroup(_multicastEndPoint.Address); _udpClient.Close(); break; case TransmissionMode.Unicast: _udpClient.Close(); break; } } } catch (ThreadAbortException) { } catch (Exception ex) { Logger.Error(string.Format("SAT>IP : RTP listener thread exception"), ex); return; } Logger.Warn("SAT>IP : RTP listener thread stopping"); } [/code] denke damit sollten so manche TsPackete ausgefiltert werden bevor sie im file landen [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Language specific support
Deutsches MediaPortal Forum
Allgemein
Einsteigerforum
TS Packet Checker
Contact us
RSS
Top
Bottom