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 <gst/gst.h>
25 :
26 : namespace firebolt::rialto::server::tasks::generic
27 : {
28 3 : ReportPosition::ReportPosition(GenericPlayerContext &context, IGstGenericPlayerClient *client,
29 3 : std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> gstWrapper)
30 3 : : m_context{context}, m_gstPlayerClient{client}, m_gstWrapper{gstWrapper}
31 : {
32 : }
33 :
34 2 : void ReportPosition::execute() const
35 : {
36 2 : gint64 position = -1;
37 2 : m_gstWrapper->gstElementQueryPosition(m_context.pipeline, GST_FORMAT_TIME, &position);
38 2 : if (position >= 0)
39 : {
40 1 : if (m_gstPlayerClient)
41 : {
42 1 : m_gstPlayerClient->notifyPosition(position);
43 : }
44 : }
45 2 : }
46 : } // namespace firebolt::rialto::server::tasks::generic
|