hornetseye-ffmpeg 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
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.5.2'
10
+ PKG_VERSION = '0.5.3'
11
11
  CXX = ENV[ 'CXX' ] || 'g++'
12
12
  STRIP = ENV[ 'STRIP' ] || 'strip'
13
13
  RB_FILES = FileList[ 'lib/**/*.rb' ]
@@ -33,7 +33,7 @@ if RbConfig::CONFIG[ 'rubyhdrdir' ]
33
33
  $CXXFLAGS = "#{$CXXFLAGS} -I#{RbConfig::CONFIG[ 'rubyhdrdir' ]} " +
34
34
  "-I#{RbConfig::CONFIG[ 'rubyhdrdir' ]}/#{RbConfig::CONFIG[ 'arch' ]}"
35
35
  else
36
- $CXXFLAGS += "#{$CXXFLAGS} -I#{RbConfig::CONFIG[ 'archdir' ]}"
36
+ $CXXFLAGS = "#{$CXXFLAGS} -I#{RbConfig::CONFIG[ 'archdir' ]}"
37
37
  end
38
38
  $LIBRUBYARG = RbConfig::CONFIG[ 'LIBRUBYARG' ]
39
39
  $SITELIBDIR = RbConfig::CONFIG[ 'sitelibdir' ]
@@ -113,7 +113,7 @@ file 'ext/config.h' do |t|
113
113
  elsif check_c_header 'ffmpeg/avformat.h'
114
114
  s << "#undef HAVE_LIBAVFORMAT_INCDIR\n"
115
115
  else
116
- raise 'Cannot find swscale.h header file'
116
+ raise 'Cannot find avformat.h header file'
117
117
  end
118
118
  have_libavformat_alloc_context = check_program do |c|
119
119
  c.puts <<EOS
data/ext/avinput.cc CHANGED
@@ -241,6 +241,13 @@ AVRational AVInput::frameRate(void) throw (Error)
241
241
  return m_ic->streams[ m_videoStream ]->r_frame_rate;
242
242
  }
243
243
 
244
+ AVRational AVInput::aspectRatio(void) throw (Error)
245
+ {
246
+ ERRORMACRO( m_ic != NULL, Error, , "Video \"" << m_mrl << "\" is not open. "
247
+ "Did you call \"close\" before?" );
248
+ return m_ic->streams[ m_videoStream ]->sample_aspect_ratio;
249
+ }
250
+
244
251
  int AVInput::sampleRate(void) throw (Error)
245
252
  {
246
253
  ERRORMACRO( m_audioDec != NULL, Error, , "Audio \"" << m_mrl << "\" is not open. "
@@ -307,6 +314,8 @@ VALUE AVInput::registerRubyClass( VALUE rbModule )
307
314
  rb_define_method( cRubyClass, "audio_time_base",
308
315
  RUBY_METHOD_FUNC( wrapAudioTimeBase ), 0 );
309
316
  rb_define_method( cRubyClass, "frame_rate", RUBY_METHOD_FUNC( wrapFrameRate ), 0 );
317
+ rb_define_method( cRubyClass, "aspect_ratio",
318
+ RUBY_METHOD_FUNC( wrapAspectRatio ), 0 );
310
319
  rb_define_method( cRubyClass, "sample_rate", RUBY_METHOD_FUNC( wrapSampleRate ), 0 );
311
320
  rb_define_method( cRubyClass, "channels", RUBY_METHOD_FUNC( wrapChannels ), 0 );
312
321
  rb_define_method( cRubyClass, "duration", RUBY_METHOD_FUNC( wrapDuration ), 0 );
@@ -415,6 +424,20 @@ VALUE AVInput::wrapFrameRate( VALUE rbSelf )
415
424
  return retVal;
416
425
  }
417
426
 
427
+ VALUE AVInput::wrapAspectRatio( VALUE rbSelf )
428
+ {
429
+ VALUE retVal = Qnil;
430
+ try {
431
+ AVInputPtr *self; Data_Get_Struct( rbSelf, AVInputPtr, self );
432
+ AVRational aspectRatio = (*self)->aspectRatio();
433
+ retVal = rb_funcall( rb_cObject, rb_intern( "Rational" ), 2,
434
+ INT2NUM( aspectRatio.num ), INT2NUM( aspectRatio.den ) );
435
+ } catch( exception &e ) {
436
+ rb_raise( rb_eRuntimeError, "%s", e.what() );
437
+ };
438
+ return retVal;
439
+ }
440
+
418
441
  VALUE AVInput::wrapSampleRate( VALUE rbSelf )
419
442
  {
420
443
  VALUE retVal = Qnil;
data/ext/avinput.hh CHANGED
@@ -51,6 +51,7 @@ public:
51
51
  AVRational videoTimeBase(void) throw (Error);
52
52
  AVRational audioTimeBase(void) throw (Error);
53
53
  AVRational frameRate(void) throw (Error);
54
+ AVRational aspectRatio(void) throw (Error);
54
55
  int sampleRate(void) throw (Error);
55
56
  int channels(void) throw (Error);
56
57
  long long duration(void) throw (Error);
@@ -69,6 +70,7 @@ public:
69
70
  static VALUE wrapVideoTimeBase( VALUE rbSelf );
70
71
  static VALUE wrapAudioTimeBase( VALUE rbSelf );
71
72
  static VALUE wrapFrameRate( VALUE rbSelf );
73
+ static VALUE wrapAspectRatio( VALUE rbSelf );
72
74
  static VALUE wrapSampleRate( VALUE rbSelf );
73
75
  static VALUE wrapChannels( VALUE rbSelf );
74
76
  static VALUE wrapDuration( VALUE rbSelf );
@@ -99,6 +99,12 @@ module Hornetseye
99
99
  orig_start_time == AV_NOPTS_VALUE ? nil : orig_start_time * video_time_base
100
100
  end
101
101
 
102
+ alias_method :orig_aspect_ratio, :aspect_ratio
103
+
104
+ def aspect_ratio
105
+ orig_aspect_ratio == 0 ? 1 : orig_aspect_ratio
106
+ end
107
+
102
108
  end
103
109
 
104
110
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 2
9
- version: 0.5.2
8
+ - 3
9
+ version: 0.5.3
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-20 00:00:00 +01:00
17
+ date: 2010-10-21 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency