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

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: jcsston
Date: 2004-10-03 13:42:56 +0400 (Sun, 03 Oct 2004)
New Revision: 860

Modified:
   trunk/JEBML/CommandLineSample.vjsproj
   trunk/JEBML/src/org/ebml/sample/CommandLineSample.java
Log:
Added some mp3/wav extraction code

Modified: trunk/JEBML/CommandLineSample.vjsproj
===================================================================
--- trunk/JEBML/CommandLineSample.vjsproj	2004-10-03 09:42:03 UTC (rev 859)
+++ trunk/JEBML/CommandLineSample.vjsproj	2004-10-03 09:42:56 UTC (rev 860)
@@ -55,6 +55,11 @@
                     Project = "{2FE45AE7-D916-497F-9035-B6EDA1C9E34C}"
                     Package = "{E6FDF86B-F3D1-11D4-8576-0002A516ECE8}"
                 />
+                <Reference
+                    Name = "WavLib"
+                    AssemblyName = "WavLib"
+                    HintPath = "..\..\WavLib\bin\WavLib.dll"
+                />
             </References>
         </Build>
         <Files>

Modified: trunk/JEBML/src/org/ebml/sample/CommandLineSample.java
===================================================================
--- trunk/JEBML/src/org/ebml/sample/CommandLineSample.java	2004-10-03 09:42:03 UTC (rev 859)
+++ trunk/JEBML/src/org/ebml/sample/CommandLineSample.java	2004-10-03 09:42:56 UTC (rev 860)
@@ -32,16 +32,41 @@
 
       System.out.println(mF.getReport());
       
-      if (mF.getTrack(1).CodecID.compareTo("A_MPEG/L3") == 0) 
+      MatroskaFile.MatroskaFileTrack track = mF.getTrack(1);
+      if (track.CodecID.compareTo("A_MPEG/L3") == 0) 
       {
         System.out.println("Extracting mp3 track");
-        FileOutputStream oFS = new FileOutputStream(args[1] + ".mp3");
+        String outputFilename = args[1] + ".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);
+        */
+        
         MatroskaFile.MatroskaFrame 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");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.