video_file 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 07dc12f8d9cb04c871af4f1643f4d0e48d225989cc1d651a1c08c185f5a6ab81
4
- data.tar.gz: 941df4b9e058b79aa84ab9c54c605aea3312adf8bdd94b65c2c3e49c20216d98
3
+ metadata.gz: b32f432c6b89bda31fae5d777f1ef5735abe6d1fa23903e3addb447245cf5121
4
+ data.tar.gz: 2f91edfb3d8fdacc146c2c48fbb22da9f0a920916ecc100524c2bb7b26d2c42a
5
5
  SHA512:
6
- metadata.gz: 2341339f983f200a532258cc1e3237d403218626eea4f26ec534399c9d14ba26338a24cea22a9db2197448e616f84ac5f0899cc0186f221dd4170a80a4d4d1ac
7
- data.tar.gz: 422b51b2d1d1f2d37c8ac808abb032e29ac8d0711acc8ab211192cdba801e701b8b35aeb884d3a977d697dcba191017c180cb8e4fa0ed4dd0b63ce6a05b11db0
6
+ metadata.gz: 6bbe6bde902606c50a7253e4d40832f7b0bcfa165bd069ee134cc4d961266917c08f056d966c79e9cfea66fda1786b070ba1b179d51b980fa39eb7439829139f
7
+ data.tar.gz: efd352a10b247dee6275eeed60bb02b3afed09115797425866391a3cbb6b379755ddad7d3d213a2b44709bd68b043f1448578d1e5687fbe89654d8e2174cf15e
data/CMakeLists.txt CHANGED
@@ -23,6 +23,6 @@ add_library(video_file_ext SHARED ${SOURCE_FILES})
23
23
 
24
24
  set_target_properties(video_file_ext PROPERTIES PREFIX "")
25
25
  set_target_properties(video_file_ext PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib")
26
- target_compile_definitions(video_file_ext PRIVATE AV_ENABLE_DEBUG)
26
+ target_compile_definitions(video_file_ext PRIVATE VF_ENABLE_DEBUG)
27
27
  target_include_directories(video_file_ext PRIVATE ${RUBY_INCLUDE_DIRS})
28
28
  target_link_libraries(video_file_ext ${LIBAV_LIBRARIES} ${JPEG_LIBRARIES} ${RUBY_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
@@ -137,7 +137,7 @@ VALUE thumbnailer_m_initialize(int argc, VALUE* argv, VALUE self)
137
137
  {
138
138
  VALUE file = Qnil;
139
139
  VALUE width = Qnil;
140
- VALUE count = INT2FIX(1);
140
+ VALUE count = Qnil;
141
141
  rb_scan_args(argc, argv, "21", &file, &width, &count);
142
142
 
143
143
  Check_TypedStruct(file, &file_type);
@@ -148,7 +148,7 @@ VALUE thumbnailer_m_initialize(int argc, VALUE* argv, VALUE self)
148
148
  TypedData_Get_Struct(file, VfFile, &file_type, file_);
149
149
 
150
150
  int width_ = FIX2INT(width);
151
- unsigned n_ = FIX2UINT(count);
151
+ unsigned n_ = count == Qnil ? 1 : FIX2UINT(count);
152
152
 
153
153
  if(!vf_thumbnailer_init(&thumbnailer->thumbnailer, file_, width_, n_)) {
154
154
  rb_raise(eError, "%s", thumbnailer->thumbnailer.last_error_str);
@@ -97,6 +97,10 @@ vf_thumbnailer_init(VfThumbnailer* thumbnailer,
97
97
  width = file->video_codec_context->width;
98
98
  }
99
99
 
100
+ if(n == 0) {
101
+ n = 1;
102
+ }
103
+
100
104
  thumbnailer->video_file = file;
101
105
  thumbnailer->width = width;
102
106
  thumbnailer->position = -1;
@@ -225,6 +229,8 @@ vf_thumbnailer_get_frame(VfThumbnailer* thumbnailer,
225
229
 
226
230
  int64_t position = (int64_t)(AV_TIME_BASE * seconds);
227
231
  if (format_context->duration < position || position < 0) {
232
+ VF_DEBUG("invalid position %ld (duration is: %ld)\n", position, format_context->duration);
233
+ strncpy(thumbnailer->last_error_str, "invalid position", sizeof(thumbnailer->last_error_str));
228
234
  goto fail;
229
235
  }
230
236
 
@@ -1,3 +1,3 @@
1
1
  module VideoFile
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: video_file
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
  - furunkel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-17 00:00:00.000000000 Z
11
+ date: 2019-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler