class MovieMasher::LayerRawVideo

a raw video layer

Public Instance Methods

__filter_trim_input() click to toggle source
# File lib/graphs/layers.rb, line 95
def __filter_trim_input
  filter = nil
  raise 'no offset' unless @input[:offset]
  offset = @input[:offset]
  raise 'no length' unless @input[:length]
  length = @input[:length]
  trim_beginning = FloatUtil.gtr(offset, FloatUtil::ZERO)
  trim_end = FloatUtil.gtr(length, FloatUtil::ZERO)
  trim_end &&= (@input[:duration].to_f > (offset + length))
  if trim_beginning || trim_end
    # start and duration look at timestamp and change it
    filter = FilterHash.new('trim', duration: FloatUtil.precision(length))
    filter.hash[:start] = FloatUtil.precision(offset) if trim_beginning
  end
  filter
end
initialize_chains() click to toggle source
Calls superclass method MovieMasher::Layer#initialize_chains
# File lib/graphs/layers.rb, line 67
def initialize_chains
  # puts "LayerRawVideo#initialize_chains"
  chain = Chain.new(nil, @job_input)
  @filter_movie = FilterSourceVideo.new(@input, @job_input)
  chain << @filter_movie
  # trim filter, if needed
  @trim_filter = __filter_trim_input
  chain << @trim_filter if @trim_filter
  # fps is placeholder since each output has its own rate
  @fps_filter = FilterHash.new('fps', fps: 0)
  chain << @fps_filter
  # set presentation timestamp filter
  @filter_timestamps = FilterSetpts.new
  chain << @filter_timestamps
  @chains << chain
  super
  # puts "LayerRawVideo.initialize_chains #{@chains}"
end
layer_command(scope) click to toggle source
Calls superclass method MovieMasher::LayerRaw#layer_command
# File lib/graphs/layers.rb, line 85
def layer_command(scope)
  raise(Error::JobInput, 'layer_command with empty scope') unless scope
  output_type_is_not_video = (Type::VIDEO != scope[:mm_output][:type])
  # puts "output_type_is_not_video = #{output_type_is_not_video}"
  @fps_filter.disabled = output_type_is_not_video
  @trim_filter.disabled = output_type_is_not_video if @trim_filter
  @filter_timestamps.disabled = output_type_is_not_video
  @fps_filter.hash[:fps] = scope[:mm_fps]
  super
end