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,161 @@
// 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=35f0e881b5a98c1da73789ecb72254fbe254a350$
//
#include "libcef_dll/cpptoc/media_observer_cpptoc.h"
#include "libcef_dll/ctocpp/media_route_ctocpp.h"
#include "libcef_dll/ctocpp/media_sink_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK
media_observer_on_sinks(struct _cef_media_observer_t* self,
size_t sinksCount,
struct _cef_media_sink_t* const* sinks) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: sinks; type: refptr_vec_diff_byref_const
DCHECK(sinksCount == 0 || sinks);
if (sinksCount > 0 && !sinks)
return;
// Translate param: sinks; type: refptr_vec_diff_byref_const
std::vector<CefRefPtr<CefMediaSink>> sinksList;
if (sinksCount > 0) {
for (size_t i = 0; i < sinksCount; ++i) {
CefRefPtr<CefMediaSink> sinksVal = CefMediaSinkCToCpp::Wrap(sinks[i]);
sinksList.push_back(sinksVal);
}
}
// Execute
CefMediaObserverCppToC::Get(self)->OnSinks(sinksList);
}
void CEF_CALLBACK
media_observer_on_routes(struct _cef_media_observer_t* self,
size_t routesCount,
struct _cef_media_route_t* const* routes) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: routes; type: refptr_vec_diff_byref_const
DCHECK(routesCount == 0 || routes);
if (routesCount > 0 && !routes)
return;
// Translate param: routes; type: refptr_vec_diff_byref_const
std::vector<CefRefPtr<CefMediaRoute>> routesList;
if (routesCount > 0) {
for (size_t i = 0; i < routesCount; ++i) {
CefRefPtr<CefMediaRoute> routesVal = CefMediaRouteCToCpp::Wrap(routes[i]);
routesList.push_back(routesVal);
}
}
// Execute
CefMediaObserverCppToC::Get(self)->OnRoutes(routesList);
}
void CEF_CALLBACK media_observer_on_route_state_changed(
struct _cef_media_observer_t* self,
struct _cef_media_route_t* route,
cef_media_route_connection_state_t state) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: route; type: refptr_diff
DCHECK(route);
if (!route)
return;
// Execute
CefMediaObserverCppToC::Get(self)->OnRouteStateChanged(
CefMediaRouteCToCpp::Wrap(route), state);
}
void CEF_CALLBACK
media_observer_on_route_message_received(struct _cef_media_observer_t* self,
struct _cef_media_route_t* route,
const void* message,
size_t message_size) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: route; type: refptr_diff
DCHECK(route);
if (!route)
return;
// Verify param: message; type: simple_byaddr
DCHECK(message);
if (!message)
return;
// Execute
CefMediaObserverCppToC::Get(self)->OnRouteMessageReceived(
CefMediaRouteCToCpp::Wrap(route), message, message_size);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefMediaObserverCppToC::CefMediaObserverCppToC() {
GetStruct()->on_sinks = media_observer_on_sinks;
GetStruct()->on_routes = media_observer_on_routes;
GetStruct()->on_route_state_changed = media_observer_on_route_state_changed;
GetStruct()->on_route_message_received =
media_observer_on_route_message_received;
}
// DESTRUCTOR - Do not edit by hand.
CefMediaObserverCppToC::~CefMediaObserverCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefMediaObserver> CefCppToCRefCounted<
CefMediaObserverCppToC,
CefMediaObserver,
cef_media_observer_t>::UnwrapDerived(CefWrapperType type,
cef_media_observer_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCppToCRefCounted<CefMediaObserverCppToC,
CefMediaObserver,
cef_media_observer_t>::kWrapperType =
WT_MEDIA_OBSERVER;

View File

@ -0,0 +1,38 @@
// 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=14ef1b6f920a375e585174e4057c66221f3e1c05$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_OBSERVER_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_OBSERVER_CPPTOC_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/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefMediaObserverCppToC
: public CefCppToCRefCounted<CefMediaObserverCppToC,
CefMediaObserver,
cef_media_observer_t> {
public:
CefMediaObserverCppToC();
virtual ~CefMediaObserverCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_OBSERVER_CPPTOC_H_

View File

@ -0,0 +1,139 @@
// 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=47181b936b29037dd4ff5169d7175ac538f5be56$
//
#include "libcef_dll/cpptoc/media_route_cpptoc.h"
#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_route_get_id(struct _cef_media_route_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefMediaRouteCppToC::Get(self)->GetId();
// Return type: string
return _retval.DetachToUserFree();
}
struct _cef_media_source_t* CEF_CALLBACK
media_route_get_source(struct _cef_media_route_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefMediaSource> _retval =
CefMediaRouteCppToC::Get(self)->GetSource();
// Return type: refptr_same
return CefMediaSourceCppToC::Wrap(_retval);
}
struct _cef_media_sink_t* CEF_CALLBACK
media_route_get_sink(struct _cef_media_route_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefMediaSink> _retval = CefMediaRouteCppToC::Get(self)->GetSink();
// Return type: refptr_same
return CefMediaSinkCppToC::Wrap(_retval);
}
void CEF_CALLBACK
media_route_send_route_message(struct _cef_media_route_t* self,
const void* message,
size_t message_size) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: message; type: simple_byaddr
DCHECK(message);
if (!message)
return;
// Execute
CefMediaRouteCppToC::Get(self)->SendRouteMessage(message, message_size);
}
void CEF_CALLBACK media_route_terminate(struct _cef_media_route_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefMediaRouteCppToC::Get(self)->Terminate();
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefMediaRouteCppToC::CefMediaRouteCppToC() {
GetStruct()->get_id = media_route_get_id;
GetStruct()->get_source = media_route_get_source;
GetStruct()->get_sink = media_route_get_sink;
GetStruct()->send_route_message = media_route_send_route_message;
GetStruct()->terminate = media_route_terminate;
}
// DESTRUCTOR - Do not edit by hand.
CefMediaRouteCppToC::~CefMediaRouteCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefMediaRoute>
CefCppToCRefCounted<CefMediaRouteCppToC, CefMediaRoute, cef_media_route_t>::
UnwrapDerived(CefWrapperType type, cef_media_route_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCppToCRefCounted<CefMediaRouteCppToC,
CefMediaRoute,
cef_media_route_t>::kWrapperType =
WT_MEDIA_ROUTE;

View File

@ -0,0 +1,37 @@
// 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=26fe0f9bd956318d0e6c7e0216024b5b839429c2$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CPPTOC_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/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefMediaRouteCppToC : public CefCppToCRefCounted<CefMediaRouteCppToC,
CefMediaRoute,
cef_media_route_t> {
public:
CefMediaRouteCppToC();
virtual ~CefMediaRouteCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CPPTOC_H_

View File

@ -0,0 +1,72 @@
// 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=a27462c4bcc0ef4856230997718f95edae5c1ef1$
//
#include "libcef_dll/cpptoc/media_route_create_callback_cpptoc.h"
#include "libcef_dll/ctocpp/media_route_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK media_route_create_callback_on_media_route_create_finished(
struct _cef_media_route_create_callback_t* self,
cef_media_route_create_result_t result,
const cef_string_t* error,
cef_media_route_t* route) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Unverified params: error, route
// Execute
CefMediaRouteCreateCallbackCppToC::Get(self)->OnMediaRouteCreateFinished(
result, CefString(error), CefMediaRouteCToCpp::Wrap(route));
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefMediaRouteCreateCallbackCppToC::CefMediaRouteCreateCallbackCppToC() {
GetStruct()->on_media_route_create_finished =
media_route_create_callback_on_media_route_create_finished;
}
// DESTRUCTOR - Do not edit by hand.
CefMediaRouteCreateCallbackCppToC::~CefMediaRouteCreateCallbackCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefMediaRouteCreateCallback>
CefCppToCRefCounted<CefMediaRouteCreateCallbackCppToC,
CefMediaRouteCreateCallback,
cef_media_route_create_callback_t>::
UnwrapDerived(CefWrapperType type, cef_media_route_create_callback_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType
CefCppToCRefCounted<CefMediaRouteCreateCallbackCppToC,
CefMediaRouteCreateCallback,
cef_media_route_create_callback_t>::kWrapperType =
WT_MEDIA_ROUTE_CREATE_CALLBACK;

View File

@ -0,0 +1,38 @@
// 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=8085b195054f43f67d4ee21d8b69b9e0ee8e2ac3$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CREATE_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CREATE_CALLBACK_CPPTOC_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/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefMediaRouteCreateCallbackCppToC
: public CefCppToCRefCounted<CefMediaRouteCreateCallbackCppToC,
CefMediaRouteCreateCallback,
cef_media_route_create_callback_t> {
public:
CefMediaRouteCreateCallbackCppToC();
virtual ~CefMediaRouteCreateCallbackCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTE_CREATE_CALLBACK_CPPTOC_H_

View File

@ -0,0 +1,177 @@
// 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=6b52fceffec99c0f274b5031266c20da5480d0c1$
//
#include "libcef_dll/cpptoc/media_router_cpptoc.h"
#include "libcef_dll/cpptoc/media_sink_cpptoc.h"
#include "libcef_dll/cpptoc/media_source_cpptoc.h"
#include "libcef_dll/cpptoc/registration_cpptoc.h"
#include "libcef_dll/ctocpp/media_observer_ctocpp.h"
#include "libcef_dll/ctocpp/media_route_create_callback_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_media_router_t* cef_media_router_get_global() {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefMediaRouter> _retval = CefMediaRouter::GetGlobalMediaRouter();
// Return type: refptr_same
return CefMediaRouterCppToC::Wrap(_retval);
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
struct _cef_registration_t* CEF_CALLBACK
media_router_add_observer(struct _cef_media_router_t* self,
struct _cef_media_observer_t* observer) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Verify param: observer; type: refptr_diff
DCHECK(observer);
if (!observer)
return NULL;
// Execute
CefRefPtr<CefRegistration> _retval =
CefMediaRouterCppToC::Get(self)->AddObserver(
CefMediaObserverCToCpp::Wrap(observer));
// Return type: refptr_same
return CefRegistrationCppToC::Wrap(_retval);
}
struct _cef_media_source_t* CEF_CALLBACK
media_router_get_source(struct _cef_media_router_t* self,
const cef_string_t* urn) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Verify param: urn; type: string_byref_const
DCHECK(urn);
if (!urn)
return NULL;
// Execute
CefRefPtr<CefMediaSource> _retval =
CefMediaRouterCppToC::Get(self)->GetSource(CefString(urn));
// Return type: refptr_same
return CefMediaSourceCppToC::Wrap(_retval);
}
void CEF_CALLBACK
media_router_notify_current_sinks(struct _cef_media_router_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefMediaRouterCppToC::Get(self)->NotifyCurrentSinks();
}
void CEF_CALLBACK
media_router_create_route(struct _cef_media_router_t* self,
struct _cef_media_source_t* source,
struct _cef_media_sink_t* sink,
struct _cef_media_route_create_callback_t* callback) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: source; type: refptr_same
DCHECK(source);
if (!source)
return;
// Verify param: sink; type: refptr_same
DCHECK(sink);
if (!sink)
return;
// Verify param: callback; type: refptr_diff
DCHECK(callback);
if (!callback)
return;
// Execute
CefMediaRouterCppToC::Get(self)->CreateRoute(
CefMediaSourceCppToC::Unwrap(source), CefMediaSinkCppToC::Unwrap(sink),
CefMediaRouteCreateCallbackCToCpp::Wrap(callback));
}
void CEF_CALLBACK
media_router_notify_current_routes(struct _cef_media_router_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefMediaRouterCppToC::Get(self)->NotifyCurrentRoutes();
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefMediaRouterCppToC::CefMediaRouterCppToC() {
GetStruct()->add_observer = media_router_add_observer;
GetStruct()->get_source = media_router_get_source;
GetStruct()->notify_current_sinks = media_router_notify_current_sinks;
GetStruct()->create_route = media_router_create_route;
GetStruct()->notify_current_routes = media_router_notify_current_routes;
}
// DESTRUCTOR - Do not edit by hand.
CefMediaRouterCppToC::~CefMediaRouterCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefMediaRouter>
CefCppToCRefCounted<CefMediaRouterCppToC, CefMediaRouter, cef_media_router_t>::
UnwrapDerived(CefWrapperType type, cef_media_router_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCppToCRefCounted<CefMediaRouterCppToC,
CefMediaRouter,
cef_media_router_t>::kWrapperType =
WT_MEDIA_ROUTER;

View File

@ -0,0 +1,37 @@
// 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=cea747c7202b95684b7208a312da818ddb094c0a$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTER_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTER_CPPTOC_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/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefMediaRouterCppToC : public CefCppToCRefCounted<CefMediaRouterCppToC,
CefMediaRouter,
cef_media_router_t> {
public:
CefMediaRouterCppToC();
virtual ~CefMediaRouterCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_ROUTER_CPPTOC_H_

View File

@ -0,0 +1,177 @@
// 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;

View File

@ -0,0 +1,37 @@
// 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=409478c735898bd4e13315183e185a80ae570b74$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_CPPTOC_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/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefMediaSinkCppToC : public CefCppToCRefCounted<CefMediaSinkCppToC,
CefMediaSink,
cef_media_sink_t> {
public:
CefMediaSinkCppToC();
virtual ~CefMediaSinkCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_CPPTOC_H_

View File

@ -0,0 +1,116 @@
// 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=ddd51b3c8020de1b10b00eef06d745a498168323$
//
#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_source_get_id(struct _cef_media_source_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefMediaSourceCppToC::Get(self)->GetId();
// Return type: string
return _retval.DetachToUserFree();
}
int CEF_CALLBACK media_source_is_valid(struct _cef_media_source_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefMediaSourceCppToC::Get(self)->IsValid();
// Return type: bool
return _retval;
}
int CEF_CALLBACK media_source_is_cast_source(struct _cef_media_source_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefMediaSourceCppToC::Get(self)->IsCastSource();
// Return type: bool
return _retval;
}
int CEF_CALLBACK media_source_is_dial_source(struct _cef_media_source_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefMediaSourceCppToC::Get(self)->IsDialSource();
// Return type: bool
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefMediaSourceCppToC::CefMediaSourceCppToC() {
GetStruct()->get_id = media_source_get_id;
GetStruct()->is_valid = media_source_is_valid;
GetStruct()->is_cast_source = media_source_is_cast_source;
GetStruct()->is_dial_source = media_source_is_dial_source;
}
// DESTRUCTOR - Do not edit by hand.
CefMediaSourceCppToC::~CefMediaSourceCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefMediaSource>
CefCppToCRefCounted<CefMediaSourceCppToC, CefMediaSource, cef_media_source_t>::
UnwrapDerived(CefWrapperType type, cef_media_source_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCppToCRefCounted<CefMediaSourceCppToC,
CefMediaSource,
cef_media_source_t>::kWrapperType =
WT_MEDIA_SOURCE;

View File

@ -0,0 +1,37 @@
// 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=aceafab724145242461fc9f5e7c76a365bb6d54c$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_SOURCE_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_SOURCE_CPPTOC_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/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefMediaSourceCppToC : public CefCppToCRefCounted<CefMediaSourceCppToC,
CefMediaSource,
cef_media_source_t> {
public:
CefMediaSourceCppToC();
virtual ~CefMediaSourceCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_SOURCE_CPPTOC_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=37c8c576c5bccd43f6124095e4ad55e88bc1a185$
//
#include "libcef_dll/cpptoc/registration_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
// CONSTRUCTOR - Do not edit by hand.
CefRegistrationCppToC::CefRegistrationCppToC() {}
// DESTRUCTOR - Do not edit by hand.
CefRegistrationCppToC::~CefRegistrationCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefRegistration>
CefCppToCRefCounted<CefRegistrationCppToC,
CefRegistration,
cef_registration_t>::UnwrapDerived(CefWrapperType type,
cef_registration_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCppToCRefCounted<CefRegistrationCppToC,
CefRegistration,
cef_registration_t>::kWrapperType =
WT_REGISTRATION;

View File

@ -0,0 +1,37 @@
// 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=e27d69c1509e74c7f5d69f5829c27fa65e47fc2d$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_REGISTRATION_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_REGISTRATION_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/cef_registration_capi.h"
#include "include/cef_registration.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefRegistrationCppToC : public CefCppToCRefCounted<CefRegistrationCppToC,
CefRegistration,
cef_registration_t> {
public:
CefRegistrationCppToC();
virtual ~CefRegistrationCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_REGISTRATION_CPPTOC_H_

View File

@ -9,13 +9,14 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=4af6d074b7de62b759a9555a0b0246e57c290328$
// $hash=5168000f75f7911dce0bffcf47341e4ee1c2a275$
//
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h"
#include "libcef_dll/cpptoc/extension_cpptoc.h"
#include "libcef_dll/cpptoc/media_router_cpptoc.h"
#include "libcef_dll/cpptoc/value_cpptoc.h"
#include "libcef_dll/ctocpp/completion_callback_ctocpp.h"
#include "libcef_dll/ctocpp/extension_handler_ctocpp.h"
@ -540,6 +541,22 @@ request_context_get_extension(struct _cef_request_context_t* self,
return CefExtensionCppToC::Wrap(_retval);
}
cef_media_router_t* CEF_CALLBACK
request_context_get_media_router(struct _cef_request_context_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefMediaRouter> _retval =
CefRequestContextCppToC::Get(self)->GetMediaRouter();
// Return type: refptr_same
return CefMediaRouterCppToC::Wrap(_retval);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
@ -573,6 +590,7 @@ CefRequestContextCppToC::CefRequestContextCppToC() {
GetStruct()->has_extension = request_context_has_extension;
GetStruct()->get_extensions = request_context_get_extensions;
GetStruct()->get_extension = request_context_get_extension;
GetStruct()->get_media_router = request_context_get_media_router;
}
// DESTRUCTOR - Do not edit by hand.