Add support for media device discovery and messaging (fixes issue #2900)

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.
This commit is contained in:
Marshall Greenblatt
2020-03-19 11:34:15 -04:00
parent fecd582035
commit 03fd5b15da
69 changed files with 5402 additions and 33 deletions

View File

@ -0,0 +1,158 @@
// 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=6eed652a4bd13cf685980f7ea0b838d73e6071ba$
//
#include "libcef_dll/ctocpp/media_observer_ctocpp.h"
#include "libcef_dll/cpptoc/media_route_cpptoc.h"
#include "libcef_dll/cpptoc/media_sink_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
void CefMediaObserverCToCpp::OnSinks(
const std::vector<CefRefPtr<CefMediaSink>>& sinks) {
shutdown_checker::AssertNotShutdown();
cef_media_observer_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_sinks))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: sinks; type: refptr_vec_diff_byref_const
const size_t sinksCount = sinks.size();
cef_media_sink_t** sinksList = NULL;
if (sinksCount > 0) {
sinksList = new cef_media_sink_t*[sinksCount];
DCHECK(sinksList);
if (sinksList) {
for (size_t i = 0; i < sinksCount; ++i) {
sinksList[i] = CefMediaSinkCppToC::Wrap(sinks[i]);
}
}
}
// Execute
_struct->on_sinks(_struct, sinksCount, sinksList);
// Restore param:sinks; type: refptr_vec_diff_byref_const
if (sinksList)
delete[] sinksList;
}
NO_SANITIZE("cfi-icall")
void CefMediaObserverCToCpp::OnRoutes(
const std::vector<CefRefPtr<CefMediaRoute>>& routes) {
shutdown_checker::AssertNotShutdown();
cef_media_observer_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_routes))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: routes; type: refptr_vec_diff_byref_const
const size_t routesCount = routes.size();
cef_media_route_t** routesList = NULL;
if (routesCount > 0) {
routesList = new cef_media_route_t*[routesCount];
DCHECK(routesList);
if (routesList) {
for (size_t i = 0; i < routesCount; ++i) {
routesList[i] = CefMediaRouteCppToC::Wrap(routes[i]);
}
}
}
// Execute
_struct->on_routes(_struct, routesCount, routesList);
// Restore param:routes; type: refptr_vec_diff_byref_const
if (routesList)
delete[] routesList;
}
NO_SANITIZE("cfi-icall")
void CefMediaObserverCToCpp::OnRouteStateChanged(CefRefPtr<CefMediaRoute> route,
ConnectionState state) {
shutdown_checker::AssertNotShutdown();
cef_media_observer_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_route_state_changed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: route; type: refptr_diff
DCHECK(route.get());
if (!route.get())
return;
// Execute
_struct->on_route_state_changed(_struct, CefMediaRouteCppToC::Wrap(route),
state);
}
NO_SANITIZE("cfi-icall")
void CefMediaObserverCToCpp::OnRouteMessageReceived(
CefRefPtr<CefMediaRoute> route,
const void* message,
size_t message_size) {
shutdown_checker::AssertNotShutdown();
cef_media_observer_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_route_message_received))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: route; type: refptr_diff
DCHECK(route.get());
if (!route.get())
return;
// Verify param: message; type: simple_byaddr
DCHECK(message);
if (!message)
return;
// Execute
_struct->on_route_message_received(_struct, CefMediaRouteCppToC::Wrap(route),
message, message_size);
}
// CONSTRUCTOR - Do not edit by hand.
CefMediaObserverCToCpp::CefMediaObserverCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefMediaObserverCToCpp::~CefMediaObserverCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_media_observer_t*
CefCToCppRefCounted<CefMediaObserverCToCpp,
CefMediaObserver,
cef_media_observer_t>::UnwrapDerived(CefWrapperType type,
CefMediaObserver* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefMediaObserverCToCpp,
CefMediaObserver,
cef_media_observer_t>::kWrapperType =
WT_MEDIA_OBSERVER;

View File

@ -0,0 +1,48 @@
// 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=4c2e71870e5f8a31052431a5242f91392607502d$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_OBSERVER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_OBSERVER_CTOCPP_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include <vector>
#include "include/capi/cef_media_router_capi.h"
#include "include/cef_media_router.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefMediaObserverCToCpp
: public CefCToCppRefCounted<CefMediaObserverCToCpp,
CefMediaObserver,
cef_media_observer_t> {
public:
CefMediaObserverCToCpp();
virtual ~CefMediaObserverCToCpp();
// CefMediaObserver methods.
void OnSinks(const std::vector<CefRefPtr<CefMediaSink>>& sinks) override;
void OnRoutes(const std::vector<CefRefPtr<CefMediaRoute>>& routes) override;
void OnRouteStateChanged(CefRefPtr<CefMediaRoute> route,
ConnectionState state) override;
void OnRouteMessageReceived(CefRefPtr<CefMediaRoute> route,
const void* message,
size_t message_size) override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_OBSERVER_CTOCPP_H_

View File

@ -0,0 +1,66 @@
// 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=93dd08de00931b1c00ec0307cc70496455936b0c$
//
#include "libcef_dll/ctocpp/media_route_create_callback_ctocpp.h"
#include "libcef_dll/cpptoc/media_route_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
void CefMediaRouteCreateCallbackCToCpp::OnMediaRouteCreateFinished(
RouteCreateResult result,
const CefString& error,
CefRefPtr<CefMediaRoute> route) {
shutdown_checker::AssertNotShutdown();
cef_media_route_create_callback_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_media_route_create_finished))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: error, route
// Execute
_struct->on_media_route_create_finished(_struct, result, error.GetStruct(),
CefMediaRouteCppToC::Wrap(route));
}
// CONSTRUCTOR - Do not edit by hand.
CefMediaRouteCreateCallbackCToCpp::CefMediaRouteCreateCallbackCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefMediaRouteCreateCallbackCToCpp::~CefMediaRouteCreateCallbackCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_media_route_create_callback_t*
CefCToCppRefCounted<CefMediaRouteCreateCallbackCToCpp,
CefMediaRouteCreateCallback,
cef_media_route_create_callback_t>::
UnwrapDerived(CefWrapperType type, CefMediaRouteCreateCallback* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType
CefCToCppRefCounted<CefMediaRouteCreateCallbackCToCpp,
CefMediaRouteCreateCallback,
cef_media_route_create_callback_t>::kWrapperType =
WT_MEDIA_ROUTE_CREATE_CALLBACK;

View File

@ -0,0 +1,43 @@
// 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=ac5657bccd7830fde1d3dddfad69d87dff2ae684$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CREATE_CALLBACK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CREATE_CALLBACK_CTOCPP_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/cef_media_router_capi.h"
#include "include/cef_media_router.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefMediaRouteCreateCallbackCToCpp
: public CefCToCppRefCounted<CefMediaRouteCreateCallbackCToCpp,
CefMediaRouteCreateCallback,
cef_media_route_create_callback_t> {
public:
CefMediaRouteCreateCallbackCToCpp();
virtual ~CefMediaRouteCreateCallbackCToCpp();
// CefMediaRouteCreateCallback methods.
void OnMediaRouteCreateFinished(RouteCreateResult result,
const CefString& error,
CefRefPtr<CefMediaRoute> route) override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CREATE_CALLBACK_CTOCPP_H_

View File

@ -0,0 +1,129 @@
// 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=7fe34c4b79d10a88bfcf5ec46a54cf52d3657e87$
//
#include "libcef_dll/ctocpp/media_route_ctocpp.h"
#include "libcef_dll/ctocpp/media_sink_ctocpp.h"
#include "libcef_dll/ctocpp/media_source_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall") CefString CefMediaRouteCToCpp::GetId() {
shutdown_checker::AssertNotShutdown();
cef_media_route_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_id))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = _struct->get_id(_struct);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefMediaSource> CefMediaRouteCToCpp::GetSource() {
shutdown_checker::AssertNotShutdown();
cef_media_route_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_source))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_media_source_t* _retval = _struct->get_source(_struct);
// Return type: refptr_same
return CefMediaSourceCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefMediaSink> CefMediaRouteCToCpp::GetSink() {
shutdown_checker::AssertNotShutdown();
cef_media_route_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_sink))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_media_sink_t* _retval = _struct->get_sink(_struct);
// Return type: refptr_same
return CefMediaSinkCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
void CefMediaRouteCToCpp::SendRouteMessage(const void* message,
size_t message_size) {
shutdown_checker::AssertNotShutdown();
cef_media_route_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, send_route_message))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: message; type: simple_byaddr
DCHECK(message);
if (!message)
return;
// Execute
_struct->send_route_message(_struct, message, message_size);
}
NO_SANITIZE("cfi-icall") void CefMediaRouteCToCpp::Terminate() {
shutdown_checker::AssertNotShutdown();
cef_media_route_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, terminate))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->terminate(_struct);
}
// CONSTRUCTOR - Do not edit by hand.
CefMediaRouteCToCpp::CefMediaRouteCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefMediaRouteCToCpp::~CefMediaRouteCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_media_route_t*
CefCToCppRefCounted<CefMediaRouteCToCpp, CefMediaRoute, cef_media_route_t>::
UnwrapDerived(CefWrapperType type, CefMediaRoute* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefMediaRouteCToCpp,
CefMediaRoute,
cef_media_route_t>::kWrapperType =
WT_MEDIA_ROUTE;

View File

@ -0,0 +1,44 @@
// 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=cb792f909646d1ccd3644877ce2393080465471a$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_media_router_capi.h"
#include "include/cef_media_router.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefMediaRouteCToCpp : public CefCToCppRefCounted<CefMediaRouteCToCpp,
CefMediaRoute,
cef_media_route_t> {
public:
CefMediaRouteCToCpp();
virtual ~CefMediaRouteCToCpp();
// CefMediaRoute methods.
CefString GetId() OVERRIDE;
CefRefPtr<CefMediaSource> GetSource() OVERRIDE;
CefRefPtr<CefMediaSink> GetSink() OVERRIDE;
void SendRouteMessage(const void* message, size_t message_size) OVERRIDE;
void Terminate() OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTE_CTOCPP_H_

View File

@ -0,0 +1,167 @@
// 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=4b8ab6373fcb0a84a818c2c5ef8982600346f34b$
//
#include "libcef_dll/ctocpp/media_router_ctocpp.h"
#include "libcef_dll/cpptoc/media_observer_cpptoc.h"
#include "libcef_dll/cpptoc/media_route_create_callback_cpptoc.h"
#include "libcef_dll/ctocpp/media_sink_ctocpp.h"
#include "libcef_dll/ctocpp/media_source_ctocpp.h"
#include "libcef_dll/ctocpp/registration_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// STATIC METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
CefRefPtr<CefMediaRouter> CefMediaRouter::GetGlobalMediaRouter() {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_media_router_t* _retval = cef_media_router_get_global();
// Return type: refptr_same
return CefMediaRouterCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
CefRefPtr<CefRegistration> CefMediaRouterCToCpp::AddObserver(
CefRefPtr<CefMediaObserver> observer) {
shutdown_checker::AssertNotShutdown();
cef_media_router_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, add_observer))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: observer; type: refptr_diff
DCHECK(observer.get());
if (!observer.get())
return nullptr;
// Execute
cef_registration_t* _retval =
_struct->add_observer(_struct, CefMediaObserverCppToC::Wrap(observer));
// Return type: refptr_same
return CefRegistrationCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefMediaSource> CefMediaRouterCToCpp::GetSource(
const CefString& urn) {
shutdown_checker::AssertNotShutdown();
cef_media_router_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_source))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: urn; type: string_byref_const
DCHECK(!urn.empty());
if (urn.empty())
return nullptr;
// Execute
cef_media_source_t* _retval = _struct->get_source(_struct, urn.GetStruct());
// Return type: refptr_same
return CefMediaSourceCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall") void CefMediaRouterCToCpp::NotifyCurrentSinks() {
shutdown_checker::AssertNotShutdown();
cef_media_router_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, notify_current_sinks))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->notify_current_sinks(_struct);
}
NO_SANITIZE("cfi-icall")
void CefMediaRouterCToCpp::CreateRoute(
CefRefPtr<CefMediaSource> source,
CefRefPtr<CefMediaSink> sink,
CefRefPtr<CefMediaRouteCreateCallback> callback) {
shutdown_checker::AssertNotShutdown();
cef_media_router_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, create_route))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: source; type: refptr_same
DCHECK(source.get());
if (!source.get())
return;
// Verify param: sink; type: refptr_same
DCHECK(sink.get());
if (!sink.get())
return;
// Verify param: callback; type: refptr_diff
DCHECK(callback.get());
if (!callback.get())
return;
// Execute
_struct->create_route(_struct, CefMediaSourceCToCpp::Unwrap(source),
CefMediaSinkCToCpp::Unwrap(sink),
CefMediaRouteCreateCallbackCppToC::Wrap(callback));
}
NO_SANITIZE("cfi-icall") void CefMediaRouterCToCpp::NotifyCurrentRoutes() {
shutdown_checker::AssertNotShutdown();
cef_media_router_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, notify_current_routes))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->notify_current_routes(_struct);
}
// CONSTRUCTOR - Do not edit by hand.
CefMediaRouterCToCpp::CefMediaRouterCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefMediaRouterCToCpp::~CefMediaRouterCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_media_router_t*
CefCToCppRefCounted<CefMediaRouterCToCpp, CefMediaRouter, cef_media_router_t>::
UnwrapDerived(CefWrapperType type, CefMediaRouter* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefMediaRouterCToCpp,
CefMediaRouter,
cef_media_router_t>::kWrapperType =
WT_MEDIA_ROUTER;

View File

@ -0,0 +1,47 @@
// 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=e3d62de09a699415a839cadda52cca2582d90063$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTER_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_media_router_capi.h"
#include "include/cef_media_router.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefMediaRouterCToCpp : public CefCToCppRefCounted<CefMediaRouterCToCpp,
CefMediaRouter,
cef_media_router_t> {
public:
CefMediaRouterCToCpp();
virtual ~CefMediaRouterCToCpp();
// CefMediaRouter methods.
CefRefPtr<CefRegistration> AddObserver(
CefRefPtr<CefMediaObserver> observer) OVERRIDE;
CefRefPtr<CefMediaSource> GetSource(const CefString& urn) OVERRIDE;
void NotifyCurrentSinks() OVERRIDE;
void CreateRoute(CefRefPtr<CefMediaSource> source,
CefRefPtr<CefMediaSink> sink,
CefRefPtr<CefMediaRouteCreateCallback> callback) OVERRIDE;
void NotifyCurrentRoutes() OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_ROUTER_CTOCPP_H_

View File

@ -0,0 +1,168 @@
// 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=bb39ec5e546482b707c1e01a83fc1b064d96a4e6$
//
#include "libcef_dll/ctocpp/media_sink_ctocpp.h"
#include "libcef_dll/ctocpp/media_source_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall") CefString CefMediaSinkCToCpp::GetId() {
shutdown_checker::AssertNotShutdown();
cef_media_sink_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_id))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = _struct->get_id(_struct);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
NO_SANITIZE("cfi-icall") bool CefMediaSinkCToCpp::IsValid() {
shutdown_checker::AssertNotShutdown();
cef_media_sink_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_valid))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_valid(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") CefString CefMediaSinkCToCpp::GetName() {
shutdown_checker::AssertNotShutdown();
cef_media_sink_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_name))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = _struct->get_name(_struct);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
NO_SANITIZE("cfi-icall") CefString CefMediaSinkCToCpp::GetDescription() {
shutdown_checker::AssertNotShutdown();
cef_media_sink_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_description))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = _struct->get_description(_struct);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
NO_SANITIZE("cfi-icall") bool CefMediaSinkCToCpp::IsCastSink() {
shutdown_checker::AssertNotShutdown();
cef_media_sink_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_cast_sink))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_cast_sink(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") bool CefMediaSinkCToCpp::IsDialSink() {
shutdown_checker::AssertNotShutdown();
cef_media_sink_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_dial_sink))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_dial_sink(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
bool CefMediaSinkCToCpp::IsCompatibleWith(CefRefPtr<CefMediaSource> source) {
shutdown_checker::AssertNotShutdown();
cef_media_sink_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_compatible_with))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: source; type: refptr_same
DCHECK(source.get());
if (!source.get())
return false;
// Execute
int _retval = _struct->is_compatible_with(
_struct, CefMediaSourceCToCpp::Unwrap(source));
// Return type: bool
return _retval ? true : false;
}
// CONSTRUCTOR - Do not edit by hand.
CefMediaSinkCToCpp::CefMediaSinkCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefMediaSinkCToCpp::~CefMediaSinkCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_media_sink_t*
CefCToCppRefCounted<CefMediaSinkCToCpp, CefMediaSink, cef_media_sink_t>::
UnwrapDerived(CefWrapperType type, CefMediaSink* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefMediaSinkCToCpp,
CefMediaSink,
cef_media_sink_t>::kWrapperType =
WT_MEDIA_SINK;

View File

@ -0,0 +1,46 @@
// 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=d69c0bdadc802bc7cb970c316f3a0ed8529c5f9c$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_media_router_capi.h"
#include "include/cef_media_router.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefMediaSinkCToCpp : public CefCToCppRefCounted<CefMediaSinkCToCpp,
CefMediaSink,
cef_media_sink_t> {
public:
CefMediaSinkCToCpp();
virtual ~CefMediaSinkCToCpp();
// CefMediaSink methods.
CefString GetId() OVERRIDE;
bool IsValid() OVERRIDE;
CefString GetName() OVERRIDE;
CefString GetDescription() OVERRIDE;
bool IsCastSink() OVERRIDE;
bool IsDialSink() OVERRIDE;
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_CTOCPP_H_

View File

@ -0,0 +1,108 @@
// 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=2b4f20db4eccd1429c748f39db19852cd1644b4a$
//
#include "libcef_dll/ctocpp/media_source_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall") CefString CefMediaSourceCToCpp::GetId() {
shutdown_checker::AssertNotShutdown();
cef_media_source_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_id))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = _struct->get_id(_struct);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
NO_SANITIZE("cfi-icall") bool CefMediaSourceCToCpp::IsValid() {
shutdown_checker::AssertNotShutdown();
cef_media_source_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_valid))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_valid(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") bool CefMediaSourceCToCpp::IsCastSource() {
shutdown_checker::AssertNotShutdown();
cef_media_source_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_cast_source))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_cast_source(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") bool CefMediaSourceCToCpp::IsDialSource() {
shutdown_checker::AssertNotShutdown();
cef_media_source_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_dial_source))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_dial_source(_struct);
// Return type: bool
return _retval ? true : false;
}
// CONSTRUCTOR - Do not edit by hand.
CefMediaSourceCToCpp::CefMediaSourceCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefMediaSourceCToCpp::~CefMediaSourceCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_media_source_t*
CefCToCppRefCounted<CefMediaSourceCToCpp, CefMediaSource, cef_media_source_t>::
UnwrapDerived(CefWrapperType type, CefMediaSource* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefMediaSourceCToCpp,
CefMediaSource,
cef_media_source_t>::kWrapperType =
WT_MEDIA_SOURCE;

View File

@ -0,0 +1,43 @@
// 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=73aeb0f58611c0d7a9fa13f1d9268912e0fba0bd$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_SOURCE_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_SOURCE_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_media_router_capi.h"
#include "include/cef_media_router.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefMediaSourceCToCpp : public CefCToCppRefCounted<CefMediaSourceCToCpp,
CefMediaSource,
cef_media_source_t> {
public:
CefMediaSourceCToCpp();
virtual ~CefMediaSourceCToCpp();
// CefMediaSource methods.
CefString GetId() OVERRIDE;
bool IsValid() OVERRIDE;
bool IsCastSource() OVERRIDE;
bool IsDialSource() OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_SOURCE_CTOCPP_H_

View File

@ -0,0 +1,42 @@
// 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=89f0f0c0ae2485adbf8140a419969901e5766b51$
//
#include "libcef_dll/ctocpp/registration_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// CONSTRUCTOR - Do not edit by hand.
CefRegistrationCToCpp::CefRegistrationCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefRegistrationCToCpp::~CefRegistrationCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_registration_t*
CefCToCppRefCounted<CefRegistrationCToCpp,
CefRegistration,
cef_registration_t>::UnwrapDerived(CefWrapperType type,
CefRegistration* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefRegistrationCToCpp,
CefRegistration,
cef_registration_t>::kWrapperType =
WT_REGISTRATION;

View File

@ -0,0 +1,39 @@
// 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=6d458b0a8e42e3f3347d5101f8d3f1f88264ecc7$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_REGISTRATION_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_REGISTRATION_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_registration_capi.h"
#include "include/cef_registration.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefRegistrationCToCpp : public CefCToCppRefCounted<CefRegistrationCToCpp,
CefRegistration,
cef_registration_t> {
public:
CefRegistrationCToCpp();
virtual ~CefRegistrationCToCpp();
// CefRegistration methods.
};
#endif // CEF_LIBCEF_DLL_CTOCPP_REGISTRATION_CTOCPP_H_

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=dd21194253186ee403d7ffe5098e87b030eeb4c8$
// $hash=a29d8f9e49143e42a0ae0204c7d439c76b3c371c$
//
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
@ -21,6 +21,7 @@
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h"
#include "libcef_dll/ctocpp/extension_ctocpp.h"
#include "libcef_dll/ctocpp/media_router_ctocpp.h"
#include "libcef_dll/ctocpp/value_ctocpp.h"
#include "libcef_dll/transfer_util.h"
@ -525,6 +526,21 @@ CefRefPtr<CefExtension> CefRequestContextCToCpp::GetExtension(
return CefExtensionCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefMediaRouter> CefRequestContextCToCpp::GetMediaRouter() {
cef_request_context_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_media_router))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_media_router_t* _retval = _struct->get_media_router(_struct);
// Return type: refptr_same
return CefMediaRouterCToCpp::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand.
CefRequestContextCToCpp::CefRequestContextCToCpp() {}

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=d962f641e63a8dd86bdb44eb058c39d97db7f880$
// $hash=7841eec57c44171080b5d958ca03760cbe23f22b$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_CONTEXT_CTOCPP_H_
@ -75,6 +75,7 @@ class CefRequestContextCToCpp
bool HasExtension(const CefString& extension_id) OVERRIDE;
bool GetExtensions(std::vector<CefString>& extension_ids) OVERRIDE;
CefRefPtr<CefExtension> GetExtension(const CefString& extension_id) OVERRIDE;
CefRefPtr<CefMediaRouter> GetMediaRouter() OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_REQUEST_CONTEXT_CTOCPP_H_