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 2023 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/UpdatePlaybackGroup.h"
21 : #include "RialtoServerLogging.h"
22 :
23 : namespace firebolt::rialto::server::tasks::generic
24 : {
25 8 : UpdatePlaybackGroup::UpdatePlaybackGroup(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
26 : std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> gstWrapper,
27 : std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> glibWrapper,
28 8 : GstElement *typefind, const GstCaps *caps)
29 8 : : m_context{context}, m_player{player}, m_gstWrapper{gstWrapper}, m_glibWrapper{glibWrapper},
30 8 : m_typefind{typefind}, m_caps{caps}
31 : {
32 8 : RIALTO_SERVER_LOG_DEBUG("Constructing UpdatePlaybackGroup");
33 : }
34 :
35 9 : UpdatePlaybackGroup::~UpdatePlaybackGroup()
36 : {
37 8 : RIALTO_SERVER_LOG_DEBUG("UpdatePlaybackGroup finished");
38 9 : }
39 :
40 7 : void UpdatePlaybackGroup::execute() const
41 : {
42 7 : RIALTO_SERVER_LOG_DEBUG("Executing UpdatePlaybackGroup");
43 7 : if (nullptr == m_caps)
44 : {
45 1 : RIALTO_SERVER_LOG_DEBUG("Typefind SRC Pad Caps NULL");
46 1 : return;
47 : }
48 6 : gchar *typefindCaps = m_gstWrapper->gstCapsToString(m_caps);
49 6 : if (typefindCaps)
50 : {
51 5 : RIALTO_SERVER_LOG_DEBUG("Typefind SRC Pad Strm Parsed Caps %s", typefindCaps);
52 5 : if (m_glibWrapper->gStrrstr(typefindCaps, "audio/"))
53 : {
54 4 : GstElement *typeFindParent = reinterpret_cast<GstElement *>(m_gstWrapper->gstElementGetParent(m_typefind));
55 4 : if (typeFindParent)
56 : {
57 3 : gchar *elementName = m_gstWrapper->gstElementGetName(typeFindParent);
58 3 : RIALTO_SERVER_LOG_DEBUG("elementName %s", elementName);
59 3 : if (elementName && m_glibWrapper->gStrrstr(elementName, "decodebin"))
60 : {
61 2 : RIALTO_SERVER_LOG_DEBUG("m_context.playbackGroup.curAudioDecodeBin %s", elementName);
62 2 : m_context.playbackGroup.m_curAudioDecodeBin = typeFindParent;
63 2 : gchar *typefindName = m_gstWrapper->gstElementGetName(m_typefind);
64 2 : RIALTO_SERVER_LOG_DEBUG("onTypeFound(): m_context.playbackGroup.curAudioTypefind %s", typefindName);
65 2 : m_glibWrapper->gFree(typefindName);
66 2 : m_context.playbackGroup.m_curAudioTypefind = m_typefind;
67 2 : if (m_context.pendingUseBuffering.has_value())
68 : {
69 1 : m_player.setUseBuffering();
70 : }
71 : }
72 3 : m_glibWrapper->gFree(elementName);
73 3 : m_gstWrapper->gstObjectUnref(typeFindParent);
74 : }
75 : }
76 5 : m_glibWrapper->gFree(typefindCaps);
77 : }
78 : }
79 : } // namespace firebolt::rialto::server::tasks::generic
|