/// <summary> /// Pakete sind ungefiltert aber sauber ausgerichtet und fehlerfrei. /// </summary> /// <param name="buffer">Ts-Packet</param> /// <param name="size">sollte immer vielfaches von 188 byte sein.</param> /// <returns></returns> public static byte ProcessRawTs(IntPtr buffer, int size) { try { _DvbAdapter.ProcessRawTs(buffer, size); } catch (Exception ex) { LogProvider.Exception(cLogSection, Message.DvbvProcessFailed, ex); } return(0); }
private void FilterDataArrival(int filter, int len, IntPtr data) { if (_Disposed) { LogProvider.Add(DebugLevel.Error, cLogSection, Message.MdapiCtxFilterDisposed, filter, FilterPid); return; } try { int offset = 0; if (len % cTsPacketSize == 0) { _Adapter.ProcessRawTs(data, len); } else { // ggf. Header versteckt. if (len == (cTsPacketSize - cTsHeaderSize) && Marshal.ReadByte(data, -4) == cTsSyncByte) { _Adapter.ProcessRawTs(data - 4, cTsPacketSize); } else // Header rekonstruieren { if (len % (cTsPacketSize - cTsHeaderSize) == 0) { while (offset < len) { bool c = _Section.AddPacket(data + offset); if (c) { SectionBase t = _Section; while (t != null) { if (t.Finished) { byte[] packets = t.Packetize(ref _ContCounter); if (packets != null) { IntPtr p = Marshal.AllocHGlobal(packets.Length); Marshal.Copy(packets, 0, p, packets.Length); _Adapter.ProcessRawTs(p, packets.Length); Marshal.FreeHGlobal(p); } } else { _Section = t; break; } t = t.NextSection; } } if (_Section.Finished) { _Section = new SectionBase(FilterPid, _FilterTables); } offset += cTsPacketSize - cTsHeaderSize; } } // ansonsten nicht parsbar... } } } catch (Exception ex) { LogProvider.Exception(cLogSection, Message.MdapiCtxProcessFailed, ex); } }