-
Notifications
You must be signed in to change notification settings - Fork 0
/
mp4_test.go
108 lines (100 loc) · 2.17 KB
/
mp4_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package bmff
import (
"io"
"os"
"path/filepath"
"testing"
"github.com/davecgh/go-spew/spew"
)
func readerFromFixture(t *testing.T, path string) io.Reader {
t.Helper()
f, err := os.OpenFile(path, os.O_RDONLY, 0400)
if err != nil {
t.Fatalf("failed to open %s file: %v", path, err)
}
return f
}
func TestParse(t *testing.T) {
type args struct {
src io.Reader
}
tests := []struct {
name string
args args
want File
wantErr bool
}{
// {
// name: "01_simple.mp4",
// args: args{
// src: readerFromFixture(t, filepath.Join("testdata", "01_simple.mp4")),
// },
// want: File{
// Movie: &Movie{
// box: &box{
// boxtype: "ftyp",
// },
// },
// },
// },
// {
// name: "02_dref_edts_img.mp4",
// args: args{
// src: readerFromFixture(t, filepath.Join("testdata", "02_dref_edts_img.mp4")),
// },
// want: File{},
// },
// {
// name: "03_hinted.mp4",
// args: args{
// src: readerFromFixture(t, filepath.Join("testdata", "03_hinted.mp4")),
// },
// want: File{},
// },
// {
// name: "04_bifs_video.mp4",
// args: args{
// src: readerFromFixture(t, filepath.Join("testdata", "04_bifs_video.mp4")),
// },
// want: File{},
// },
// {
// name: "05_bifs_video_protected_v2.mp4",
// args: args{
// src: readerFromFixture(t, filepath.Join("testdata", "05_bifs_video_protected_v2.mp4")),
// },
// want: File{},
// },
// {
// name: "06_bifs.mp4",
// args: args{
// src: readerFromFixture(t, filepath.Join("testdata", "06_bifs.mp4")),
// },
// want: File{},
// },
// {
// name: "07_bifs_sprite.mp4",
// args: args{
// src: readerFromFixture(t, filepath.Join("testdata", "07_bifs_sprite.mp4")),
// },
// want: File{},
// },
{
name: "08_bifs_carousel_v2.mp4",
args: args{
src: readerFromFixture(t, filepath.Join("testdata", "08_bifs_carousel_v2.mp4")),
},
want: File{},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
f, err := Parse(tt.args.src)
if (err != nil) != tt.wantErr {
t.Errorf("Parse() error = %v, wantErr %v", err, tt.wantErr)
return
}
spew.Dump(f)
})
}
}