[matroska] r1194 - in trunk/JEBML: . src/org/ebml/sample

[email protected] Fri, 27 May 2005 06:55:58 +0400 (MSD)
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: jcsston
Date: 2005-05-27 06:52:38 +0400 (Fri, 27 May 2005)
New Revision: 1194

Modified:
   trunk/JEBML/JEBML.jpx
   trunk/JEBML/build.xml
   trunk/JEBML/src/org/ebml/sample/CommandLineSample.java
Log:


Modified: trunk/JEBML/JEBML.jpx
===================================================================
--- trunk/JEBML/JEBML.jpx	2005-05-23 18:51:34 UTC (rev 1193)
+++ trunk/JEBML/JEBML.jpx	2005-05-27 02:52:38 UTC (rev 1194)
@@ -22,7 +22,7 @@
   <property category="runtime.0" name="BuildTargetOnRun" value="com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make"/>
   <property category="runtime.0" name="ConfigurationName" value="EbmlSampleApp"/>
   <property category="runtime.0" name="RunnableType" value="com.borland.jbuilder.runtime.ApplicationRunner"/>
-  <property category="runtime.0" name="application.class" value="org.ebml.sample.EbmlSampleApp"/>
+  <property category="runtime.0" name="application.class" value="org.ebml.sample.CommandLineSample"/>
   <property category="runtime.1" name="BuildTargetOnRun" value="com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make"/>
   <property category="runtime.1" name="ConfigurationName" value="JMStudio - JMF"/>
   <property category="runtime.1" name="RunnableType" value="com.borland.jbuilder.runtime.ApplicationRunner"/>
@@ -64,6 +64,7 @@
     <property category="archiving" name="archiverClass" value="com.borland.jbuilder.wizard.archive.ApplicationArchiver"/>
     <property category="archiving" name="buildWithProject" value="0"/>
     <property category="archiving" name="contentRules.1" value="I:**/*.*"/>
+    <property category="archiving" name="manifestConfigFile" value="0"/>
     <property category="archiving" name="targetCompressed" value="1"/>
     <property category="archiving" name="targetPath" value="JEBML.jar"/>
     <property category="archiving" name="usingRules" value="1"/>

Modified: trunk/JEBML/build.xml
===================================================================
--- trunk/JEBML/build.xml	2005-05-23 18:51:34 UTC (rev 1193)
+++ trunk/JEBML/build.xml	2005-05-27 02:52:38 UTC (rev 1194)
@@ -1,32 +1,27 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--Exported by JBuilder on Oct 14, 2004 2:21:41 PM-->
+<!--Exported by JBuilder on Jan 30, 2005 3:32:47 PM-->
 <!--It is RECOMMENDED that JBuilder builds and Ant builds done with
 this exported Ant file be kept separate and be written to different
 directories. For example, the JBuilder output directory might be "classes"
 and the Ant output directory might be "classes.ant".-->
 <project basedir="." default="rebuild" name="JEBML.jpx">
-  <property name="jbuilder.home" value="C:/JBuilderX"/>
+  <property name="jbuilder.home" value="G:/JBuilderX"/>
   <property name="Tomcat.home" value="${jbuilder.home}/thirdparty/jakarta-tomcat-4.0.6-LE-jdk14"/>
   <property name="jdk.home" value="${jbuilder.home}/jdk1.4"/>
   <property name="dest" value="classes.ant"/>
   <property name="Generated.Source" value="${dest}/Temporary_Files"/>
-  <property name="JMF.home" value="C:/JMF-2.1.1e"/>
   <property name="src" value="src"/>
   <path id="project.class.path">
     <pathelement location="${dest}"/>
-    <pathelement location="${JMF.home}/lib"/>
-    <pathelement location="${JMF.home}/lib/jmf.jar"/>
-    <pathelement location="${JMF.home}/lib/mediaplayer.jar"/>
-    <pathelement location="${JMF.home}/lib/multiplayer.jar"/>
-    <pathelement location="${JMF.home}/lib/sound.jar"/>
-    <pathelement location="${JMF.home}/lib/customizer.jar"/>
     <pathelement location="${jdk.home}/demo/jfc/Java2D/Java2Demo.jar"/>
     <pathelement location="${jdk.home}/demo/plugin/jfc/Java2D/Java2Demo.jar"/>
     <pathelement location="${jdk.home}/jre/javaws/javaws.jar"/>
     <pathelement location="${jdk.home}/jre/lib/charsets.jar"/>
     <pathelement location="${jdk.home}/jre/lib/ext/dnsns.jar"/>
+    <pathelement location="${jdk.home}/jre/lib/ext/jmf.jar"/>
     <pathelement location="${jdk.home}/jre/lib/ext/ldapsec.jar"/>
     <pathelement location="${jdk.home}/jre/lib/ext/localedata.jar"/>
+    <pathelement location="${jdk.home}/jre/lib/ext/sound.jar"/>
     <pathelement location="${jdk.home}/jre/lib/ext/sunjce_provider.jar"/>
     <pathelement location="${jdk.home}/jre/lib/im/indicim.jar"/>
     <pathelement location="${jdk.home}/jre/lib/im/thaiim.jar"/>
@@ -67,7 +62,7 @@
         <include name="**/*.*"/>
       </fileset>
       <manifest>
-        <attribute name="Main-Class" value="org.ebml.sample.EbmlSampleApp"/>
+        <attribute name="Main-Class" value="org.ebml.sample.CommandLineSample"/>
       </manifest>
     </jar>
     <jar compress="true" destfile="JEBML-src.jar">

Modified: trunk/JEBML/src/org/ebml/sample/CommandLineSample.java
===================================================================
--- trunk/JEBML/src/org/ebml/sample/CommandLineSample.java	2005-05-23 18:51:34 UTC (rev 1193)
+++ trunk/JEBML/src/org/ebml/sample/CommandLineSample.java	2005-05-27 02:52:38 UTC (rev 1194)
@@ -1,118 +1,120 @@
-package org.ebml.sample;
-
-import org.ebml.matroska.*;
-import org.ebml.*;
-import org.ebml.io.*;
-import java.io.*;
-
-/**
- * <p>Title: JEBML</p>
- * <p>Description: Java Classes to Read EBML Elements</p>
- * <p>Copyright: Copyright (c) 2002-2004 John Cannon <[email protected]>, Jory Stone <[email protected]></p>
- * <p>Company: </p>
- * @author jcsston
- * @version 1.0
- */
-
-public class CommandLineSample {
-  public static void main(String[] args) {
-    System.out.println("JEBML CommandLineSample - (c) 2004 Jory 'jcsston' Stone <[email protected]>");
-
-    if (args.length < 3) {
-      System.out.println("Please provide a command and matroska filename on the command-line");
-      return;
-    }
-
-    try {
-      String mode = args[1];
-      if (mode.compareTo("-i") == 0) 
-      {
-        readFile(args[2]);
-      }
-      else if (mode.compareTo("-o") == 0) 
-      {
-        writeFile(args[2]);
-      }
-
-    } catch (IOException ex) {
-      ex.printStackTrace();
-    }
-
-  }
-
+package org.ebml.sample;
+
+import org.ebml.matroska.*;
+import org.ebml.*;
+import org.ebml.io.*;
+import java.io.*;
+
+/**
+ * <p>Title: JEBML</p>
+ * <p>Description: Java Classes to Read EBML Elements</p>
+ * <p>Copyright: Copyright (c) 2002-2004 John Cannon <[email protected]>, Jory Stone <[email protected]></p>
+ * <p>Company: </p>
+ * @author jcsston
+ * @version 1.0
+ */
+
+public class CommandLineSample {
+  public static void main(String[] args) {
+    System.out.println("JEBML CommandLineSample - (c) 2004 Jory 'jcsston' Stone <[email protected]>");
+
+    if (args.length < 3) {
+      System.out.println("Please provide a command and matroska filename on the command-line");
+      return;
+    }
+
+    try {
+      String mode = args[1];
+      if (mode.compareTo("-i") == 0)
+      {
+        readFile(args[2]);
+      }
+      else if (mode.compareTo("-o") == 0)
+      {
+        writeFile(args[2]);
+      }
+
+    } catch (IOException ex) {
+      ex.printStackTrace();
+    }
+
+  }
+
   static void readFile(String filename) throws IOException
-  {
-    System.out.println("Scanning file: " + filename);
-
-    FileDataSource iFS = new FileDataSource(filename);
-    MatroskaFile mF = new MatroskaFile(iFS);
-    mF.setScanFirstCluster(true);
-    mF.readFile();
-
-    System.out.println(mF.getReport());
-      
-    MatroskaFileTrack track = mF.getTrack(1);
-    if (track.CodecID.compareTo("A_MPEG/L3") == 0) 
-    {
-      System.out.println("Extracting mp3 track");
-      String outputFilename = filename + ".mp3";// + ".wav";
-      FileOutputStream oFS = new FileOutputStream(outputFilename);
-        
-      /*
-       WavLib.WaveFormatEx wfx = new WavLib.WaveFormatEx();
-       wfx.wFormatTag = 0x55; // MP3
-       wfx.nSamplesPerSec = (int)track.Audio_SamplingFrequency;
-       if (track.Audio_Channels == 0) {
-       wfx.nChannels = 1;
-       } else {
-       wfx.nChannels = track.Audio_Channels;
-       }
-       if (track.Audio_BitDepth == 0) {
-       wfx.wBitsPerSample = 16;
-       } else {
-       wfx.wBitsPerSample = track.Audio_BitDepth;
-       }
-       //wfx.nBlockAlign = 4;
-
-       WavLib.WavWriter writer = new WavLib.WavWriter();
-       writer.Open(outputFilename, wfx);
-       */
-        
-      MatroskaFileFrame frame = mF.getNextFrame();
-      while (frame != null) 
-      {
-        oFS.write(frame.Data);
-        //writer.WriteSampleData(frame.Data, 0, frame.Data.length);
-        frame = mF.getNextFrame();
-      }
-      //writer.Close();
-    }
-
-    System.out.println("Scan complete");
-  }
-
+  {
+    System.out.println("Scanning file: " + filename);
+    long startTime = System.currentTimeMillis();
+
+    FileDataSource iFS = new FileDataSource(filename);
+    MatroskaFile mF = new MatroskaFile(iFS);
+    mF.setScanFirstCluster(true);
+    mF.readFile();
+
+    System.out.println(mF.getReport());
+
+    MatroskaFileTrack track = mF.getTrack(1);
+    if (track.CodecID.compareTo("A_MPEG/L3") == 0)
+    {
+      System.out.println("Extracting mp3 track");
+      String outputFilename = filename + ".mp3";// + ".wav";
+      FileOutputStream oFS = new FileOutputStream(outputFilename);
+
+      /*
+       WavLib.WaveFormatEx wfx = new WavLib.WaveFormatEx();
+       wfx.wFormatTag = 0x55; // MP3
+       wfx.nSamplesPerSec = (int)track.Audio_SamplingFrequency;
+       if (track.Audio_Channels == 0) {
+       wfx.nChannels = 1;
+       } else {
+       wfx.nChannels = track.Audio_Channels;
+       }
+       if (track.Audio_BitDepth == 0) {
+       wfx.wBitsPerSample = 16;
+       } else {
+       wfx.wBitsPerSample = track.Audio_BitDepth;
+       }
+       //wfx.nBlockAlign = 4;
+
+       WavLib.WavWriter writer = new WavLib.WavWriter();
+       writer.Open(outputFilename, wfx);
+       */
+
+      MatroskaFileFrame frame = mF.getNextFrame();
+      while (frame != null)
+      {
+        oFS.write(frame.Data);
+        //writer.WriteSampleData(frame.Data, 0, frame.Data.length);
+        frame = mF.getNextFrame();
+      }
+      //writer.Close();
+    }
+
+    long endTime = System.currentTimeMillis();
+    System.out.println("Scan complete. Took: " + ((endTime - startTime) / 1000.0) + " seconds");
+  }
+
   static void writeFile(String filename) throws IOException
-  {
-    System.out.println("Write file: " + filename);
-
-    FileDataWriter iFW = new FileDataWriter(filename);
-    MatroskaFileWriter mFW = new MatroskaFileWriter(iFW);
-    mFW.writeEBMLHeader();
-    mFW.writeSegmentHeader();
-    mFW.writeSegmentInfo();
-    for (int i = 0; i < 5; i++) 
-    {
-      MatroskaFileTrack track = new MatroskaFileTrack();
-      track.TrackNo = (short)i;
-      track.TrackUID = new java.util.Random().nextLong();
-      track.TrackType = 1;
-      track.Name = "Track " + Integer.toString(i);
-      track.Video_PixelWidth = 320;
-      track.Video_PixelHeight = 240;
-      mFW.TrackList.add(track);
-    }
-    mFW.writeTracks();
-
-    System.out.println("Write complete");
-  }
-}
\ No newline at end of file
+  {
+    System.out.println("Write file: " + filename);
+
+    FileDataWriter iFW = new FileDataWriter(filename);
+    MatroskaFileWriter mFW = new MatroskaFileWriter(iFW);
+    mFW.writeEBMLHeader();
+    mFW.writeSegmentHeader();
+    mFW.writeSegmentInfo();
+    for (int i = 0; i < 5; i++)
+    {
+      MatroskaFileTrack track = new MatroskaFileTrack();
+      track.TrackNo = (short)i;
+      track.TrackUID = new java.util.Random().nextLong();
+      track.TrackType = 1;
+      track.Name = "Track " + Integer.toString(i);
+      track.Video_PixelWidth = 320;
+      track.Video_PixelHeight = 240;
+      mFW.TrackList.add(track);
+    }
+    mFW.writeTracks();
+
+    System.out.println("Write complete");
+  }
+}