Class: FFruby::VideoStream
- Defined in:
- ext/ffruby/ffrubystream.c,
ext/ffruby/ffrubystream.c
Overview
An interface to FFmpeg on video streams. Provides access to video metadata.
Instance Method Summary collapse
-
#frame_aspect_ratio ⇒ Object
Returns the frame aspect ratio.
-
#frame_rate ⇒ Object
Returns the frame rate as a Rational.
-
#height ⇒ Object
Returns the frame height.
-
#real_aspect_ratio ⇒ Object
Returns the real aspect ratio.
-
#sample_aspect_ratio ⇒ Object
Returns the sample aspect ratio.
-
#width ⇒ Object
Returns the frame width.
Methods inherited from Stream
#bit_rate, #codec, #initialize, #tag
Constructor Details
This class inherits a constructor from FFruby::Stream
Instance Method Details
#frame_aspect_ratio ⇒ Object
Returns the frame aspect ratio.
106 107 108 109 110 111 112 113 114 |
# File 'ext/ffruby/ffrubystream.c', line 106
static VALUE ffrvs_frame_aspect_ratio(VALUE self)
{
AVStream *stream = ffrs_get_stream(self);
if (stream->codec->width == 0 || stream->codec->height == 0)
return Qnil;
else
return rb_funcall(rb_mKernel, rb_intern("Rational"), 2, INT2NUM(stream->codec->width), INT2NUM(stream->codec->height));
}
|
#frame_rate ⇒ Object
Returns the frame rate as a Rational.
141 142 143 144 145 146 147 148 149 150 |
# File 'ext/ffruby/ffrubystream.c', line 141
static VALUE ffrvs_frame_rate(VALUE self)
{
AVStream *stream = ffrs_get_stream(self);
ffrs_open_codec(stream);
if (stream->r_frame_rate.den && stream->r_frame_rate.num)
return rb_funcall(rb_mKernel, rb_intern("Rational"), 2, INT2NUM(stream->r_frame_rate.num), INT2NUM(stream->r_frame_rate.den));
else
return rb_funcall(rb_mKernel, rb_intern("Rational"), 2, INT2NUM(stream->codec->time_base.den), INT2NUM(stream->codec->time_base.num));
}
|
#height ⇒ Object
Returns the frame height.
99 100 101 102 103 |
# File 'ext/ffruby/ffrubystream.c', line 99
static VALUE ffrvs_height(VALUE self)
{
AVStream *stream = ffrs_get_stream(self);
return INT2NUM(stream->codec->height);
}
|
#real_aspect_ratio ⇒ Object
Returns the real aspect ratio.
128 129 130 131 132 133 134 135 136 137 138 |
# File 'ext/ffruby/ffrubystream.c', line 128
static VALUE ffrvs_real_aspect_ratio(VALUE self)
{
VALUE x, y;
x = ffrvs_frame_aspect_ratio(self);
y = ffrvs_sample_aspect_ratio(self);
if (x == Qnil || y == Qnil)
return Qnil;
else
return rb_funcall(x, rb_intern("*"), 1, y);
}
|
#sample_aspect_ratio ⇒ Object
Returns the sample aspect ratio.
117 118 119 120 121 122 123 124 125 |
# File 'ext/ffruby/ffrubystream.c', line 117
static VALUE ffrvs_sample_aspect_ratio(VALUE self)
{
AVStream *stream = ffrs_get_stream(self);
if (stream->codec->sample_aspect_ratio.den == 0 || stream->codec->sample_aspect_ratio.num == 0)
return rb_funcall(rb_mKernel, rb_intern("Rational"), 2, INT2FIX(1), INT2FIX(1));
else
return rb_funcall(rb_mKernel, rb_intern("Rational"), 2, INT2NUM(stream->codec->sample_aspect_ratio.num), INT2NUM(stream->codec->sample_aspect_ratio.den));
}
|
#width ⇒ Object
Returns the frame width.
92 93 94 95 96 |
# File 'ext/ffruby/ffrubystream.c', line 92
static VALUE ffrvs_width(VALUE self)
{
AVStream *stream = ffrs_get_stream(self);
return INT2NUM(stream->codec->width);
}
|