mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-03-03 19:37:47 +01:00
- Windows: 10.0.19041 SDK is now required. - macOS: 10.15.1 SDK (at least Xcode 11.2) is now required. - Remove CefMediaSource::IsValid and CefMediaSink::IsValid which would always return true.
52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
// can be found in the LICENSE file.
|
|
|
|
#include "libcef/browser/media_router/media_sink_impl.h"
|
|
|
|
CefMediaSinkImpl::CefMediaSinkImpl(const media_router::MediaSink& sink)
|
|
: sink_(sink) {}
|
|
|
|
CefMediaSinkImpl::CefMediaSinkImpl(const media_router::MediaSink::Id& sink_id,
|
|
const std::string& sink_name)
|
|
: sink_(sink_id, sink_name, media_router::SinkIconType::GENERIC) {}
|
|
|
|
CefString CefMediaSinkImpl::GetId() {
|
|
return sink_.id();
|
|
}
|
|
|
|
CefString CefMediaSinkImpl::GetName() {
|
|
return sink_.name();
|
|
}
|
|
|
|
CefString CefMediaSinkImpl::GetDescription() {
|
|
return sink_.description().value_or("");
|
|
}
|
|
|
|
CefMediaSink::IconType CefMediaSinkImpl::GetIconType() {
|
|
// Verify that our enum matches Chromium's values.
|
|
static_assert(static_cast<int>(CEF_MSIT_TOTAL_COUNT) ==
|
|
static_cast<int>(media_router::SinkIconType::TOTAL_COUNT),
|
|
"enum mismatch");
|
|
|
|
return static_cast<CefMediaSink::IconType>(sink_.icon_type());
|
|
}
|
|
|
|
bool CefMediaSinkImpl::IsCastSink() {
|
|
return sink_.provider_id() == media_router::CAST;
|
|
}
|
|
|
|
bool CefMediaSinkImpl::IsDialSink() {
|
|
return sink_.provider_id() == media_router::DIAL;
|
|
}
|
|
|
|
bool CefMediaSinkImpl::IsCompatibleWith(CefRefPtr<CefMediaSource> source) {
|
|
if (source) {
|
|
if (IsCastSink())
|
|
return source->IsCastSource();
|
|
if (IsDialSink())
|
|
return source->IsDialSource();
|
|
}
|
|
return false;
|
|
}
|