Line data Source code
1 : /*
2 : * If not stated otherwise in this file or this component's LICENSE file the
3 : * following copyright and licenses apply:
4 : *
5 : * Copyright 2024 Sky UK
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : */
19 :
20 : #ifndef FIREBOLT_RIALTO_SERVER_I_TEXT_TRACK_ACCESSOR_H_
21 : #define FIREBOLT_RIALTO_SERVER_I_TEXT_TRACK_ACCESSOR_H_
22 :
23 : #include <cstdint>
24 : #include <memory>
25 : #include <optional>
26 : #include <string>
27 :
28 : namespace firebolt::rialto::server
29 : {
30 : class ITextTrackAccessor;
31 :
32 : class ITextTrackAccessorFactory
33 : {
34 : public:
35 10 : virtual ~ITextTrackAccessorFactory() = default;
36 :
37 : static ITextTrackAccessorFactory &getFactory();
38 : virtual std::shared_ptr<ITextTrackAccessor> getTextTrackAccessor() const = 0;
39 : };
40 :
41 : class ITextTrackAccessor
42 : {
43 : public:
44 : enum class DataType
45 : {
46 : UNKNOWN,
47 : WebVTT,
48 : TTML,
49 : CC
50 : };
51 :
52 39 : ITextTrackAccessor() = default;
53 39 : virtual ~ITextTrackAccessor() = default;
54 : virtual std::optional<uint32_t> openSession(const std::string &displayName) = 0;
55 : virtual bool closeSession(uint32_t sessionId) = 0;
56 : virtual bool resetSession(uint32_t sessionId) = 0;
57 : virtual bool pause(uint32_t sessionId) = 0;
58 : virtual bool play(uint32_t sessionId) = 0;
59 : virtual bool mute(uint32_t sessionId, bool mute) = 0;
60 : virtual bool setPosition(uint32_t sessionId, uint64_t mediaTimestampMs) = 0;
61 : virtual bool sendData(uint32_t sessionId, const std::string &data, DataType datatype, int32_t displayOffsetMs = 0) = 0;
62 : virtual bool setSessionWebVTTSelection(uint32_t sessionId) = 0;
63 : virtual bool setSessionTTMLSelection(uint32_t sessionId) = 0;
64 : virtual bool setSessionCCSelection(uint32_t sessionId, const std::string &service) = 0;
65 : };
66 :
67 : } // namespace firebolt::rialto::server
68 :
69 : #endif // FIREBOLT_RIALTO_SERVER_I_TEXT_TRACK_ACCESSOR_H_
|