| 1 | package ffprobescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.13 context/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 6 | "net/httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/" |
| 7 | "osscip-go gomod github.com/golang/go/src go1.13 os/" |
| 8 | "stringsscip-go gomod github.com/golang/go/src go1.13 strings/" |
| 9 | "testingscip-go gomod github.com/golang/go/src go1.13 testing/" |
| 10 | "timescip-go gomod github.com/golang/go/src go1.13 time/" |
| 11 | ) |
| 12 | |
| 13 | const ( |
| 14 | testPathscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/testPath. = "assets/test.mp4" |
| 15 | testPathErrorscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/testPathError. = "assets/test.avi" |
| 16 | ) |
| 17 | |
| 18 | func Test_ProbeURLscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Test_ProbeURL().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 19 | ctx, cancelFn := contextscip-go gomod github.com/golang/go/src go1.13 context/.WithTimeoutscip-go gomod github.com/golang/go/src go1.13 context/WithTimeout().(contextscip-go gomod github.com/golang/go/src go1.13 context/.Backgroundscip-go gomod github.com/golang/go/src go1.13 context/Background().(), 3*timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second.) |
| 20 | defer cancelFn() |
| 21 | |
| 22 | data, err := ProbeURLscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeURL().(ctx, testPathscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/testPath.) |
| 23 | if err != nil { |
| 24 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Error getting data: %v", err) |
| 25 | } |
| 26 | |
| 27 | validateDatascip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/validateData().(t, data) |
| 28 | } |
| 29 | |
| 30 | func Test_ProbeURL_Errorscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Test_ProbeURL_Error().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 31 | ctx, cancelFn := contextscip-go gomod github.com/golang/go/src go1.13 context/.WithTimeoutscip-go gomod github.com/golang/go/src go1.13 context/WithTimeout().(contextscip-go gomod github.com/golang/go/src go1.13 context/.Backgroundscip-go gomod github.com/golang/go/src go1.13 context/Background().(), 3*timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second.) |
| 32 | defer cancelFn() |
| 33 | |
| 34 | _, err := ProbeURLscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeURL().(ctx, testPathErrorscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/testPathError., "-loglevel", "error") |
| 35 | if err == nil { |
| 36 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("No error reading bad asset") |
| 37 | } |
| 38 | |
| 39 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Containsscip-go gomod github.com/golang/go/src go1.13 strings/Contains().(err.Error(), "[]") { |
| 40 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("No stderr included in error message") |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | func Test_ProbeURL_HTTPscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Test_ProbeURL_HTTP().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 45 | const testPort = 20811 |
| 46 | |
| 47 | ctx, cancelFn := contextscip-go gomod github.com/golang/go/src go1.13 context/.WithTimeoutscip-go gomod github.com/golang/go/src go1.13 context/WithTimeout().(contextscip-go gomod github.com/golang/go/src go1.13 context/.Backgroundscip-go gomod github.com/golang/go/src go1.13 context/Background().(), 3*timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second.) |
| 48 | defer cancelFn() |
| 49 | |
| 50 | // Serve all files in assets |
| 51 | go func() { |
| 52 | httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Handlescip-go gomod github.com/golang/go/src go1.13 `net/http`/Handle().("/", httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.FileServerscip-go gomod github.com/golang/go/src go1.13 `net/http`/FileServer().(httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.Dirscip-go gomod github.com/golang/go/src go1.13 `net/http`/Dir#("./assets"))) |
| 53 | err := httpscip-go gomod github.com/golang/go/src go1.13 `net/http`/.ListenAndServescip-go gomod github.com/golang/go/src go1.13 `net/http`/ListenAndServe().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().(":%d", testPort), nil) //nolint:gosec |
| 54 | t.Logscip-go gomod github.com/golang/go/src go1.13 testing/common#Log().(err) |
| 55 | }() |
| 56 | |
| 57 | // Make sure HTTP is up |
| 58 | timescip-go gomod github.com/golang/go/src go1.13 time/.Sleepscip-go gomod github.com/golang/go/src go1.13 time/Sleep().(timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second.) |
| 59 | |
| 60 | data, err := ProbeURLscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeURL().(ctx, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("http://127.0.0.1:%d/test.mp4", testPort)) |
| 61 | if err != nil { |
| 62 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Error getting data: %v", err) |
| 63 | } |
| 64 | |
| 65 | validateDatascip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/validateData().(t, data) |
| 66 | |
| 67 | _, err = ProbeURLscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeURL().(ctx, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("http://127.0.0.1:%d/test.avi", testPort), "-loglevel", "error") |
| 68 | if err == nil { |
| 69 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("No error reading bad asset") |
| 70 | } |
| 71 | |
| 72 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Containsscip-go gomod github.com/golang/go/src go1.13 strings/Contains().(err.Error(), "[]") { |
| 73 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("No stderr included in error message") |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | func Test_ProbeReaderscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Test_ProbeReader().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 78 | ctx, cancelFn := contextscip-go gomod github.com/golang/go/src go1.13 context/.WithTimeoutscip-go gomod github.com/golang/go/src go1.13 context/WithTimeout().(contextscip-go gomod github.com/golang/go/src go1.13 context/.Backgroundscip-go gomod github.com/golang/go/src go1.13 context/Background().(), 3*timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second.) |
| 79 | defer cancelFn() |
| 80 | |
| 81 | fileReader, err := osscip-go gomod github.com/golang/go/src go1.13 os/.Openscip-go gomod github.com/golang/go/src go1.13 os/Open().(testPathscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/testPath.) |
| 82 | if err != nil { |
| 83 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Error opening test file: %v", err) |
| 84 | } |
| 85 | |
| 86 | data, err := ProbeReaderscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeReader().(ctx, fileReader) |
| 87 | if err != nil { |
| 88 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Error getting data: %v", err) |
| 89 | } |
| 90 | |
| 91 | validateDatascip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/validateData().(t, data) |
| 92 | } |
| 93 | |
| 94 | func Test_ProbeReader_Errorscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Test_ProbeReader_Error().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 95 | ctx, cancelFn := contextscip-go gomod github.com/golang/go/src go1.13 context/.WithTimeoutscip-go gomod github.com/golang/go/src go1.13 context/WithTimeout().(contextscip-go gomod github.com/golang/go/src go1.13 context/.Backgroundscip-go gomod github.com/golang/go/src go1.13 context/Background().(), 3*timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second.) |
| 96 | defer cancelFn() |
| 97 | |
| 98 | fileReader, err := osscip-go gomod github.com/golang/go/src go1.13 os/.Openscip-go gomod github.com/golang/go/src go1.13 os/Open().(testPathErrorscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/testPathError.) |
| 99 | if err != nil { |
| 100 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Error opening test file: %v", err) |
| 101 | } |
| 102 | |
| 103 | _, err = ProbeReaderscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeReader().(ctx, fileReader, "-loglevel", "error") |
| 104 | if err == nil { |
| 105 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("No error reading bad asset") |
| 106 | } |
| 107 | |
| 108 | if stringsscip-go gomod github.com/golang/go/src go1.13 strings/.Containsscip-go gomod github.com/golang/go/src go1.13 strings/Contains().(err.Error(), "[]") { |
| 109 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("No stderr included in error message") |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | func validateDatascip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/validateData().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#, data *ProbeDatascip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#) { |
| 114 | validateStreamsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/validateStreams().(t, data) |
| 115 | // Check some Tags |
| 116 | const testMajorBrand = "isom" |
| 117 | if data.Formatscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#Format..Tagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Format#Tags..MajorBrandscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/FormatTags#MajorBrand. != testMajorBrand { |
| 118 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("MajorBrand format tag is not %s", testMajorBrand) |
| 119 | } |
| 120 | |
| 121 | if val, err := data.Formatscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#Format..TagListscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Format#TagList..GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("major_brand"); err != nil { |
| 122 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("retrieving major_brand tag errors: %v", err) |
| 123 | } else if val != testMajorBrand { |
| 124 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("MajorBrand format tag is not %s", testMajorBrand) |
| 125 | } |
| 126 | |
| 127 | // test Format.Duration |
| 128 | duration := data.Formatscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#Format..Durationscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Format#Duration().() |
| 129 | if duration.Secondsscip-go gomod github.com/golang/go/src go1.13 time/Duration#Seconds().() != 5.312 { |
| 130 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("this video is 5.312s.") |
| 131 | } |
| 132 | // test Format.StartTime |
| 133 | startTime := data.Formatscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#Format..StartTimescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Format#StartTime().() |
| 134 | if startTime != timescip-go gomod github.com/golang/go/src go1.13 time/.Durationscip-go gomod github.com/golang/go/src go1.13 time/Duration#(0) { |
| 135 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("this video starts at 0s.") |
| 136 | } |
| 137 | validateChaptersscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/validateChapters().(t, data) |
| 138 | } |
| 139 | |
| 140 | func validateStreamsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/validateStreams().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#, data *ProbeDatascip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#) { |
| 141 | // test ProbeData.GetStream |
| 142 | stream := data.StreamTypescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#StreamType().(StreamVideoscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamVideo.) |
| 143 | if len(stream) != 1 { |
| 144 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("It just has one video stream.") |
| 145 | } |
| 146 | |
| 147 | // Check some Tags |
| 148 | const testLanguage = "und" |
| 149 | if stream[0].Tagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Stream#Tags..Rotatescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Rotate. != 0 { |
| 150 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Video stream rotate tag is not 0") |
| 151 | } |
| 152 | if stream[0].Tagsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Stream#Tags..Languagescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamTags#Language. != testLanguage { |
| 153 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Video stream language tag is not %s", testLanguage) |
| 154 | } |
| 155 | |
| 156 | if val, err := stream[0].TagListscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Stream#TagList..GetStringscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Tags#GetString().("language"); err != nil { |
| 157 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("retrieving language tag errors: %v", err) |
| 158 | } else if val != testLanguage { |
| 159 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Video stream language tag is not %s", testLanguage) |
| 160 | } |
| 161 | |
| 162 | stream = data.StreamTypescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#StreamType().(StreamAudioscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamAudio.) |
| 163 | if len(stream) != 1 { |
| 164 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("It just has one audio stream.") |
| 165 | } |
| 166 | |
| 167 | // this stream is [] |
| 168 | stream = data.StreamTypescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#StreamType().(StreamSubtitlescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamSubtitle.) |
| 169 | if len(stream) != 0 { |
| 170 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("It does not have a subtitle stream.") |
| 171 | } |
| 172 | |
| 173 | stream = data.StreamTypescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#StreamType().(StreamDatascip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamData.) |
| 174 | // We expect at least one data stream, since there are chapters |
| 175 | if len(stream) == 0 { |
| 176 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("It does not have a data stream.") |
| 177 | } |
| 178 | |
| 179 | stream = data.StreamTypescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#StreamType().(StreamAttachmentscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamAttachment.) |
| 180 | if len(stream) != 0 { |
| 181 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("It does not have an attachment stream.") |
| 182 | } |
| 183 | |
| 184 | stream = data.StreamTypescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#StreamType().(StreamAnyscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/StreamAny.) |
| 185 | if len(stream) != 3 { |
| 186 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("It should have three streams.") |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | func validateChaptersscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/validateChapters().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#, data *ProbeDatascip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#) { |
| 191 | chapters := data.Chaptersscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#Chapters. |
| 192 | if chapters == nil { |
| 193 | t.Errorscip-go gomod github.com/golang/go/src go1.13 testing/common#Error().("Chapters List was nil") |
| 194 | return |
| 195 | } |
| 196 | if len(chapters) != 3 { |
| 197 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Expected 3 chapters. Got %d", len(chapters)) |
| 198 | return |
| 199 | } |
| 200 | chapterToTest := chapters[1] |
| 201 | if chapterToTest.Titlescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Chapter#Title().() != "Middle" { |
| 202 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Bad Chapter Name. Got %s", chapterToTest.Titlescip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Chapter#Title().()) |
| 203 | } |
| 204 | if chapterToTest.StartTimeSecondsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Chapter#StartTimeSeconds. != 2.0 { |
| 205 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Bad Chapter Start Time. Got %f", chapterToTest.StartTimeSecondsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Chapter#StartTimeSeconds.) |
| 206 | } |
| 207 | if chapterToTest.EndTimeSecondsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Chapter#EndTimeSeconds. != 4.0 { |
| 208 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Bad Chapter End Time. Got %f", chapterToTest.EndTimeSecondsscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Chapter#EndTimeSeconds.) |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | func Test_ProbeSideDatascip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Test_ProbeSideData().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 213 | ctx, cancelFn := contextscip-go gomod github.com/golang/go/src go1.13 context/.WithTimeoutscip-go gomod github.com/golang/go/src go1.13 context/WithTimeout().(contextscip-go gomod github.com/golang/go/src go1.13 context/.Backgroundscip-go gomod github.com/golang/go/src go1.13 context/Background().(), 3*timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second.) |
| 214 | defer cancelFn() |
| 215 | |
| 216 | fileReader, err := osscip-go gomod github.com/golang/go/src go1.13 os/.Openscip-go gomod github.com/golang/go/src go1.13 os/Open().("assets/test.mov") |
| 217 | if err != nil { |
| 218 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Error opening test file: %v", err) |
| 219 | } |
| 220 | |
| 221 | data, err := ProbeReaderscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeReader().(ctx, fileReader) |
| 222 | if err != nil { |
| 223 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Error getting data: %v", err) |
| 224 | } |
| 225 | |
| 226 | videoStream := data.FirstVideoStreamscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/ProbeData#FirstVideoStream().() |
| 227 | if videoStream == nil { |
| 228 | t.Errorscip-go gomod github.com/golang/go/src go1.13 testing/common#Error().("Video Stream was nil") |
| 229 | return |
| 230 | } |
| 231 | |
| 232 | sideData, err := videoStream.SideDataListscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/Stream#SideDataList..GetDisplayMatrixscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/SideDataList#GetDisplayMatrix().() |
| 233 | if err != nil { |
| 234 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Error getting display matrix: %v", err) |
| 235 | } |
| 236 | |
| 237 | if sideData.Rotationscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/SideDataDisplayMatrix#Rotation. != -180 { |
| 238 | t.Errorfscip-go gomod github.com/golang/go/src go1.13 testing/common#Errorf().("Expected rotation to be -180, got %d", sideData.Rotationscip-go gomod gopkg.in/vansante/go-ffprobe.v2 . `gopkg.in/vansante/go-ffprobe.v2`/SideDataDisplayMatrix#Rotation.) |
| 239 | } |
| 240 | } |