/// <summary> /// Asynchronously streams a windows screen and audio capture to a specified IP-Address. /// </summary> /// <returns>The windows screen to ip async.</returns> /// <param name="videoDeviceName">Video device name.</param> /// <param name="audioDeviceName">Audio device name.</param> /// <param name="ip">IP-Address.</param> /// <param name="mode">Streaming mode.</param> /// <param name="frameRate">Desired frame rate.</param> /// <param name="quality">Quality of compression.</param> public async Task<bool> StreamWindowsScreenToIpAsync (string videoDeviceName, string audioDeviceName, string ip, string port, VideoCodec vcodec, AudioCodec acodec, StreamingMode mode, int frameRate, Resolution outputSize, string videoExtras, int quality = 20) { // TODO: -b for bitrate string input = string.Format ( "-f dshow -i video=\"{0}\":audio=\"{1}\" -r {2} -async 1 -vcodec {3} {4} -q {5} -s {6} -maxrate 750k -bufsize 3000k -acodec {7} -ab 128k", videoDeviceName, audioDeviceName, frameRate.ToString(), FFmpegManager.GetCodecName(vcodec), videoExtras, quality.ToString(), outputSize, FFmpegManager.GetCodecName(acodec) ); string output = string.Format ( "-f mpegts udp://{0}:{1}?pkt_size=188?buffer_size=10000000?fifo_size=100000", ip, port ); string args = input + " " + output; try { FFmpegProcess = FFmpegManager.GetFFmpegProcess(args); } catch(FileNotFoundException e) { throw new FileNotFoundException (e.Message, e); } FFmpegProcess.Start (); await Task.Run(() => FFmpegProcess.WaitForExit ()); return true; }
/// <summary> /// Initializes a new instance of the SQL Azure database-based persistence queue using the specified streaming mode, data type and buffer settings. /// </summary> /// <param name="streamingMode">The type of buffer that will be used for streaming operations.</param> /// <param name="streamingDataType">The type of data that will be used for streaming operations.</param> /// <param name="initialBufferSize">The initial size of the buffer where data is being collected before flushed into a SQL Azure database.</param> /// <param name="maxBufferSize">The maximum allowed size of the data buffer.</param> public SqlAzurePersistenceQueue(StreamingMode streamingMode, StreamingDataType streamingDataType, int initialBufferSize, int maxBufferSize) { this.streamingMode = streamingMode; this.streamingDataType = streamingDataType; this.initialBufferSize = initialBufferSize; this.maxBufferSize = maxBufferSize; this.connectionRetryPolicy = RetryPolicyFactory.GetDefaultSqlConnectionRetryPolicy(); this.commandRetryPolicy = RetryPolicyFactory.GetDefaultSqlCommandRetryPolicy(); }
internal static IEnumerable <TarHeader> ReadHeader(StreamingMode mode, Stream stream, Encoding forceEncoding) { while (true) { TarHeader header = null; try { BinaryReader reader = new BinaryReader(stream); header = new TarHeader() { ForceEncoding = forceEncoding }; if (!header.Read(reader)) { yield break; } switch (mode) { case StreamingMode.Seekable: { header.DataStartPosition = reader.BaseStream.Position; //skip to nearest 512 reader.BaseStream.Position += PadTo512(header.Size); } break; case StreamingMode.Streaming: { header.PackedStream = new TarReadOnlySubStream(stream, header.Size); } break; default: { throw new InvalidFormatException("Invalid StreamingMode"); } } } catch { header = null; } yield return(header); } }
internal static IEnumerable <TarEntry> GetEntries(StreamingMode mode, Stream stream, CompressionType compressionType) { foreach (TarHeader h in TarHeaderFactory.ReadHeader(mode, stream)) { if (h != null) { if (mode == StreamingMode.Seekable) { yield return(new TarEntry(new TarFilePart(h, stream), compressionType)); } else { yield return(new TarEntry(new TarFilePart(h, null), compressionType)); } } } }
internal static IEnumerable <TarEntry> GetEntries(StreamingMode mode, Stream stream, SharpCompress.Common.CompressionType compressionType) { foreach (TarHeader iteratorVariable0 in TarHeaderFactory.ReadHeader(mode, stream)) { if (iteratorVariable0 == null) { continue; } if (mode == StreamingMode.Seekable) { yield return(new TarEntry(new TarFilePart(iteratorVariable0, stream), compressionType)); continue; } yield return(new TarEntry(new TarFilePart(iteratorVariable0, null), compressionType)); } }
internal static IEnumerable<TarEntry> GetEntries(StreamingMode mode, Stream stream, CompressionType compressionType) { foreach (TarHeader h in TarHeaderFactory.ReadHeader(mode, stream)) { if (h != null) { if (mode == StreamingMode.Seekable) { yield return new TarEntry(new TarFilePart(h, stream), compressionType); } else { yield return new TarEntry(new TarFilePart(h, null), compressionType); } } } }
internal static IEnumerable <TarHeader> ReadHeader(StreamingMode mode, Stream stream) { TarHeader iteratorVariable0; bool flag2; goto Label_012E; Label_010E: yield return(iteratorVariable0); Label_012E: flag2 = true; iteratorVariable0 = null; try { BinaryReader reader = new BinaryReader(stream); iteratorVariable0 = new TarHeader(); if (iteratorVariable0.Read(reader)) { switch (mode) { case StreamingMode.Streaming: iteratorVariable0.PackedStream = new TarReadOnlySubStream(stream, iteratorVariable0.Size); goto Label_010E; case StreamingMode.Seekable: { iteratorVariable0.DataStartPosition = new long?(reader.BaseStream.Position); Stream baseStream = reader.BaseStream; baseStream.Position += PadTo512(iteratorVariable0.Size); goto Label_010E; } } throw new InvalidFormatException("Invalid StreamingMode"); } goto Label_0135; } catch { iteratorVariable0 = null; } goto Label_010E; Label_0135 :; }
internal static IEnumerable<TarHeader> ReadHeader(StreamingMode mode, Stream stream) { TarHeader iteratorVariable0; bool flag2; goto Label_012E; Label_010E: yield return iteratorVariable0; Label_012E: flag2 = true; iteratorVariable0 = null; try { BinaryReader reader = new BinaryReader(stream); iteratorVariable0 = new TarHeader(); if (iteratorVariable0.Read(reader)) { switch (mode) { case StreamingMode.Streaming: iteratorVariable0.PackedStream = new TarReadOnlySubStream(stream, iteratorVariable0.Size); goto Label_010E; case StreamingMode.Seekable: { iteratorVariable0.DataStartPosition = new long?(reader.BaseStream.Position); Stream baseStream = reader.BaseStream; baseStream.Position += PadTo512(iteratorVariable0.Size); goto Label_010E; } } throw new InvalidFormatException("Invalid StreamingMode"); } goto Label_0135; } catch { iteratorVariable0 = null; } goto Label_010E; Label_0135:; }
internal static IEnumerable<TarHeader> ReadHeader(StreamingMode mode, Stream stream) { while (true) { TarHeader header = null; try { BinaryReader reader = new BinaryReader(stream); header = new TarHeader(); if (!header.Read(reader)) { yield break; } switch (mode) { case StreamingMode.Seekable: { header.DataStartPosition = reader.BaseStream.Position; //skip to nearest 512 reader.BaseStream.Position += PadTo512(header.Size); } break; case StreamingMode.Streaming: { header.PackedStream = new TarReadOnlySubStream(stream, header.Size); } break; default: { throw new InvalidFormatException("Invalid StreamingMode"); } } } catch { header = null; } yield return header; } }
internal RarVolume(StreamingMode mode, RarOptions options) { this.options = options; headerFactory = new RarHeaderFactory(mode, options); }
private const int MAX_SFX_SIZE = 0x80000 - 16; //archive.cpp line 136 internal RarHeaderFactory(StreamingMode mode, Options options, string password = null) { StreamingMode = mode; Options = options; Password = password; }
internal static IEnumerable<TarEntry> GetEntries(StreamingMode mode, Stream stream, SharpCompress.Common.CompressionType compressionType) { foreach (TarHeader iteratorVariable0 in TarHeaderFactory.ReadHeader(mode, stream)) { if (iteratorVariable0 == null) { continue; } if (mode == StreamingMode.Seekable) { yield return new TarEntry(new TarFilePart(iteratorVariable0, stream), compressionType); continue; } yield return new TarEntry(new TarFilePart(iteratorVariable0, null), compressionType); } }
protected ZipHeaderFactory(StreamingMode mode, string password) { this.mode = mode; this.password = password; }
internal RarVolume(StreamingMode mode, Stream stream, string password, Options options) : base(stream, options) { headerFactory = new RarHeaderFactory(mode, options, password); }
private const int MAX_SFX_SIZE = 0x80000 - 16; //archive.cpp line 136 internal RarHeaderFactory(StreamingMode mode, ReaderOptions options) { StreamingMode = mode; Options = options; }
private int MAX_SFX_SIZE = 0x80000 - 16; //archive.cpp line 136 internal RarHeaderFactory(StreamingMode mode, Options options) { StreamingMode = mode; Options = options; }
public static IConnectableObservable <StreamingMessage> StartStreaming(int suffix, StreamingMode mode, string param = null) { if (Tokens == null || suffix >= Tokens.Count || suffix < 0) { return(null); } try { switch (mode) { case StreamingMode.Filter: if (param == null) { return(null); } return(Tokens[suffix].Streaming.FilterAsObservable(replies => "all", track => param).Publish()); default: return(null); } } catch (Exception e) { DebugConsole.Write(e); return(null); } }
private const int MAX_SFX_SIZE = 0x80000 - 16; //archive.cpp line 136 #endregion Fields #region Constructors internal RarHeaderFactory(StreamingMode mode, Options options, string password = null) { StreamingMode = mode; Options = options; Password = password; }
internal static IEnumerable <TarHeader> ReadHeader(StreamingMode mode, Stream stream) =>
internal RarArchiveVolume(StreamingMode mode, RarOptions options) : base(mode, options) { }
/// <summary> /// Initializes a new instance of the SQL Azure database-based persistence queue using the specified streaming mode. /// </summary> /// <param name="streamingMode">The type of buffer that will be used for streaming operations.</param> public SqlAzurePersistenceQueue(StreamingMode streamingMode) : this(streamingMode, StreamingDataType.Raw) { }
/// <summary> /// Initializes a new instance of the SQL Azure database-based persistence queue using the specified streaming mode and data type. /// </summary> /// <param name="streamingMode">The type of buffer that will be used for streaming operations.</param> /// <param name="streamingDataType">The type of data that will be used for streaming operations.</param> public SqlAzurePersistenceQueue(StreamingMode streamingMode, StreamingDataType streamingDataType) : this(streamingMode, streamingDataType, DefaultInitialBufferSize, DefaultMaxBufferSize) { }
public async Task <Option <MediaStream> > SelectAudioStream( MediaVersion version, StreamingMode streamingMode, string channelNumber, string preferredAudioLanguage) { if (streamingMode == StreamingMode.HttpLiveStreamingDirect && string.IsNullOrWhiteSpace(preferredAudioLanguage)) { _logger.LogDebug( "Channel {Number} is HLS Direct with no preferred audio language; using all audio streams", channelNumber); return(None); } var audioStreams = version.Streams.Filter(s => s.MediaStreamKind == MediaStreamKind.Audio).ToList(); string language = (preferredAudioLanguage ?? string.Empty).ToLowerInvariant(); if (string.IsNullOrWhiteSpace(language)) { _logger.LogDebug("Channel {Number} has no preferred audio language code", channelNumber); Option <string> maybeDefaultLanguage = await _configElementRepository.GetValue <string>( ConfigElementKey.FFmpegPreferredLanguageCode); maybeDefaultLanguage.Match( lang => language = lang.ToLowerInvariant(), () => { _logger.LogDebug("FFmpeg has no preferred audio language code; falling back to {Code}", "eng"); language = "eng"; }); } List <string> allCodes = await _searchRepository.GetAllLanguageCodes(new List <string> { language }); if (allCodes.Count > 1) { _logger.LogDebug("Preferred audio language has multiple codes {Codes}", allCodes); } var correctLanguage = audioStreams.Filter( s => allCodes.Any( c => string.Equals( s.Language, c, StringComparison.InvariantCultureIgnoreCase))).ToList(); if (correctLanguage.Any()) { _logger.LogDebug( "Found {Count} audio streams with preferred audio language code(s) {Code}; selecting stream with most channels", correctLanguage.Count, allCodes); return(correctLanguage.OrderByDescending(s => s.Channels).Head()); } _logger.LogDebug( "Unable to find audio stream with preferred audio language code(s) {Code}; selecting stream with most channels", allCodes); return(audioStreams.OrderByDescending(s => s.Channels).Head()); }
protected ZipHeaderFactory(StreamingMode mode, string password, Encoding forceEncoding) { this.mode = mode; this.password = password; this.forceEncoding = forceEncoding; }
public async Task <Option <Subtitle> > SelectSubtitleStream( MediaVersion version, List <Subtitle> subtitles, StreamingMode streamingMode, string channelNumber, string preferredSubtitleLanguage, ChannelSubtitleMode subtitleMode) { if (subtitleMode == ChannelSubtitleMode.None) { return(None); } if (streamingMode == StreamingMode.HttpLiveStreamingDirect && string.IsNullOrWhiteSpace(preferredSubtitleLanguage)) { // _logger.LogDebug( // "Channel {Number} is HLS Direct with no preferred subtitle language; using all subtitle streams", // channel.Number); return(None); } string language = (preferredSubtitleLanguage ?? string.Empty).ToLowerInvariant(); if (string.IsNullOrWhiteSpace(language)) { _logger.LogDebug("Channel {Number} has no preferred subtitle language code", channelNumber); } else { // filter to preferred language List <string> allCodes = await _searchRepository.GetAllLanguageCodes(new List <string> { language }); subtitles = subtitles .Filter( s => allCodes.Any(c => string.Equals(s.Language, c, StringComparison.InvariantCultureIgnoreCase))) .ToList(); } if (subtitles.Count > 0) { switch (subtitleMode) { case ChannelSubtitleMode.Forced: foreach (Subtitle subtitle in subtitles.OrderBy(s => s.StreamIndex).Find(s => s.Forced)) { return(subtitle); } break; case ChannelSubtitleMode.Default: foreach (Subtitle subtitle in subtitles.OrderBy(s => s.Default ? 0 : 1).ThenBy(s => s.StreamIndex)) { return(subtitle); } break; case ChannelSubtitleMode.Any: foreach (Subtitle subtitle in subtitles.OrderBy(s => s.StreamIndex).HeadOrNone()) { return(subtitle); } break; } } _logger.LogDebug( "Found no subtitles for channel {ChannelNumber} with mode {Mode} matching language {Language}", channelNumber, subtitleMode, preferredSubtitleLanguage); return(None); }
protected ZipHeaderFactory(StreamingMode mode, string password, ArchiveEncoding archiveEncoding) { this._mode = mode; this._password = password; this._archiveEncoding = archiveEncoding; }
internal RarVolume(StreamingMode mode, Stream stream, Options options) : this(mode, stream, null, options) { }
static void Main(string[] args) { APIWrapper api = new APIWrapper(); // Search for devices. int[] devID = null; string[] devSN = null; string[] devType = null; ReturnStatus rs = api.DEVICE_Search(ref devID, ref devSN, ref devType); // Reset and connect to the first device detected. rs = api.DEVICE_Reset(devID[0]); rs = api.DEVICE_Connect(devID[0]); // The following is an example on how to use the return status of an API function. // For simplicity, it will not be used in the rest of the program. // This is a fatal error: the device could not be connected. if (rs != ReturnStatus.noError) { Console.WriteLine("\nERROR: " + rs); goto end; } else // print the name of the connected device. { Console.WriteLine("\nCONNECTED TO: " + devType[0]); } // Set the center frequency and reference level. rs = api.CONFIG_SetCenterFreq(103.3e6); rs = api.CONFIG_SetReferenceLevel(-10); // Define parameters for file output. int msec = 5; // Time to record. int numfiles = 10; // Number of files to output. string fn = "IFSTREAM"; // Output file name base. string fp = "."; // Output file path. StreamingMode fmode = StreamingMode.StreamingModeFramed; // Set the streaming mode. int fnsuffix = -1; // Filename suffix. // Prepare for streaming. rs = api.IFSTREAM_SetDiskFilePath(fp); rs = api.IFSTREAM_SetDiskFilenameBase(fn); rs = api.IFSTREAM_SetDiskFilenameSuffix(fnsuffix); rs = api.IFSTREAM_SetDiskFileMode(fmode); rs = api.IFSTREAM_SetDiskFileLength(msec); rs = api.IFSTREAM_SetDiskFileCount(numfiles); // Put the device into Run mode to begin streaming. rs = api.DEVICE_Run(); // Begin streaming. rs = api.IFSTREAM_SetEnable(true); Console.WriteLine("\nIF Streaming has started..."); bool isActive = true; // While IFSTREAM has Active status, continue streaming. while (isActive) { rs = api.IFSTREAM_GetActiveStatus(ref isActive); } // Disconnect the device and finish up. rs = api.IFSTREAM_SetEnable(false); rs = api.DEVICE_Stop(); rs = api.DEVICE_Disconnect(); end: Console.WriteLine("\nIF Data to R3F routine complete."); Console.WriteLine("\nPress enter key to exit..."); Console.ReadKey(); }
internal RarVolume(StreamingMode mode, Stream stream, ReaderOptions options) : base(stream, options) { _headerFactory = new RarHeaderFactory(mode, options); }
internal RarHeaderFactory(StreamingMode mode, Options options) : this(mode, options, null) { }
internal static IEnumerable <TarEntry> GetEntries(StreamingMode mode, Stream stream, SharpCompress.Common.CompressionType compressionType) =>