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 2022 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_GST_CAPABILITIES_H_
21 : #define FIREBOLT_RIALTO_SERVER_I_GST_CAPABILITIES_H_
22 :
23 : #include <AudioDecoderCapabilities.h>
24 : #include <MediaCommon.h>
25 : #include <VideoDecoderCapabilities.h>
26 : #include <memory>
27 : #include <optional>
28 : #include <string>
29 : #include <vector>
30 :
31 : namespace firebolt::rialto::server
32 : {
33 : class IGstCapabilities;
34 :
35 : /**
36 : * @brief IGstCapabilities factory class, returns a concrete implementation of IGstCapabilities
37 : */
38 : class IGstCapabilitiesFactory
39 : {
40 : public:
41 8 : IGstCapabilitiesFactory() = default;
42 8 : virtual ~IGstCapabilitiesFactory() = default;
43 :
44 : /**
45 : * @brief Gets the IGstCapabilitiesFactory instance.
46 : *
47 : * @retval the factory instance or null on error.
48 : */
49 : static std::shared_ptr<IGstCapabilitiesFactory> getFactory();
50 :
51 : /**
52 : * @brief Creates a IGstCapabilities object.
53 : *
54 : *
55 : * @retval the new gstreamer capabilities instance or null on error.
56 : */
57 : virtual std::unique_ptr<IGstCapabilities> createGstCapabilities() = 0;
58 : };
59 :
60 : class IGstCapabilities
61 : {
62 : public:
63 46 : IGstCapabilities() = default;
64 46 : virtual ~IGstCapabilities() = default;
65 :
66 : IGstCapabilities(const IGstCapabilities &) = delete;
67 : IGstCapabilities &operator=(const IGstCapabilities &) = delete;
68 : IGstCapabilities(IGstCapabilities &&) = delete;
69 : IGstCapabilities &operator=(IGstCapabilities &&) = delete;
70 :
71 : /**
72 : * @brief Gets vector of mime types supported by gstreamer
73 : *
74 : * @retval vector of mime types supported by gstreamer
75 : */
76 : virtual std::vector<std::string> getSupportedMimeTypes(MediaSourceType sourceType) = 0;
77 :
78 : /**
79 : * @brief Checks is \a mimeType is supported by gstreamer
80 : *
81 : * @retval True if mime type is supported by gstreamer
82 : */
83 : virtual bool isMimeTypeSupported(const std::string &mimeType) = 0;
84 :
85 : /**
86 : * @brief Check sinks and decoders for supported properties
87 : *
88 : * @param[in] mediaType : The media type to search. If set to UNKNOWN then both AUDIO and VIDEO are searched
89 : * @param[in] propertyNames : A vector of property names to look for
90 : *
91 : * @retval Returns the subset of propertyNames that are supported by the mediaType
92 : */
93 : virtual std::vector<std::string> getSupportedProperties(MediaSourceType mediaType,
94 : const std::vector<std::string> &propertyNames) = 0;
95 :
96 : /**
97 : * @brief Checks if the platform is video master.
98 : *
99 : * @param[out] isVideoMaster : The output value. True if video is master otherwise false.
100 : *
101 : * @retval true on success false otherwise
102 : */
103 : virtual bool isVideoMaster(bool &isVideoMaster) = 0;
104 :
105 : /**
106 : * @brief Gets the supported audio capabilities from GStreamer.
107 : *
108 : * Queries GStreamer for discovered MIME types and returns populated audio decoder capabilities
109 : * discovered during GStreamer initialization. If GStreamer fails to discover any capabilities,
110 : * returns empty capabilities.
111 : * Full capabilities should be obtained via MediaCapabilities which orchestrates
112 : * between YAML (Path A) and GStreamer (Path B) sources.
113 : *
114 : * @retval The supported audio capabilities (populated from GStreamer discovery, empty if unavailable).
115 : */
116 : virtual firebolt::rialto::common::AudioDecoderCapabilities getSupportedAudioCapabilities() = 0;
117 :
118 : /**
119 : * @brief Gets the supported video capabilities from GStreamer.
120 : *
121 : * Queries GStreamer for discovered MIME types and returns populated video decoder capabilities
122 : * discovered during GStreamer initialization. If GStreamer fails to discover any capabilities,
123 : * returns empty capabilities.
124 : * Full capabilities should be obtained via MediaCapabilities which orchestrates
125 : * between YAML (Path A) and GStreamer (Path B) sources.
126 : *
127 : * @retval The supported video capabilities (populated from GStreamer discovery, empty if unavailable).
128 : */
129 : virtual firebolt::rialto::common::VideoDecoderCapabilities getSupportedVideoCapabilities() = 0;
130 : };
131 :
132 : }; // namespace firebolt::rialto::server
133 :
134 : #endif // FIREBOLT_RIALTO_SERVER_I_GST_CAPABILITIES_H_
|