1# 2# Microsoft Resource Interchange File Format 3# with AVI support 4# 5Riff: module 6{ 7 PATH: con "/dis/lib/riff.dis"; 8 9 DEFBUF: con 8192; 10 11 BI_RGB: con 0; 12 BI_RLE8: con 1; 13 BI_RLE4: con 2; 14 BI_BITFEILD: con 3; 15 16 RGB: adt 17 { 18 r: int; 19 g: int; 20 b: int; 21 }; 22 23 Binfosize: con 10*4; 24 Bitmapinfo: adt # Windows bitmap info structure 25 { 26 width: int; # width in pixels 27 height: int; # height in pixels 28 planes: int; # planes of output device (must be 1) 29 bitcount: int; # bits per pixel 30 compression: int; # coding BI_RGB... or IV32 for indeo 31 sizeimage: int; # size in bytes of image 32 xpelpermeter: int; # resolution in pixels per meter 33 ypelpermeter: int; 34 clrused: int; # colors used 35 clrimportant: int; # how fixed is the map 36 37 cmap: array of RGB; # color map 38 }; 39 40 AVImainhdr: con 14*4; 41 AVIhdr: adt 42 { 43 usecperframe: int; 44 bytesec: int; 45 flag: int; 46 frames: int; 47 initframes: int; 48 streams: int; 49 bufsize: int; 50 width: int; 51 height: int; 52 }; 53 54 AVIstreamhdr: con 2*4 + 10*4; 55 AVIstream: adt 56 { 57 # Stream Header information 58 stype: string; 59 handler: string; 60 flags: int; 61 priority: int; 62 initframes: int; 63 scale: int; 64 rate: int; 65 start: int; 66 length: int; 67 bufsize: int; 68 quality: int; 69 samplesz: int; 70 71 # Stream Format information (decoder specific) 72 fmt: array of byte; 73 binfo: ref Bitmapinfo; 74 75 fmt2binfo: fn(a: self ref AVIstream): string; 76 }; 77 78 # Riff descriptor 79 RD: adt 80 { 81 fd: ref sys->FD; # descriptor of RIFF file 82 buf: array of byte; # buffer 83 nbyte: int; # bytes remaining 84 ptr: int; # buffer pointer 85 86 gethdr: fn(r: self ref RD): (string, int); 87 readn: fn(r: self ref RD, b: array of byte, l: int): int; 88 check4: fn(r: self ref RD, code: string): string; 89 avihdr: fn(r: self ref RD): (ref AVIhdr, string); 90 streaminfo: fn(r: self ref RD): (ref AVIstream, string); 91 skip: fn(r: self ref RD, size: int): int; 92 }; 93 94 init: fn(); 95 open: fn(file: string): (ref RD, string); 96}; 97