Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Created August 2, 2019 21:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
class AV1
def encode(bytes)
end
def decode(bytes)
end
end
class H264
def encode(bytes)
end
def decode(bytes)
end
end
# ...
supported_codecs = [AV1.new, H264.new, HEVC.new]
class MediaFramework
def encode(type, bytes)
codec = supported_codecs.find {|c| c.class.name.downcase == type}
codec.encode(bytes)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment