hornetseye-ffmpeg 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,74 @@
1
- Hornetseye-FFMPEG
2
- ======
1
+ hornetseye-ffmpeg
2
+ ===============
3
+
4
+ **Author**: Jan Wedekind
5
+ **Copyright**: 2010, 2011
6
+ **License**: GPL
7
+
8
+ Synopsis
9
+ --------
10
+
3
11
  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
12
 
13
+ Installation
14
+ ------------
15
+
16
+ *hornetseye-ffmpeg* requires FFMpeg and the software scaling library. If you are running Debian or (K)ubuntu, you can install them like this:
17
+
18
+ $ sudo aptitude install libavformat-dev libswscale-dev
19
+
20
+ To install this Ruby extension, use the following command:
21
+
22
+ $ sudo gem install hornetseye-ffmpeg
23
+
24
+ Alternatively you can build and install the Ruby extension from source as follows:
25
+
26
+ $ rake
27
+ $ sudo rake install
28
+
29
+ Usage
30
+ -----
31
+
32
+ Simply run Interactive Ruby:
33
+
34
+ $ irb
35
+
36
+ You can load and use FFMpeg as shown below. The example is a simple video player.
37
+
38
+ require 'rubygems'
39
+ require 'hornetseye_ffmpeg'
40
+ require 'hornetseye_xorg'
41
+ require 'hornetseye_alsa'
42
+ include Hornetseye
43
+ raise 'Syntax: ./play.rb <video file> [offset]' unless ( 1 .. 2 ).member? ARGV.size
44
+ input = AVInput.new ARGV.first
45
+ input.pos = ARGV.last.to_i if ARGV.size > 1
46
+ display = X11Display.new
47
+ output = XVideoOutput.new
48
+ w, h = ( input.width * input.aspect_ratio ).to_i, input.height
49
+ window = X11Window.new display, output, w, h
50
+ window.title = ARGV.first
51
+ if input.has_audio?
52
+ alsa = AlsaOutput.new 'default:0', input.sample_rate, input.channels, 16, 1024
53
+ audio_frame = input.read_audio
54
+ else
55
+ t0 = Time.new.to_f
56
+ end
57
+ window.show
58
+ while display.status?
59
+ video_frame = input.read_video
60
+ if input.has_audio?
61
+ while alsa.avail >= audio_frame.shape[1]
62
+ alsa.write audio_frame
63
+ audio_frame = input.read_audio
64
+ end
65
+ t = input.audio_pos - alsa.delay.quo( alsa.rate )
66
+ else
67
+ t = Time.new.to_f - t0
68
+ end
69
+ delay = [ input.video_pos - t, 0 ].max
70
+ display.event_loop delay
71
+ output.write video_frame
72
+ display.process_events
73
+ end
74
+
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.8.2'
10
+ PKG_VERSION = '0.9.0'
11
11
  CFG = RbConfig::CONFIG
12
12
  CXX = ENV[ 'CXX' ] || 'g++'
13
13
  RB_FILES = FileList[ 'lib/**/*.rb' ]
@@ -100,6 +100,7 @@ end
100
100
 
101
101
  file 'ext/config.h' do |t|
102
102
  s = "/* config.h. Generated from Rakefile by rake. */\n"
103
+ # need to compile with -D__STDC_CONSTANT_MACROS
103
104
  if check_c_header 'libswscale/swscale.h'
104
105
  s << "#define HAVE_LIBSWSCALE_INCDIR 1\n"
105
106
  elsif check_c_header 'ffmpeg/swscale.h'
@@ -174,8 +175,7 @@ end
174
175
  begin
175
176
  require 'yard'
176
177
  YARD::Rake::YardocTask.new :yard do |y|
177
- y.options << '--no-private'
178
- y.files << FileList[ 'lib/**/*.rb' ]
178
+ y.files << RB_FILES
179
179
  end
180
180
  rescue LoadError
181
181
  STDERR.puts 'Please install \'yard\' if you want to generate documentation'
@@ -208,7 +208,7 @@ begin
208
208
  s.extra_rdoc_files = []
209
209
  s.rdoc_options = %w{--no-private}
210
210
  s.add_dependency %<malloc>, [ '~> 1.2' ]
211
- s.add_dependency %<multiarray>, [ '~> 0.11' ]
211
+ s.add_dependency %<multiarray>, [ '~> 0.20' ]
212
212
  s.add_dependency %<hornetseye-frame>, [ '~> 0.8' ]
213
213
  s.add_development_dependency %q{rake}
214
214
  end
@@ -231,7 +231,7 @@ begin
231
231
  s.extra_rdoc_files = []
232
232
  s.rdoc_options = %w{--no-private}
233
233
  s.add_dependency %<malloc>, [ '~> 1.2' ]
234
- s.add_dependency %<multiarray>, [ '~> 0.11' ]
234
+ s.add_dependency %<multiarray>, [ '~> 0.20' ]
235
235
  s.add_dependency %<hornetseye-frame>, [ '~> 0.8' ]
236
236
  end
237
237
  GEM_BINARY = "#{PKG_NAME}-#{PKG_VERSION}-#{$BINSPEC.platform}.gem"
@@ -113,6 +113,8 @@ module Hornetseye
113
113
  orig_aspect_ratio == 0 ? 1 : orig_aspect_ratio
114
114
  end
115
115
 
116
+ include ReaderConversion
117
+
116
118
  end
117
119
 
118
120
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 8
8
- - 2
9
- version: 0.8.2
7
+ - 9
8
+ - 0
9
+ version: 0.9.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-12-19 00:00:00 +00:00
17
+ date: 2011-01-26 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -41,8 +41,8 @@ dependencies:
41
41
  - !ruby/object:Gem::Version
42
42
  segments:
43
43
  - 0
44
- - 11
45
- version: "0.11"
44
+ - 20
45
+ version: "0.20"
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
@@ -88,17 +88,17 @@ files:
88
88
  - lib/hornetseye-ffmpeg/avinput.rb
89
89
  - lib/hornetseye-ffmpeg/avoutput.rb
90
90
  - lib/hornetseye_ffmpeg_ext.rb
91
- - ext/avoutput.cc
92
91
  - ext/avinput.cc
92
+ - ext/sequence.cc
93
93
  - ext/init.cc
94
94
  - ext/frame.cc
95
- - ext/sequence.cc
96
- - ext/frame.hh
97
- - ext/sequence.hh
98
- - ext/avoutput.hh
95
+ - ext/avoutput.cc
99
96
  - ext/avinput.hh
100
- - ext/rubyinc.hh
97
+ - ext/sequence.hh
98
+ - ext/frame.hh
101
99
  - ext/error.hh
100
+ - ext/rubyinc.hh
101
+ - ext/avoutput.hh
102
102
  has_rdoc: yard
103
103
  homepage: http://wedesoft.github.com/hornetseye-ffmpeg/
104
104
  licenses: []