public FormTranscode(Transcode trans) { InitializeComponent(); _trans = trans; textName.Text = trans.Name; textAudioBitrate.Text = trans.AudioBitrate.ToString(); textChannels.Text = trans.AudioChannels.ToString(); textFps.Text = trans.VideoFps.ToString(new NumberFormatInfo { CurrencyDecimalSeparator = "."}); textHeight.Text = trans.VideoHeight.ToString(); textVideoBitrate.Text = trans.VideoBitrate.ToString(); textWidth.Text = trans.VideoWidth.ToString(); comboAudioCodec.SelectedItem = string.IsNullOrEmpty(trans.AudioCodec) ? "" : trans.AudioCodec; comboMux.SelectedItem = string.IsNullOrEmpty(trans.Incapsulate) ? "ts" : trans.Incapsulate; comboRate.SelectedText = trans.AudioRate > 0 ? trans.AudioRate.ToString() : ""; comboVideoCodec.SelectedItem = string.IsNullOrEmpty(trans.VideoCodec) ? "" : trans.VideoCodec; }
public void LoadSettings() { _sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP); _vlcport = P2pProxyApp.MySettings.GetSetting("vlc", "vlcport", 4212); _passw = P2pProxyApp.MySettings.GetSetting("vlc", "vlcpassw", "admin"); _broadcastport = P2pProxyApp.MySettings.GetSetting("vlc", "vlcbroadcastport", 8082); _cache = P2pProxyApp.MySettings.GetSetting("vlc", "vlccache", 2000); _vlcmuxcache = P2pProxyApp.MySettings.GetSetting("vlc", "vlcmuxcache", 0); _extvlc = P2pProxyApp.MySettings.GetSetting("vlc", "vlcext", false); _extvlcpath = P2pProxyApp.MySettings.GetSetting("vlc", "vlcpath"); if (string.IsNullOrEmpty(_extvlcpath) || !File.Exists(_extvlcpath)) { _extvlc = false; } _broadcasts = new Dictionary <string, string>(); _transcodes = Transcode.LoadTranscodes(); }
public static List <Transcode> LoadTranscodes() { string file = P2pProxyApp.ApplicationDataFolder + "/transcodes.xml"; List <Transcode> listOfTranses = new List <Transcode>(); if (!File.Exists(file)) { return(listOfTranses); } XDocument xd = XDocument.Load(file); var xroot = xd.Element("transcodes"); if (xroot == null) { return(listOfTranses); } foreach (var xe in xroot.Elements("transcode")) { Transcode trans = new Transcode(xe.Attribute("name").Value); string value = xe.Attribute("value").Value; if (string.IsNullOrEmpty(value)) { continue; } var values = value.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (var v in values) { var vs = v.Split("=".ToCharArray(), StringSplitOptions.None); if (vs[0] == VIDEO_CODEC) { trans.VideoCodec = vs[1]; } else if (vs[0] == VIDEO_BITRATE) { ushort.TryParse(vs[1], out trans.VideoBitrate); } else if (vs[0] == VIDEO_FPS) { NumberFormatInfo format = new NumberFormatInfo { CurrencyDecimalSeparator = "." }; float.TryParse(vs[1], NumberStyles.Float, format, out trans.VideoFps); } else if (vs[0] == VIDEO_WIDTH) { ushort.TryParse(vs[1], out trans.VideoWidth); } else if (vs[0] == VIDEO_HEIGHT) { ushort.TryParse(vs[1], out trans.VideoHeight); } else if (vs[0] == AUDIO_CODEC) { trans.AudioCodec = vs[1]; } else if (vs[0] == AUDIO_BITRATE) { ushort.TryParse(vs[1], out trans.AudioBitrate); } else if (vs[0] == AUDIO_CHANNELS) { ushort.TryParse(vs[1], out trans.AudioChannels); } else if (vs[0] == AUDIO_RATE) { uint.TryParse(vs[1], out trans.AudioRate); } else if (vs[0] == INCAPSULATE) { trans.Incapsulate = vs[1]; } } listOfTranses.Add(trans); } return(listOfTranses); }
public void RemoveTranscode(Transcode trans) { _transcodes.Remove(trans); }
public void AddTranscode(Transcode trans) { _transcodes.Add(trans); }
public void SaveTranscodes() { Transcode.SaveTranscodes(_transcodes); }
public static List<Transcode> LoadTranscodes() { string file = P2pProxyApp.ApplicationDataFolder + "/transcodes.xml"; List<Transcode> listOfTranses = new List<Transcode>(); if (!File.Exists(file)) return listOfTranses; XDocument xd = XDocument.Load(file); var xroot = xd.Element("transcodes"); if (xroot == null) return listOfTranses; foreach (var xe in xroot.Elements("transcode")) { Transcode trans = new Transcode(xe.Attribute("name").Value); string value = xe.Attribute("value").Value; if (string.IsNullOrEmpty(value)) continue; var values = value.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (var v in values) { var vs = v.Split("=".ToCharArray(), StringSplitOptions.None); if (vs[0] == VIDEO_CODEC) trans.VideoCodec = vs[1]; else if (vs[0] == VIDEO_BITRATE) ushort.TryParse(vs[1], out trans.VideoBitrate); else if (vs[0] == VIDEO_FPS) { NumberFormatInfo format = new NumberFormatInfo { CurrencyDecimalSeparator = "." }; float.TryParse(vs[1], NumberStyles.Float, format, out trans.VideoFps); } else if (vs[0] == VIDEO_WIDTH) ushort.TryParse(vs[1], out trans.VideoWidth); else if (vs[0] == VIDEO_HEIGHT) ushort.TryParse(vs[1], out trans.VideoHeight); else if (vs[0] == AUDIO_CODEC) trans.AudioCodec = vs[1]; else if (vs[0] == AUDIO_BITRATE) ushort.TryParse(vs[1], out trans.AudioBitrate); else if (vs[0] == AUDIO_CHANNELS) ushort.TryParse(vs[1], out trans.AudioChannels); else if (vs[0] == AUDIO_RATE) uint.TryParse(vs[1], out trans.AudioRate); else if (vs[0] == INCAPSULATE) trans.Incapsulate = vs[1]; } listOfTranses.Add(trans); } return listOfTranses; }
public void RemoveTranscode(Transcode trans) { _transcodes.Remove(trans); }
public void AddTranscode(Transcode trans) { _transcodes.Add(trans); }
private void btnTransAdd_Click(object sender, EventArgs e) { var broadcaster = _app.Broadcaster as VlcBroadcaster; if (broadcaster == null) return; Transcode trans = new Transcode("Новый профиль"); var form = new FormTranscode(trans); form.Closed += (o, args) => { if (form.DialogResult == DialogResult.OK) { broadcaster.AddTranscode(trans); broadcaster.SaveTranscodes(); comboTranscode.Items.Add(trans.Name); comboTranscode.SelectedItem = trans.Name; } }; form.ShowDialog(); }