Expose MediaSink device ip/port and model name (see issue #2900)

This commit is contained in:
Marshall Greenblatt
2020-07-14 16:43:57 -04:00
parent 13e3c8b42a
commit e8573173dd
18 changed files with 578 additions and 35 deletions

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=a259fab661bc913498ae4f46f8dee1c1e592823d$
// $hash=4f4a0d76efaf87055ebf5e784f5d1b69fafdabc2$
//
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
@@ -50,6 +50,7 @@ extern "C" {
struct _cef_media_observer_t;
struct _cef_media_route_create_callback_t;
struct _cef_media_route_t;
struct _cef_media_sink_device_info_callback_t;
struct _cef_media_sink_t;
struct _cef_media_source_t;
@@ -265,6 +266,13 @@ typedef struct _cef_media_sink_t {
cef_media_sink_icon_type_t(CEF_CALLBACK* get_icon_type)(
struct _cef_media_sink_t* self);
///
// Asynchronously retrieves device info.
///
void(CEF_CALLBACK* get_device_info)(
struct _cef_media_sink_t* self,
struct _cef_media_sink_device_info_callback_t* callback);
///
// Returns true (1) if this sink accepts content via Cast.
///
@@ -282,6 +290,25 @@ typedef struct _cef_media_sink_t {
struct _cef_media_source_t* source);
} cef_media_sink_t;
///
// Callback structure for cef_media_sink_t::GetDeviceInfo. The functions of this
// structure will be called on the browser process UI thread.
///
typedef struct _cef_media_sink_device_info_callback_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Method that will be executed asyncronously once device information has been
// retrieved.
///
void(CEF_CALLBACK* on_media_sink_device_info)(
struct _cef_media_sink_device_info_callback_t* self,
const struct _cef_media_sink_device_info_t* device_info);
} cef_media_sink_device_info_callback_t;
///
// Represents a source from which media can be routed. Instances of this object
// are retrieved via cef_media_router_t::GetSource. The functions of this

View File

@@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "fb680f6c23c5fb612f22894422b058c8f8833703"
#define CEF_API_HASH_UNIVERSAL "20d95f0b54da45b2ced365aa92c784e348862bd3"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "b174bf9f140ac8cdfcc8db9185723d8236768496"
#define CEF_API_HASH_PLATFORM "fbe8ca0acbdc4b4050d5e44cbde930177be44edf"
#elif defined(OS_MACOSX)
#define CEF_API_HASH_PLATFORM "a93343f0e769bade840574e1547bd16546afcc9d"
#define CEF_API_HASH_PLATFORM "68ba2cd3b110e52ef2d6b07412155b845b105177"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "92fb849966e00682c42bcf22fa36a689a16c9d9f"
#define CEF_API_HASH_PLATFORM "40e1cf30d708463e32bf65f9d033f98f22a321e8"
#endif
#ifdef __cplusplus

View File

@@ -46,6 +46,7 @@ class CefMediaObserver;
class CefMediaRoute;
class CefMediaRouteCreateCallback;
class CefMediaSink;
class CefMediaSinkDeviceInfoCallback;
class CefMediaSource;
///
@@ -247,6 +248,13 @@ class CefMediaSink : public virtual CefBaseRefCounted {
/*--cef(default_retval=CEF_MSIT_GENERIC)--*/
virtual IconType GetIconType() = 0;
///
// Asynchronously retrieves device info.
///
/*--cef()--*/
virtual void GetDeviceInfo(
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) = 0;
///
// Returns true if this sink accepts content via Cast.
///
@@ -266,6 +274,22 @@ class CefMediaSink : public virtual CefBaseRefCounted {
virtual bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) = 0;
};
///
// Callback interface for CefMediaSink::GetDeviceInfo. The methods of this
// class will be called on the browser process UI thread.
///
/*--cef(source=client)--*/
class CefMediaSinkDeviceInfoCallback : public virtual CefBaseRefCounted {
public:
///
// Method that will be executed asyncronously once device information has been
// retrieved.
///
/*--cef()--*/
virtual void OnMediaSinkDeviceInfo(
const CefMediaSinkDeviceInfo& device_info) = 0;
};
///
// Represents a source from which media can be routed. Instances of this object
// are retrieved via CefMediaRouter::GetSource. The methods of this class may be

View File

@@ -3187,6 +3187,15 @@ typedef enum {
CEF_MSIT_TOTAL_COUNT, // The total number of values.
} cef_media_sink_icon_type_t;
///
// Device information for a MediaSink object.
///
typedef struct _cef_media_sink_device_info_t {
cef_string_t ip_address;
int port;
cef_string_t model_name;
} cef_media_sink_device_info_t;
///
// Represents commands available to TextField.
///

View File

@@ -980,4 +980,30 @@ struct CefAudioParametersTraits {
///
typedef CefStructBase<CefAudioParametersTraits> CefAudioParameters;
struct CefMediaSinkDeviceInfoTraits {
typedef cef_media_sink_device_info_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {
cef_string_clear(&s->ip_address);
cef_string_clear(&s->model_name);
}
static inline void set(const struct_type* src,
struct_type* target,
bool copy) {
cef_string_set(src->ip_address.str, src->ip_address.length,
&target->ip_address, copy);
target->port = src->port;
cef_string_set(src->model_name.str, src->model_name.length,
&target->model_name, copy);
}
};
///
// Class representing MediaSink device info.
///
typedef CefStructBase<CefMediaSinkDeviceInfoTraits> CefMediaSinkDeviceInfo;
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_