public BlueMux(string fileName, TsFileType fileType, List<StreamInfo> StreamsToKeep, bool fAsync, bool fProcessAudio, bool fMlpToAc3) { fsw = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None, Constants.DISK_BUFFER, fAsync); this.tsiow = new TsIo(null, fsw, Constants.DISK_BUFFER); this.fileType = fileType; this.StreamsToKeep = StreamsToKeep; this.buffer = new List<TsPacket>(); this.currentPcr = -1; this.lastPcr = -1; this.lastDelta = -1; this.pcrOffset = -1; this.lastPts = -1; this.currentPts = -1; this.ptsDelta = -1; this.ptsOffset = 0; this.ptsCount = -1; this.pcrPacket = null; this.header = new byte[4]; this.supHeader = new byte[10]; this.supHeader[0] = (byte)'P'; this.supHeader[1] = (byte)'G'; this.VideoType = 0; this.lastPacket = null; this.sitCount = 0; this.packetCount = 0; this.epData = new List<EpElement>(); this.pmtStreams = null; this.lastPtsList = new Dictionary<ushort, long>(); this.soundFrames = new Dictionary<ushort, List<byte>>(); this.processAudio = fProcessAudio; this.MlpToAc3 = fMlpToAc3; CreatePsi(); }
public static PesFile OpenFile(string path, bool useAsync, BackgroundWorker openWorker) { PesFile pf = null; FileStream fs = null; fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, Constants.DISK_BUFFER, useAsync); try { TsIo tsior = new TsIo(fs, null, Constants.DISK_BUFFER ); TsFileType fileType = GetFileType(fs); switch (fileType) { case TsFileType.EVOB: pf = new EvoPesFile(openWorker); break; case TsFileType.M2TS: pf = new TsPesFile(openWorker,4); break; case TsFileType.TS: pf = new TsPesFile(openWorker,0); break; case TsFileType.SUP_ELEMENTARY: pf = new SupPesFile(openWorker); break; case TsFileType.MKV: pf = new MkvPesFile(openWorker); break; } pf.fileType = fileType; pf.fs = fs; pf.tsior = tsior; pf.GetInitialValues(); pf.ParseElementaryStreams(); } catch (Exception) { fs.Close(); throw; } return pf; }
public void CloseFile() { fs.Close(); fs = null; tsior = null; }
protected PesFile(BackgroundWorker openWorker) { fs = null; tsior = null; fileType = TsFileType.UNKNOWN; startPcr = -1; endPcr = -1; sis = null; pcrDelegate = null; ptsDelegate = null; this.openWorker = openWorker; lastPercent = 0; }