mediainfo 0.7.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,254 +0,0 @@
1
- require "test_helper"
2
- require "mediainfo_test_helper"
3
-
4
- class MediainfoHatsTest < ActiveSupport::TestCase
5
- def setup
6
- @info = mediainfo_mock "hats.3gp"
7
- end
8
-
9
- ### GENERAL
10
-
11
- test "audio?" do
12
- assert @info.audio?
13
- end
14
-
15
- test "video?" do
16
- assert @info.video?
17
- end
18
-
19
- test "format" do
20
- assert_equal "MPEG-4", @info.format
21
- end
22
-
23
- test "format profile" do
24
- assert_equal "3GPP Media Release 6 Basic", @info.format_profile
25
- end
26
-
27
- test "codec id" do
28
- assert_equal "3gp6", @info.codec_id
29
- end
30
-
31
- mediainfo_test_size
32
-
33
- test "duration" do
34
- assert_equal 301000, @info.duration
35
- assert_equal "5mn 1s", @info.duration_before_type_cast
36
- end
37
-
38
- test "overall bitrate" do
39
- assert_equal "83.2 Kbps", @info.overall_bit_rate
40
- end
41
-
42
- test "encoded date" do
43
- assert_kind_of Time, @info.encoded_date
44
- end
45
-
46
- test "tagged date" do
47
- assert_kind_of Time, @info.tagged_date
48
- end
49
-
50
- test "writing application" do
51
- assert_nil @info.writing_application
52
- end
53
-
54
- test "writing library" do
55
- assert_nil @info.writing_library
56
- end
57
-
58
- ### VIDEO
59
-
60
- test "video stream id" do
61
- assert_equal "1", @info.video.stream_id
62
- end
63
-
64
- test "video Format" do
65
- assert_equal "AVC", @info.video.format
66
- end
67
-
68
- test "video format profile" do
69
- assert_equal "Baseline@L1.0", @info.video.format_profile
70
- end
71
-
72
- test "video format version" do
73
- assert_nil @info.video.format_version
74
- end
75
-
76
- test "video format settings Matrix" do
77
- assert_nil @info.video.format_settings_matrix
78
- end
79
-
80
- test "video format settings CABAC" do
81
- assert_equal "No", @info.video.format_settings_cabac
82
- end
83
-
84
- test "video format settings ReFrames" do
85
- assert_equal "2 frames", @info.video.format_settings_reframes
86
- end
87
-
88
- test "video Codec ID" do
89
- assert_equal "avc1", @info.video.codec_id
90
- end
91
-
92
- test "video Duration" do
93
- assert_equal 301000, @info.video.duration
94
- assert_equal "5mn 1s", @info.video.duration_before_type_cast
95
- end
96
-
97
- test "video Bit rate" do
98
- assert_equal "57.5 Kbps", @info.video.bit_rate
99
- end
100
-
101
- test "video nominal bit rate" do
102
- assert_nil @info.video.nominal_bit_rate
103
- end
104
-
105
- test "video bit rate mode" do
106
- assert_equal "Variable", @info.video.bit_rate_mode
107
- assert @info.video.vbr?
108
- assert !@info.video.cbr?
109
- end
110
-
111
- test "frame size" do
112
- assert_equal "176x144", @info.video.frame_size
113
- end
114
-
115
- test "video Width" do
116
- assert_equal 176, @info.video.width
117
- end
118
-
119
- test "video Height" do
120
- assert_equal 144, @info.video.height
121
- end
122
-
123
- test "video Display aspect ratio" do
124
- assert_equal "1.222", @info.video.display_aspect_ratio
125
- end
126
-
127
- test "video frame rate" do
128
- assert_equal "14.985 fps", @info.video.frame_rate
129
- assert_equal 14.985, @info.video.fps
130
- assert_equal 14.985, @info.video.framerate
131
- end
132
-
133
- test "video frame rate mode" do
134
- assert_equal "Constant", @info.video.frame_rate_mode
135
- end
136
-
137
- test "video Resolution" do
138
- assert_equal 24, @info.video.resolution
139
- assert_equal "24 bits", @info.video.resolution_before_type_cast
140
- end
141
-
142
- test "video colorimetry" do
143
- assert_equal "4:2:0", @info.video.colorimetry
144
- assert_equal "4:2:0", @info.video.colorspace
145
- end
146
-
147
- test "video Scan type" do
148
- assert_equal "Progressive", @info.video.scan_type
149
- assert !@info.video.interlaced?
150
- assert @info.video.progressive?
151
- end
152
-
153
- test "video scan order" do
154
- assert_nil @info.video.scan_order
155
- end
156
-
157
- test "video Bits/(Pixel*Frame)" do
158
- assert_equal "0.152", @info.video.bits_pixel_frame
159
- end
160
-
161
- test "video Stream size" do
162
- assert_equal "2.07 MiB (69%)", @info.video.stream_size
163
- end
164
-
165
- ### AUDIO
166
-
167
- test "audio stream id" do
168
- assert_equal "2", @info.audio.stream_id
169
- end
170
-
171
- test "audio Format" do
172
- assert_equal "AAC", @info.audio.format
173
- end
174
-
175
- test "audio format info" do
176
- assert_equal "Advanced Audio Codec", @info.audio.format_info
177
- end
178
-
179
- test "audio Format settings, Endianness" do
180
- assert_nil @info.audio.format_settings_endianness
181
- end
182
-
183
- test "audio Format settings, Sign" do
184
- assert_nil @info.audio.format_settings_sign
185
- end
186
-
187
- test "audio Codec ID" do
188
- assert_equal "40", @info.audio.codec_id
189
- end
190
-
191
- test "audio Codec ID/Info" do
192
- assert_nil @info.audio.codec_info
193
- end
194
-
195
- test "audio Duration" do
196
- assert_equal 298000, @info.audio.duration
197
- assert_equal "4mn 58s", @info.audio.duration_before_type_cast
198
- end
199
-
200
- test "audio Bit rate mode" do
201
- assert_equal "Constant", @info.audio.bit_rate_mode
202
- end
203
-
204
- test "audio Bit rate" do
205
- assert_equal "24.0 Kbps", @info.audio.bit_rate
206
- end
207
-
208
- test "audio Channel(s)" do
209
- assert_equal 1, @info.audio.channels
210
- end
211
-
212
- test "audio channel positions" do
213
- assert_equal "C", @info.audio.channel_positions
214
- end
215
-
216
- test "stereo?" do
217
- assert !@info.audio.stereo?
218
- end
219
-
220
- test "mono?" do
221
- assert @info.audio.mono?
222
- end
223
-
224
- test "audio Sampling rate" do
225
- assert_equal 16000, @info.audio.sample_rate
226
- assert_equal 16000, @info.audio.sampling_rate
227
- assert_equal "16.0 KHz", @info.audio.sampling_rate_before_type_cast
228
- end
229
-
230
- test "audio resolution" do
231
- assert_equal 16, @info.audio.resolution
232
- assert_equal "16 bits", @info.audio.resolution_before_type_cast
233
- end
234
-
235
- test "audio Stream size" do
236
- assert_equal "877 KiB (29%)", @info.audio.stream_size
237
- end
238
-
239
- test "audio Interleave, duration" do
240
- assert_nil @info.audio.interleave_duration
241
- end
242
-
243
- test "audio encoded date" do
244
- assert_kind_of Time, @info.audio.encoded_date
245
- end
246
-
247
- test "audio tagged date" do
248
- assert_kind_of Time, @info.audio.tagged_date
249
- end
250
-
251
- ### IMAGE
252
-
253
- mediainfo_test_not_an_image
254
- end
@@ -1,526 +0,0 @@
1
- require "test_helper"
2
- require "mediainfo_test_helper"
3
-
4
- class MediainfoMultipleStreamsTest < ActiveSupport::TestCase
5
- def setup
6
- @info = mediainfo_mock "multiple-streams"
7
- end
8
-
9
- ### GENERAL
10
-
11
- test_stream_type_queries :expect => [:audio, :video, :menu]
12
-
13
- test "format" do
14
- assert_equal "MPEG-4", @info.format
15
- end
16
-
17
- test "format profile" do
18
- assert_equal "QuickTime", @info.format_profile
19
- end
20
-
21
- test "codec id" do
22
- assert_equal "qt", @info.codec_id
23
- end
24
-
25
- mediainfo_test_size
26
-
27
- test "duration" do
28
- assert_equal 85000, @info.duration
29
- assert_equal "1mn 25s", @info.duration_before_type_cast
30
- end
31
-
32
- test "overall bitrate" do
33
- assert_equal "9 872 Kbps", @info.overall_bit_rate
34
- end
35
-
36
- test "mastered date" do
37
- assert_nil @info.mastered_date
38
- end
39
-
40
- test "encoded date" do
41
- assert_equal Time.parse("UTC 2009-08-18 16:42:50"), @info.encoded_date
42
- end
43
-
44
- test "tagged date" do
45
- assert_equal Time.parse("UTC 2009-08-18 16:42:55"), @info.tagged_date
46
- end
47
-
48
- test "writing application" do
49
- assert_equal "Sorenson Squeeze 5.0", @info.writing_application
50
- end
51
-
52
- test "writing library" do
53
- assert_equal "Apple QuickTime", @info.writing_library
54
- end
55
-
56
- ### VIDEO
57
-
58
- test "video streams count" do
59
- assert_equal 2, @info.video.count
60
- end
61
-
62
- # stream 1
63
-
64
- test "video 1 stream id" do
65
- assert_equal "2", @info.video[0].stream_id
66
- end
67
-
68
- test "video 1 Format" do
69
- assert_equal "AVC", @info.video[0].format
70
- end
71
-
72
- test "video 1 Format info" do
73
- assert_equal "Advanced Video Codec", @info.video[0].format_info
74
- end
75
-
76
- test "video 1 format profile" do
77
- assert_equal "Baseline@L3.2", @info.video[0].format_profile
78
- end
79
-
80
- test "video 1 format version" do
81
- assert_nil @info.video[0].format_version
82
- end
83
-
84
- test "video 1 format settings Matrix" do
85
- assert_nil @info.video[0].format_settings_matrix
86
- end
87
-
88
- test "video 1 format settings CABAC" do
89
- assert_equal "No", @info.video[0].format_settings_cabac
90
- end
91
-
92
- test "video 1 format settings ReFrames" do
93
- assert_equal "4 frames", @info.video[0].format_settings_reframes
94
- end
95
-
96
- test "video 1 Codec ID" do
97
- assert_equal "avc1", @info.video[0].codec_id
98
- end
99
-
100
- test "video 1 Codec ID info" do
101
- assert_equal "Advanced Video Coding", @info.video[0].codec_id_info
102
- end
103
-
104
- test "video 1 Duration" do
105
- assert_equal 85000, @info.video[0].duration
106
- assert_equal "1mn 25s", @info.video[0].duration_before_type_cast
107
- end
108
-
109
- test "video 1 Bit rate" do
110
- assert_equal "9 392 Kbps", @info.video[0].bit_rate
111
- end
112
-
113
- test "video 1 nominal bit rate" do
114
- assert_nil @info.video[0].nominal_bit_rate
115
- end
116
-
117
- test "video 1 bit rate mode" do
118
- assert_equal "Variable", @info.video[0].bit_rate_mode
119
- assert @info.video[0].vbr?
120
- assert !@info.video[0].cbr?
121
- end
122
-
123
- test "video 1 resolution" do
124
- assert_equal 24, @info.video[0].resolution
125
- end
126
-
127
- test "video 1 Width" do
128
- assert_equal 1280, @info.video[0].width
129
- end
130
-
131
- test "video 1 Height" do
132
- assert_equal 720, @info.video[0].height
133
- end
134
-
135
- test "video 1 frame size" do
136
- assert_equal "1280x720", @info.video[0].frame_size
137
- end
138
-
139
- test "video 1 Display aspect ratio" do
140
- assert_equal "16:9", @info.video[0].display_aspect_ratio
141
- end
142
-
143
- test "video 1 frame rate" do
144
- assert_equal "29.970 fps", @info.video[0].frame_rate
145
- assert_equal 29.97, @info.video[0].fps
146
- assert_equal 29.97, @info.video[0].framerate
147
-
148
- assert_equal 29.94, @info.video[0].min_fps
149
- assert_equal 29.97, @info.video[0].max_fps
150
- end
151
-
152
- test "video 1 frame rate mode" do
153
- assert_equal "Variable", @info.video[0].frame_rate_mode
154
- end
155
-
156
- test "video 1 Resolution" do
157
- assert_equal 24, @info.video[0].resolution
158
- assert_equal "24 bits", @info.video[0].resolution_before_type_cast
159
- end
160
-
161
- test "video 1 standard" do
162
- assert_equal "NTSC", @info.video[0].standard
163
- end
164
-
165
- test "video 1 colorimetry" do
166
- assert_equal "4:2:0", @info.video[0].colorimetry
167
- assert_equal "4:2:0", @info.video[0].colorspace
168
- end
169
-
170
- test "video 1 Scan type" do
171
- assert_equal "Progressive", @info.video[0].scan_type
172
- assert !@info.video[0].interlaced?
173
- assert @info.video[0].progressive?
174
- end
175
-
176
- test "video 1 scan order" do
177
- assert_nil @info.video[0].scan_order
178
- end
179
-
180
- test "video 1 Bits/(Pixel*Frame)" do
181
- assert_equal "0.340", @info.video[0].bits_pixel_frame
182
- end
183
-
184
- test "video 1 Stream size" do
185
- assert_equal "95.6 MiB (95%)", @info.video[0].stream_size
186
- end
187
-
188
- # stream 2
189
-
190
- test "video 2 stream id" do
191
- assert_equal "6", @info.video[1].stream_id
192
- end
193
-
194
- test "video 2 Format" do
195
- assert_equal "AVC", @info.video[1].format
196
- end
197
-
198
- test "video 2 format profile" do
199
- assert_equal "Baseline@L3.2", @info.video[1].format_profile
200
- end
201
-
202
- test "video 2 format version" do
203
- assert_nil @info.video[1].format_version
204
- end
205
-
206
- test "video 2 format settings Matrix" do
207
- assert_nil @info.video[1].format_settings_matrix
208
- end
209
-
210
- test "video 2 format settings CABAC" do
211
- assert_equal "No", @info.video[1].format_settings_cabac
212
- end
213
-
214
- test "video 2 format settings ReFrames" do
215
- assert_equal "4 frames", @info.video[1].format_settings_reframes
216
- end
217
-
218
- test "video 2 Codec ID" do
219
- assert_equal "avc1", @info.video[1].codec_id
220
- end
221
-
222
- test "video 2 Codec ID info" do
223
- assert_equal "Advanced Video Coding", @info.video[1].codec_id_info
224
- end
225
-
226
- test "video 2 Duration" do
227
- assert_equal 4170, @info.video[1].duration
228
- assert_equal "4s 170ms", @info.video[1].duration_before_type_cast
229
- end
230
-
231
- test "video 2 Bit rate" do
232
- assert_equal "656 Kbps", @info.video[1].bit_rate
233
- end
234
-
235
- test "video 2 nominal bit rate" do
236
- assert_nil @info.video[1].nominal_bit_rate
237
- end
238
-
239
- test "video 2 bit rate mode" do
240
- assert_equal "Variable", @info.video[1].bit_rate_mode
241
- assert @info.video[1].vbr?
242
- assert !@info.video[1].cbr?
243
- end
244
-
245
- test "video 2 frame size" do
246
- assert_equal "1280x720", @info.video[1].frame_size
247
- end
248
-
249
- test "video 2 Width" do
250
- assert_equal 1280, @info.video[1].width
251
- end
252
-
253
- test "video 2 Height" do
254
- assert_equal 720, @info.video[1].height
255
- end
256
-
257
- test "video 2 Display aspect ratio" do
258
- assert_equal "16:9", @info.video[1].display_aspect_ratio
259
- end
260
-
261
- test "video 2 frame rate" do
262
- assert_equal "29.970 fps", @info.video[1].frame_rate
263
- assert_equal 29.97, @info.video[1].fps
264
- assert_equal 29.97, @info.video[1].framerate
265
- end
266
-
267
- test "video 2 frame rate mode" do
268
- assert_equal "Constant", @info.video[1].frame_rate_mode
269
- end
270
-
271
- test "video 2 Resolution" do
272
- assert_equal 24, @info.video[1].resolution
273
- assert_equal "24 bits", @info.video[1].resolution_before_type_cast
274
- end
275
-
276
- test "video 2 colorimetry" do
277
- assert_equal "4:2:0", @info.video[1].colorimetry
278
- assert_equal "4:2:0", @info.video[1].colorspace
279
- end
280
-
281
- test "video 2 Scan type" do
282
- assert_equal "Progressive", @info.video[1].scan_type
283
- assert !@info.video[1].interlaced?
284
- assert @info.video[1].progressive?
285
- end
286
-
287
- test "video 2 scan order" do
288
- assert_nil @info.video[1].scan_order
289
- end
290
-
291
- test "video 2 Bits/(Pixel*Frame)" do
292
- assert_equal "0.024", @info.video[1].bits_pixel_frame
293
- end
294
-
295
- test "video 2 Stream size" do
296
- assert_equal "334 KiB (0%)", @info.video[1].stream_size
297
- end
298
-
299
- ### AUDIO
300
-
301
- test "audio streams count" do
302
- assert_equal 2, @info.audio.count
303
- end
304
-
305
- # stream 1
306
-
307
- test "audio 1 stream id" do
308
- assert_equal "1", @info.audio[0].stream_id
309
- end
310
-
311
- test "audio 1 Format" do
312
- assert_equal "AAC", @info.audio[0].format
313
- end
314
-
315
- test "audio 1 format info" do
316
- assert_equal "Advanced Audio Codec", @info.audio[0].format_info
317
- end
318
-
319
- test "audio 1 format version" do
320
- assert_equal "Version 4", @info.audio[0].format_version
321
- end
322
-
323
- test "audio 1 format profile" do
324
- assert_equal "LC", @info.audio[0].format_profile
325
- end
326
-
327
- test "audio 1 format settings SBR" do
328
- assert_equal "No", @info.audio[0].format_settings_sbr
329
- end
330
-
331
- test "audio 1 codec id" do
332
- assert_equal "40", @info.audio[0].codec_id
333
- end
334
-
335
- test "audio 1 codec id hint" do
336
- assert_nil @info.audio[0].codec_id_hint
337
- end
338
-
339
- test "audio 1 Format settings, Endianness" do
340
- assert_nil @info.audio[0].format_settings_endianness
341
- end
342
-
343
- test "audio 1 Format settings, Sign" do
344
- assert_nil @info.audio[0].format_settings_sign
345
- end
346
-
347
- test "audio 1 Codec ID" do
348
- assert_equal "40", @info.audio[0].codec_id
349
- end
350
-
351
- test "audio 1 Codec ID/Info" do
352
- assert_nil @info.audio[0].codec_info
353
- end
354
-
355
- test "audio 1 Duration" do
356
- assert_equal 85000, @info.audio[0].duration
357
- assert_equal "1mn 25s", @info.audio[0].duration_before_type_cast
358
- end
359
-
360
- test "audio 1 Bit rate mode" do
361
- assert_equal "Variable", @info.audio[0].bit_rate_mode
362
- end
363
-
364
- test "audio 1 Bit rate" do
365
- assert_equal "256 Kbps", @info.audio[0].bit_rate
366
- end
367
-
368
- test "audio 1 Channel(s)" do
369
- assert_equal 2, @info.audio[0].channels
370
- end
371
-
372
- test "audio 1 channel positions" do
373
- assert_equal "L R", @info.audio[0].channel_positions
374
- end
375
-
376
- test "audio 1 stereo?" do
377
- assert @info.audio[0].stereo?
378
- end
379
-
380
- test "audio 1 mono?" do
381
- assert !@info.audio[0].mono?
382
- end
383
-
384
- test "audio 1 Sampling rate" do
385
- assert_equal 48000, @info.audio[0].sample_rate
386
- assert_equal 48000, @info.audio[0].sampling_rate
387
- assert_equal "48.0 KHz", @info.audio[0].sampling_rate_before_type_cast
388
- end
389
-
390
- test "audio 1 resolution" do
391
- assert_equal 16, @info.audio[0].resolution
392
- assert_equal "16 bits", @info.audio[0].resolution_before_type_cast
393
- end
394
-
395
- test "audio 1 Stream size" do
396
- assert_equal "2.61 MiB (3%)", @info.audio[0].stream_size
397
- end
398
-
399
- test "audio 1 Interleave, duration" do
400
- assert_nil @info.audio[0].interleave_duration
401
- end
402
-
403
- test "audio 1 tagged date" do
404
- assert_kind_of Time, @info.audio[0].tagged_date
405
- end
406
-
407
- test "audio 1 encoded date" do
408
- assert_kind_of Time, @info.audio[0].encoded_date
409
- end
410
-
411
- # stream 2
412
-
413
- test "audio 2 stream id" do
414
- assert_equal "5", @info.audio[1].stream_id
415
- end
416
-
417
- test "audio 2 Format" do
418
- assert_equal "AAC", @info.audio[1].format
419
- end
420
-
421
- test "audio 2 Format version" do
422
- assert_equal "Version 4", @info.audio[1].format_version
423
- end
424
-
425
- test "audio 2 Format profile" do
426
- assert_equal "LC", @info.audio[1].format_profile
427
- end
428
-
429
- test "audio 2 format info" do
430
- assert_equal "Advanced Audio Codec", @info.audio[1].format_info
431
- end
432
-
433
- test "audio 2 codec id hint" do
434
- assert_nil @info.audio[1].codec_id_hint
435
- end
436
-
437
- test "audio 2 Format settings, Endianness" do
438
- assert_nil @info.audio[1].format_settings_endianness
439
- end
440
-
441
- test "audio 1 format settings SBR" do
442
- assert_equal "No", @info.audio[1].format_settings_sbr
443
- end
444
-
445
- test "audio 2 Format settings, Sign" do
446
- assert_nil @info.audio[1].format_settings_sign
447
- end
448
-
449
- test "audio 2 Codec ID" do
450
- assert_equal "40", @info.audio[1].codec_id
451
- end
452
-
453
- test "audio 2 Codec ID/Info" do
454
- assert_nil @info.audio[1].codec_info
455
- end
456
-
457
- test "audio 2 Duration" do
458
- assert_equal 4156, @info.audio[1].duration
459
- assert_equal "4s 156ms", @info.audio[1].duration_before_type_cast
460
- end
461
-
462
- test "audio 2 Bit rate mode" do
463
- assert_equal "Constant", @info.audio[1].bit_rate_mode
464
- end
465
-
466
- test "audio 2 Bit rate" do
467
- assert_equal "256 Kbps", @info.audio[1].bit_rate
468
- end
469
-
470
- test "audio 2 Channel(s)" do
471
- assert_equal 2, @info.audio[1].channels
472
- end
473
-
474
- test "audio 2 channel positions" do
475
- assert_equal "L R", @info.audio[1].channel_positions
476
- end
477
-
478
- test "audio 2 stereo?" do
479
- assert @info.audio[1].stereo?
480
- end
481
-
482
- test "audio 2 mono?" do
483
- assert !@info.audio[1].mono?
484
- end
485
-
486
- test "audio 2 Sampling rate" do
487
- assert_equal 44100, @info.audio[1].sample_rate
488
- assert_equal 44100, @info.audio[1].sampling_rate
489
- assert_equal "44.1 KHz", @info.audio[1].sampling_rate_before_type_cast
490
- end
491
-
492
- test "audio 2 resolution" do
493
- assert_equal 16, @info.audio[1].resolution
494
- assert_equal "16 bits", @info.audio[1].resolution_before_type_cast
495
- end
496
-
497
- test "audio 2 Stream size" do
498
- assert_equal "130 KiB (0%)", @info.audio[1].stream_size
499
- end
500
-
501
- test "audio 2 Interleave, duration" do
502
- assert_nil @info.audio[1].interleave_duration
503
- end
504
-
505
- test "audio 1 tagged date" do
506
- assert_kind_of Time, @info.audio[1].tagged_date
507
- end
508
-
509
- test "audio 1 encoded date" do
510
- assert_kind_of Time, @info.audio[1].encoded_date
511
- end
512
-
513
- ### IMAGE
514
-
515
- mediainfo_test_not_an_image
516
-
517
- ### MENU
518
-
519
- test "menu" do
520
- assert @info.menu?
521
- assert @info.menu.stream_id
522
- assert @info.menu.encoded_date
523
- assert @info.menu.tagged_date
524
- assert @info.menu.delay
525
- end
526
- end