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_GST_PROFILER_H_
21 : #define FIREBOLT_RIALTO_SERVER_I_GST_PROFILER_H_
22 :
23 : #include "IGlibWrapper.h"
24 : #include "IGstWrapper.h"
25 : #include "IProfiler.h"
26 :
27 : #include <gst/gst.h>
28 :
29 : #include <cstdint>
30 : #include <memory>
31 : #include <optional>
32 : #include <string>
33 : #include <vector>
34 :
35 : namespace firebolt::rialto::server
36 : {
37 : class IGstProfiler;
38 :
39 : class IGstProfilerFactory
40 : {
41 : public:
42 : using IGstWrapper = firebolt::rialto::wrappers::IGstWrapper;
43 : using IGlibWrapper = firebolt::rialto::wrappers::IGlibWrapper;
44 :
45 221 : IGstProfilerFactory() = default;
46 221 : virtual ~IGstProfilerFactory() = default;
47 :
48 : static std::shared_ptr<IGstProfilerFactory> getFactory();
49 :
50 : virtual std::unique_ptr<IGstProfiler> createGstProfiler(GstElement *pipeline,
51 : const std::shared_ptr<IGstWrapper> &gstWrapper,
52 : const std::shared_ptr<IGlibWrapper> &glibWrapper) const = 0;
53 : };
54 :
55 : class IGstProfiler
56 : {
57 : public:
58 : using RecordId = std::uint64_t;
59 : using Record = firebolt::rialto::common::IProfiler::Record;
60 :
61 469 : virtual ~IGstProfiler() = default;
62 :
63 : virtual std::optional<RecordId> createRecord(const std::string &stage) = 0;
64 : virtual std::optional<RecordId> createRecord(const std::string &stage, const std::string &info) = 0;
65 :
66 : virtual void scheduleGstElementRecord(GstElement *element) = 0;
67 : virtual std::vector<Record> getRecords() const = 0;
68 :
69 : virtual void logRecord(RecordId id) = 0;
70 : virtual void dumpToFile() const = 0;
71 : virtual void logPipelineSummary() const = 0;
72 : };
73 : } // namespace firebolt::rialto::server
74 :
75 : #endif // FIREBOLT_RIALTO_SERVER_I_GST_PROFILER_H_
|