public IContainer ChildContainer(container aContainer) { return(null); }
public IContainer ChildContainer(container aContainer) { return(new ContainerPlaylist(aContainer)); }
public IContainer ChildContainer(container aContainer) { return(new ContainerMediaServer(iMediaServer, aContainer)); }
public IContainer ChildContainer(container aContainer) { return(iWrapped.ChildContainer(aContainer)); }
QuickImport(container, Definition, Data, ShuffleEventHandler, null);
void run() { try { HttpResponseMessage response = client.GetAsync(url).Result; string startTimestamp = DateTime.Now.ToString().Replace(":", "-"); if (response.StatusCode == System.Net.HttpStatusCode.OK) { string data = ASCIIEncoding.ASCII.GetString(response.Content.ReadAsByteArrayAsync().Result); string fileName = exeDirectory + startTimestamp + "-master.json"; File.WriteAllText(fileName, data); container c = JsonConvert.DeserializeObject <container>(data); if (c != null) { int segmentsCount = 0; run_processStarted(); video videoSegments = null; audio audioSegments = null; //calculate segments count using audio or video stream if (c.audios != null && c.audios.Length > 0) { audioSegments = c.audios[c.audios.Length - 1]; segmentsCount = audioSegments.segments.Length; } if (c.videos != null && c.videos.Length > 0) { videoSegments = c.videos[0]; //берём лудшую качеству foreach (video v in c.videos) { if (v.width > videoSegments.width) { videoSegments = v; segmentsCount = videoSegments.segments.Length; } } } if (segmentsCount > 0) { run_updateProgress(0, segmentsCount); int sepIndex = url.IndexOf("/sep/"); string baseUrl = url.Substring(0, sepIndex + 5); string videoUrl = baseUrl + video.path + videoSegments.base_url; string audioUrl = baseUrl + audioSegments.base_url.Replace("../", ""); Directory.CreateDirectory(exeDirectory + startTimestamp); string directory = exeDirectory + startTimestamp; List <string> audioFilesList = new List <string>(); List <string> videoFilesList = new List <string>(); // zero segment stored in json file if (audioSegments != null) { string audioFileName = directory + "\\a[0000].m4s"; File.WriteAllBytes(audioFileName, audioSegments.segment0); audioFilesList.Add(audioFileName); } if (videoSegments != null) { string videoFileName = directory + "\\v[0000].m4s"; File.WriteAllBytes(videoFileName, videoSegments.segment0); videoFilesList.Add(videoFileName); } HttpClient audioClient = new HttpClient(); HttpClient videoClient = new HttpClient(); for (int i = 0; i < segmentsCount; i++) { if (shouldStop) { return; } //for index 0 we have name (and real part) 1.m4s string videoSegmentUrl = videoUrl + videoSegments.segments[i].url; string audioSegmentUrl = audioUrl + videoSegments.segments[i].url; string videoFileName = directory + String.Format("\\v[{0:d4}].m4s", i + 1); string audioFileName = directory + String.Format("\\a[{0:d4}].m4s", i + 1); var vTask = videoClient.GetAsync(videoSegmentUrl); var aTask = audioClient.GetAsync(audioSegmentUrl); byte[] vData = vTask.Result.Content.ReadAsByteArrayAsync().Result; byte[] aData = aTask.Result.Content.ReadAsByteArrayAsync().Result; File.WriteAllBytes(videoFileName, vData); File.WriteAllBytes(audioFileName, aData); audioFilesList.Add(audioFileName); videoFilesList.Add(videoFileName); if (shouldStop) { return; } run_updateProgress(i, segmentsCount); } string concatAudioFileName = directory + "\\audio.m4s"; string concatVideoFileName = directory + "\\video.m4s"; //concatenate files using (FileStream fs = File.Create(concatAudioFileName)) { for (int i = 0; i < audioFilesList.Count; i++) { byte[] tmpData = File.ReadAllBytes(audioFilesList[i]); fs.Write(tmpData, 0, tmpData.Length); run_updateProgress(i, segmentsCount); } } using (FileStream fs = File.Create(concatVideoFileName)) { for (int i = 0; i < videoFilesList.Count; i++) { byte[] tmpData = File.ReadAllBytes(videoFilesList[i]); fs.Write(tmpData, 0, tmpData.Length); run_updateProgress(i, segmentsCount); } } //concatenate video+audio ProcessStartInfo cmd = new ProcessStartInfo(exeDirectory + "ffmpeg.exe", String.Format("-i \"{0}\\video.m4s\" -i \"{0}\\audio.m4s\" -c copy \"{0}\\output.mp4\"", directory)); cmd.WorkingDirectory = directory; Process pConcatenate = Process.Start(cmd); //delete temprory files if (checkBoxDeleteTemp.Checked) { for (int i = 0; i < videoFilesList.Count; i++) { File.Delete(videoFilesList[i]); File.Delete(audioFilesList[i]); run_updateProgress(i, segmentsCount); } while (!pConcatenate.HasExited) { if (shouldStop) { return; } Thread.Sleep(100); } File.Delete(concatAudioFileName); File.Delete(concatVideoFileName); } if (checkBoxMove.Checked) { string newDirectory = textBoxBaseFolder.Text + "\\" + textBoxNewFolder.Text; string src = Path.Combine(directory, "output.mp4"); string dst = Path.Combine(newDirectory, "output.mp4"); Directory.CreateDirectory(newDirectory); File.Move(src, dst); directory = newDirectory; } //open output directory ProcessStartInfo openFolder = new ProcessStartInfo { FileName = "explorer.exe", Arguments = directory }; //MessageBox.Show(openFolder.Arguments); Process.Start(openFolder); if (checkBoxClose.Checked) { run_close(); } } } } else { MessageBox.Show(response.ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } if (!shouldStop) { run_resetForm(); } }
public IContainer ChildContainer(container aContainer) { return(new ContainerSharedPlaylist(iPlaylistManager, aContainer)); }
/// <summary> /// Creates a /// <see cref="MediaContainer"/> /// object, given a metadata instantiation /// block. /// </summary> /// <param name="info"> /// The metadata to use when instantiating the media. /// </param> /// <returns>a new media container</returns> public static MediaContainer CreateContainer (container info) { MediaContainer newObj = new MediaContainer(); SetObjectProperties(newObj, info); return newObj; }
MatchExitBlock(container, exitBlock, returnVar));
public Network(int p, string id, int cap) { port = p; msgbox = new container(id, cap); }
=> container.AddControlPassThrough(new Picture(container, x, y, texture) { SourceRectangle = sourceRectangle ?? new(0, 0, texture.Width, texture.Height), Scale = scale ?? Vector2.One, Color = color ?? Color.White, });
CompileProperty(container, property, fields);
QuickImport(container, Definition, Data, ShuffleEventHandler, defpath, false);
public ContainerPlaylist(container aContainer) { iMutex = new Mutex(false); iMetadata = aContainer; iPlaylist = new Playlist(aContainer.Id); }
public IContainer ChildContainer(container aContainer) { throw new NotSupportedException(); }
public IContainer ChildContainer(container aContainer) { throw new NotImplementedException(); }
container.OnUpdateAfterChildren = () => onUpdateAfterChildren(container, circular);
private CompleteConfig loadCurrentConfig() { CompleteConfig ret = new CompleteConfig(); XmlDocument doc = new XmlDocument(); doc.LoadXml(File.ReadAllText( workingDirectory + "current.config")); XmlNodeList list = doc.GetElementsByTagName("appSettings"); XmlNode servicemodelsection = null; if (list.Count == 1) servicemodelsection = list[0]; IEnumerator it = servicemodelsection.ChildNodes.GetEnumerator(); while (it.MoveNext()) { XmlNode temp = (XmlNode)it.Current; if (temp.Name.Equals("add", StringComparison.CurrentCultureIgnoreCase)) { container c = new container(); XmlAttribute a = temp.Attributes["key"]; XmlAttribute v = temp.Attributes["value"]; if (a != null && v != null) { c.key = a.Value; c.value = v.Value; ret.items.Add(c); } } } return ret; }
private void WriteConfigFile(string filename) { try { config.items.Clear(); //convert to the internal form foreach (DataGridViewRow r in dataGridView1.Rows) { container c = new container(); c.key = r.Cells[0].Value.ToString(); c.value = r.Cells[1].Value.ToString(); config.items.Add(c); } XmlDocument doc = new XmlDocument(); doc.LoadXml("<?xml version=\"1.0\"?><configuration> <appSettings> </appSettings></configuration>"); XmlNodeList list = doc.GetElementsByTagName("appSettings"); XmlNode servicemodelsection = null; if (list.Count == 1) servicemodelsection = list[0]; else { MessageBox.Show("a strange error occured, please report this"); } for (int i = 0; i < config.items.Count; i++) { XmlElement e = doc.CreateElement("add"); e.SetAttribute("key", config.items[i].key); e.SetAttribute("value", config.items[i].value); servicemodelsection.AppendChild(e); } XmlWriterSettings xws = new XmlWriterSettings(); xws.ConformanceLevel = ConformanceLevel.Document; xws.Indent = true; // xws.OutputMethod = XmlOutputMethod.Xml; XmlWriter xw = XmlWriter.Create(filename, xws); doc.Save(xw); xw.Flush(); xw.Close(); } catch (Exception ex) { MessageBox.Show("error " + ex.Message); } }