[Red5commits] [1691] skip ID3v2 header if present, this fixes APPSERVER-47

jbauch luke at codegent.com
Tue Feb 6 18:50:06 EST 2007


skip ID3v2 header if present, this fixes APPSERVER-47


Timestamp: 02/06/07 17:21:52 EST (1 hour ago) 
Change: 1691 
Author: jbauch

Files (see diff or trac for details): 
doc/trunk/changelog.txt
java/server/trunk/src/org/red5/io/mp3/impl/MP3Reader.java


Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/1691

Index: /java/server/trunk/src/org/red5/io/mp3/impl/MP3Reader.java
===================================================================
--- /java/server/trunk/src/org/red5/io/mp3/impl/MP3Reader.java (revision 1660)
+++ /java/server/trunk/src/org/red5/io/mp3/impl/MP3Reader.java (revision 1691)
@@ -124,4 +124,8 @@
         analyzeKeyFrames();
 		firstFrame = true;
+		
+        // Process ID3v2 header if present
+		processID3v2Header();
+		
         // Create file metadata object
         fileMeta = createFileMeta();
@@ -382,4 +386,5 @@
 		double time = 0;
 		in.position(0);
+		processID3v2Header();
 		searchNextFrame();
 		while (this.hasMoreTags()) {
@@ -420,3 +425,26 @@
 	}
 
+    private void processID3v2Header() {
+    	if (in.remaining() <= 10)
+    		// We need at least 10 bytes ID3v2 header + data
+    		return;
+    	
+    	int start = in.position();
+    	byte a, b, c;
+    	a = in.get();
+    	b = in.get();
+    	c = in.get();
+    	if (a != 'I' || b != 'D' || c != '3') {
+    		// No ID3v2 header
+    		in.position(start);
+    		return;
+    	}
+    	
+    	// Skip version and flags
+    	in.skip(3);
+    	int size = in.get() << 21 | in.get() << 14 | in.get() << 7 | in.get();
+    	// Skip ID3v2 header for now
+    	in.skip(size);
+    }
+    
 }
Index: /doc/trunk/changelog.txt
===================================================================
--- /doc/trunk/changelog.txt (revision 1690)
+++ /doc/trunk/changelog.txt (revision 1691)
@@ -50,4 +50,5 @@
 - SharedObjects support "getAttributes" (Jira APPSERVER-45)
 - access to streams can be limited (Jira APPSERVER-25)
+- mp3 files containing images can be played back (Jira APPSERVER-47)
 
 


Note:
Diffs are chopped if more than 25k.
This is to get past the limit on the mailing list.



More information about the Red5commits mailing list