summaryrefslogtreecommitdiffstats
path: root/chromecast
diff options
context:
space:
mode:
authorsmcgruer <smcgruer@google.com>2015-12-17 08:05:36 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-17 16:07:07 +0000
commit7dfd8058cbfb0c70f40c11cc30b2346da9b5c906 (patch)
tree4ec18bb5a9b92ee0950cc7ac64624f4c16e08c39 /chromecast
parente77640ddf41053b6687984b19b161530c26d8755 (diff)
downloadchromium_src-7dfd8058cbfb0c70f40c11cc30b2346da9b5c906.zip
chromium_src-7dfd8058cbfb0c70f40c11cc30b2346da9b5c906.tar.gz
chromium_src-7dfd8058cbfb0c70f40c11cc30b2346da9b5c906.tar.bz2
[Chromecast] Add OutputRestriction information to AvSettings
This enables the device to report the output restrictions that it supports, as well as providing a hook to apply those output restrictions as required. The primary intent is to use this for PlayReady Output Protection Levels on platforms where it is not handled internally by the vendor firmware, but it could be extended in the future for other DRM systems or cases where output protection is needed. Change-Id: I3040fae71be5fd7fd4642689a00f8ae9755f02e1 BUG= Review URL: https://codereview.chromium.org/1500253002 Cr-Commit-Position: refs/heads/master@{#365831}
Diffstat (limited to 'chromecast')
-rw-r--r--chromecast/public/avsettings.h19
-rw-r--r--chromecast/public/output_restrictions.h97
2 files changed, 116 insertions, 0 deletions
diff --git a/chromecast/public/avsettings.h b/chromecast/public/avsettings.h
index c554a56..87c4a15 100644
--- a/chromecast/public/avsettings.h
+++ b/chromecast/public/avsettings.h
@@ -5,6 +5,7 @@
#ifndef CHROMECAST_PUBLIC_AVSETTINGS_H_
#define CHROMECAST_PUBLIC_AVSETTINGS_H_
+#include "output_restrictions.h"
#include "task_runner.h"
namespace chromecast {
@@ -64,6 +65,11 @@ class AvSettings {
// Initialize() was called.
SCREEN_INFO_CHANGED = 3,
+ // This event should be fired whenever the active output restrictions on the
+ // device outputs change. On this event, GetOutputRestrictions() will be
+ // called on the thread where Initialize() was called.
+ OUTPUT_RESTRICTIONS_CHANGED = 4,
+
// This event should be fired when the device is connected to HDMI sinks.
HDMI_CONNECTED = 100,
@@ -162,6 +168,19 @@ class AvSettings {
// Retrieves the resolution of screen of the device (or HDMI sinks).
// Returns true if it gets resolution successfully.
virtual bool GetScreenResolution(int* width, int* height) = 0;
+
+ // If supported, retrieves the restrictions active on the device outputs (as
+ // specified by the PlayReady CDM; see output_restrictions.h). If reporting
+ // output restrictions is unsupported, should return false.
+ virtual bool GetOutputRestrictions(
+ OutputRestrictions* output_restrictions) = 0;
+
+ // If supported, sets which output restrictions should be active on the device
+ // (as specified by the PlayReady CDM; see output_restrictions.h). The device
+ // should try to apply these restrictions and fire OUTPUT_RESTRICTIONS_CHANGED
+ // if they result in a change of active restrictions.
+ virtual void ApplyOutputRestrictions(
+ const OutputRestrictions& restrictions) = 0;
};
} // namespace chromecast
diff --git a/chromecast/public/output_restrictions.h b/chromecast/public/output_restrictions.h
new file mode 100644
index 0000000..d08b054
--- /dev/null
+++ b/chromecast/public/output_restrictions.h
@@ -0,0 +1,97 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMECAST_PUBLIC_OUTPUT_RESTRICTIONS_H_
+#define CHROMECAST_PUBLIC_OUTPUT_RESTRICTIONS_H_
+
+namespace chromecast {
+
+// The below values were adapted from the msdn article on Output Protection
+// Levels: https://msdn.microsoft.com/en-us/library/dn468832.aspx
+
+// Restrictions supported/applied to Uncompressed Digital Audio outputs, e.g.
+// HDMI, DisplayPort, MHL.
+class UncompressedDigitalAudio {
+ public:
+ enum Restrictions {
+ // HDCP protection.
+ kHdcp = 1,
+ // HDCP protection *or* SCMS Copy Never protection.
+ kHdcpOrScmsCopyNever = 1 << 1,
+ // Disable the output so that content is not sent to it.
+ kDisableOutput = 1 << 2,
+ };
+};
+
+// Restrictions supported/applied to Compressed Digital Audio outputs, e.g.
+// HDMI, DisplayPort, MHL.
+class CompressedDigitalAudio {
+ public:
+ enum Restrictions {
+ // HDCP protection *or* SCMS Copy Never protection.
+ kHdcpOrScmsCopyNever = 1,
+ // HDCP protection.
+ kHdcp = 1 << 1,
+ // Disable the output so that content is not sent to it.
+ kDisableOutput = 1 << 2,
+ };
+};
+
+// Restrictions supported/applied to Analog TV outputs, e.g. Component,
+// Composite, VGA.
+class AnalogVideo {
+ public:
+ enum Restrictions {
+ // Content is constrainted to 520,000 pixels of effective resolution.
+ kConstrainOutputToSd = 1,
+ // CGMS-A Copy Never protection.
+ kCgmsACopyNever = 1 << 1,
+ // Macrovision APC Automatic Gain Control and Color Stripe protection.
+ kAgcAndColorStripe = 1 << 2,
+ // Disable the output so that content is not sent to it.
+ kDisableOutput = 1 << 3,
+ };
+};
+
+// Restrictions supported/applied to Uncompressed Digital Video outputs, e.g.
+// HDMI, DVI, DisplayPort, MHL.
+class UncompressedDigitalVideo {
+ public:
+ enum Restrictions {
+ // HDCP protection.
+ kHdcp = 1,
+ // Disable the output so that content is not sent to it.
+ kDisableOutput = 1 << 2,
+ };
+};
+
+// Represents either a set of supported OutputRestrictions, or a set of
+// OutputRestrictions to be applied.
+struct OutputRestrictions {
+ OutputRestrictions()
+ : uncompressed_digital_audio_mask(0),
+ compressed_digital_audio_mask(0),
+ analog_video_mask(0),
+ uncompressed_digital_video_mask(0) {}
+
+ // A bitmask of UncompressedDigitalAudio restrictions, indicating either
+ // supported or required restrictions.
+ int uncompressed_digital_audio_mask;
+
+ // A bitmask of CompressedDigitalAudio restrictions, indicating either
+ // supported or required restrictions.
+ int compressed_digital_audio_mask;
+
+ // A bitmask of Analog TV restrictions, indicating either supported or
+ // required restrictions.
+ int analog_video_mask;
+
+ // A bitmask of UncompressedDigitalVideo restrictions, indicating either
+ // supported or required restrictions.
+ int uncompressed_digital_video_mask;
+};
+
+} // namespace chromecast
+
+#endif // CHROMECAST_PUBLIC_OUTPUT_RESTRICTIONS_H_