mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-23 15:47:30 +09:00
Ensure we correctly parse the finalized codec string for av1
This commit is contained in:
parent
1b0277eca5
commit
de6b3a930f
1 changed files with 12 additions and 11 deletions
|
|
@ -438,6 +438,16 @@ ParseMIMETypeString(const nsAString& aMIMEType,
|
||||||
return ParseCodecsString(codecsStr, aOutCodecs);
|
return ParseCodecsString(codecsStr, aOutCodecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <int N>
|
||||||
|
static bool
|
||||||
|
StartsWith(const nsACString& string, const char (&prefix)[N])
|
||||||
|
{
|
||||||
|
if (N - 1 > string.Length()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return memcmp(string.Data(), prefix, N - 1) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
IsH264CodecString(const nsAString& aCodec)
|
IsH264CodecString(const nsAString& aCodec)
|
||||||
{
|
{
|
||||||
|
|
@ -474,20 +484,11 @@ IsVP9CodecString(const nsAString& aCodec)
|
||||||
bool
|
bool
|
||||||
IsAV1CodecString(const nsAString& aCodec)
|
IsAV1CodecString(const nsAString& aCodec)
|
||||||
{
|
{
|
||||||
return aCodec.EqualsLiteral("av1");
|
return aCodec.EqualsLiteral("av1") ||
|
||||||
|
StartsWith(NS_ConvertUTF16toUTF8(aCodec), "av01");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <int N>
|
|
||||||
static bool
|
|
||||||
StartsWith(const nsACString& string, const char (&prefix)[N])
|
|
||||||
{
|
|
||||||
if (N - 1 > string.Length()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return memcmp(string.Data(), prefix, N - 1) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
UniquePtr<TrackInfo>
|
UniquePtr<TrackInfo>
|
||||||
CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType)
|
CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue