public override void sendStreamResponse(NetworkStream ns, ref HTTPResponseStruct rp, int SendBufferSize) { if (command.sourceType == SourceType.File) { if (command.streamType == StreamType.File) { if (rp.fs != null) { using (rp.fs) { if (command.HTTPRequest.Args == null || command.HTTPRequest.Args.Count == 0) { sendStream(ns, SendBufferSize, LoadMemoryStreamFromFile(rp.fs)); } else { MemoryStream ms = new ffMpegFileConvert(this.vsAppPath).ConvertToWmv(rp.fs.Name, command.videoSize).VideoStream; sendStream(ns, SendBufferSize, ms);// rp.fs.Close(); // sendStream(ns, SendBufferSize, rp.fs);// } } } } else if (command.streamType == StreamType.MJpeg) { string fileName = Path.Combine(this.DataFolder, command.urlSource.Replace("/", "\\"));//command.urlSource; int framRate = command.framRate; Size videoSize = command.videoSize; int videoQuanlity = command.videoQuanlity; sendStreamMjpegFromFile(fileName, ns, SendBufferSize, framRate, videoSize, videoQuanlity); } } if (command.sourceType == SourceType.Live) { if (command.streamType == StreamType.Jpeg) { } else if (command.streamType == StreamType.MJpeg) { // string fileName = "data\\42.wmv"; string camID = command.urlSource; int framRate = command.framRate; Size videoSize = command.videoSize; int videoQuanlity = command.videoQuanlity; //sendStreamMjpegFromFile(ns, SendBufferSize, fileName, framRate, videoSize, videoQuanlity); sendStreamMjpegFromProvider(getProvider(camID), ns, SendBufferSize, framRate, videoSize, videoQuanlity); //sendStreamMjpegFromProvider(getProvider("camera-210-01.coe.psu.ac.th"), ns, SendBufferSize, framRate, videoSize, videoQuanlity); } } }
public override void sendStreamResponse(NetworkStream ns, ref HTTPResponseStruct rp, int SendBufferSize) { if (command.sourceType == SourceType.File) { if (command.streamType == StreamType.File) { if (rp.fs != null) using (rp.fs) { if (command.HTTPRequest.Args == null || command.HTTPRequest.Args.Count == 0) { sendStream(ns, SendBufferSize, LoadMemoryStreamFromFile(rp.fs)); } else { MemoryStream ms = new ffMpegFileConvert(this.vsAppPath).ConvertToWmv(rp.fs.Name, command.videoSize).VideoStream; sendStream(ns, SendBufferSize, ms);// rp.fs.Close(); // sendStream(ns, SendBufferSize, rp.fs);// } } } else if (command.streamType == StreamType.MJpeg) { string fileName = Path.Combine(this.DataFolder, command.urlSource.Replace("/", "\\"));//command.urlSource; int framRate = command.framRate; Size videoSize = command.videoSize; int videoQuanlity = command.videoQuanlity; sendStreamMjpegFromFile(fileName, ns, SendBufferSize, framRate, videoSize, videoQuanlity); } } if (command.sourceType == SourceType.Live) { if (command.streamType == StreamType.Jpeg) { } else if (command.streamType == StreamType.MJpeg) { // string fileName = "data\\42.wmv"; string camID = command.urlSource; int framRate = command.framRate; Size videoSize = command.videoSize; int videoQuanlity = command.videoQuanlity; //sendStreamMjpegFromFile(ns, SendBufferSize, fileName, framRate, videoSize, videoQuanlity); sendStreamMjpegFromProvider(getProvider(camID), ns, SendBufferSize, framRate, videoSize, videoQuanlity); //sendStreamMjpegFromProvider(getProvider("camera-210-01.coe.psu.ac.th"), ns, SendBufferSize, framRate, videoSize, videoQuanlity); } } }