mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-12 17:46:04 +01:00
03fd5b15da
Chromium supports communication with media devices on the local network via the Cast and DIAL protocols. This takes two primary forms: 1. Messaging, where strings representing state information are passed between the client and a dedicated receiver app on the media device. The receiver app communicates directly with an app-specific backend service to retrieve and possibly control media playback. 2. Tab/desktop mirroring, where the media contents are streamed directly from the browser to a generic streaming app on the media device and playback is controlled by the browser. This change adds support for device discovery and messaging (but not mirroring) with functionality exposed via the new CefMediaRouter interface. To test: Navigate to http://tests/media_router in cefclient and follow the on-screen instructions.
178 lines
4.5 KiB
C++
178 lines
4.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.
|
|
//
|
|
// ---------------------------------------------------------------------------
|
|
//
|
|
// This file was generated by the CEF translator tool. If making changes by
|
|
// hand only do so within the body of existing method and function
|
|
// implementations. See the translator.README.txt file in the tools directory
|
|
// for more information.
|
|
//
|
|
// $hash=cbbac244f39cc1d644b0db80a3f7234399286368$
|
|
//
|
|
|
|
#include "libcef_dll/cpptoc/media_sink_cpptoc.h"
|
|
#include "libcef_dll/cpptoc/media_source_cpptoc.h"
|
|
#include "libcef_dll/shutdown_checker.h"
|
|
|
|
namespace {
|
|
|
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
|
|
|
cef_string_userfree_t CEF_CALLBACK
|
|
media_sink_get_id(struct _cef_media_sink_t* self) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
DCHECK(self);
|
|
if (!self)
|
|
return NULL;
|
|
|
|
// Execute
|
|
CefString _retval = CefMediaSinkCppToC::Get(self)->GetId();
|
|
|
|
// Return type: string
|
|
return _retval.DetachToUserFree();
|
|
}
|
|
|
|
int CEF_CALLBACK media_sink_is_valid(struct _cef_media_sink_t* self) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
DCHECK(self);
|
|
if (!self)
|
|
return 0;
|
|
|
|
// Execute
|
|
bool _retval = CefMediaSinkCppToC::Get(self)->IsValid();
|
|
|
|
// Return type: bool
|
|
return _retval;
|
|
}
|
|
|
|
cef_string_userfree_t CEF_CALLBACK
|
|
media_sink_get_name(struct _cef_media_sink_t* self) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
DCHECK(self);
|
|
if (!self)
|
|
return NULL;
|
|
|
|
// Execute
|
|
CefString _retval = CefMediaSinkCppToC::Get(self)->GetName();
|
|
|
|
// Return type: string
|
|
return _retval.DetachToUserFree();
|
|
}
|
|
|
|
cef_string_userfree_t CEF_CALLBACK
|
|
media_sink_get_description(struct _cef_media_sink_t* self) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
DCHECK(self);
|
|
if (!self)
|
|
return NULL;
|
|
|
|
// Execute
|
|
CefString _retval = CefMediaSinkCppToC::Get(self)->GetDescription();
|
|
|
|
// Return type: string
|
|
return _retval.DetachToUserFree();
|
|
}
|
|
|
|
int CEF_CALLBACK media_sink_is_cast_sink(struct _cef_media_sink_t* self) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
DCHECK(self);
|
|
if (!self)
|
|
return 0;
|
|
|
|
// Execute
|
|
bool _retval = CefMediaSinkCppToC::Get(self)->IsCastSink();
|
|
|
|
// Return type: bool
|
|
return _retval;
|
|
}
|
|
|
|
int CEF_CALLBACK media_sink_is_dial_sink(struct _cef_media_sink_t* self) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
DCHECK(self);
|
|
if (!self)
|
|
return 0;
|
|
|
|
// Execute
|
|
bool _retval = CefMediaSinkCppToC::Get(self)->IsDialSink();
|
|
|
|
// Return type: bool
|
|
return _retval;
|
|
}
|
|
|
|
int CEF_CALLBACK
|
|
media_sink_is_compatible_with(struct _cef_media_sink_t* self,
|
|
struct _cef_media_source_t* source) {
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
DCHECK(self);
|
|
if (!self)
|
|
return 0;
|
|
// Verify param: source; type: refptr_same
|
|
DCHECK(source);
|
|
if (!source)
|
|
return 0;
|
|
|
|
// Execute
|
|
bool _retval = CefMediaSinkCppToC::Get(self)->IsCompatibleWith(
|
|
CefMediaSourceCppToC::Unwrap(source));
|
|
|
|
// Return type: bool
|
|
return _retval;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
// CONSTRUCTOR - Do not edit by hand.
|
|
|
|
CefMediaSinkCppToC::CefMediaSinkCppToC() {
|
|
GetStruct()->get_id = media_sink_get_id;
|
|
GetStruct()->is_valid = media_sink_is_valid;
|
|
GetStruct()->get_name = media_sink_get_name;
|
|
GetStruct()->get_description = media_sink_get_description;
|
|
GetStruct()->is_cast_sink = media_sink_is_cast_sink;
|
|
GetStruct()->is_dial_sink = media_sink_is_dial_sink;
|
|
GetStruct()->is_compatible_with = media_sink_is_compatible_with;
|
|
}
|
|
|
|
// DESTRUCTOR - Do not edit by hand.
|
|
|
|
CefMediaSinkCppToC::~CefMediaSinkCppToC() {
|
|
shutdown_checker::AssertNotShutdown();
|
|
}
|
|
|
|
template <>
|
|
CefRefPtr<CefMediaSink>
|
|
CefCppToCRefCounted<CefMediaSinkCppToC, CefMediaSink, cef_media_sink_t>::
|
|
UnwrapDerived(CefWrapperType type, cef_media_sink_t* s) {
|
|
NOTREACHED() << "Unexpected class type: " << type;
|
|
return nullptr;
|
|
}
|
|
|
|
template <>
|
|
CefWrapperType CefCppToCRefCounted<CefMediaSinkCppToC,
|
|
CefMediaSink,
|
|
cef_media_sink_t>::kWrapperType =
|
|
WT_MEDIA_SINK;
|