Bug 1358662 - Store VPXDecoder codec as an enum. r=jya

Use the enum we already have here instead of converting
to an int when we pass it around, giving us better
type checking.

MozReview-Commit-ID: Gj4xmtQnzw2

--HG--
extra : rebase_source : fc7769c9650c59f52bfd8611e6cabb8e5b6d7068
This commit is contained in:
Ralph Giles 2017-04-24 15:02:54 -07:00
parent 9032567bba
commit 318e6f6af0
2 changed files with 6 additions and 5 deletions

View File

@ -22,7 +22,7 @@ namespace mozilla {
using namespace gfx;
using namespace layers;
static int MimeTypeToCodec(const nsACString& aMimeType)
static VPXDecoder::Codec MimeTypeToCodec(const nsACString& aMimeType)
{
if (aMimeType.EqualsLiteral("video/webm; codecs=vp8")) {
return VPXDecoder::Codec::VP8;
@ -31,13 +31,13 @@ static int MimeTypeToCodec(const nsACString& aMimeType)
} else if (aMimeType.EqualsLiteral("video/vp9")) {
return VPXDecoder::Codec::VP9;
}
return -1;
return VPXDecoder::Codec::Unknown;
}
static nsresult
InitContext(vpx_codec_ctx_t* aCtx,
const VideoInfo& aInfo,
const int aCodec)
const VPXDecoder::Codec aCodec)
{
int decode_threads = 2;

View File

@ -34,7 +34,8 @@ public:
enum Codec: uint8_t
{
VP8 = 1 << 0,
VP9 = 1 << 1
VP9 = 1 << 1,
Unknown = 1 << 7,
};
// Return true if aMimeType is a one of the strings used by our demuxers to
@ -60,7 +61,7 @@ private:
const VideoInfo& mInfo;
const int mCodec;
const Codec mCodec;
};
} // namespace mozilla