class AviGlitch::Frame

Frame is the struct of the frame data and meta-data. You can access this class through AviGlitch::Frames. To modify the binary data, operate the data property.

Constants

AVIIF_KEYFRAME
AVIIF_LIST
AVIIF_NO_TIME

Attributes

data[RW]
flag[RW]
id[RW]

Public Class Methods

new(data, id, flag) click to toggle source

Creates a new AviGlitch::Frame object.

The arguments are:

data

just data, without meta-data

id

id for the stream number and content type code (like “00dc”)

flag

flag that describes the chunk type (taken from idx1)

# File lib/aviglitch/frame.rb, line 23
def initialize data, id, flag
  @data = data
  @id = id
  @flag = flag
end

Public Instance Methods

==(other) click to toggle source

Compares its content.

# File lib/aviglitch/frame.rb, line 75
def == other
  self.id == other.id &&
  self.flag == other.flag &&
  self.data == other.data
end
is?(frame_type) click to toggle source

Returns if it is a frame in frame_type.

# File lib/aviglitch/frame.rb, line 63
def is? frame_type
  return true if frame_type == :all
  detection = "is_#{frame_type.to_s.sub(/frames$/, 'frame')}?"
  begin 
    self.send detection
  rescue NoMethodError => e
    false
  end
end
is_audioframe?() click to toggle source

Returns if it is an audio frame.

# File lib/aviglitch/frame.rb, line 57
def is_audioframe?
  @id[2, 2] == 'wb'
end
is_deltaframe?() click to toggle source

Returns if it is a video frame and also not a key frame.

# File lib/aviglitch/frame.rb, line 41
def is_deltaframe?
  is_videoframe? && @flag & AVIIF_KEYFRAME == 0
end
Also aliased as: is_pframe?
is_iframe?()

Alias for is_keyframe?

Alias for: is_keyframe?
is_keyframe?() click to toggle source

Returns if it is a video frame and also a key frame.

# File lib/aviglitch/frame.rb, line 31
def is_keyframe?
  is_videoframe? && @flag & AVIIF_KEYFRAME != 0
end
Also aliased as: is_iframe?
is_pframe?()

Alias for is_deltaframe?

Alias for: is_deltaframe?
is_videoframe?() click to toggle source

Returns if it is a video frame.

# File lib/aviglitch/frame.rb, line 51
def is_videoframe?
  @id[2, 2] == 'db' || @id[2, 2] == 'dc'
end