Skip to content

Commit 9781295

Browse files
RDKEMW-4358: Add ITextTrack interfaces for TTML overrides (#200)
The ITextTrackTtmlStyle interface provides the interface for setting/getting the persistent global TTML style overrides setting. The per-session setting is supported by the added function ApplyCustomTtmlStyleOverridesToSession on ITextTrack. As a client, use the version define ITEXTTRACK_VERSION to determine whether the function is supported. It's supported from version 2.
1 parent 085f036 commit 9781295

File tree

2 files changed

+66
-3
lines changed

2 files changed

+66
-3
lines changed

apis/Ids.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ namespace Exchange {
176176
ID_TEXT_TRACK = ID_ENTOS_OFFSET + 0x190,
177177
ID_TEXT_TRACK_CLOSED_CAPTIONS_STYLE = ID_TEXT_TRACK + 1,
178178
ID_TEXT_TRACK_CLOSED_CAPTIONS_STYLE_NOTIFICATION = ID_TEXT_TRACK + 2,
179+
ID_TEXT_TRACK_TTML_STYLE = ID_TEXT_TRACK + 3,
180+
ID_TEXT_TRACK_TTML_STYLE_NOTIFICATION = ID_TEXT_TRACK + 4,
179181

180182
ID_USB_DEVICE = ID_ENTOS_OFFSET + 0x1A0,
181183
ID_USB_PRODUCT_INFO_ITERATOR = ID_USB_DEVICE + 1,

apis/TextTrack/ITextTrack.h

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* If not stated otherwise in this file or this component's LICENSE file the
33
* following copyright and licenses apply:
44
*
5-
* Copyright 2024 RDK Management.
5+
* Copyright 2024-2025 RDK Management.
66
*
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
2121

2222
#include "Module.h"
2323

24-
#define ITEXTTRACK_VERSION 1
24+
#define ITEXTTRACK_VERSION 2
2525

2626
namespace WPEFramework {
2727
namespace Exchange {
@@ -306,11 +306,59 @@ struct EXTERNAL ITextTrackClosedCaptionsStyle : virtual public Core::IUnknown {
306306
/* @} */
307307
};
308308

309+
/*
310+
* This is the COM-RPC interface for global TTML style overrides.
311+
*/
312+
/* @json 1.0.0 @text:keep */
313+
struct EXTERNAL ITextTrackTtmlStyle : virtual public Core::IUnknown {
314+
enum {
315+
ID = ID_TEXT_TRACK_TTML_STYLE
316+
};
317+
318+
/* @event */
319+
struct EXTERNAL INotification : virtual public Core::IUnknown {
320+
enum {
321+
ID = ID_TEXT_TRACK_TTML_STYLE_NOTIFICATION
322+
};
323+
324+
/**
325+
* @brief The TTML Style override settings has changed.
326+
* @text onTtmlStyleOverridesChanged
327+
*/
328+
virtual void OnTtmlStyleOverridesChanged(const string &style) {};
329+
};
330+
331+
/** Register notification interface.
332+
* The callback will be called with the current settings.
333+
*/
334+
virtual Core::hresult Register(INotification *notification) = 0;
335+
/** Unregister notification interface */
336+
virtual Core::hresult Unregister(const INotification *notification) = 0;
337+
338+
/**
339+
* @brief Sets global TTML override style.
340+
* @details The styles given here (as "attr:value;attr:value") will be applied last to TTML sessions, meaning
341+
* that they will override styles given in the content.
342+
* The value will be persisted in the system.
343+
* The style setting will take effect immediately in all running (TTML) sessions, which has not applied a custom style.
344+
* @param style Contains the chosen override for styles
345+
* @text setTtmlStyleOverrides
346+
*/
347+
virtual Core::hresult SetTtmlStyleOverrides(const string& style) = 0;
348+
349+
/**
350+
* @briet Gets the global TTML style overrides
351+
* @param style will receive the style overrides
352+
* @text getTtmlStyleOverrides
353+
*/
354+
virtual Core::hresult GetTtmlStyleOverrides(string& style /* @out */) const = 0;
355+
356+
};
309357

310358
/*
311359
This is the COM-RPC interface for handling TextTrack sessions.
312360
*/
313-
/* @json 1.0.0 @text:keep */
361+
/* @json 1.1.0 @text:keep */
314362
struct EXTERNAL ITextTrack : virtual public Core::IUnknown {
315363
enum {
316364
ID = ID_TEXT_TRACK
@@ -462,6 +510,19 @@ struct EXTERNAL ITextTrack : virtual public Core::IUnknown {
462510
* @text setSessionSCTESelection
463511
*/
464512
virtual Core::hresult SetSessionSCTESelection(const uint32_t sessionId) = 0;
513+
514+
/**
515+
* @brief Applies a custom TTML styling with overrides that is applied on all elements
516+
* @details When a custom styling override is applied on a specific TTML session, the styling carried on the data for the specified element is
517+
* overridden. For styling options, see https://www.w3.org/TR/2018/REC-ttml1-20181108/#styling-vocabulary-style
518+
* The format of the styling string is "attr:value;attr:value;attr:value" (see vocabulary; NB: not all styling is supported)
519+
* Styles not mentioned in the list will not be affected.
520+
* @param sessionId Is the session as returned in the ITextTrack interface.
521+
* @param style Contains the list of styles to be overridden
522+
* @text applyCustomTtmlStyleOverridesToSession
523+
*/
524+
virtual Core::hresult ApplyCustomTtmlStyleOverridesToSession(const uint32_t sessionId, const string &style) { return Core::ERROR_NOT_SUPPORTED; }
525+
465526
};
466527
} // namespace Exchange
467528
} // namespace WPEFramework

0 commit comments

Comments
 (0)