OSDN Git Service

fix some error.
[rec10/rec10-git.git] / jTsSplitter / trunk / src / jtssplitter / Main.java
index 64303b5..a027d52 100644 (file)
@@ -1,10 +1,12 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * jTsSplitter - java based mpeg2ts splitter.
+ * Copyright (C) 2009-2012 Yukikaze
  */
-
 package jtssplitter;
 
+import java.io.File;
+
+
 /**
  *
  * @author Administrator
@@ -13,29 +15,48 @@ public class Main {
 
     /**
      * @param args the command line arguments
+     *
      */
-    public static boolean debug_mode=false;
     public static void main(String[] args) {
         // TODO code application logic here
-        String inf,outf;
-        int ch=0;
-        inf="";
-        outf="";
-        if (args.length>1){
-            inf=args[0];
-            outf=args[1];
-            if (args.length>2){
-                ch=Integer.parseInt(args[2].trim(),10);
+        String inf;
+        String outf;
+        int ch = 0;
+        inf = "";
+        outf = "";
+         System.out.println("USAGE : \njava -jar jTsSplitter.jar <Input file> <Output file> [Option ch number]");
+         System.out.println("Option ch number is used in CS splitting.\n");
+        for (int i = 0; i < args.length; i++) {
+            System.out.println(((Integer)i).toString()+":"+args[i]);
+        }
+        if (args.length > 1) {
+            if (args[0].trim().toUpperCase().equals("-ch".toUpperCase())){
+                Chlist chl=new Chlist();
+                chl.writeCHList(args[1], args[2],-1,-1);
+                System.exit(0);
+            }else if (args[0].trim().toUpperCase().equals("-bs".toUpperCase())){
+                Chlist chl=new Chlist();
+                chl.writeCHList(args[1], args[2],-1,290);
+                System.exit(0);
+            }else if (args[0].trim().toUpperCase().equals("-cs".toUpperCase())){
+                Chlist chl=new Chlist();
+                chl.writeCHList(args[1], args[2],-1,-1);
+                System.exit(0);
             }
+
+            inf = args[0];
+            outf = args[1];
+            if (args.length > 2) {
+                ch = Integer.parseInt(args[2].trim(), 10);
+            }
+        }
+        //inf = "";
+        //outf = "";
+        Tsfile t1 = new Tsfile();
+        File f=new File(inf);
+        if (f.length()>1000*1000){
+            t1.splitTS_byte(inf, outf, ch);
         }
-        Tsfile t1=new Tsfile();
-        //t1.readTs("D:\\jTssplitter\\test-sp.ts");
-        //inf="/home/ftpusr/ftp-tmp/tester/testcs30.tsmix";
-        //outf="/home/ftpusr/ftp-tmp/tester/test.tssp.ts";
-        //inf="D:\\jTssplitter\\NEEDLESS.ts";
-        //outf="D:\\jTssplitter\\NEEDLESS.split-2.ts";
-        //inf="D:\\jTssplitter\\test.ts";
-        //outf="D:\\jTssplitter\\test.split-2.ts";
-        t1.splitTS(inf,outf,0);
+        System.exit(0);
     }
 }