Music Hub ..
A session-wide music playback service
 
Loading...
Searching...
No Matches
backend.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Canonical Ltd
3 * Copyright © 2022 UBports Foundation.
4 *
5 * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
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 * Authored by: Jim Hodapp <jim.hodapp@canonical.com>
20 */
21
22#include "player.h"
23
24#include <gst/gst.h>
25
27
28media::AVBackend::Backend media::AVBackend::get_backend_type()
29{
30 GstRegistry *registry;
31 GstPlugin *plugin;
32
33 registry = gst_registry_get();
34 if (not registry)
35 return media::AVBackend::Backend::none;
36
37 plugin = gst_registry_lookup(registry, "libgsthybris.so");
38 if (plugin)
39 {
40 gint blacklisted = GST_OBJECT_FLAG_IS_SET(plugin, GST_PLUGIN_FLAG_BLACKLISTED);
41 gst_object_unref(plugin);
42 if (!blacklisted) {
43 return media::AVBackend::Backend::hybris;
44 }
45 }
46
47 plugin = gst_registry_lookup(registry, "libgstandroidmedia.so");
48 if (plugin)
49 {
50 gint blacklisted = GST_OBJECT_FLAG_IS_SET(plugin, GST_PLUGIN_FLAG_BLACKLISTED);
51 gst_object_unref(plugin);
52 if (!blacklisted) {
53 return media::AVBackend::Backend::hybris;
54 }
55 }
56
57 plugin = gst_registry_lookup(registry, "libgstmirsink.so");
58 if (plugin)
59 {
60 gint blacklisted = GST_OBJECT_FLAG_IS_SET(plugin, GST_PLUGIN_FLAG_BLACKLISTED);
61 gst_object_unref(plugin);
62 if (!blacklisted) {
63 return media::AVBackend::Backend::mir;
64 }
65 }
66
67 return media::AVBackend::Backend::none;
68}