mediainfo 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ class String
2
+ def shell_escape
3
+ # The gsub is for ANSI-C style quoting.
4
+ #
5
+ # The $'' is for bash, see http://www.faqs.org/docs/bashman/bashref_12.html,
6
+ # but appears to be working for other shells: sh, zsh, ksh, dash
7
+ "$'#{gsub(/\\|'/) { |c| "\\#{c}" }}'"
8
+ end unless method_defined?(:shell_escape)
9
+ end
data/mediainfo.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{mediainfo}
5
+ s.version = "0.5.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Seth Thomas Rasmussen"]
9
+ s.date = %q{2009-11-19}
10
+ s.description = %q{Mediainfo is a class wrapping the mediainfo CLI (http://mediainfo.sourceforge.net)}
11
+ s.email = %q{sethrasmussen@gmail.com}
12
+ s.extra_rdoc_files = ["LICENSE", "README.markdown", "lib/mediainfo.rb", "lib/mediainfo/attr_readers.rb", "lib/mediainfo/string.rb"]
13
+ s.files = ["Changelog", "LICENSE", "Manifest", "README.markdown", "Rakefile", "lib/mediainfo.rb", "lib/mediainfo/attr_readers.rb", "lib/mediainfo/string.rb", "mediainfo.gemspec", "test/mediainfo_awaywego_encoded_test.rb", "test/mediainfo_awaywego_test.rb", "test/mediainfo_dinner_test.rb", "test/mediainfo_hats_test.rb", "test/mediainfo_string_test.rb", "test/mediainfo_test.rb", "test/mediainfo_vimeo_test.rb", "test/mediainfo_vimeoimage_test.rb", "test/test_helper.rb"]
14
+ s.homepage = %q{http://greatseth.com}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Mediainfo", "--main", "README.markdown"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{mediainfo}
18
+ s.rubygems_version = %q{1.3.5}
19
+ s.summary = %q{Mediainfo is a class wrapping the mediainfo CLI (http://mediainfo.sourceforge.net)}
20
+ s.test_files = ["test/mediainfo_awaywego_encoded_test.rb", "test/mediainfo_awaywego_test.rb", "test/mediainfo_dinner_test.rb", "test/mediainfo_hats_test.rb", "test/mediainfo_string_test.rb", "test/mediainfo_test.rb", "test/mediainfo_vimeo_test.rb", "test/mediainfo_vimeoimage_test.rb", "test/test_helper.rb"]
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 3
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ else
28
+ end
29
+ else
30
+ end
31
+ end
@@ -0,0 +1,271 @@
1
+ require "test_helper"
2
+ require "mediainfo_test_helper"
3
+
4
+ class MediainfoAwaywegoEncodedTest < ActiveSupport::TestCase
5
+ def setup
6
+ @info = mediainfo_mock "AwayWeGo_24fps_253_15000_1920x840.mov"
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-PS", @info.format
21
+ end
22
+
23
+ test "format profile" do
24
+ assert_nil @info.format_profile
25
+ end
26
+
27
+ test "codec id" do
28
+ assert_nil @info.codec_id
29
+ end
30
+
31
+ mediainfo_test_size
32
+
33
+ test "duration" do
34
+ assert_equal 36224, @info.duration
35
+ assert_equal "36s 224ms", @info.duration_before_type_cast
36
+ end
37
+
38
+ test "overall bitrate" do
39
+ assert_equal "17.3 Mbps", @info.overall_bit_rate
40
+ end
41
+
42
+ test "encoded date" do
43
+ assert_nil @info.encoded_date
44
+ end
45
+
46
+ test "tagged date" do
47
+ assert_nil @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 "224 (0xE0)", @info.video_stream_id
62
+ end
63
+
64
+ test "video Format" do
65
+ assert_equal "MPEG Video", @info.video_format
66
+ end
67
+
68
+ test "video format version" do
69
+ assert_equal "Version 2", @info.video_format_version
70
+ end
71
+
72
+ test "video format settings Matrix" do
73
+ assert_equal "Default", @info.video_format_settings_matrix
74
+ end
75
+
76
+ test "video format profile" do
77
+ assert_nil @info.video_format_profile
78
+ end
79
+
80
+ test "video format settings CABAC" do
81
+ assert_nil @info.video_format_settings_cabac
82
+ end
83
+
84
+ test "video format settings ReFrames" do
85
+ assert_nil @info.video_format_settings_reframes
86
+ end
87
+
88
+ test "video Codec ID" do
89
+ assert_nil @info.video_codec_id
90
+ end
91
+
92
+ test "video codec info" do
93
+ assert_nil @info.video_codec_info
94
+ end
95
+
96
+ test "video Duration" do
97
+ assert_equal 36202, @info.video_duration
98
+ assert_equal "36s 202ms", @info.video_duration_before_type_cast
99
+ end
100
+
101
+ test "video bit rate mode" do
102
+ assert_equal "Constant", @info.video_bit_rate_mode
103
+ assert !@info.vbr?
104
+ assert @info.cbr?
105
+ end
106
+
107
+ test "video Bit rate" do
108
+ assert_equal "16.0 Mbps", @info.video_bit_rate
109
+ end
110
+
111
+ test "video nominal bit rate" do
112
+ assert_equal "15.0 Mbps", @info.video_nominal_bit_rate
113
+ end
114
+
115
+ test "resolution" do
116
+ assert_equal "1920x1080", @info.resolution
117
+ end
118
+
119
+ test "video Width" do
120
+ assert_equal 1920, @info.video_width
121
+ assert_equal 1920, @info.width
122
+ end
123
+
124
+ test "video Height" do
125
+ assert_equal 1080, @info.video_height
126
+ assert_equal 1080, @info.height
127
+ end
128
+
129
+ test "video Display aspect ratio" do
130
+ assert_equal "16/9", @info.video_display_aspect_ratio
131
+ assert_equal "16/9", @info.display_aspect_ratio
132
+ end
133
+
134
+ test "video Frame rate" do
135
+ assert_equal "29.970 fps", @info.video_frame_rate
136
+ assert_equal 29.97, @info.fps
137
+ assert_equal 29.97, @info.framerate
138
+ end
139
+
140
+ test "video frame rate mode" do
141
+ assert_nil @info.video_frame_rate_mode
142
+ end
143
+
144
+ test "video Resolution" do
145
+ assert_nil @info.video_resolution
146
+ end
147
+
148
+ test "video colorimetry" do
149
+ assert_equal "4:2:2", @info.video_colorimetry
150
+ assert_equal "4:2:2", @info.video_colorspace
151
+ end
152
+
153
+ test "video Scan type" do
154
+ assert_equal "Interlaced", @info.video_scan_type
155
+ assert @info.interlaced?
156
+ assert !@info.progressive?
157
+ end
158
+
159
+ test "video scan order" do
160
+ assert_equal "Bottom Field First", @info.video_scan_order
161
+ end
162
+
163
+ test "video Bits/(Pixel*Frame)" do
164
+ assert_equal "0.258", @info.video_bits_pixel_frame
165
+ end
166
+
167
+ test "video Stream size" do
168
+ assert_nil @info.video_stream_size
169
+ end
170
+
171
+ test "video encoded date" do
172
+ assert_nil @info.video_encoded_date
173
+ # assert_equal "UTC 2009-03-30 19:57:50", @info.video_encoded_date
174
+ end
175
+
176
+ test "video tagged date" do
177
+ assert_nil @info.video_tagged_date
178
+ # assert_equal "UTC 2009-03-30 19:57:57", @info.video_tagged_date
179
+ end
180
+
181
+ ### AUDIO
182
+
183
+ test "audio stream id" do
184
+ assert_equal "128 (0x80)", @info.audio_stream_id
185
+ end
186
+
187
+ test "audio Format" do
188
+ assert_equal "AC-3", @info.audio_format
189
+ end
190
+
191
+ test "audio format info" do
192
+ assert_equal "Audio Coding 3", @info.audio_format_info
193
+ end
194
+
195
+ test "audio Format settings, Endianness" do
196
+ assert_nil @info.audio_format_settings_endianness
197
+ end
198
+
199
+ test "audio Format settings, Sign" do
200
+ assert_nil @info.audio_format_settings_sign
201
+ end
202
+
203
+ test "audio Codec ID" do
204
+ assert_nil @info.audio_codec_id
205
+ end
206
+
207
+ test "audio Codec ID/Info" do
208
+ assert_nil @info.audio_codec_info
209
+ end
210
+
211
+ test "audio Duration" do
212
+ assert_equal 36224, @info.audio_duration
213
+ assert_equal "36s 224ms", @info.audio_duration_before_type_cast
214
+ end
215
+
216
+ test "audio Bit rate mode" do
217
+ assert_equal "Constant", @info.audio_bit_rate_mode
218
+ end
219
+
220
+ test "audio Bit rate" do
221
+ assert_equal "64.0 Kbps", @info.audio_bit_rate
222
+ end
223
+
224
+ test "audio Channel(s)" do
225
+ assert_equal 2, @info.audio_channels
226
+ end
227
+
228
+ test "audio channel positions" do
229
+ assert_equal "L R", @info.audio_channel_positions
230
+ end
231
+
232
+ test "stereo?" do
233
+ assert @info.stereo?
234
+ end
235
+
236
+ test "mono?" do
237
+ assert !@info.mono?
238
+ end
239
+
240
+ test "audio Sampling rate" do
241
+ assert_equal 48000, @info.audio_sample_rate
242
+ assert_equal 48000, @info.audio_sampling_rate
243
+ assert_equal "48.0 KHz", @info.audio_sampling_rate_before_type_cast
244
+ end
245
+
246
+ test "audio Resolution" do
247
+ assert_nil @info.audio_resolution
248
+ end
249
+
250
+ test "audio Stream size" do
251
+ assert_nil @info.audio_stream_size
252
+ end
253
+
254
+ test "audio Interleave, duration" do
255
+ assert_nil @info.audio_interleave_duration
256
+ end
257
+
258
+ test "audio encoded date" do
259
+ assert_nil @info.audio_encoded_date
260
+ # assert_equal "UTC 2009-03-30 19:57:50", @info.audio_encoded_date
261
+ end
262
+
263
+ test "audio tagged date" do
264
+ assert_nil @info.audio_tagged_date
265
+ # assert_equal "UTC 2009-03-30 19:57:57", @info.audio_tagged_date
266
+ end
267
+
268
+ ### IMAGE
269
+
270
+ mediainfo_test_not_an_image
271
+ end
@@ -0,0 +1,275 @@
1
+ require "test_helper"
2
+ require "mediainfo_test_helper"
3
+
4
+ class MediainfoAwaywegoTest < ActiveSupport::TestCase
5
+ def setup
6
+ @info = mediainfo_mock "AwayWeGo_24fps.mov"
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 "QuickTime", @info.format_profile
25
+ end
26
+
27
+ test "codec id" do
28
+ assert_equal "qt", @info.codec_id
29
+ end
30
+
31
+ mediainfo_test_size
32
+
33
+ test "duration" do
34
+ assert_equal 36286, @info.duration
35
+ assert_equal "36s 286ms", @info.duration_before_type_cast
36
+ end
37
+
38
+ test "overall bitrate" do
39
+ assert_equal "42.7 Mbps", @info.overall_bit_rate
40
+ end
41
+
42
+ test "encoded date" do
43
+ assert_kind_of Time, @info.encoded_date
44
+ # assert_equal "UTC 2009-03-30 19:49:13", @info.encoded_date
45
+ end
46
+
47
+ test "tagged date" do
48
+ assert_kind_of Time, @info.tagged_date
49
+ # assert_equal "UTC 2009-03-30 19:57:57", @info.tagged_date
50
+ end
51
+
52
+ test "writing application" do
53
+ assert_nil @info.writing_application
54
+ end
55
+
56
+ test "writing library" do
57
+ assert_equal "Apple QuickTime", @info.writing_library
58
+ end
59
+
60
+ ### VIDEO
61
+
62
+ test "video stream id" do
63
+ assert_equal "2", @info.video_stream_id
64
+ end
65
+
66
+ test "video Format" do
67
+ assert_equal "AVC", @info.video_format
68
+ end
69
+
70
+ test "video format profile" do
71
+ assert_equal "Main@L4.1", @info.video_format_profile
72
+ end
73
+
74
+ test "video format version" do
75
+ assert_nil @info.video_format_version
76
+ end
77
+
78
+ test "video format settings Matrix" do
79
+ assert_nil @info.video_format_settings_matrix
80
+ end
81
+
82
+ test "video format settings CABAC" do
83
+ assert_equal "No", @info.video_format_settings_cabac
84
+ end
85
+
86
+ test "video format settings ReFrames" do
87
+ assert_equal "2 frames", @info.video_format_settings_reframes
88
+ end
89
+
90
+ test "video Codec ID" do
91
+ assert_equal "avc1", @info.video_codec_id
92
+ end
93
+
94
+ test "video codec info" do
95
+ assert_equal "Advanced Video Coding", @info.video_codec_info
96
+ end
97
+
98
+ test "video Duration" do
99
+ assert_equal 36286, @info.video_duration
100
+ assert_equal "36s 286ms", @info.video_duration_before_type_cast
101
+ end
102
+
103
+ test "video bit rate mode" do
104
+ assert_equal "Variable", @info.video_bit_rate_mode
105
+ assert @info.vbr?
106
+ assert !@info.cbr?
107
+ end
108
+
109
+ test "video Bit rate" do
110
+ assert_equal "41.2 Mbps", @info.video_bit_rate
111
+ end
112
+
113
+ test "video nominal bit rate" do
114
+ assert_nil @info.video_nominal_bit_rate
115
+ end
116
+
117
+ test "resolution" do
118
+ assert_equal "1920x840", @info.resolution
119
+ end
120
+
121
+ test "video Width" do
122
+ assert_equal 1920, @info.video_width
123
+ assert_equal 1920, @info.width
124
+ end
125
+
126
+ test "video Height" do
127
+ assert_equal 840, @info.video_height
128
+ assert_equal 840, @info.height
129
+ end
130
+
131
+ test "video Display aspect ratio" do
132
+ assert_equal "2.25", @info.video_display_aspect_ratio
133
+ assert_equal "2.25", @info.display_aspect_ratio
134
+ end
135
+
136
+ test "video frame rate" do
137
+ assert_equal "23.976 fps", @info.video_frame_rate
138
+ assert_equal 23.976, @info.fps
139
+ assert_equal 23.976, @info.framerate
140
+ end
141
+
142
+ test "video frame rate mode" do
143
+ assert_equal "Constant", @info.video_frame_rate_mode
144
+ end
145
+
146
+ test "video Resolution" do
147
+ assert_equal 24, @info.video_resolution
148
+ assert_equal "24 bits", @info.video_resolution_before_type_cast
149
+ end
150
+
151
+ test "video colorimetry" do
152
+ assert_equal "4:2:0", @info.video_colorimetry
153
+ assert_equal "4:2:0", @info.video_colorspace
154
+ end
155
+
156
+ test "video Scan type" do
157
+ assert_equal "Progressive", @info.video_scan_type
158
+ assert !@info.interlaced?
159
+ assert @info.progressive?
160
+ end
161
+
162
+ test "video scan order" do
163
+ assert_nil @info.video_scan_order
164
+ end
165
+
166
+ test "video Bits/(Pixel*Frame)" do
167
+ assert_equal "1.065", @info.video_bits_pixel_frame
168
+ end
169
+
170
+ test "video Stream size" do
171
+ assert_equal "178 MiB (96%)", @info.video_stream_size
172
+ end
173
+
174
+ test "video encoded date" do
175
+ assert_kind_of Time, @info.video_encoded_date
176
+ # assert_equal "UTC 2009-03-30 19:57:50", @info.video_encoded_date
177
+ end
178
+
179
+ test "video tagged date" do
180
+ assert_kind_of Time, @info.video_tagged_date
181
+ # assert_equal "UTC 2009-03-30 19:57:57", @info.video_tagged_date
182
+ end
183
+
184
+ ### AUDIO
185
+
186
+ test "audio stream id" do
187
+ assert_equal "1", @info.audio_stream_id
188
+ end
189
+
190
+ test "audio Format" do
191
+ assert_equal "PCM", @info.audio_format
192
+ end
193
+
194
+ test "audio format info" do
195
+ assert_nil @info.audio_format_info
196
+ end
197
+
198
+ test "audio Format settings, Endianness" do
199
+ assert_equal "Little", @info.audio_format_settings_endianness
200
+ end
201
+
202
+ test "audio Format settings, Sign" do
203
+ assert_equal "Signed", @info.audio_format_settings_sign
204
+ end
205
+
206
+ test "audio Codec ID" do
207
+ assert_equal "sowt", @info.audio_codec_id
208
+ end
209
+
210
+ test "audio Codec ID/Info" do
211
+ assert_nil @info.audio_codec_info
212
+ end
213
+
214
+ test "audio Duration" do
215
+ assert_equal 36286, @info.audio_duration
216
+ assert_equal "36s 286ms", @info.audio_duration_before_type_cast
217
+ end
218
+
219
+ test "audio Bit rate mode" do
220
+ assert_equal "Constant", @info.audio_bit_rate_mode
221
+ end
222
+
223
+ test "audio Bit rate" do
224
+ assert_equal "1 536 Kbps", @info.audio_bit_rate
225
+ end
226
+
227
+ test "audio Channel(s)" do
228
+ assert_equal 2, @info.audio_channels
229
+ end
230
+
231
+ test "audio channel positions" do
232
+ assert_nil @info.audio_channel_positions
233
+ end
234
+
235
+ test "stereo?" do
236
+ assert @info.stereo?
237
+ end
238
+
239
+ test "mono?" do
240
+ assert !@info.mono?
241
+ end
242
+
243
+ test "audio Sampling rate" do
244
+ assert_equal 48000, @info.audio_sample_rate
245
+ assert_equal 48000, @info.audio_sampling_rate
246
+ assert_equal "48.0 KHz", @info.audio_sampling_rate_before_type_cast
247
+ end
248
+
249
+ test "audio resolution" do
250
+ assert_equal 16, @info.audio_resolution
251
+ assert_equal "16 bits", @info.audio_resolution_before_type_cast
252
+ end
253
+
254
+ test "audio Stream size" do
255
+ assert_equal "6.64 MiB (4%)", @info.audio_stream_size
256
+ end
257
+
258
+ test "audio Interleave, duration" do
259
+ assert_nil @info.audio_interleave_duration
260
+ end
261
+
262
+ test "audio encoded date" do
263
+ assert_kind_of Time, @info.audio_encoded_date
264
+ # assert_equal "UTC 2009-03-30 19:57:50", @info.audio_encoded_date
265
+ end
266
+
267
+ test "audio tagged date" do
268
+ assert_kind_of Time, @info.audio_tagged_date
269
+ # assert_equal "UTC 2009-03-30 19:57:57", @info.audio_tagged_date
270
+ end
271
+
272
+ ### IMAGE
273
+
274
+ mediainfo_test_not_an_image
275
+ end