public PreviewForm(ArchiveTranscoderJobSegment segment, String sqlHost, String dbName) { InitializeComponent(); this.sqlHost = sqlHost; this.dbName = dbName; this.segment = segment; this.textBoxStartTime.Text = segment.StartTime; this.textBoxDuration.Text = "300"; useSlideStream = false; Debug.WriteLine("WMP Version: " + this.axWindowsMediaPlayer1.versionInfo); if (segment.VideoDescriptor != null) { this.videoStreamGroup = new StreamGroup(segment.VideoDescriptor); this.labelVideoSource.Text = videoStreamGroup.ToString(); } else { if (Utility.SegmentFlagIsSet(segment, SegmentFlags.SlidesReplaceVideo)) { this.videoStreamGroup = new StreamGroup(segment.PresentationDescriptor.PresentationCname, "Presentation Slides", "dynamicVideo"); useSlideStream = true; } else { Debug.Assert(false); } this.labelVideoSource.Text = "[Presentation] " + videoStreamGroup.Cname; } bool itemChecked = false; closing = false; //We prefer to default to an audio cname that matches the video cname if possible. for (int i = 0; i < segment.AudioDescriptor.Length; i++) { if (segment.AudioDescriptor[i].AudioCname == videoStreamGroup.Cname) { this.checkedListBoxAudioSources.Items.Add(new StreamGroup(segment.AudioDescriptor[i]), CheckState.Checked); itemChecked = true; } else { this.checkedListBoxAudioSources.Items.Add(new StreamGroup(segment.AudioDescriptor[i]), CheckState.Unchecked); } } //..otherwise just use the first one. if (!itemChecked) { if (this.checkedListBoxAudioSources.Items.Count > 0) { this.checkedListBoxAudioSources.SetItemCheckState(0, CheckState.Checked); } } this.setToolTips(); }
/// <summary> /// Wrote a custom 'contains' method here because it may contain a different object with /// the same identifiers if it was preloaded. /// </summary> /// <param name="sg_target"></param> /// <returns></returns> private bool listBoxAudioSourcesContains(StreamGroup sg_target) { foreach (StreamGroup sg in listBoxAudioSources.Items) { if ((sg.Cname == sg_target.Cname) && (sg.Name == sg_target.Name)) { return(true); } } return(false); }
/// <summary> /// If a presentation source is specified, Check to see if decks exist and are matched. If either is not /// the case, prompt the user to do so now. /// </summary> /// <returns></returns> private bool validateDecks(object sender, System.EventArgs e) { if (this.listBoxPresentationSource.Items.Count == 1) { if (slideDecks == null) { StreamGroup sg = (StreamGroup)this.listBoxPresentationSource.Items[0]; if ((sg.Format == PresenterWireFormatType.CPNav) || (sg.Format == PresenterWireFormatType.CPCapability)) { DialogResult dr = MessageBox.Show(this, "You have specified a presentation source, but no slide decks. " + "If no slide decks are specified, Archive Transcoder may not be able to build slide images." + "\r\n\r\nDo you want to specify slide decks now?", "Do you want to specify slide decks?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { this.buttonDeckMatcher_Click(sender, e); return(false); } } } else { bool allmatched = true; for (int i = 0; i < slideDecks.Length; i++) { if (!slideDecks[i].Matched) { allmatched = false; break; } } if (!allmatched) { DialogResult dr = MessageBox.Show(this, "The presentation data contains slide decks which " + "have not been matched to files. " + "If the decks are not matched, Archive Transcoder may not be able to build slide images." + "\r\n\r\nDo you want to match the slide decks now?", "Do you want to specify slide decks?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { this.buttonDeckMatcher_Click(sender, e); return(false); } } } } return(true); }
private void buttonOk_Click(object sender, EventArgs e) { if (this.treeView1.SelectedNode != null) { TreeNode tn = this.treeView1.SelectedNode; if ((tn.Tag != null) && (tn.Tag is StreamGroup)) { StreamGroup sg = (StreamGroup)tn.Tag; if (sg.Payload == "dynamicVideo") { this.videoStreamGroup = sg; this.DialogResult = DialogResult.OK; this.Close(); return; } } } MessageBox.Show("Please select a video stream and try again.", "Error: A Video Stream Type Was Not Selected", MessageBoxButtons.OK, MessageBoxIcon.Error); }
private void treeView1_DoubleClick(object sender, EventArgs e) { if (sender is TreeView) { TreeView tv = (TreeView)sender; TreeNode tn = tv.SelectedNode; if ((tn != null) && (tn.Tag is StreamGroup)) { Participant p = (Participant)tn.Parent.Tag; Conference c = (Conference)tn.Parent.Parent.Tag; StreamGroup s = (StreamGroup)tn.Tag; if (s.Payload == "dynamicVideo") { this.videoStreamGroup = s; this.DialogResult = DialogResult.OK; this.Close(); return; } } } }
/// <summary> /// Add this stream to the appropriate group, or create a new group as necessary. /// </summary> /// <param name="stream"></param> public void AddStream(Stream stream) { if (stream.Payload == "dynamicAudio") { /// if stream name matches an existing group, just add it /// otherwise make a new group. bool matchfound = false; foreach (StreamGroup sg in audioGroups) { if (sg.IsInAudioGroup(stream)) { sg.AddStream(stream); matchfound = true; break; } } if (!matchfound) { StreamGroup newsg = new StreamGroup(this.cname, "", stream.Payload); newsg.AddStream(stream); audioGroups.Add(newsg); } } else if (stream.Payload == "dynamicVideo") { /// if stream name matches an existing group, just add it /// otherwise make a new group. bool matchfound = false; foreach (StreamGroup sg in videoGroups) { if (sg.IsInVideoGroup(stream)) { sg.AddStream(stream); matchfound = true; break; } } if (!matchfound) { StreamGroup newsg = new StreamGroup(this.cname, "", stream.Payload); newsg.AddStream(stream); videoGroups.Add(newsg); } } else if ((stream.Payload == "dynamicPresentation") || //CP running standalone uses dynamicPresentation (stream.Payload == "RTDocument")) //CP as a capability or CXP Presenter uses RTDocument { PresenterWireFormatType wireFormat; PresenterRoleType role; string presenterName; if (PresentationMgr.GetPresentationType(stream, out wireFormat, out role, out presenterName)) { ///PRI2: We need a better solution here: We would like to filter out all non-instructors, but ///we can't afford to look at every frame. if ((wireFormat == PresenterWireFormatType.CPNav) || (wireFormat == PresenterWireFormatType.CPCapability) || (wireFormat == PresenterWireFormatType.RTDocument) || (wireFormat == PresenterWireFormatType.CP3)) // && (role == PresenterRoleType.Instructor)) { //add to existing group if there is a match bool matchfound = false; foreach (StreamGroup sg in presGroups) { if (sg.IsInPresGroup(stream, wireFormat, role)) { sg.AddStream(stream); matchfound = true; break; } } //if no match, create a new group if (!matchfound) { StreamGroup newsg = new StreamGroup(this.cname, "", stream.Payload); newsg.AddStream(stream, wireFormat, role); presGroups.Add(newsg); } } } } }
private void treeViewSources_DoubleClick(object sender, System.EventArgs e) { if (sender is TreeView) { TreeView tv = (TreeView)sender; TreeNode tn = tv.SelectedNode; if ((tn != null) && (tn.Tag is StreamGroup)) //<--lame { Participant p = (Participant)tn.Parent.Tag; Conference c = (Conference)tn.Parent.Parent.Tag; StreamGroup s = (StreamGroup)tn.Tag; //changed conference.. reset some things: if (!listBoxConference.Items.Contains(c.Start.ToString() + " - " + c.Description)) { listBoxConference.Items.Clear(); listBoxConference.Items.Add(c.Start.ToString() + " - " + c.Description); listBoxVideoSource.Items.Clear(); listBoxAudioSources.Items.Clear(); listBoxPresentationSource.Items.Clear(); //default time range is the entire conference //textBoxStart.Text = c.Start.ToString(Constants.dtformat); textBoxStart.Text = Utility.GetLocalizedDateTimeString(c.Start, Constants.timeformat); //textBoxEnd.Text = c.End.ToString(Constants.dtformat); textBoxEnd.Text = Utility.GetLocalizedDateTimeString(c.End, Constants.timeformat); this.buttonRemoveAudio.Enabled = false; } if (s.Payload == "dynamicVideo") { if (!this.checkBoxSlidesReplaceVideo.Checked) { this.listBoxVideoSource.Items.Clear(); this.listBoxVideoSource.Items.Add(s); } } else if (s.Payload == "dynamicAudio") { if (!listBoxAudioSourcesContains(s)) { this.listBoxAudioSources.Items.Add(s); } } else if ((s.Payload == "dynamicPresentation") || (s.Payload == "RTDocument")) { this.listBoxPresentationSource.Items.Clear(); this.listBoxPresentationSource.Items.Add(s); this.buttonDeckMatcher.Enabled = true; this.buttonRemovePresentation.Enabled = true; this.checkBoxSlidesReplaceVideo.Enabled = true; } if ((this.listBoxAudioSources.Items.Count > 0) && (this.listBoxVideoSource.Items.Count > 0)) { this.buttonPreview.Enabled = true; this.buttonOk.Enabled = true; } } } }