Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Created August 2, 2019 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leandromoreira/a2539a40702d2b06b35ffc1bdf7b96bd to your computer and use it in GitHub Desktop.
Save leandromoreira/a2539a40702d2b06b35ffc1bdf7b96bd to your computer and use it in GitHub Desktop.
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