mediainfo-native 0.1.1 → 0.1.2

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: e07d1c47c08b8c03b5dcc9ed8f0bbccab0dd78f1
4
- data.tar.gz: 808c573cb2551e45722218a7c098e8861333293a
3
+ metadata.gz: b002345aa6d665ca92c66ba77ff0cb9996aaf890
4
+ data.tar.gz: 4975486613761c4e9307be99ac0c5fafcc81979a
5
5
  SHA512:
6
- metadata.gz: 4fbb4b6856edc400e8311819c5797663a89c08b3d6211015153b9a80d0b1c0d0a047eb7e7cff05c8e66944fcc2d8717d5e775d950fe1cec89356e6278e0e6e2c
7
- data.tar.gz: c85706f602da7650333c6731098bbca440ec16bbbbca9f73014d8183f5fce8ceffe9c5ccdd4974414d92666ded9e18b0395389290d63c5bf23073583a4d6f7b2
6
+ metadata.gz: 8e41c585c7e13b06b18c5fd0f897978dc2bebb37b62c8eddb5f65af125385e66771f3a13249474c44f69d827e8613c595ab78218c0db4d3f449f903d6f074722
7
+ data.tar.gz: 816e6c76af927997abf9070b473654cad2a277ba9b95ce6b192bc21f8d5d8a901b746cf55c882fad415484546413a8a250b49313f07135661b6a83dcb9232aa7
@@ -48,27 +48,10 @@ void Init_BaseStream(VALUE mMediaInfoNative)
48
48
  /* ************************** BaseStream ************************************ */
49
49
 
50
50
  BaseStream::BaseStream(StreamType _type, unsigned int _idx, MediaInfoWrapper* _wrapper)
51
- : valid(true), type(_type), idx(_idx), wrapper(_wrapper)
51
+ : type(_type), idx(_idx), wrapper(_wrapper)
52
52
  {
53
53
  }
54
54
 
55
- BaseStream::~BaseStream()
56
- {
57
- if(wrapper)
58
- wrapper->notifyOfStreamDestruction(this);
59
- }
60
-
61
- void BaseStream::notifyOfWrapperDestruction()
62
- {
63
- invalidate();
64
- wrapper = NULL;
65
- }
66
-
67
- void BaseStream::invalidate()
68
- {
69
- valid = false;
70
- }
71
-
72
55
  VALUE BaseStream::wrap()
73
56
  {
74
57
  return Data_Wrap_Struct(stream_klasses[type], 0, bs_free, this);
@@ -76,9 +59,6 @@ VALUE BaseStream::wrap()
76
59
 
77
60
  VALUE BaseStream::lookup(VALUE key) const
78
61
  {
79
- if(!valid)
80
- rb_raise(rb_eStandardError, "stream is invalid");
81
-
82
62
  return wrapper->get(type, idx, key);
83
63
  }
84
64
 
@@ -24,15 +24,11 @@ class BaseStream
24
24
  {
25
25
  public:
26
26
  BaseStream(StreamType _type, unsigned int _idx, MediaInfoWrapper* _wrapper);
27
- ~BaseStream();
28
- void notifyOfWrapperDestruction();
29
- void invalidate();
30
27
 
31
28
  VALUE wrap();
32
29
  VALUE lookup(VALUE key) const;
33
30
 
34
31
  private:
35
- bool valid;
36
32
  const StreamType type;
37
33
  const unsigned int idx;
38
34
  MediaInfoWrapper* wrapper;
@@ -8,10 +8,6 @@ unless have_library('mediainfo')
8
8
  abort 'Failed to test-link against libmediainfo.'
9
9
  end
10
10
 
11
- unless have_library('pthread')
12
- abort 'Failed to test-link against pthread.'
13
- end
14
-
15
11
  non_std_location = mediainfo_cfg.detect { |flag| flag =~ /^-L/ }
16
12
  if non_std_location
17
13
  non_std_location.gsub!('-L', '')
@@ -127,8 +127,6 @@ MediaInfoWrapper::MediaInfoWrapper()
127
127
  mi = new MediaInfoDLL::MediaInfo();
128
128
  mi->Option("Inform", "XML");
129
129
  mi->Option("Complete", "1");
130
-
131
- pthread_mutex_init(&streams_mutex, NULL);
132
130
  }
133
131
 
134
132
  MediaInfoWrapper::~MediaInfoWrapper()
@@ -136,14 +134,6 @@ MediaInfoWrapper::~MediaInfoWrapper()
136
134
  if(file_opened)
137
135
  close();
138
136
 
139
- pthread_mutex_lock(&streams_mutex);
140
- std::list<BaseStream*>::iterator it;
141
- for(it = streams.begin(); it != streams.end(); ++it)
142
- (*it)->notifyOfWrapperDestruction();
143
- streams.clear();
144
- pthread_mutex_unlock(&streams_mutex);
145
- pthread_mutex_destroy(&streams_mutex);
146
-
147
137
  if(mi != NULL)
148
138
  delete mi;
149
139
  }
@@ -165,11 +155,6 @@ void MediaInfoWrapper::close()
165
155
  {
166
156
  CHECK_OPEN;
167
157
 
168
- std::list<BaseStream*>::iterator it;
169
- for(it = streams.begin(); it != streams.end(); ++it)
170
- (*it)->invalidate();
171
- streams.clear();
172
-
173
158
  mi->Close();
174
159
  file_opened = false;
175
160
  }
@@ -207,13 +192,4 @@ VALUE MediaInfoWrapper::option() const
207
192
  return ansi_string_to_value(mi->Option("Info_Parameters"));
208
193
  }
209
194
 
210
- void MediaInfoWrapper::notifyOfStreamDestruction(BaseStream* stream)
211
- {
212
- // Might become EINVAL after destruction.
213
- if(pthread_mutex_lock(&streams_mutex) == 0) {
214
- streams.remove(stream);
215
- pthread_mutex_unlock(&streams_mutex);
216
- }
217
- }
218
-
219
195
  } /* namespace MediaInfoNative */
@@ -2,7 +2,6 @@
2
2
  #define MEDIAINFO_NATIVE_MEDIAINFO_WRAPPER_H
3
3
 
4
4
  #include <list>
5
- #include <pthread.h>
6
5
  #include <ruby.h>
7
6
  #include "basestream.h"
8
7
 
@@ -25,14 +24,10 @@ public:
25
24
  VALUE option() const;
26
25
  VALUE get(StreamType type, unsigned int idx, VALUE key) const;
27
26
 
28
- void notifyOfStreamDestruction(BaseStream* stream);
29
27
 
30
28
  private:
31
29
  bool file_opened;
32
30
  MediaInfoDLL::MediaInfo* mi;
33
-
34
- std::list<BaseStream*> streams;
35
- pthread_mutex_t streams_mutex;
36
31
  };
37
32
 
38
33
  void Init_MediaInfoWrapper(VALUE mMediaInfoNative);
@@ -1,3 +1,3 @@
1
1
  module MediaInfoNative
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mediainfo-native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - FlavourSys Technology GmbH