Beispiel #1
0
        private bool DoDemux()
        {
            try
            {
                DoPlugin(PluginType.BeforeDemux);

                if (!Directory.Exists(settings.workingDir))
                {
                    logWindow.MessageDemux(Global.Res("ErrorWorkingDirectory"));
                    if (!silent) Global.ErrorMsg(Global.Res("ErrorWorkingDirectory"));
                    return false;
                }
                if (comboBoxTitle.SelectedIndex == -1)
                {
                    logWindow.MessageDemux(Global.Res("ErrorNoTitle"));
                    if (!silent) Global.ErrorMsg(Global.Res("ErrorNoTitle"));
                    return false;
                }
                int videoCount = 0;
                int audioCount = 0;
                int unknown = 0;
                foreach (StreamInfo si in titleList[comboBoxTitle.SelectedIndex].streams)
                {
                    if (si.streamType == StreamType.Audio && si.selected)
                    {
                        audioCount++;
                    }
                    if (si.streamType == StreamType.Video && si.selected)
                    {
                        videoCount++;
                    }
                    if (si.streamType == StreamType.Unknown && si.selected)
                    {
                        unknown++;
                    }
                }
                if (audioCount < 1)
                {
                    logWindow.MessageDemux(Global.Res("ErrorNoAudio"));
                    if (!silent) Global.ErrorMsg(Global.Res("ErrorNoAudio"));
                    return false;
                }
                if (videoCount != 1)
                {
                    logWindow.MessageDemux(Global.Res("ErrorNoVideo"));
                    if (!silent) Global.ErrorMsg(Global.Res("ErrorNoVideo"));
                    return false;
                }
                if (unknown > 0)
                {
                    logWindow.MessageDemux(Global.Res("ErrorUnknownTracks"));
                    if (!silent) Global.ErrorMsg(Global.Res("ErrorUnknownTracks"));
                    return false;
                }

                UpdateStatus(Global.Res("StatusBar") + " " + Global.Res("StatusBarDemux"));
                DisableControls();
                
                string dtsBitrate = "1536";
                string ac3Bitrate = "640";
                if (settings.downmixDTSIndex >= 0 && settings.downmixDTSIndex < GlobalVars.dtsBitrates.Count) dtsBitrate = GlobalVars.dtsBitrates[settings.downmixDTSIndex];
                if (settings.downmixAc3Index >= 0 && settings.downmixAc3Index < GlobalVars.ac3Bitrates.Count) ac3Bitrate = GlobalVars.ac3Bitrates[settings.downmixAc3Index];

                dt = new DemuxTool(settings, m2tsList, GlobalVars.videoTypes, GlobalVars.ac3AudioTypes, GlobalVars.dtsAudioTypes,
                    titleList[comboBoxTitle.SelectedIndex], ref demuxedStreamList, ac3Bitrate, dtsBitrate);

                dt.OnInfoMsg += new ExternalTool.InfoEventHandler(DemuxMsg);
                dt.OnLogMsg += new ExternalTool.LogEventHandler(DemuxMsg);

                dt.Start();
                dt.WaitForExit();

                DoPlugin(PluginType.AfterDemux);

                TitleInfo.SaveStreamInfoFile(demuxedStreamList, settings.workingDir + "\\" + settings.filePrefix + "_streamInfo.xml");
                demuxedStreamsWindow.UpdateDemuxedStreams();

                if (dt == null) return false;
                else return dt.Successfull;
            }
            catch (Exception ex)
            {
                logWindow.MessageDemux(Global.Res("ErrorException") + " " + ex.Message);
                return false;
            }
            finally
            {
                EnableControls();

                UpdateStatus(Global.Res("StatusBar") + " " + Global.Res("StatusBarReady"));
            }
        }
Beispiel #2
0
        private bool DoDemux()
        {
            try
            {
                DoPlugin(PluginType.BeforeDemux);

                if (!Directory.Exists(settings.workingDir))
                {
                    logWindow.MessageDemux(Global.Res("ErrorWorkingDirectory"));
                    if (!silent)
                    {
                        Global.ErrorMsg(Global.Res("ErrorWorkingDirectory"));
                    }
                    return(false);
                }
                if (comboBoxTitle.SelectedIndex == -1)
                {
                    logWindow.MessageDemux(Global.Res("ErrorNoTitle"));
                    if (!silent)
                    {
                        Global.ErrorMsg(Global.Res("ErrorNoTitle"));
                    }
                    return(false);
                }
                int videoCount = 0;
                int audioCount = 0;
                int unknown    = 0;
                foreach (StreamInfo si in titleList[comboBoxTitle.SelectedIndex].streams)
                {
                    if (si.streamType == StreamType.Audio && si.selected)
                    {
                        audioCount++;
                    }
                    if (si.streamType == StreamType.Video && si.selected)
                    {
                        videoCount++;
                    }
                    if (si.streamType == StreamType.Unknown && si.selected)
                    {
                        unknown++;
                    }
                }
                if (audioCount < 1)
                {
                    logWindow.MessageDemux(Global.Res("ErrorNoAudio"));
                    if (!silent)
                    {
                        Global.ErrorMsg(Global.Res("ErrorNoAudio"));
                    }
                    return(false);
                }
                if (videoCount != 1)
                {
                    logWindow.MessageDemux(Global.Res("ErrorNoVideo"));
                    if (!silent)
                    {
                        Global.ErrorMsg(Global.Res("ErrorNoVideo"));
                    }
                    return(false);
                }
                if (unknown > 0)
                {
                    logWindow.MessageDemux(Global.Res("ErrorUnknownTracks"));
                    if (!silent)
                    {
                        Global.ErrorMsg(Global.Res("ErrorUnknownTracks"));
                    }
                    return(false);
                }

                UpdateStatus(Global.Res("StatusBar") + " " + Global.Res("StatusBarDemux"));
                DisableControls();

                string dtsBitrate = "1536";
                string ac3Bitrate = "640";
                if (settings.downmixDTSIndex >= 0 && settings.downmixDTSIndex < GlobalVars.dtsBitrates.Count)
                {
                    dtsBitrate = GlobalVars.dtsBitrates[settings.downmixDTSIndex];
                }
                if (settings.downmixAc3Index >= 0 && settings.downmixAc3Index < GlobalVars.ac3Bitrates.Count)
                {
                    ac3Bitrate = GlobalVars.ac3Bitrates[settings.downmixAc3Index];
                }

                dt = new DemuxTool(settings, m2tsList, GlobalVars.videoTypes, GlobalVars.ac3AudioTypes, GlobalVars.dtsAudioTypes,
                                   titleList[comboBoxTitle.SelectedIndex], ref demuxedStreamList, ac3Bitrate, dtsBitrate);

                dt.OnInfoMsg += new ExternalTool.InfoEventHandler(DemuxMsg);
                dt.OnLogMsg  += new ExternalTool.LogEventHandler(DemuxMsg);

                dt.Start();
                dt.WaitForExit();

                DoPlugin(PluginType.AfterDemux);

                TitleInfo.SaveStreamInfoFile(demuxedStreamList, settings.workingDir + "\\" + settings.filePrefix + "_streamInfo.xml");
                demuxedStreamsWindow.UpdateDemuxedStreams();

                if (dt == null)
                {
                    return(false);
                }
                else
                {
                    return(dt.Successfull);
                }
            }
            catch (Exception ex)
            {
                logWindow.MessageDemux(Global.Res("ErrorException") + " " + ex.Message);
                return(false);
            }
            finally
            {
                EnableControls();

                UpdateStatus(Global.Res("StatusBar") + " " + Global.Res("StatusBarReady"));
            }
        }