#include "components/media_router/common/media_source.h"
#include <array>
#include <cstdio>
#include <ostream>
#include <string>
#include <string_view>
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "media/audio/audio_features.h"
#include "media/base/audio_codecs.h"
#include "media/base/media_switches.h"
#include "media/base/video_codecs.h"
#include "net/base/url_util.h"
#include "third_party/blink/public/platform/modules/remoteplayback/remote_playback_source.h"
#include "url/gurl.h"
namespace media_router {
namespace {
constexpr char kAnyTabMediaUrn[] = …;
constexpr char kTabMediaUrnFormat[] = …;
constexpr std::string_view kDesktopMediaUrnPrefix = …;
constexpr std::string_view kDesktopMediaUrnAudioParam = …;
constexpr std::string_view kUnchosenDesktopMediaUrn = …;
constexpr std::string_view kUnchosenDesktopWithAudioMediaUrn = …;
constexpr std::array<const char* const, 5> kAllowedSchemes{ … };
bool IsSchemeAllowed(const GURL& url) { … }
bool IsSystemAudioCaptureSupported() { … }
}
bool IsLegacyCastPresentationUrl(const GURL& url) { … }
bool IsValidPresentationUrl(const GURL& url) { … }
bool IsValidStandardPresentationSource(const std::string& media_source) { … }
bool IsAutoJoinPresentationId(const std::string& presentation_id) { … }
MediaSource::MediaSource(const MediaSource::Id& source_id) : … { … }
MediaSource::MediaSource(const GURL& presentation_url)
: … { … }
MediaSource::~MediaSource() = default;
MediaSource MediaSource::ForAnyTab() { … }
MediaSource MediaSource::ForTab(int tab_id) { … }
MediaSource MediaSource::ForPresentationUrl(const GURL& presentation_url) { … }
MediaSource MediaSource::ForRemotePlayback(int tab_id,
media::VideoCodec video_codec,
media::AudioCodec audio_codec) { … }
MediaSource MediaSource::ForDesktop(const std::string& desktop_media_id,
bool with_audio) { … }
MediaSource MediaSource::ForUnchosenDesktop() { … }
bool MediaSource::IsTabMirroringSource() const { … }
bool MediaSource::IsDesktopMirroringSource() const { … }
bool MediaSource::IsCastPresentationUrl() const { … }
bool MediaSource::IsRemotePlaybackSource() const { … }
std::optional<int> MediaSource::TabId() const { … }
std::optional<int> MediaSource::TabIdFromRemotePlaybackSource() const { … }
std::optional<std::string> MediaSource::DesktopStreamId() const { … }
bool MediaSource::IsDesktopSourceWithAudio() const { … }
bool MediaSource::IsDialSource() const { … }
std::string MediaSource::AppNameFromDialSource() const { … }
std::string MediaSource::TruncateForLogging(size_t max_length) const { … }
void MediaSource::AppendTabIdToRemotePlaybackUrlQuery(int tab_id) { … }
}