TsRemux.TsRemux.exec C# (CSharp) Method

exec() public method

public exec ( ) : Form
return Form
        public Form exec()
        {
            Console.WriteLine();
            Console.WriteLine(this.Text);
            if (args.Length < 2)
            {
                Console.WriteLine("usage: tsremux input-file output-path [-a] [+b] [+m] [+c]");
                Console.WriteLine("   -a: do not use async io (default on)");
                Console.WriteLine("   +b: bypass audio alignment (default off)");
                Console.WriteLine("   +m: trueHd to ac3 (default off)");
                Console.WriteLine("   +c: keep console open when done (win2k)");
                Console.WriteLine("   output extension controls processing:");
                Console.WriteLine("       ts, m2ts, none for bluray directory");
                return con;
            }
            this.InputFileTextBox.Text = args[0];
            this.cbxUseAsyncIO.Checked = true;
            this.cbxBypassAudioProcessing.Checked = false;
            this.cbxMlpToAc3.Checked = false;
            for (int i = 2; i < args.Length; i++)
            {
                if (args[i].Equals("-a"))
                    this.cbxUseAsyncIO.Checked = false;
                else if (args[i].Equals("+b"))
                    this.cbxBypassAudioProcessing.Checked = true;
                else if (args[i].Equals("+c"))
                    this.keepConOpen = true;
                else if (args[i].Equals("+m"))
                    this.cbxMlpToAc3.Checked = true;
                else
                {
                    Console.WriteLine("unrecognized option: " + args[i]);
                    return con;
                }
            }

            // pre-process the input file
            say("pre-processing input file: " + args[0]);
            OpenFile(args[0]);

            // set the processing and output options
            this.OutputFileTextBox.Text = args[1];
            int ix = args[1].LastIndexOf(".")+1;
            string ext = (ix > 1) ? args[1].Substring(ix).ToLower() : "";
            if (ext.Equals("m2ts"))
            {
                this.M2tsFormatRadioButton.Checked = true;
            }
            else if (ext.Equals("ts"))
            {
                this.TsFormatRadioButton.Checked = true;
            }
            else if (ext.Equals(""))
            {
                this.BluRayFormatRadioButton.Checked = true;
            }
            else
            {
                System.Console.WriteLine("unrecognized output type");
                return con;
            }
            this.RemuxButton.Enabled = true;
            foreach (StreamInfo si in inFile.StreamInfos)
                pidsToKeep.Add(si.ElementaryPID);

            say("begin remuxing to: " + args[1]);
            backgroundWorker1_DoWork(this, null);
            //RemuxButton_Click(this, null);
            say("done remuxing");
            return (keepConOpen)?con:null;
        }

Usage Example

Exemplo n.º 1
0
 static void Main(string[] args)
 {
     if (args.Length == 0)
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new TsRemux());
     }
     else
     {
         TsRemux tsr = new TsRemux(args);
         Form f = null;
         if ((f = tsr.exec()) != null)
             Application.Run(f);
     }
 }
TsRemux