# File lib/ogg.rb, line 81 def detect_codec(input) if input.kind_of?(Page) first_page = input else first_page = Page.read(input) input.rewind end codecs = Ogg::Codecs.constants.map { |module_name| Ogg::Codecs.class_eval(module_name) }.select { |c| c.is_a?(Class) } codec = codecs.detect { |c| c.match?(first_page.segments.first) } unless codec raise(StreamError,"unknown codec") end return codec end