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_MEDIA_PIPELINE_SERVER_INTERNAL_H_
21 : #define FIREBOLT_RIALTO_SERVER_I_MEDIA_PIPELINE_SERVER_INTERNAL_H_
22 :
23 : /**
24 : * @file IMediaPipelineServerInternal.h
25 : *
26 : * The definition of the IMediaPipelineServerInternal interface.
27 : *
28 : * This interface defines the server internal APIs for playback of AV content.
29 : */
30 :
31 : #include <stdint.h>
32 :
33 : #include <memory>
34 : #include <string>
35 : #include <vector>
36 :
37 : #include "IDecryptionService.h"
38 : #include "IHeartbeatHandler.h"
39 : #include "IMediaPipeline.h"
40 : #include "ISharedMemoryBuffer.h"
41 : #include <MediaCommon.h>
42 :
43 : namespace firebolt::rialto::server
44 : {
45 : class IMediaPipelineServerInternal;
46 :
47 : /**
48 : * @brief IMediaPipelineServerInternal factory class, returns a concrete implementation of IMediaPipelineServerInternal
49 : */
50 : class IMediaPipelineServerInternalFactory : public IMediaPipelineFactory
51 : {
52 : public:
53 129 : virtual ~IMediaPipelineServerInternalFactory() = default;
54 :
55 : /**
56 : * @brief Create a IMediaPipelineServerInternalFactory instance.
57 : *
58 : * @retval the factory instance or null on error.
59 : */
60 : static std::shared_ptr<IMediaPipelineServerInternalFactory> createFactory();
61 :
62 : /**
63 : * @brief IMediaPipelineServerInternal factory method, returns a concrete implementation of IMediaPipeline
64 : *
65 : * @param[in] client : The Rialto media player client.
66 : * @param[in] videoRequirements : The video decoder requirements for the MediaPipeline session
67 : * @param[in] sessionId : The session id for this MediaPipeline.
68 : * @param[in] shmBuffer : The shared buffer object.
69 : * @param[in] decryptionService : The decryption service object.
70 : *
71 : * @retval the new backend instance or null on error.
72 : */
73 : virtual std::unique_ptr<IMediaPipelineServerInternal> createMediaPipelineServerInternal(
74 : std::weak_ptr<IMediaPipelineClient> client, const VideoRequirements &videoRequirements, int sessionId,
75 : const std::shared_ptr<ISharedMemoryBuffer> &shmBuffer, IDecryptionService &decryptionService) const = 0;
76 : };
77 :
78 : /**
79 : * @brief The definition of the IMediaPipelineServerInternal interface.
80 : *
81 : * This interface defines the internal server APIs for playback of AV content which
82 : * should be implemented by Rialto Server only.
83 : */
84 : class IMediaPipelineServerInternal : public IMediaPipeline
85 : {
86 : public:
87 : /**
88 : * @brief Returns data requested using notifyNeedMediaData().
89 : *
90 : * This is a server only implementation. The data from the client has already been
91 : * writen to the shared memory.
92 : *
93 : * A successful notifyNeedMediaData() request will return at least one frame
94 : * of data but may return less than originally requested.
95 : *
96 : * @param[in] status : The status
97 : * @param[in] numFrames : The number of frames written.
98 : * @param[in] needDataRequestId : Need data request id
99 : */
100 : virtual bool haveData(MediaSourceStatus status, uint32_t numFrames, uint32_t needDataRequestId) = 0;
101 :
102 : /**
103 : * @brief Checks if MediaPipeline threads are not deadlocked
104 : *
105 : * @param[out] heartbeatHandler : The heartbeat handler instance
106 : */
107 : virtual void ping(std::unique_ptr<IHeartbeatHandler> &&heartbeatHandler) = 0;
108 : };
109 :
110 : }; // namespace firebolt::rialto::server
111 :
112 : #endif // FIREBOLT_RIALTO_SERVER_I_MEDIA_PIPELINE_SERVER_INTERNAL_H_
|