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 2026 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_MEDIA_CAPABILITIES_SERVER_INTERNAL_H_
21 : #define FIREBOLT_RIALTO_SERVER_I_MEDIA_CAPABILITIES_SERVER_INTERNAL_H_
22 :
23 : #include "IMediaCapabilities.h"
24 : #include <memory>
25 : #include <optional>
26 :
27 : namespace firebolt::rialto::server
28 : {
29 : /**
30 : * @brief The definition of the IMediaCapabilitiesServerInternal interface.
31 : *
32 : * Extends IMediaCapabilities with the ability to accept preloaded (YAML) capabilities
33 : * supplied by ServerManager at startup. This interface should be implemented by Rialto Server only.
34 : *
35 : * Following the pattern: IMediaPipeline vs IMediaPipelineServerInternal
36 : */
37 : class IMediaCapabilitiesServerInternal : public firebolt::rialto::IMediaCapabilities
38 : {
39 : public:
40 18 : IMediaCapabilitiesServerInternal() = default;
41 18 : virtual ~IMediaCapabilitiesServerInternal() = default;
42 :
43 : /**
44 : * @brief Sets preloaded capabilities from ServerManager
45 : *
46 : * Called when ServerManager provides preloaded YAML capabilities.
47 : * These take priority over GStreamer discovery when present.
48 : *
49 : * @param[in] audioCapabilities Optional preloaded audio capabilities
50 : * @param[in] videoCapabilities Optional preloaded video capabilities
51 : */
52 : virtual void setPreloadedCapabilities(
53 : const std::optional<firebolt::rialto::common::AudioDecoderCapabilities> &audioCapabilities,
54 : const std::optional<firebolt::rialto::common::VideoDecoderCapabilities> &videoCapabilities) = 0;
55 : };
56 :
57 : /**
58 : * @brief Server-internal factory for MediaCapabilities
59 : *
60 : * This interface provides server-specific factory methods for creating MediaCapabilities.
61 : * It is separate from the public IMediaCapabilitiesFactory to maintain clean separation:
62 : *
63 : * - IMediaCapabilitiesFactory (public): Used by clients, has no preloaded parameters
64 : * - IMediaCapabilitiesServerInternalFactory (server): ONLY used by RialtoServer,
65 : * provides method to create factories with preloaded capabilities
66 : *
67 : * Following the pattern: IMediaPipeline vs IMediaPipelineServerInternal
68 : */
69 : class IMediaCapabilitiesServerInternalFactory
70 : {
71 : public:
72 0 : IMediaCapabilitiesServerInternalFactory() = default;
73 0 : virtual ~IMediaCapabilitiesServerInternalFactory() = default;
74 :
75 : /**
76 : * @brief Gets the IMediaCapabilitiesServerInternalFactory instance.
77 : *
78 : * @retval the factory instance or null on error.
79 : */
80 : static std::shared_ptr<IMediaCapabilitiesServerInternalFactory> createFactory();
81 :
82 : /**
83 : * @brief Creates an IMediaCapabilitiesServerInternal instance.
84 : *
85 : * This method is SERVER-INTERNAL ONLY. It creates the orchestrator that handles
86 : * preloaded capabilities and GStreamer fallback.
87 : *
88 : * @retval the orchestrator instance or null on error.
89 : */
90 : virtual std::shared_ptr<IMediaCapabilitiesServerInternal> createMediaCapabilitiesServerInternal() const = 0;
91 : };
92 :
93 : } // namespace firebolt::rialto::server
94 :
95 : #endif // FIREBOLT_RIALTO_SERVER_I_MEDIA_CAPABILITIES_SERVER_INTERNAL_H_
|