mxfinfo 0.1.0 → 0.2.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 +5 -5
- data/.gitignore +1 -0
- data/compile_commands.json +52 -0
- data/ext/mxfinfo/mxfinfo.c +28 -17
- data/lib/mxfinfo.rb +3 -8
- data/lib/mxfinfo/version.rb +1 -2
- data/mxfinfo.gemspec +9 -10
- data/spec/fixtures/IMG_0395.MOV.A14DC7130D.mxf +0 -0
- data/spec/info_object_spec.rb +9 -8
- data/spec/mxfinfo_spec.rb +5 -1
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aa3df278ee25b7a72dc59e151ac43a9b6fb68322b024f4a1936ca26b07fa8510
|
4
|
+
data.tar.gz: 26769c4edb88678e718507f1c7d3b90b5f3ab9ca24c2d019a1f9989f7eafe628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d9fb19f7d1b9f505992c62e6573b6509255036f8ef95795d9d82196c75314190bdb0e207170760372571e23dfc6ccc03cd25c9425004b84a60eede1f6f0fc5d
|
7
|
+
data.tar.gz: e350f2325a5ade79be7d7bf08b8a5719498833dc56b47475add0625511dc0631a34f210b4659c9ad470c125b42711dec5c72be4edba9a1c0094b895dba5043b8
|
data/.gitignore
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"arguments": [
|
4
|
+
"gcc",
|
5
|
+
"-c",
|
6
|
+
"-I.",
|
7
|
+
"-I/home/steved/.rbenv/versions/2.5.8/include/ruby-2.5.0/x86_64-linux",
|
8
|
+
"-I/home/steved/.rbenv/versions/2.5.8/include/ruby-2.5.0/ruby/backward",
|
9
|
+
"-I/home/steved/.rbenv/versions/2.5.8/include/ruby-2.5.0",
|
10
|
+
"-I../../../../ext/mxfinfo",
|
11
|
+
"-I/opt/environments/strawberry/include/libMXF-1.0",
|
12
|
+
"--std=gnu99",
|
13
|
+
"-D_GNU_SOURCE",
|
14
|
+
"-Wall",
|
15
|
+
"-I/home/steved/.rbenv/versions/2.5.8/include",
|
16
|
+
"-fPIC",
|
17
|
+
"-O3",
|
18
|
+
"-ggdb3",
|
19
|
+
"-fPIC",
|
20
|
+
"-o",
|
21
|
+
"avid_mxf_info.o",
|
22
|
+
"../../../../ext/mxfinfo/avid_mxf_info.c"
|
23
|
+
],
|
24
|
+
"directory": "/home/steved/Documents/projective/github/mxfinfo/tmp/x86_64-linux/mxfinfo/2.5.8",
|
25
|
+
"file": "../../../../ext/mxfinfo/avid_mxf_info.c"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"arguments": [
|
29
|
+
"gcc",
|
30
|
+
"-c",
|
31
|
+
"-I.",
|
32
|
+
"-I/home/steved/.rbenv/versions/2.5.8/include/ruby-2.5.0/x86_64-linux",
|
33
|
+
"-I/home/steved/.rbenv/versions/2.5.8/include/ruby-2.5.0/ruby/backward",
|
34
|
+
"-I/home/steved/.rbenv/versions/2.5.8/include/ruby-2.5.0",
|
35
|
+
"-I../../../../ext/mxfinfo",
|
36
|
+
"-I/opt/environments/strawberry/include/libMXF-1.0",
|
37
|
+
"--std=gnu99",
|
38
|
+
"-D_GNU_SOURCE",
|
39
|
+
"-Wall",
|
40
|
+
"-I/home/steved/.rbenv/versions/2.5.8/include",
|
41
|
+
"-fPIC",
|
42
|
+
"-O3",
|
43
|
+
"-ggdb3",
|
44
|
+
"-fPIC",
|
45
|
+
"-o",
|
46
|
+
"mxfinfo.o",
|
47
|
+
"../../../../ext/mxfinfo/mxfinfo.c"
|
48
|
+
],
|
49
|
+
"directory": "/home/steved/Documents/projective/github/mxfinfo/tmp/x86_64-linux/mxfinfo/2.5.8",
|
50
|
+
"file": "../../../../ext/mxfinfo/mxfinfo.c"
|
51
|
+
}
|
52
|
+
]
|
data/ext/mxfinfo/mxfinfo.c
CHANGED
@@ -9,13 +9,12 @@ static
|
|
9
9
|
VALUE rb_time_from_mxf_timestamp(mxfTimestamp *ts)
|
10
10
|
{
|
11
11
|
/*
|
12
|
-
* NOTE: This is probably not thread-safe, since struct tm*
|
13
|
-
* returned by localtime is shared static.
|
12
|
+
* NOTE: This is probably not thread-safe, since struct tm* returned by localtime is shared static.
|
14
13
|
*/
|
15
14
|
time_t t;
|
16
15
|
time(&t);
|
17
16
|
struct tm *tmts;
|
18
|
-
tmts =
|
17
|
+
tmts = gmtime(&t);
|
19
18
|
|
20
19
|
tmts->tm_year = (int) ts->year - 1900;
|
21
20
|
tmts->tm_mon = (int) ts->month - 1;
|
@@ -23,6 +22,7 @@ VALUE rb_time_from_mxf_timestamp(mxfTimestamp *ts)
|
|
23
22
|
tmts->tm_hour = (int) ts->hour;
|
24
23
|
tmts->tm_min = (int) ts->min;
|
25
24
|
tmts->tm_sec = (int) ts->sec;
|
25
|
+
tmts->tm_isdst = -1;
|
26
26
|
|
27
27
|
return rb_time_new(mktime(tmts), ts->qmsec);
|
28
28
|
}
|
@@ -74,8 +74,12 @@ VALUE rb_str_from_label(const unsigned char *lbl, int len)
|
|
74
74
|
{ \
|
75
75
|
AvidMXFInfo *info; \
|
76
76
|
Data_Get_Struct(self, AvidMXFInfo, info); \
|
77
|
-
|
78
|
-
|
77
|
+
if((info->attr).denominator == 0) { \
|
78
|
+
return Qnil; \
|
79
|
+
} else { \
|
80
|
+
return rb_rational_new(INT2FIX((info-> attr ).numerator), \
|
81
|
+
INT2FIX((info-> attr ).denominator)); \
|
82
|
+
} \
|
79
83
|
}
|
80
84
|
|
81
85
|
#define CIO_INT_GETTER(name, attr) CIO_GENERIC_GETTER(INT2FIX, name, attr)
|
@@ -86,6 +90,9 @@ VALUE rb_str_from_label(const unsigned char *lbl, int len)
|
|
86
90
|
|
87
91
|
VALUE m_mxfinfo = Qnil;
|
88
92
|
VALUE c_infoobject = Qnil;
|
93
|
+
VALUE c_error = Qnil;
|
94
|
+
VALUE c_eNotOpAtom = Qnil;
|
95
|
+
VALUE c_eNotReadable = Qnil;
|
89
96
|
|
90
97
|
static
|
91
98
|
void cio_free(void *ptr) {
|
@@ -106,7 +113,7 @@ void* ami_read_info_without_gvl(void* ptr)
|
|
106
113
|
return NULL;
|
107
114
|
}
|
108
115
|
|
109
|
-
static
|
116
|
+
static
|
110
117
|
VALUE cio_new(VALUE class, VALUE path)
|
111
118
|
{
|
112
119
|
Check_Type(path, T_STRING);
|
@@ -129,22 +136,22 @@ VALUE cio_new(VALUE class, VALUE path)
|
|
129
136
|
switch(params.result)
|
130
137
|
{
|
131
138
|
case -2:
|
132
|
-
rb_raise(
|
139
|
+
rb_raise(c_eNotReadable, "Failed to open file.");
|
133
140
|
break;
|
134
141
|
case -3:
|
135
|
-
rb_raise(
|
142
|
+
rb_raise(c_eNotReadable, "Failed to read header partition.");
|
136
143
|
break;
|
137
144
|
case -4:
|
138
|
-
rb_raise(
|
145
|
+
rb_raise(c_eNotOpAtom, "File is not OP-Atom.");
|
139
146
|
break;
|
140
147
|
case -1:
|
141
148
|
default:
|
142
|
-
rb_raise(
|
149
|
+
rb_raise(c_eNotReadable, "Failed to read info.");
|
143
150
|
break;
|
144
151
|
}
|
145
152
|
|
146
153
|
return Qnil;
|
147
|
-
}
|
154
|
+
}
|
148
155
|
else
|
149
156
|
{
|
150
157
|
VALUE tdata = Data_Wrap_Struct(class, 0, cio_free, info);
|
@@ -205,7 +212,7 @@ VALUE cio_get_material_package_uid(VALUE self)
|
|
205
212
|
unsigned char *uid = (unsigned char*) &info->materialPackageUID;
|
206
213
|
|
207
214
|
VALUE ary = rb_ary_new2(32);
|
208
|
-
for(unsigned int i = 0; i < 32; i++)
|
215
|
+
for(unsigned int i = 0; i < 32; i++)
|
209
216
|
{
|
210
217
|
rb_ary_store(ary, i, CHR2FIX(uid[i]));
|
211
218
|
}
|
@@ -238,7 +245,7 @@ VALUE cio_get_aspect_ratio(VALUE self)
|
|
238
245
|
if(info->isVideo && info->aspectRatio.denominator != 0)
|
239
246
|
{
|
240
247
|
return rb_rational_new(INT2FIX(info->aspectRatio.numerator),
|
241
|
-
INT2FIX(info->aspectRatio.denominator));
|
248
|
+
INT2FIX(info->aspectRatio.denominator));
|
242
249
|
}
|
243
250
|
else
|
244
251
|
{
|
@@ -286,12 +293,16 @@ VALUE cio_get_clip_track_string(VALUE self)
|
|
286
293
|
|
287
294
|
void Init_mxfinfo()
|
288
295
|
{
|
289
|
-
m_mxfinfo = rb_define_module("MXFInfo");
|
296
|
+
m_mxfinfo = rb_define_module("MXFInfo");
|
297
|
+
|
298
|
+
c_error = rb_define_class_under(m_mxfinfo, "Error", rb_eStandardError);
|
299
|
+
c_eNotOpAtom = rb_define_class_under(c_error, "NotOpAtom", c_error);
|
300
|
+
c_eNotReadable = rb_define_class_under(c_error, "NotReadable", c_error);
|
290
301
|
|
291
302
|
c_infoobject = rb_define_class_under(m_mxfinfo, "InfoObject", rb_cObject);
|
292
303
|
rb_define_singleton_method(c_infoobject, "new", cio_new, 1);
|
293
|
-
|
294
|
-
rb_define_method(c_infoobject, "
|
304
|
+
|
305
|
+
rb_define_method(c_infoobject, "_clip_name", cio_get_clip_name, 0);
|
295
306
|
rb_define_method(c_infoobject, "project_name", cio_get_project_name, 0);
|
296
307
|
rb_define_method(c_infoobject, "clip_created", cio_get_clip_created, 0);
|
297
308
|
rb_define_method(c_infoobject, "project_edit_rate", cio_get_project_edit_rate, 0);
|
@@ -302,7 +313,7 @@ void Init_mxfinfo()
|
|
302
313
|
/* int numUserComments */
|
303
314
|
/* AvidTaggedValue *materialPackageAttributes */
|
304
315
|
/* int numMaterialPackageAttributes */
|
305
|
-
|
316
|
+
|
306
317
|
rb_define_method(c_infoobject, "num_video_tracks", cio_get_num_video_tracks, 0);
|
307
318
|
rb_define_method(c_infoobject, "num_audio_tracks", cio_get_num_audio_tracks, 0);
|
308
319
|
rb_define_method(c_infoobject, "tracks_string", cio_get_tracks_string, 0);
|
data/lib/mxfinfo.rb
CHANGED
@@ -15,7 +15,7 @@ module MXFInfo
|
|
15
15
|
|
16
16
|
class InfoObject
|
17
17
|
alias_method :videotracks, :num_video_tracks
|
18
|
-
alias_method :v_tracks, :num_video_tracks
|
18
|
+
alias_method :v_tracks, :num_video_tracks
|
19
19
|
alias_method :video_tracks, :num_video_tracks
|
20
20
|
alias_method :audiotracks, :num_audio_tracks
|
21
21
|
alias_method :audio_tracks, :num_audio_tracks
|
@@ -33,13 +33,8 @@ module MXFInfo
|
|
33
33
|
physical_package_name == "Precompute Source Mob"
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
result = self.send(:essence_type_orig)
|
39
|
-
if result.start_with?("DNxHD")
|
40
|
-
result.gsub!(/ \(\d+\)/, "")
|
41
|
-
end
|
42
|
-
result
|
36
|
+
def clip_name
|
37
|
+
_clip_name&.force_encoding('UTF-8')
|
43
38
|
end
|
44
39
|
end
|
45
40
|
end
|
data/lib/mxfinfo/version.rb
CHANGED
data/mxfinfo.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
require File.expand_path('
|
1
|
+
require File.expand_path('lib/mxfinfo/version', __dir__)
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.authors = ['Steve Dierker', 'Malte Rohde']
|
5
|
-
gem.email = ['technology@
|
6
|
-
gem.description =
|
7
|
-
gem.summary =
|
8
|
-
gem.homepage = 'http://github.com/
|
5
|
+
gem.email = ['technology@projective.io']
|
6
|
+
gem.description = 'MXFinfo is a gem that wraps avidmxfinfo from libmxf in a native ruby extension.'
|
7
|
+
gem.summary = 'MXFinfo is a gem that wraps avidmxfinfo from libmxf in a native ruby extension.'
|
8
|
+
gem.homepage = 'http://github.com/projectivetech/mxfinfo'
|
9
9
|
|
10
|
-
gem.files = `git ls-files`.split(
|
11
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
10
|
+
gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
11
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.extensions = ['ext/mxfinfo/extconf.rb']
|
14
14
|
gem.name = 'mxfinfo'
|
@@ -18,8 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
|
19
19
|
gem.required_ruby_version = '>= 1.9.3'
|
20
20
|
|
21
|
+
gem.add_development_dependency 'rake-compiler', '~> 1.0'
|
21
22
|
gem.add_development_dependency 'rspec', '~> 3'
|
22
|
-
gem.add_development_dependency 'rspec-its', '1.
|
23
|
-
gem.add_development_dependency 'rake-compiler', '~> 0.9'
|
23
|
+
gem.add_development_dependency 'rspec-its', '1.3.0'
|
24
24
|
end
|
25
|
-
|
File without changes
|
data/spec/info_object_spec.rb
CHANGED
@@ -1,29 +1,30 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'time'
|
2
3
|
|
3
4
|
describe 'MXFInfo::InfoObject' do
|
4
|
-
context '
|
5
|
+
context 'with a valid MXF file' do
|
5
6
|
subject do
|
6
|
-
MXFInfo.scan File.expand_path('
|
7
|
+
MXFInfo.scan File.expand_path('fixtures/IMG_0395.MOV.A14DC7130D.mxf', __dir__)
|
7
8
|
end
|
8
9
|
|
9
10
|
its(:project_name) { should eq('Ballerinas_zippy') }
|
10
11
|
its(:clip_name) { should eq('IMG_0395.MOV') }
|
11
12
|
its(:clip_created_at) { should eq(Time.parse('2011-05-08 22:02:53.000')) }
|
12
|
-
its(:project_edit_rate) { should eq((25/1)) }
|
13
|
+
its(:project_edit_rate) { should eq((25 / 1)) }
|
13
14
|
its(:clip_duration) { should eq(287) }
|
14
|
-
its(:clip_edit_rate) { should eq((25/1)) }
|
15
|
+
its(:clip_edit_rate) { should eq((25 / 1)) }
|
15
16
|
its(:video_tracks) { should eq(1) }
|
16
17
|
its(:audio_tracks) { should eq(1) }
|
17
18
|
its(:clip_track_string) { should eq('V1 A1') }
|
18
19
|
its(:essence_type) { should eq('PCM') }
|
19
20
|
its(:essence_label) { should eq('060e2b34040101010d01030102060200') }
|
20
21
|
its(:track_number) { should eq(1) }
|
21
|
-
its(:edit_rate) { should eq((
|
22
|
-
its(:track_duration) { should eq(
|
23
|
-
its(:segment_duration) { should eq(
|
22
|
+
its(:edit_rate) { should eq((48_000 / 1)) }
|
23
|
+
its(:track_duration) { should eq(551_040) }
|
24
|
+
its(:segment_duration) { should eq(551_040) }
|
24
25
|
its(:segment_offset) { should eq(0) }
|
25
26
|
its(:start_timecode) { should eq(0) }
|
26
|
-
its(:audio_sampling_rate) { should eq((
|
27
|
+
its(:audio_sampling_rate) { should eq((48_000 / 1)) }
|
27
28
|
its(:quantization_bits) { should eq(16) }
|
28
29
|
its(:channel_count) { should eq(1) }
|
29
30
|
its(:material_package_uid) { should eq('060a2b340101010101010f00130000004dc7130d05831a0a060e2b347f7f2a80') }
|
data/spec/mxfinfo_spec.rb
CHANGED
@@ -20,7 +20,11 @@ describe 'MXFInfo' do
|
|
20
20
|
it 'should return an InfoObject instance' do
|
21
21
|
expect(MXFInfo.scan File.expand_path('../fixtures/IMG_0395.MOV.A14DC7130D.mxf', __FILE__)).to be_a(MXFInfo::InfoObject)
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
|
+
it 'should return an UTF-8 clip_name' do
|
25
|
+
expect(MXFInfo.scan(File.expand_path('../fixtures/IMG_0395.MOV.A14DC7130D.mxf', __FILE__)).clip_name.encoding).to eq(Encoding::UTF_8)
|
26
|
+
end
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mxfinfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Dierker
|
@@ -9,54 +9,54 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-03-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: rake-compiler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '1.0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '1.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name: rspec
|
29
|
+
name: rspec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: '3'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: '3'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: rspec-its
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - '='
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 1.3.0
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - '='
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 1.3.0
|
56
56
|
description: MXFinfo is a gem that wraps avidmxfinfo from libmxf in a native ruby
|
57
57
|
extension.
|
58
58
|
email:
|
59
|
-
- technology@
|
59
|
+
- technology@projective.io
|
60
60
|
executables: []
|
61
61
|
extensions:
|
62
62
|
- ext/mxfinfo/extconf.rb
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- LICENSE
|
68
68
|
- README.md
|
69
69
|
- Rakefile
|
70
|
+
- compile_commands.json
|
70
71
|
- ext/mxfinfo/avid_mxf_info.c
|
71
72
|
- ext/mxfinfo/avid_mxf_info.h
|
72
73
|
- ext/mxfinfo/extconf.rb
|
@@ -79,7 +80,7 @@ files:
|
|
79
80
|
- spec/info_object_spec.rb
|
80
81
|
- spec/mxfinfo_spec.rb
|
81
82
|
- spec/spec_helper.rb
|
82
|
-
homepage: http://github.com/
|
83
|
+
homepage: http://github.com/projectivetech/mxfinfo
|
83
84
|
licenses:
|
84
85
|
- MIT
|
85
86
|
metadata: {}
|
@@ -99,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
100
|
version: '0'
|
100
101
|
requirements: []
|
101
102
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.7.6.2
|
103
104
|
signing_key:
|
104
105
|
specification_version: 4
|
105
106
|
summary: MXFinfo is a gem that wraps avidmxfinfo from libmxf in a native ruby extension.
|