hornetseye-ffmpeg 0.3.2 → 0.4.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.
- data/README.md +1 -1
- data/Rakefile +5 -3
- data/ext/avinput.cc +40 -0
- data/ext/avinput.hh +4 -0
- data/lib/hornetseye-ffmpeg/avinput.rb +12 -0
- metadata +5 -5
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
Hornetseye-FFMPEG
|
2
2
|
======
|
3
|
-
This Ruby extension defines the class {Hornetseye::AVInput} for reading frames from video files.
|
3
|
+
This Ruby extension defines the class {Hornetseye::AVInput} for reading frames from video files and the class {Hornetseye::AVOutput} for writing frames to video files.
|
4
4
|
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ require 'rake/loaders/makefile'
|
|
7
7
|
require 'rbconfig'
|
8
8
|
|
9
9
|
PKG_NAME = 'hornetseye-ffmpeg'
|
10
|
-
PKG_VERSION = '0.
|
10
|
+
PKG_VERSION = '0.4.0'
|
11
11
|
CXX = ENV[ 'CXX' ] || 'g++'
|
12
12
|
STRIP = ENV[ 'STRIP' ] || 'strip'
|
13
13
|
RB_FILES = FileList[ 'lib/**/*.rb' ]
|
@@ -21,7 +21,7 @@ PKG_FILES = [ 'Rakefile', 'README.md', 'COPYING', '.document' ] +
|
|
21
21
|
BIN_FILES = [ 'README.md', 'COPYING', '.document', SO_FILE ] +
|
22
22
|
RB_FILES + TS_FILES + TC_FILES
|
23
23
|
SUMMARY = %q{Read/write video frames using libffmpeg}
|
24
|
-
DESCRIPTION = %q{This Ruby extension defines the class Hornetseye::AVInput for reading frames from video files.}
|
24
|
+
DESCRIPTION = %q{This Ruby extension defines the class Hornetseye::AVInput for reading frames from video files and the class Hornetseye::AVOutput for writing frames to video files.}
|
25
25
|
AUTHOR = %q{Jan Wedekind}
|
26
26
|
EMAIL = %q{jan@wedesoft.de}
|
27
27
|
HOMEPAGE = %q{http://wedesoft.github.com/hornetseye-ffmpeg/}
|
@@ -171,7 +171,9 @@ rule '.o' => '.cc' do |t|
|
|
171
171
|
end
|
172
172
|
|
173
173
|
file ".depends.mf" do |t|
|
174
|
-
sh "
|
174
|
+
sh "g++ -MM #{$CXXFLAGS} #{CC_FILES.join ' '} | " +
|
175
|
+
"sed -e :a -e N -e 's/\\n/\\$/g' -e ta | " +
|
176
|
+
"sed -e 's/ *\\\\\\$ */ /g' -e 's/\\$/\\n/g' | sed -e 's/^/ext\\//' > #{t.name}"
|
175
177
|
end
|
176
178
|
CC_FILES.each do |t|
|
177
179
|
file t.ext(".o") => t
|
data/ext/avinput.cc
CHANGED
@@ -159,6 +159,20 @@ AVRational AVInput::frameRate(void) throw (Error)
|
|
159
159
|
return m_ic->streams[ m_idx ]->r_frame_rate;
|
160
160
|
}
|
161
161
|
|
162
|
+
long long AVInput::duration(void) throw (Error)
|
163
|
+
{
|
164
|
+
ERRORMACRO( m_ic != NULL, Error, , "Video \"" << m_mrl << "\" is not open. "
|
165
|
+
"Did you call \"close\" before?" );
|
166
|
+
return m_ic->streams[ m_idx ]->duration;
|
167
|
+
}
|
168
|
+
|
169
|
+
long long AVInput::startTime(void) throw (Error)
|
170
|
+
{
|
171
|
+
ERRORMACRO( m_ic != NULL, Error, , "Video \"" << m_mrl << "\" is not open. "
|
172
|
+
"Did you call \"close\" before?" );
|
173
|
+
return m_ic->streams[ m_idx ]->start_time;
|
174
|
+
}
|
175
|
+
|
162
176
|
void AVInput::seek( long timestamp ) throw (Error)
|
163
177
|
{
|
164
178
|
ERRORMACRO( m_ic != NULL, Error, , "Video \"" << m_mrl << "\" is not open. "
|
@@ -185,6 +199,8 @@ VALUE AVInput::registerRubyClass( VALUE rbModule )
|
|
185
199
|
rb_define_method( cRubyClass, "read", RUBY_METHOD_FUNC( wrapRead ), 0 );
|
186
200
|
rb_define_method( cRubyClass, "time_base", RUBY_METHOD_FUNC( wrapTimeBase ), 0 );
|
187
201
|
rb_define_method( cRubyClass, "frame_rate", RUBY_METHOD_FUNC( wrapFrameRate ), 0 );
|
202
|
+
rb_define_method( cRubyClass, "duration", RUBY_METHOD_FUNC( wrapDuration ), 0 );
|
203
|
+
rb_define_method( cRubyClass, "start_time", RUBY_METHOD_FUNC( wrapStartTime ), 0 );
|
188
204
|
rb_define_method( cRubyClass, "width", RUBY_METHOD_FUNC( wrapWidth ), 0 );
|
189
205
|
rb_define_method( cRubyClass, "height", RUBY_METHOD_FUNC( wrapHeight ), 0 );
|
190
206
|
rb_define_method( cRubyClass, "seek", RUBY_METHOD_FUNC( wrapSeek ), 1 );
|
@@ -258,6 +274,30 @@ VALUE AVInput::wrapFrameRate( VALUE rbSelf )
|
|
258
274
|
return retVal;
|
259
275
|
}
|
260
276
|
|
277
|
+
VALUE AVInput::wrapDuration( VALUE rbSelf )
|
278
|
+
{
|
279
|
+
VALUE retVal = Qnil;
|
280
|
+
try {
|
281
|
+
AVInputPtr *self; Data_Get_Struct( rbSelf, AVInputPtr, self );
|
282
|
+
retVal = LL2NUM( (*self)->duration() );
|
283
|
+
} catch( exception &e ) {
|
284
|
+
rb_raise( rb_eRuntimeError, "%s", e.what() );
|
285
|
+
};
|
286
|
+
return retVal;
|
287
|
+
}
|
288
|
+
|
289
|
+
VALUE AVInput::wrapStartTime( VALUE rbSelf )
|
290
|
+
{
|
291
|
+
VALUE retVal = Qnil;
|
292
|
+
try {
|
293
|
+
AVInputPtr *self; Data_Get_Struct( rbSelf, AVInputPtr, self );
|
294
|
+
retVal = LL2NUM( (*self)->startTime() );
|
295
|
+
} catch( exception &e ) {
|
296
|
+
rb_raise( rb_eRuntimeError, "%s", e.what() );
|
297
|
+
};
|
298
|
+
return retVal;
|
299
|
+
}
|
300
|
+
|
261
301
|
VALUE AVInput::wrapWidth( VALUE rbSelf )
|
262
302
|
{
|
263
303
|
VALUE retVal = Qnil;
|
data/ext/avinput.hh
CHANGED
@@ -36,6 +36,8 @@ public:
|
|
36
36
|
int height(void) const throw (Error);
|
37
37
|
AVRational timeBase(void) throw (Error);
|
38
38
|
AVRational frameRate(void) throw (Error);
|
39
|
+
long long duration(void) throw (Error);
|
40
|
+
long long startTime(void) throw (Error);
|
39
41
|
void seek( long timestamp ) throw (Error);
|
40
42
|
long long pts(void) throw (Error);
|
41
43
|
static VALUE cRubyClass;
|
@@ -46,6 +48,8 @@ public:
|
|
46
48
|
static VALUE wrapRead( VALUE rbSelf );
|
47
49
|
static VALUE wrapTimeBase( VALUE rbSelf );
|
48
50
|
static VALUE wrapFrameRate( VALUE rbSelf );
|
51
|
+
static VALUE wrapDuration( VALUE rbSelf );
|
52
|
+
static VALUE wrapStartTime( VALUE rbSelf );
|
49
53
|
static VALUE wrapWidth( VALUE rbSelf );
|
50
54
|
static VALUE wrapHeight( VALUE rbSelf );
|
51
55
|
static VALUE wrapSeek( VALUE rbSelf, VALUE rbPos );
|
@@ -55,6 +55,18 @@ module Hornetseye
|
|
55
55
|
pts * time_base
|
56
56
|
end
|
57
57
|
|
58
|
+
alias_method :orig_duration, :duration
|
59
|
+
|
60
|
+
def duration
|
61
|
+
orig_duration * time_base
|
62
|
+
end
|
63
|
+
|
64
|
+
alias_method :orig_start_time, :start_time
|
65
|
+
|
66
|
+
def start_time
|
67
|
+
orig_start_time * time_base
|
68
|
+
end
|
69
|
+
|
58
70
|
end
|
59
71
|
|
60
72
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 0.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jan Wedekind
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-06 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
version: "0"
|
73
73
|
type: :development
|
74
74
|
version_requirements: *id004
|
75
|
-
description: This Ruby extension defines the class Hornetseye::AVInput for reading frames from video files.
|
75
|
+
description: This Ruby extension defines the class Hornetseye::AVInput for reading frames from video files and the class Hornetseye::AVOutput for writing frames to video files.
|
76
76
|
email: jan@wedesoft.de
|
77
77
|
executables: []
|
78
78
|
|