@@ -32,6 +32,7 @@ namespace Plugin {
32
32
private:
33
33
struct Session {
34
34
string ClientId;
35
+ string AppId;
35
36
Exchange::IContentProtection::KeySystem KeySystem;
36
37
};
37
38
@@ -226,8 +227,10 @@ namespace Plugin {
226
227
ShowWatermarkParams ()
227
228
{
228
229
Add (_T (" show" ), &Show);
230
+ Add (_T (" alpha" ), &Alpha);
229
231
}
230
232
Core::JSON::Boolean Show;
233
+ Core::JSON::DecUInt8 Alpha;
231
234
};
232
235
233
236
struct CreateWatermarkParams : public Core ::JSON::Container {
@@ -338,6 +341,7 @@ namespace Plugin {
338
341
}
339
342
340
343
uint32_t OpenDrmSession (const string& clientId,
344
+ const string& appId,
341
345
KeySystem keySystem, const string& licenseRequest,
342
346
const string& initData, uint32_t & sessionId, string& response)
343
347
override
@@ -360,7 +364,7 @@ namespace Plugin {
360
364
in.ToString (response);
361
365
362
366
_parent._sessionStorage .Set (sessionId,
363
- { clientId, keySystem });
367
+ { clientId, appId, keySystem });
364
368
}
365
369
}
366
370
return result;
@@ -445,11 +449,12 @@ namespace Plugin {
445
449
}
446
450
447
451
uint32_t ShowWatermark (uint32_t /* sessionId*/ ,
448
- bool show, bool /* localOverlay */ ) override
452
+ bool show, const uint8_t opacityLevel ) override
449
453
{
450
454
uint32_t result;
451
455
ShowWatermarkParams out;
452
456
out.Show = show;
457
+ out.Alpha = opacityLevel;
453
458
JsonObject in;
454
459
result = _parent._watermark ->Invoke <
455
460
ShowWatermarkParams, JsonObject>(
@@ -562,8 +567,14 @@ namespace Plugin {
562
567
ASSERT (_secManager->Subscribe <OnWatermarkSessionParams>(
563
568
Timeout, _T (" onWatermarkSession" ),
564
569
[&](const OnWatermarkSessionParams& params) {
570
+ auto session = _sessionStorage.Get (
571
+ params.SessionId );
572
+ if (!session.IsSet ()) {
573
+ return ; // No such session
574
+ }
565
575
WatermarkStatusChanged (
566
576
params.SessionId ,
577
+ session.Value ().AppId ,
567
578
{ ((params.ConditionContext == 1 )
568
579
? State::GRANTED
569
580
: ((params.ConditionContext == 2 )
@@ -713,8 +724,14 @@ namespace Plugin {
713
724
auto watermark = _watermarkStorage
714
725
.Get (params.Image );
715
726
if (watermark.IsSet ()) {
727
+ auto session = _sessionStorage.Get (
728
+ watermark.Value ().SessionId );
729
+ if (!session.IsSet ()) {
730
+ return ; // No such session
731
+ }
716
732
WatermarkStatusChanged (
717
733
watermark.Value ().SessionId ,
734
+ session.Value ().AppId ,
718
735
{ State::FAILED, 20001 });
719
736
}
720
737
})
@@ -731,14 +748,15 @@ namespace Plugin {
731
748
_watermark->Unsubscribe (Timeout, _T (" onWatermarkRenderFailed" ));
732
749
}
733
750
void WatermarkStatusChanged (uint32_t sessionId,
751
+ const string& appId,
734
752
const Exchange::IContentProtection::INotification::Status& status)
735
753
{
736
754
Exchange::JContentProtection::Event::WatermarkStatusChanged (
737
- *this , sessionId, status);
755
+ *this , sessionId, appId, status);
738
756
739
757
Core::SafeSyncType<Core::CriticalSection> lock (_clientLock);
740
758
for (auto & i : _clients) {
741
- i->WatermarkStatusChanged (sessionId, status);
759
+ i->WatermarkStatusChanged (sessionId, appId, status);
742
760
}
743
761
}
744
762
0 commit comments