mediainfo-native 0.2.9 → 0.3.0
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 +4 -4
- data/ext/mediainfo_native/MediaInfoDLL.h +4 -1
- data/ext/mediainfo_native/basestream.cpp +17 -3
- data/ext/mediainfo_native/mediainfo_wrapper.cpp +25 -12
- data/lib/mediainfo-native/attr_readers.rb +7 -5
- data/lib/mediainfo-native/streams/general.rb +3 -0
- data/lib/mediainfo-native/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c240897a580eb3de9faaf15a827f96d20d310b0532cb2b01b74bf481bbb31760
|
|
4
|
+
data.tar.gz: 41596ad2d43cb9141732bac08d7e4cf1a4939b1df6b50739edf4d6f44ea243e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34d30843f971abf092d7db9676176e7c9a76ea531156d1b053f58025a6cfb2063b0bb24d5ce6b1b1309d96d503e2788428e37aebe9bd78e1652d32d64b2a3086
|
|
7
|
+
data.tar.gz: 579b8b1185b0222f9ac99150a66fd29183b4a3fe91d301fff38610a076aa3e6a620a2a1bdca9cd17899ff019c604b832ec21f19d53b207114c8d9cfdc1060114
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
#ifndef MediaInfoDLLH
|
|
16
16
|
#define MediaInfoDLLH
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
#ifndef UNICODE
|
|
19
19
|
#define UNICODE
|
|
20
|
+
#endif
|
|
21
|
+
#ifndef _UNICODE
|
|
20
22
|
#define _UNICODE
|
|
23
|
+
#endif
|
|
21
24
|
|
|
22
25
|
//***************************************************************************
|
|
23
26
|
// Platforms (from libzen)
|
|
@@ -8,7 +8,7 @@ namespace MediaInfoNative
|
|
|
8
8
|
|
|
9
9
|
#define GET_BASESTREAM(var) \
|
|
10
10
|
BaseStream* var; \
|
|
11
|
-
|
|
11
|
+
TypedData_Get_Struct(self, BaseStream, &basestream_type, var)
|
|
12
12
|
|
|
13
13
|
extern "C"
|
|
14
14
|
{
|
|
@@ -18,6 +18,17 @@ extern "C"
|
|
|
18
18
|
delete ((BaseStream*) ptr);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
static const rb_data_type_t basestream_type = {
|
|
22
|
+
"BaseStream",
|
|
23
|
+
{
|
|
24
|
+
nullptr, // mark function
|
|
25
|
+
bs_free, // free function
|
|
26
|
+
nullptr, // memsize function
|
|
27
|
+
},
|
|
28
|
+
nullptr, nullptr,
|
|
29
|
+
RUBY_TYPED_FREE_IMMEDIATELY
|
|
30
|
+
};
|
|
31
|
+
|
|
21
32
|
static VALUE bs_lookup(VALUE self, VALUE key)
|
|
22
33
|
{
|
|
23
34
|
GET_BASESTREAM(bs);
|
|
@@ -31,7 +42,9 @@ VALUE stream_klasses[STREAM_TYPE_MAX];
|
|
|
31
42
|
void Init_BaseStream(VALUE mMediaInfoNative)
|
|
32
43
|
{
|
|
33
44
|
VALUE cBaseStream = rb_define_class_under(mMediaInfoNative, "BaseStream", rb_cObject);
|
|
45
|
+
rb_undef_alloc_func(cBaseStream);
|
|
34
46
|
VALUE cBaseStreamWithFramerate = rb_define_class_under(mMediaInfoNative, "BaseStreamWithFramerate", cBaseStream);
|
|
47
|
+
rb_undef_alloc_func(cBaseStreamWithFramerate);
|
|
35
48
|
|
|
36
49
|
stream_klasses[GENERAL] = rb_define_class_under(mMediaInfoNative, "GeneralStream", cBaseStream);
|
|
37
50
|
stream_klasses[VIDEO] = rb_define_class_under(mMediaInfoNative, "VideoStream", cBaseStreamWithFramerate);
|
|
@@ -42,7 +55,8 @@ void Init_BaseStream(VALUE mMediaInfoNative)
|
|
|
42
55
|
stream_klasses[MENU] = rb_define_class_under(mMediaInfoNative, "MenuStream", cBaseStream);
|
|
43
56
|
|
|
44
57
|
for(unsigned int st = 0; st < STREAM_TYPE_MAX; ++st) {
|
|
45
|
-
|
|
58
|
+
rb_undef_alloc_func(stream_klasses[st]);
|
|
59
|
+
rb_define_method(stream_klasses[st], "lookup", RUBY_METHOD_FUNC(bs_lookup), 1);
|
|
46
60
|
}
|
|
47
61
|
}
|
|
48
62
|
|
|
@@ -55,7 +69,7 @@ BaseStream::BaseStream(StreamType _type, unsigned int _idx, MediaInfoWrapper* _w
|
|
|
55
69
|
|
|
56
70
|
VALUE BaseStream::wrap()
|
|
57
71
|
{
|
|
58
|
-
return
|
|
72
|
+
return TypedData_Wrap_Struct(stream_klasses[type], &basestream_type, this);
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
VALUE BaseStream::lookup(VALUE key) const
|
|
@@ -12,7 +12,7 @@ namespace MediaInfoNative
|
|
|
12
12
|
|
|
13
13
|
#define GET_WRAPPER(var) \
|
|
14
14
|
MediaInfoWrapper* var; \
|
|
15
|
-
|
|
15
|
+
TypedData_Get_Struct(self, MediaInfoWrapper, &mediainfo_wrapper_type, var)
|
|
16
16
|
|
|
17
17
|
typedef struct {
|
|
18
18
|
MediaInfoWrapper* miw;
|
|
@@ -23,13 +23,22 @@ typedef struct {
|
|
|
23
23
|
extern "C"
|
|
24
24
|
{
|
|
25
25
|
|
|
26
|
-
typedef VALUE(*RUBYFUNC)(...);
|
|
27
|
-
|
|
28
26
|
static void miw_free(void* ptr)
|
|
29
27
|
{
|
|
30
28
|
delete ((MediaInfoWrapper*) ptr);
|
|
31
29
|
}
|
|
32
30
|
|
|
31
|
+
static const rb_data_type_t mediainfo_wrapper_type = {
|
|
32
|
+
"MediaInfoWrapper",
|
|
33
|
+
{
|
|
34
|
+
nullptr, // mark function
|
|
35
|
+
miw_free, // free function
|
|
36
|
+
nullptr, // memsize function
|
|
37
|
+
},
|
|
38
|
+
nullptr, nullptr, // parent, data
|
|
39
|
+
RUBY_TYPED_FREE_IMMEDIATELY
|
|
40
|
+
};
|
|
41
|
+
|
|
33
42
|
static VALUE miw_new(VALUE klass, VALUE args)
|
|
34
43
|
{
|
|
35
44
|
if(RARRAY_LEN(args) > 1)
|
|
@@ -46,7 +55,7 @@ extern "C"
|
|
|
46
55
|
}
|
|
47
56
|
|
|
48
57
|
MediaInfoWrapper* miw = new MediaInfoWrapper(ignore_continuous_file_names);
|
|
49
|
-
return
|
|
58
|
+
return TypedData_Wrap_Struct(klass, &mediainfo_wrapper_type, miw);
|
|
50
59
|
}
|
|
51
60
|
|
|
52
61
|
static VALUE miw_close(VALUE self)
|
|
@@ -79,7 +88,7 @@ extern "C"
|
|
|
79
88
|
}
|
|
80
89
|
|
|
81
90
|
if(rb_block_given_p())
|
|
82
|
-
return rb_ensure(
|
|
91
|
+
return rb_ensure(rb_yield, Qnil, miw_close, self);
|
|
83
92
|
else
|
|
84
93
|
return Qnil;
|
|
85
94
|
}
|
|
@@ -123,16 +132,17 @@ extern "C"
|
|
|
123
132
|
void Init_MediaInfoWrapper(VALUE mMediaInfoNative)
|
|
124
133
|
{
|
|
125
134
|
VALUE cMediaInfo = rb_define_class_under(mMediaInfoNative, "MediaInfo", rb_cObject);
|
|
135
|
+
rb_undef_alloc_func(cMediaInfo);
|
|
126
136
|
|
|
127
|
-
rb_define_singleton_method(cMediaInfo, "new", (
|
|
137
|
+
rb_define_singleton_method(cMediaInfo, "new", RUBY_METHOD_FUNC(miw_new), -2);
|
|
128
138
|
|
|
129
|
-
rb_define_method(cMediaInfo, "close", (
|
|
130
|
-
rb_define_method(cMediaInfo, "open", (
|
|
131
|
-
rb_define_method(cMediaInfo, "is_open?", (
|
|
132
|
-
rb_define_method(cMediaInfo, "streams", (
|
|
139
|
+
rb_define_method(cMediaInfo, "close", RUBY_METHOD_FUNC(miw_close), 0);
|
|
140
|
+
rb_define_method(cMediaInfo, "open", RUBY_METHOD_FUNC(miw_open), 1);
|
|
141
|
+
rb_define_method(cMediaInfo, "is_open?", RUBY_METHOD_FUNC(miw_is_open), 0);
|
|
142
|
+
rb_define_method(cMediaInfo, "streams", RUBY_METHOD_FUNC(miw_streams), 0);
|
|
133
143
|
|
|
134
|
-
rb_define_method(cMediaInfo, "inform", (
|
|
135
|
-
rb_define_method(cMediaInfo, "option", (
|
|
144
|
+
rb_define_method(cMediaInfo, "inform", RUBY_METHOD_FUNC(miw_inform), 1);
|
|
145
|
+
rb_define_method(cMediaInfo, "option", RUBY_METHOD_FUNC(miw_option), 0);
|
|
136
146
|
}
|
|
137
147
|
|
|
138
148
|
/* ************************** MediaInfoWrapper ****************************** */
|
|
@@ -157,6 +167,9 @@ MediaInfoDLL::stream_t convertToMediaInfoStreamType(StreamType type)
|
|
|
157
167
|
return MediaInfoDLL::Stream_Image;
|
|
158
168
|
case MENU:
|
|
159
169
|
return MediaInfoDLL::Stream_Menu;
|
|
170
|
+
default:
|
|
171
|
+
rb_raise(rb_eRuntimeError, "Invalid stream type: %d", (int)type);
|
|
172
|
+
__builtin_unreachable();
|
|
160
173
|
}
|
|
161
174
|
}
|
|
162
175
|
|
|
@@ -10,20 +10,22 @@ module MediaInfoNative
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def mediainfo_attr_reader(attribute, mediainfo_key)
|
|
13
|
-
|
|
13
|
+
# Sanitize for instance variable (remove ?)
|
|
14
|
+
ivar_name = attribute.to_s.tr('?', '')
|
|
15
|
+
attribute_before_type_cast = "#{ivar_name}_before_type_cast"
|
|
14
16
|
|
|
15
|
-
define_method
|
|
17
|
+
define_method "#{attribute}_before_type_cast" do
|
|
16
18
|
instance_variable_get("@#{attribute_before_type_cast}") || instance_variable_set("@#{attribute_before_type_cast}", lookup(mediainfo_key))
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
define_method attribute do
|
|
20
|
-
if v = instance_variable_get("@#{
|
|
22
|
+
if v = instance_variable_get("@#{ivar_name}")
|
|
21
23
|
v
|
|
22
24
|
else
|
|
23
|
-
v = send(
|
|
25
|
+
v = send("#{attribute}_before_type_cast")
|
|
24
26
|
v = yield v if v and block_given?
|
|
25
27
|
|
|
26
|
-
instance_variable_set("@#{
|
|
28
|
+
instance_variable_set("@#{ivar_name}", v)
|
|
27
29
|
end
|
|
28
30
|
end
|
|
29
31
|
|
|
@@ -16,6 +16,9 @@ module MediaInfoNative
|
|
|
16
16
|
mediainfo_int_reader :datasize, 'DataSize'
|
|
17
17
|
mediainfo_int_reader :footersize, 'FooterSize'
|
|
18
18
|
alias_method :writing_application, :encoded_application_string
|
|
19
|
+
mediainfo_attr_reader :streamable?, 'IsStreamable' do |value|
|
|
20
|
+
value.empty? ? nil : value == 'Yes'
|
|
21
|
+
end
|
|
19
22
|
|
|
20
23
|
# Since MediaInfo v0.7.76 encoded_application is replaced by
|
|
21
24
|
# encoded_application_string. So lets check which one is empty.
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mediainfo-native
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Projective Technology GmbH
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rake-compiler
|
|
@@ -71,7 +70,6 @@ homepage: https://github.com/projectivetech/mediainfo-native
|
|
|
71
70
|
licenses:
|
|
72
71
|
- MIT
|
|
73
72
|
metadata: {}
|
|
74
|
-
post_install_message:
|
|
75
73
|
rdoc_options: []
|
|
76
74
|
require_paths:
|
|
77
75
|
- lib
|
|
@@ -86,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
86
84
|
- !ruby/object:Gem::Version
|
|
87
85
|
version: '0'
|
|
88
86
|
requirements: []
|
|
89
|
-
rubygems_version: 3.
|
|
90
|
-
signing_key:
|
|
87
|
+
rubygems_version: 3.6.7
|
|
91
88
|
specification_version: 4
|
|
92
89
|
summary: Native bindings for mediainfo
|
|
93
90
|
test_files: []
|