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 : #include "tasks/generic/ReportPosition.h"
21 : #include "GenericPlayerContext.h"
22 : #include "IGstGenericPlayerClient.h"
23 : #include "IGstWrapper.h"
24 : #include "RialtoServerLogging.h"
25 : #include <gst/gst.h>
26 :
27 : namespace firebolt::rialto::server::tasks::generic
28 : {
29 3 : ReportPosition::ReportPosition(GenericPlayerContext &context, IGstGenericPlayerClient *client,
30 : const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
31 3 : IGstGenericPlayerPrivate &player)
32 3 : : m_context{context}, m_gstPlayerClient{client}, m_gstWrapper{gstWrapper}, m_player{player}
33 : {
34 : }
35 :
36 2 : void ReportPosition::execute() const
37 : {
38 2 : gint64 position = m_player.getPosition(m_context.pipeline);
39 2 : if (position == -1)
40 : {
41 1 : RIALTO_SERVER_LOG_WARN("Getting the position failed");
42 1 : return;
43 : }
44 :
45 1 : if (m_gstPlayerClient)
46 : {
47 1 : m_gstPlayerClient->notifyPosition(position);
48 : }
49 : }
50 : } // namespace firebolt::rialto::server::tasks::generic
|