private void backgroundWorker2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.Cursor = Cursors.Default;
RemuxButton.Text = "Remux";
RemuxButton.Enabled = false;
Quit.Enabled = true;
cbxUseAsyncIO.Enabled = true;
cbxBypassAudioProcessing.Enabled = true;
if (e.Error != null)
{
if (e.Error is ApplicationException)
return;
else
MessageBox.Show(e.Error.Message + "\n" + e.Error.StackTrace);
return;
}
if (e.Result != null && e.Result is Exception)
{
Exception ex = (Exception)e.Result;
MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
return;
}
EnableCbxMlp();
StreamInfo[] streams = null;
streams = inFile.StreamInfos;
if (null == streams)
{
MessageBox.Show("The specified file does not contain a valid PAT/PMT combo.");
return;
}
InputFileTextBox.Text = (string)e.Result;
foreach (StreamInfo si in streams)
{
// hobBIT
pidList.Add(si.ElementaryPID);
switch (si.StreamType)
{
case ElementaryStreamTypes.VIDEO_STREAM_H264:
ElementaryStreamsListBox.Items.Add(String.Format("AVC Video Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoVideo(si)));
break;
case ElementaryStreamTypes.VIDEO_STREAM_MPEG2:
ElementaryStreamsListBox.Items.Add(String.Format("MPEG2 Video Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoVideo(si)));
break;
case ElementaryStreamTypes.VIDEO_STREAM_VC1:
ElementaryStreamsListBox.Items.Add(String.Format("VC-1 Video Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoVideo(si)));
break;
case ElementaryStreamTypes.AUDIO_STREAM_AC3:
ElementaryStreamsListBox.Items.Add(String.Format("Dolby Digital Audio Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoAudio(si)));
break;
case ElementaryStreamTypes.AUDIO_STREAM_AC3_PLUS:
ElementaryStreamsListBox.Items.Add(String.Format("Dolby Digital Plus Audio Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoAudio(si)));
break;
case ElementaryStreamTypes.AUDIO_STREAM_AC3_TRUE_HD:
ElementaryStreamsListBox.Items.Add(String.Format("Dolby True HD Audio Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoAudio(si)));
break;
case ElementaryStreamTypes.AUDIO_STREAM_DTS:
ElementaryStreamsListBox.Items.Add(String.Format("DTS Audio Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoAudio(si)));
break;
case ElementaryStreamTypes.AUDIO_STREAM_DTS_HD:
ElementaryStreamsListBox.Items.Add(String.Format("DTS-HD Audio Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoAudio(si)));
break;
case ElementaryStreamTypes.AUDIO_STREAM_DTS_HD_MASTER_AUDIO:
ElementaryStreamsListBox.Items.Add(String.Format("DTS-HD Master Audio Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoAudio(si)));
break;
case ElementaryStreamTypes.AUDIO_STREAM_LPCM:
ElementaryStreamsListBox.Items.Add(String.Format("Lossless PCM Audio Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoAudio(si)));
break;
case ElementaryStreamTypes.AUDIO_STREAM_MPEG1:
ElementaryStreamsListBox.Items.Add(String.Format("MPEG1 Audio Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoAudio(si)));
break;
case ElementaryStreamTypes.AUDIO_STREAM_MPEG2:
ElementaryStreamsListBox.Items.Add(String.Format("MPEG2 Audio Stream # {0} {1}", si.ElementaryPID & 0xff, StreamInfoAudio(si)));
break;
case ElementaryStreamTypes.PRESENTATION_GRAPHICS_STREAM:
ElementaryStreamsListBox.Items.Add(String.Format("Presentation Graphics Stream # {0}", si.ElementaryPID & 0xff));
break;
case ElementaryStreamTypes.INTERACTIVE_GRAPHICS_STREAM:
ElementaryStreamsListBox.Items.Add(String.Format("Interactive Graphics Stream # {0}", si.ElementaryPID & 0xff));
break;
case ElementaryStreamTypes.SUBTITLE_STREAM:
ElementaryStreamsListBox.Items.Add(String.Format("Subtitle Stream # {0}", si.ElementaryPID & 0xff));
break;
default:
ElementaryStreamsListBox.Items.Add(String.Format("Unknown Stream of type {0}", si.StreamType));
break;
}
}
DTCP_Descriptor ds = inFile.DtcpInfo;
if (null != ds)
{
DtcpInfo.Nodes[0].Nodes.Clear();
switch (ds.CopyStatus)
{
case DtcpCci.CopyFree:
DtcpInfo.Nodes[0].Nodes.Add("Copy free");
break;
case DtcpCci.CopyNever:
DtcpInfo.Nodes[0].Nodes.Add("Copy never");
break;
case DtcpCci.CopyOnce:
DtcpInfo.Nodes[0].Nodes.Add("Copy once");
break;
case DtcpCci.NoMoreCopies:
DtcpInfo.Nodes[0].Nodes.Add("No more copies");
break;
}
if (ds.AnalogConstrain)
DtcpInfo.Nodes[0].Nodes.Add("HD analog output is constrained");
else
DtcpInfo.Nodes[0].Nodes.Add("HD analog output is full resolution");
if (ds.Macrovision)
DtcpInfo.Nodes[0].Nodes.Add("Macrovision is on");
else
DtcpInfo.Nodes[0].Nodes.Add("Macrovision is off");
}
length = inFile.VideoLength;
DtcpInfo.Nodes.Add("Video Length: " + length);
if (length == TimeSpan.Zero)
{
TreeNode tn = new TreeNode();
tn.ForeColor = Color.Red;
tn.Text = "Warning: No PCRs available!";
DtcpInfo.Nodes.Add(tn);
}
RemuxProgressBar.Maximum = (int)length.TotalMinutes;
RemuxProgressBar.Step = 1;
RemuxProgressBar.Value = 0;
RemuxProgressTimeTextBox.Text = inFile.VideoLength.ToString();
if (inFile.FileType == TsFileType.M2TS)
{
DtcpInfo.Nodes.Add("File format: M2TS (192 byte packets)");
}
else if (inFile.FileType == TsFileType.TS)
{
DtcpInfo.Nodes.Add("File format: TS (188 byte packets)");
}
OutputFileBrowseButton.Enabled = true;
if (string.CompareOrdinal(InputFileTextBox.Text, OutputFileTextBox.Text) == 0)
OutputFileTextBox.Text = String.Empty;
ElementaryStreamsListBox.Enabled = true;
if (inFile.FileType == TsFileType.M2TS)
{
TsFormatRadioButton.Enabled = true;
TsFormatRadioButton.Checked = false;
M2tsFormatRadioButton.Enabled = true;
M2tsFormatRadioButton.Checked = true;
BluRayFormatRadioButton.Checked = false;
BluRayFormatRadioButton.Enabled = true;
MKVFormatRadioButton.Checked = false;
MKVFormatRadioButton.Enabled = true;
DemuxFormatRadioButton.Enabled = true;
DemuxFormatRadioButton.Checked = false;
}
else if (inFile.FileType == TsFileType.TS)
{
TsFormatRadioButton.Enabled = true;
TsFormatRadioButton.Checked = true;
if (length > TimeSpan.Zero)
{
M2tsFormatRadioButton.Enabled = true;
BluRayFormatRadioButton.Enabled = true;
}
M2tsFormatRadioButton.Checked = false;
BluRayFormatRadioButton.Checked = false;
MKVFormatRadioButton.Checked = false;
MKVFormatRadioButton.Enabled = true;
DemuxFormatRadioButton.Enabled = true;
DemuxFormatRadioButton.Checked = false;
}
else if (inFile.FileType == TsFileType.EVOB)
{
TsFormatRadioButton.Enabled = true;
TsFormatRadioButton.Checked = false;
M2tsFormatRadioButton.Enabled = true;
M2tsFormatRadioButton.Checked = true;
BluRayFormatRadioButton.Enabled = true;
BluRayFormatRadioButton.Checked = false;
MKVFormatRadioButton.Checked = false;
MKVFormatRadioButton.Enabled = true;
DemuxFormatRadioButton.Enabled = true;
DemuxFormatRadioButton.Checked = false;
}
else if (inFile.FileType == TsFileType.MKV)
{
TsFormatRadioButton.Enabled = true;
TsFormatRadioButton.Checked = true;
M2tsFormatRadioButton.Enabled = true;
M2tsFormatRadioButton.Checked = false;
BluRayFormatRadioButton.Enabled = true;
BluRayFormatRadioButton.Checked = false;
MKVFormatRadioButton.Checked = false;
MKVFormatRadioButton.Enabled = true;
DemuxFormatRadioButton.Enabled = true;
DemuxFormatRadioButton.Checked = false;
}
if (length > TimeSpan.Zero)
EnableNumerics();
DtcpInfo.Nodes[0].ExpandAll();
}