Sha256: 7f858586dee9a80d4602edcaae2526814fc9305402ac28bbaae14ec396fa876f

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

module FLV
  module Edit  
    module Processor
      class Cut < Base
        desc ["Cuts file using the given RANGE"],
              :param => {:class => TimestampRange, :name => "RANGE"}, :shortcut => "x"

        def on_header(*)
          @from, @to = options[:cut].begin, options[:cut].end
          @wait_for_keyframe = options[:keyframe_mode]
          @first_timestamp = nil
        end

        def on_tag(tag)
          if tag.timestamp > @to
            stop
          elsif (tag.timestamp < @from) || (@wait_for_keyframe &&= !tag.body.is?(:keyframe))
            absorb
          else
            @first_timestamp ||= tag.timestamp
            tag.timestamp -= @first_timestamp
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
marcandre-flvedit-0.6.1 lib/flv/edit/processor/cut.rb
flvedit-0.6.1 lib/flv/edit/processor/cut.rb