File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ module github.com/squeeze69/vcodec
2+
3+ go 1.16
4+
5+ require golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9
Original file line number Diff line number Diff line change 1+ golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9 h1:D0iM1dTCbD5Dg1CbuvLC/v/agLc79efSj/L35Q3Vqhs =
2+ golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9 /go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM =
3+ golang.org/x/text v0.3.6 /go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ =
4+ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e /go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ =
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "bufio"
5+ "fmt"
6+ "io"
7+ "io/ioutil"
8+ "log"
9+ "os"
10+
11+ "golang.org/x/image/riff"
12+ )
13+
14+ func main () {
15+ f , err := os .Open (os .Args [1 ])
16+ if err != nil {
17+ log .Fatal (err )
18+ }
19+ defer f .Close ()
20+ formType , r , err := riff .NewReader (bufio .NewReader (io .LimitReader (f , 65000 )))
21+ if err != nil {
22+ log .Fatal (err )
23+ }
24+ fmt .Printf ("RIFF(%s)\n " , formType )
25+ if err := dump (r , ".\t " ); err != nil {
26+ log .Fatal (err )
27+ }
28+ }
29+
30+ func dump (r * riff.Reader , indent string ) error {
31+ for {
32+ chunkID , chunkLen , chunkData , err := r .Next ()
33+ if err == io .EOF {
34+ return nil
35+ }
36+ if err != nil {
37+ return err
38+ }
39+ if chunkID == riff .LIST {
40+ listType , list , err := riff .NewListReader (chunkLen , chunkData )
41+ if err != nil {
42+ return err
43+ }
44+ fmt .Printf ("%sLIST(%s)\n " , indent , listType )
45+ if err := dump (list , indent + ".\t " ); err != nil {
46+ return err
47+ }
48+ continue
49+ }
50+ b , err := ioutil .ReadAll (chunkData )
51+ if err != nil {
52+ return err
53+ }
54+ if string (b [0 :4 ]) == "vids" {
55+ log .Printf ("_%s_" , string (b [4 :8 ]))
56+ }
57+ fmt .Printf ("%s%s %q\n " , indent , chunkID , b )
58+ }
59+ }
You can’t perform that action at this time.
0 commit comments