RIFFReader.st
changeset 1452 e79910279100
parent 1451 717a60fa30f0
child 3855 1db7742d33ad
child 4413 8c800ee6b489
--- a/RIFFReader.st	Sat Dec 30 20:50:50 2000 +0100
+++ b/RIFFReader.st	Sat Dec 30 22:31:41 2000 +0100
@@ -82,6 +82,46 @@
 
 !RIFFReader class methodsFor:'testing'!
 
+isFORMFile:aFileName withAnyTypeFrom:typeList
+    "return true, if aFileName contains FORM-encoded data of format:type"
+
+    ^ self isFile:aFileName ofType:'FORM' withAnySubtypeFrom:typeList
+!
+
+isFile:aFileName ofType:mainType withAnySubtypeFrom:typeList
+    "return true, if aFileName contains RIFF-encoded data of format:type"
+
+    |data1 len data3 inStream|
+
+    inStream := aFileName asFilename readStream.
+    inStream isNil ifTrue:[^ false].
+    inStream binary.
+
+    data1 := String new:4.
+    inStream nextBytes:4 into:data1.
+    len := inStream nextLongMSB:true.
+    data3 := String new:4.
+    inStream nextBytes:4 into:data3.
+
+    inStream close.
+
+    data3 := data3 withoutTrailingSeparators.
+    ((data1 = mainType)
+    and:[typeList includes:data3]) ifTrue:[
+        ^ true
+    ].
+    ^ false.
+
+    "
+     RIFFReader isRIFFFile:'bitmaps/magtape.xpm' withType:'AVI '   
+     RIFFReader isRIFFFile:'/phys/exept/home/pd_stuff/movies/avi/drlair.avi' withType:'AVI'     
+     RIFFReader isRIFFFile: '/usr/share/sounds/alsa/test.wav' withType:'WAVE'      
+    "
+
+    "Created: 4.4.1997 / 22:35:52 / cg"
+    "Modified: 5.4.1997 / 16:12:16 / cg"
+!
+
 isRIFFFile:aFileName
     "return true, if aFileName contains RIFF-encoded data"
 
@@ -109,29 +149,16 @@
     "Modified: 5.4.1997 / 16:12:16 / cg"
 !
 
+isRIFFFile:aFileName withAnyTypeFrom:typeList
+    "return true, if aFileName contains RIFF-encoded data of format:type"
+
+    ^ self isFile:aFileName ofType:'RIFF' withAnySubtypeFrom:typeList
+!
+
 isRIFFFile:aFileName withType:type
     "return true, if aFileName contains RIFF-encoded data of format:type"
 
-    |data1 len data3 inStream|
-
-    inStream := aFileName asFilename readStream.
-    inStream isNil ifTrue:[^ false].
-    inStream binary.
-
-    data1 := String new:4.
-    inStream nextBytes:4 into:data1.
-    len := inStream nextLongMSB:true.
-    data3 := String new:4.
-    inStream nextBytes:4 into:data3.
-
-    inStream close.
-
-    data3 := data3 withoutTrailingSeparators.
-    ((data1 = 'RIFF')
-    and:[data3 = type]) ifTrue:[
-        ^ true
-    ].
-    ^ false.
+    ^ self isRIFFFile:aFileName withAnyTypeFrom:(Array with:type)
 
     "
      RIFFReader isRIFFFile:'bitmaps/magtape.xpm' withType:'AVI '   
@@ -351,6 +378,6 @@
 !RIFFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/RIFFReader.st,v 1.9 2000-12-30 19:50:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/RIFFReader.st,v 1.10 2000-12-30 21:31:41 cg Exp $'
 ! !
 RIFFReader initialize!