mediainfo-native 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0b1502f91c83eca2c8f057f9df9f5048afcafe0
4
- data.tar.gz: a181df52fa311bb36dcd6aa8e7669328a098d2ea
3
+ metadata.gz: 78ccb6789ac08eaeee5b46c17d1999d50c89bbb1
4
+ data.tar.gz: 7e5e25155198de8386df539586ec44ebd1a1c33d
5
5
  SHA512:
6
- metadata.gz: e3f5f0c3fe7bdba919b0621e64018b09f28fd14c55689559382e5a6abdd042f457986879d29d3ba59573aac3334021f5ab47bd4824578f64fde2784b78b391bd
7
- data.tar.gz: ffe53edefd1ae6e968b61c19602ef93e4ac8f633c93c2f52721ea712648a36ba5ddb05b46d6949132e1e672895dce21d1e763c389555c7cb2348f141c6379ad4
6
+ metadata.gz: 1cfa0d9a72d1381b64bc473e91d50ea6e8a528d12e69d1fff0390a21247f54ea2a9d0e46c5b219fe3bbeb4f69ec402413f84bdb90c7b9113e81492b4b5b490b1
7
+ data.tar.gz: 4f39aaae711eae84e30d6cdf5a68500e9df34f820a4c9bc1387ec04a2675e666979ea93f9327b682874441232a6f63d191488890282945446f9e0399948ad663
@@ -71,6 +71,13 @@ extern "C"
71
71
  return Qnil;
72
72
  }
73
73
 
74
+ static VALUE miw_is_open(VALUE self)
75
+ {
76
+ GET_WRAPPER(miw);
77
+
78
+ return miw->isOpen() ? Qtrue : Qfalse;
79
+ }
80
+
74
81
  static VALUE miw_streams(VALUE self)
75
82
  {
76
83
  GET_WRAPPER(miw);
@@ -108,6 +115,7 @@ void Init_MediaInfoWrapper(VALUE mMediaInfoNative)
108
115
 
109
116
  rb_define_method(cMediaInfo, "close", (RUBYFUNC) miw_close, 0);
110
117
  rb_define_method(cMediaInfo, "open", (RUBYFUNC) miw_open, 1);
118
+ rb_define_method(cMediaInfo, "is_open?", (RUBYFUNC) miw_is_open, 0);
111
119
  rb_define_method(cMediaInfo, "streams", (RUBYFUNC) miw_streams, 0);
112
120
 
113
121
  rb_define_method(cMediaInfo, "inform", (RUBYFUNC) miw_inform, 1);
@@ -173,6 +181,11 @@ int MediaInfoWrapper::open(std::string path)
173
181
  return 0;
174
182
  }
175
183
 
184
+ bool MediaInfoWrapper::isOpen() const
185
+ {
186
+ return file_opened;
187
+ }
188
+
176
189
  void MediaInfoWrapper::close()
177
190
  {
178
191
  CHECK_OPEN;
@@ -18,6 +18,7 @@ public:
18
18
  ~MediaInfoWrapper();
19
19
 
20
20
  int open(MediaInfoDLL::String path);
21
+ bool isOpen() const;
21
22
  void close();
22
23
  VALUE wrapStreams();
23
24
 
@@ -11,8 +11,16 @@ module MediaInfoNative
11
11
  end
12
12
  end
13
13
 
14
+ def respond_to?(meth, include_all = false)
15
+ (is_open? && self.general.respond_to?(meth, include_all)) || super
16
+ end
17
+
14
18
  def method_missing(meth, *args, &block)
15
- self.general.send(meth, *args, &block)
19
+ if self.general.respond_to?(meth)
20
+ self.general.send(meth, *args, &block)
21
+ else
22
+ super
23
+ end
16
24
  end
17
25
 
18
26
  [:video, :audio, :image, :other].each do |t|
@@ -20,6 +28,10 @@ module MediaInfoNative
20
28
  self.send(t).count > 0
21
29
  end
22
30
  end
31
+
32
+ # Alias the open method as it is actually a Kernel method and
33
+ # brings trouble with method_missing approaches.
34
+ alias_method :open_file, :open
23
35
  end
24
36
 
25
37
  class StreamProxy
@@ -34,6 +46,19 @@ module MediaInfoNative
34
46
  def [](idx); @streams[idx]; end
35
47
  def count; @streams.size; end
36
48
 
49
+ def respond_to?(meth, include_all = false)
50
+ begin
51
+ case @streams.size
52
+ when 0
53
+ false
54
+ when 1
55
+ @streams.first.respond_to?(meth, include_all)
56
+ else
57
+ raise SingleStreamAPIError
58
+ end
59
+ end || super
60
+ end
61
+
37
62
  def method_missing(m, *a, &b)
38
63
  case @streams.size
39
64
  when 0
@@ -5,6 +5,7 @@ module MediaInfoNative
5
5
  mediainfo_duration_reader :duration, 'Duration'
6
6
 
7
7
  mediainfo_attr_reader :format, 'Format'
8
+ alias_method :fmt, :format
8
9
  mediainfo_attr_reader :format_profile, 'Format_Profile'
9
10
  mediainfo_attr_reader :format_info, 'Format_Info'
10
11
  mediainfo_attr_reader :codec, 'Codec'
@@ -1,3 +1,3 @@
1
1
  module MediaInfoNative
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
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.1.5
4
+ version: 0.1.6
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: 2014-07-16 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler