mediainfo-native 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a2aa4009aef0400d8a9633994d9ab7906178516
4
- data.tar.gz: 6845a11a4d7b43a0db6654c963fc31ac5df24db4
3
+ metadata.gz: 7626158e151bd3538fb0c2cca718ed335c63b6e9
4
+ data.tar.gz: 6db3def0dd85a3e2b45371bd110fb4d91466a6c5
5
5
  SHA512:
6
- metadata.gz: 2017198f63938bae28bfd6acd118b71d6577929784f19d6340799112814996b0555a8da19d18de467100b7335b99f9202814a3289d0bfd88d575299c03ad1225
7
- data.tar.gz: 62816d19a8bebe7112dee3c864b832a58e64019f45be42e041387827899861fce757967c6edf8f7eae6d64864bf9d39c53dbd54ece6a4790b079f727dc39370f
6
+ metadata.gz: cede0d0b9b6b2b0480ad3a7f61c2fb18edcf17db70eb21457bea95f5cb974fe6946b3c64e4219b0574c0a8eb53c58ef0a3ca489b9231f9d3c08500d6bb456004
7
+ data.tar.gz: 11f58fe7d7ae54222c08c381c525e66eaece7a65320d5ce0ea7cec29c757248abcc503f486fcf4c5db1862fee2ed1276cf8d8c0de49ea1353d28e726d429d20c
@@ -9,43 +9,36 @@ module MediaInfoNative
9
9
  @supported_attributes || []
10
10
  end
11
11
 
12
- def mediainfo_attr_reader(attribute, mediainfo_key)
12
+ def mediainfo_attr_reader(attribute, mediainfo_key)
13
13
  attribute_before_type_cast = "#{attribute}_before_type_cast"
14
-
14
+
15
15
  define_method attribute_before_type_cast do
16
16
  instance_variable_get("@#{attribute_before_type_cast}") || instance_variable_set("@#{attribute_before_type_cast}", lookup(mediainfo_key))
17
17
  end
18
-
18
+
19
19
  define_method attribute do
20
20
  if v = instance_variable_get("@#{attribute}")
21
21
  v
22
22
  else
23
23
  v = send(attribute_before_type_cast)
24
24
  v = yield v if v and block_given?
25
-
25
+
26
26
  instance_variable_set("@#{attribute}", v)
27
27
  end
28
28
  end
29
29
 
30
30
  supported_attribute(attribute)
31
31
  end
32
-
32
+
33
33
  def mediainfo_duration_reader(*a)
34
- mediainfo_attr_reader *a do |v|
34
+ mediainfo_attr_reader(*a) do |v|
35
35
  case
36
- when v.include?(":")
37
- # If it is like 00:20:30.600
38
- splitted = v.split(/:|\./)
39
- (splitted[0].to_i * 60 * 60 * 1000) +
40
- (splitted[1].to_i * 60 * 1000) +
41
- (splitted[2].to_i * 1000) +
42
- (splitted[3].to_i)
43
36
  when v.include?('ms')
44
37
  # If it is like '20mn 30s 600ms'
45
38
  t = 0
46
39
  v.split(/\s+/).each do |tf|
47
40
  case tf
48
- # TODO: Haven't actually seen how they represent hours yet
41
+ # TODO: Haven't actually seen how they represent hours yet
49
42
  # but hopefully this is ok.. :\
50
43
  when /\d+h/ then t += tf.to_i * 60 * 60 * 1000
51
44
  when /\d+mn/ then t += tf.to_i * 60 * 1000
@@ -65,7 +58,7 @@ module MediaInfoNative
65
58
  end
66
59
  end
67
60
  end
68
-
61
+
69
62
  def mediainfo_date_reader(*a)
70
63
  # Mediainfo can return wrong timestamps, so we have to correct them before
71
64
  # we let ruby try to parse.
@@ -78,7 +71,7 @@ module MediaInfoNative
78
71
  end
79
72
  end
80
73
  end
81
-
74
+
82
75
  def mediainfo_int_reader(*a)
83
76
  mediainfo_attr_reader(*a) { |v| v.gsub(/\D+/, "").to_i }
84
77
  end
@@ -8,7 +8,7 @@ module MediaInfoNative
8
8
  /(\w+)Stream/.match(self.class.name)[1].downcase.to_sym
9
9
  end
10
10
 
11
- TYPES.each do |type|
11
+ TYPES.each do |type|
12
12
  define_method("#{type}?") { type == stream_type }
13
13
  end
14
14
  end
@@ -12,6 +12,9 @@ module MediaInfoNative
12
12
  mediainfo_attr_reader :overall_bit_rate, 'OverallBitRate'
13
13
  mediainfo_attr_reader :encoded_application_string, 'Encoded_Application/String'
14
14
  mediainfo_attr_reader :encoded_application, 'Encoded_Application'
15
+ mediainfo_int_reader :headersize, 'HeaderSize'
16
+ mediainfo_int_reader :datasize, 'DataSize'
17
+ mediainfo_int_reader :footersize, 'FooterSize'
15
18
  alias_method :writing_application, :encoded_application_string
16
19
 
17
20
  # Since MediaInfo v0.7.76 encoded_application is replaced by
@@ -2,7 +2,6 @@ module MediaInfoNative
2
2
  class OtherStream < BaseStream
3
3
  mediainfo_attr_reader :stream_id, 'ID'
4
4
  mediainfo_attr_reader :type, 'Type'
5
- mediainfo_duration_reader :timestamp_firstframe, 'TimeCode_FirstFrame'
6
- alias_method :timecode, :timestamp_firstframe
5
+ mediainfo_attr_reader :timecode, 'TimeCode_FirstFrame'
7
6
  end
8
7
  end
@@ -1,3 +1,3 @@
1
1
  module MediaInfoNative
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mediainfo-native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - FlavourSys Technology GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-03 00:00:00.000000000 Z
11
+ date: 2017-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.5.2
89
+ rubygems_version: 2.6.11
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Native bindings for mediainfo