mediainfo-native 0.1.0 → 0.1.1

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: e79de9ef5c9367cd0fd16b1e60e42d739534f97b
4
- data.tar.gz: 848f36f9242f311081ab4b595610da1304a65fbd
3
+ metadata.gz: e07d1c47c08b8c03b5dcc9ed8f0bbccab0dd78f1
4
+ data.tar.gz: 808c573cb2551e45722218a7c098e8861333293a
5
5
  SHA512:
6
- metadata.gz: f62ef289e404c36b16c21e20b8d1106fa969844916c849ed1c59b0305e71648d72f2d9f3e165b069a4aaa911dd7e4197cc4d5464f586de9b6be10d7ceebeca5b
7
- data.tar.gz: 4b1a14530d4d8141e7aadc9b2855e9651da436ad4f14ada48d0fa7a8ffcda1ca10bbdf7bc52c0f7978a959acd4ddac112d557130346867efee04d1e2e9a4fbb1
6
+ metadata.gz: 4fbb4b6856edc400e8311819c5797663a89c08b3d6211015153b9a80d0b1c0d0a047eb7e7cff05c8e66944fcc2d8717d5e775d950fe1cec89356e6278e0e6e2c
7
+ data.tar.gz: c85706f602da7650333c6731098bbca440ec16bbbbca9f73014d8183f5fce8ceffe9c5ccdd4974414d92666ded9e18b0395389290d63c5bf23073583a4d6f7b2
@@ -8,6 +8,10 @@ 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
+
11
15
  non_std_location = mediainfo_cfg.detect { |flag| flag =~ /^-L/ }
12
16
  if non_std_location
13
17
  non_std_location.gsub!('-L', '')
@@ -127,6 +127,8 @@ 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);
130
132
  }
131
133
 
132
134
  MediaInfoWrapper::~MediaInfoWrapper()
@@ -134,10 +136,13 @@ MediaInfoWrapper::~MediaInfoWrapper()
134
136
  if(file_opened)
135
137
  close();
136
138
 
139
+ pthread_mutex_lock(&streams_mutex);
137
140
  std::list<BaseStream*>::iterator it;
138
141
  for(it = streams.begin(); it != streams.end(); ++it)
139
142
  (*it)->notifyOfWrapperDestruction();
140
143
  streams.clear();
144
+ pthread_mutex_unlock(&streams_mutex);
145
+ pthread_mutex_destroy(&streams_mutex);
141
146
 
142
147
  if(mi != NULL)
143
148
  delete mi;
@@ -204,7 +209,11 @@ VALUE MediaInfoWrapper::option() const
204
209
 
205
210
  void MediaInfoWrapper::notifyOfStreamDestruction(BaseStream* stream)
206
211
  {
207
- streams.remove(stream);
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
+ }
208
217
  }
209
218
 
210
219
  } /* namespace MediaInfoNative */
@@ -2,6 +2,7 @@
2
2
  #define MEDIAINFO_NATIVE_MEDIAINFO_WRAPPER_H
3
3
 
4
4
  #include <list>
5
+ #include <pthread.h>
5
6
  #include <ruby.h>
6
7
  #include "basestream.h"
7
8
 
@@ -29,7 +30,9 @@ public:
29
30
  private:
30
31
  bool file_opened;
31
32
  MediaInfoDLL::MediaInfo* mi;
33
+
32
34
  std::list<BaseStream*> streams;
35
+ pthread_mutex_t streams_mutex;
33
36
  };
34
37
 
35
38
  void Init_MediaInfoWrapper(VALUE mMediaInfoNative);
@@ -59,7 +59,6 @@ module MediaInfoNative
59
59
  when /\A\d+\.\d+\z/ =~ v
60
60
  v.to_f.round
61
61
  else
62
- puts "TimeFragment: #{v}"
63
62
  raise "unexpected time fragment! please report bug!"
64
63
  end
65
64
  end
@@ -1,3 +1,3 @@
1
1
  module MediaInfoNative
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
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.0
4
+ version: 0.1.1
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-05-22 00:00:00.000000000 Z
11
+ date: 2014-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler