LibMedia: Add ogg/vorbis support

Technically this supports any ogg/* audio stream, but it was at least
tested successfully on ogg/vorbis :^)
This commit is contained in:
Jelle Raaijmakers 2024-09-11 12:43:56 +02:00 committed by Andreas Kling
parent 1b267abf36
commit d29797f118
Notes: github-actions[bot] 2024-09-12 08:02:15 +00:00
9 changed files with 363 additions and 17 deletions

View file

@ -204,12 +204,9 @@ Bindings::CanPlayTypeResult HTMLMediaElement::can_play_type(StringView type) con
return Bindings::CanPlayTypeResult::Probably;
if (mime_type->subtype() == "flac"sv)
return Bindings::CanPlayTypeResult::Probably;
// We don't currently support `ogg`. We'll also have to check parameters, e.g. from Bandcamp:
// audio/ogg; codecs="vorbis"
// audio/ogg; codecs="opus"
// "Maybe" because we support Ogg Vorbis, but "ogg" can contain other codecs
if (mime_type->subtype() == "ogg"sv)
return Bindings::CanPlayTypeResult::Empty;
// Quite OK Audio
return Bindings::CanPlayTypeResult::Maybe;
if (mime_type->subtype() == "qoa"sv)
return Bindings::CanPlayTypeResult::Probably;
return Bindings::CanPlayTypeResult::Maybe;