OSDN Git Service

fix bs-hi un splitable bug,
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Fri, 30 Oct 2009 04:39:36 +0000 (04:39 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Fri, 30 Oct 2009 04:39:36 +0000 (04:39 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@206 4e526526-5e11-4fc0-8910-f8fd03428081

jTsSplitter/trunk/src/jtssplitter/Main.java
jTsSplitter/trunk/src/jtssplitter/Mpeg2TSPacket.java

index 96261c4..94c04eb 100644 (file)
@@ -33,13 +33,6 @@ public class Main {
             }
         }
         Tsfile t1=new Tsfile();
-        //inf="'D:\\jTssplitter\\test.ts'";
-        //outf="'D:\\jTssplitter\\test.split-5test.ts'";
-        //t1.readTs("D:\\jTssplitter\\test-sp.ts");
-        //inf="/home/ftpusr/ftp-tmp/tester/test.ts";
-        //outf="/home/ftpusr/ftp-tmp/tester/test.tssp2.ts";
-        //inf="/home/ftpusr/ftp-tmp/tester/NEEDLESS.tsmix.ts";
-        //outf="/home/ftpusr/ftp-tmp/tester/Needless.tssp.ts";
         t1.splitTS(inf,outf,ch);
     }
 }
index 2e878f6..fbf9d26 100644 (file)
@@ -141,18 +141,28 @@ public class Mpeg2TSPacket {
         int program_info_length = TSString2Int(payload_temp, 84, 12);
         boolean end = false;
         int cur_point = 96 + program_info_length * 8;
+        if (cur_point>section_length*8){
+            end=true;
+        }
         while (end != true) {
-            int pmt_stream_type = TSString2Int(payload_temp, cur_point, 8);
-            int elementary_PID = TSString2Int(payload_temp, cur_point + 11, 13);
-            int es_length = TSString2Int(payload_temp, cur_point + 28, 12);
-            PMTData pmtd=new PMTData();
-            pmtd.Stream_Type=pmt_stream_type;
-            pmtd.Program_Table=PAT_TABLE;
-            pmtd.Elementary_PID=elementary_PID;
-            pmt_t.add(pmtd);
-            cur_point = cur_point + 40 + es_length * 8;
-            if (cur_point > section_length * 8) {
-                end = true;
+            String gs=payload_temp.substring(cur_point+8,cur_point+11);
+            if (gs.matches("111")){
+                int pmt_stream_type = TSString2Int(payload_temp, cur_point, 8);
+                int elementary_PID = TSString2Int(payload_temp, cur_point + 11, 13);
+                //System.out.println(Integer.toString(cur_point)+" :  "+Integer.toString(section_length*8));
+                int es_length = TSString2Int(payload_temp, cur_point + 28, 12);
+                PMTData pmtd=new PMTData();
+                pmtd.Stream_Type=pmt_stream_type;
+                pmtd.Program_Table=PAT_TABLE;
+                pmtd.Elementary_PID=elementary_PID;
+                pmt_t.add(pmtd);
+                cur_point = cur_point + 40 + es_length * 8;
+                //System.out.println(Integer.toString(cur_point)+" :  "+Integer.toString(section_length));
+                if (cur_point > section_length * 8 - 1) {
+                    end = true;
+                }
+            }else{
+                end=true;
             }
         }
         return pmt_t;