RIFFReader.st
changeset 541 9b654ff94202
parent 526 263d3775d846
child 1434 9675c5ea14df
--- a/RIFFReader.st	Thu Apr 17 03:31:06 1997 +0200
+++ b/RIFFReader.st	Thu Apr 17 03:32:11 1997 +0200
@@ -1,4 +1,14 @@
-'From Smalltalk/X, Version:3.1.5 on 11-apr-1997 at 6:49:46 pm'                  !
+"
+ COPYRIGHT (c) 1997 by eXept Software AG
+              All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
 
 ImageReader subclass:#RIFFReader
 	instanceVariableNames:'chunkSize streamTypes'
@@ -25,7 +35,10 @@
 
 documentation
 "
-    Helper to read RIFF files.
+    Abstract helper class to read RIFF files. See concrete subclasses for details.
+
+    This is in an experimental state and not yet finished.
+    The protocol may change.
 "
 ! !
 
@@ -73,6 +86,26 @@
 
 !RIFFReader methodsFor:'reading from stream'!
 
+fromStream:aStream
+    "read RIFF chunks from aStream. Process chunks in getChunkXXX methods
+     (usually redefined in concrete reader classes."
+
+    inStream := aStream.
+    inStream binary.
+
+    [inStream atEnd] whileFalse:[
+        self getChunk
+    ].
+    ^ nil
+
+    "
+     RIFFReader fromFile:'/home2/pd_stuff/movies/avi/hangldm.avi'      
+     RIFFReader fromFile:'/home2/cg/AFsp-V2R0/test/audiofiles/jg00b1ss.wav'      
+    "
+
+    "Modified: 17.4.1997 / 03:25:08 / cg"
+!
+
 getChunk
     "get a single chunk"
 
@@ -90,8 +123,12 @@
 
     (id at:1) isDigit ifTrue:[
         streamNr := Number readFrom:(id copyTo:2).
-        streamType := streamTypes at:(streamNr + 1).
-        s := 'getChunk_' , streamType , '_' , (id copyFrom:3).       
+        streamTypes notNil ifTrue:[
+            streamType := streamTypes at:(streamNr + 1).
+            s := 'getChunk_' , streamType , '_' , (id copyFrom:3).       
+        ] ifFalse:[
+            s := 'getChunk_' , id.
+        ]
     ] ifFalse:[
         s := 'getChunk_' , id.
     ].
@@ -106,7 +143,7 @@
     '' infoPrintCR.
 
     "Created: 5.4.1997 / 16:29:40 / cg"
-    "Modified: 11.4.1997 / 14:00:42 / cg"
+    "Modified: 17.4.1997 / 03:24:48 / cg"
 !
 
 getChunk_LIST
@@ -118,10 +155,12 @@
 
     "
      AVIReader fromFile:'/home2/pd_stuff/movies/avi/hangldm.avi'      
+     RIFFReader fromFile:'/home2/pd_stuff/movies/avi/hangldm.avi'      
+     RIFFReader fromFile:'/home2/cg/AFsp-V2R0/test/audiofiles/jg00b1ss.wav'      
     "
 
     "Created: 4.4.1997 / 23:18:33 / cg"
-    "Modified: 5.4.1997 / 16:12:16 / cg"
+    "Modified: 17.4.1997 / 03:22:15 / cg"
 !
 
 getChunk_RIFF
@@ -179,6 +218,6 @@
 !RIFFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/RIFFReader.st,v 1.2 1997-04-14 13:09:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/RIFFReader.st,v 1.3 1997-04-17 01:32:11 cg Exp $'
 ! !
 RIFFReader initialize!