MediaStreamSourceStates.cpp [plain text]
#include "config.h"
#if ENABLE(MEDIA_STREAM)
#include "MediaStreamSourceStates.h"
#include <wtf/NeverDestroyed.h>
namespace WebCore {
const AtomicString& MediaStreamSourceStates::facingMode(MediaStreamSourceStates::VideoFacingMode mode)
{
static NeverDestroyed<AtomicString> userFacing("user", AtomicString::ConstructFromLiteral);
static NeverDestroyed<AtomicString> environmentFacing("environment", AtomicString::ConstructFromLiteral);
static NeverDestroyed<AtomicString> leftFacing("left", AtomicString::ConstructFromLiteral);
static NeverDestroyed<AtomicString> rightFacing("right", AtomicString::ConstructFromLiteral);
switch (mode) {
case MediaStreamSourceStates::User:
return userFacing;
case MediaStreamSourceStates::Environment:
return environmentFacing;
case MediaStreamSourceStates::Left:
return leftFacing;
case MediaStreamSourceStates::Right:
return rightFacing;
case MediaStreamSourceStates::Unknown:
return emptyAtom;
}
ASSERT_NOT_REACHED();
return emptyAtom;
}
const AtomicString& MediaStreamSourceStates::sourceType(MediaStreamSourceStates::SourceType sourceType)
{
static NeverDestroyed<AtomicString> none("none", AtomicString::ConstructFromLiteral);
static NeverDestroyed<AtomicString> camera("camera", AtomicString::ConstructFromLiteral);
static NeverDestroyed<AtomicString> microphone("microphone", AtomicString::ConstructFromLiteral);
switch (sourceType) {
case MediaStreamSourceStates::None:
return none;
case MediaStreamSourceStates::Camera:
return camera;
case MediaStreamSourceStates::Microphone:
return microphone;
}
ASSERT_NOT_REACHED();
return emptyAtom;
}
}
#endif // ENABLE(MEDIA_STREAM)