cef/libcef_dll/ctocpp/media_source_ctocpp.cc
Marshall Greenblatt 03fd5b15da 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.
2020-03-27 15:54:39 -04:00

109 lines
3.0 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=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;