~ubuntu-branches/ubuntu/saucy/phonon-backend-gstreamer/saucy-proposed

« back to all changes in this revision

Viewing changes to gstreamer/plugininstaller.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2011-04-15 14:43:30 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110415144330-7uif3319lxdu4ltt
Tags: 4:4.7.0really4.5.0-0ubuntu2
* New upstream release
* Add kubuntu_02_install_codec.diff to fix codec install

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  This file is part of the KDE project.
 
2
 
 
3
    Copyright (C) 2011 Trever Fischer <tdfischer@fedoraproject.org>
 
4
 
 
5
    This library is free software: you can redistribute it and/or modify
 
6
    it under the terms of the GNU Lesser General Public License as published by
 
7
    the Free Software Foundation, either version 2.1 or 3 of the License.
 
8
 
 
9
    This library is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
    GNU Lesser General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU Lesser General Public License
 
15
    along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
16
*/
 
17
 
 
18
#ifndef Phonon_GSTREAMER_PLUGININSTALLER_H
 
19
#define Phonon_GSTREAMER_PLUGININSTALLER_H
 
20
 
 
21
#include <QtCore/QObject>
 
22
#include <QtCore/QHash>
 
23
#include <gst/gstcaps.h>
 
24
#include <gst/pbutils/install-plugins.h>
 
25
#include "phonon-config-gstreamer.h"
 
26
 
 
27
 
 
28
QT_BEGIN_NAMESPACE
 
29
 
 
30
namespace Phonon
 
31
{
 
32
namespace Gstreamer
 
33
{
 
34
 
 
35
/**
 
36
 * A class to help with installing missing gstreamer plugins
 
37
 */
 
38
 
 
39
class PluginInstaller : public QObject {
 
40
    Q_OBJECT
 
41
    public: 
 
42
        enum PluginType {
 
43
            Source,
 
44
            Sink,
 
45
            Decoder,
 
46
            Encoder,
 
47
            Element,
 
48
            Codec
 
49
        };
 
50
 
 
51
        enum InstallStatus {
 
52
            Idle,
 
53
            Installed,
 
54
            Installing,
 
55
            Missing
 
56
        };
 
57
 
 
58
        PluginInstaller(QObject *parent = 0);
 
59
 
 
60
        void addPlugin(const QString &name, PluginType type);
 
61
        void addPlugin(const GstCaps *caps, PluginType type);
 
62
 
 
63
        InstallStatus checkInstalledPlugins();
 
64
#ifdef PLUGIN_INSTALL_API
 
65
        static void pluginInstallationDone(GstInstallPluginsReturn result, gpointer data);
 
66
        void pluginInstallationResult(GstInstallPluginsReturn result);
 
67
        void run();
 
68
#endif
 
69
        void reset();
 
70
 
 
71
        /**
 
72
         * Returns the translated, user-friendly string that describes a plugin
 
73
         */
 
74
        static QString description(const gchar *name, PluginType type);
 
75
        static QString description(const GstCaps *caps, PluginType type);
 
76
 
 
77
        static QString getCapType(const GstCaps *caps);
 
78
 
 
79
        /**
 
80
         * Builds a string suitable for passing to gst_install_plugins_*
 
81
         */
 
82
        static QString buildInstallationString(const gchar *name, PluginType type);
 
83
        static QString buildInstallationString(const GstCaps *caps, PluginType type);
 
84
 
 
85
    Q_SIGNALS:
 
86
        void started();
 
87
        void success();
 
88
        void failure(const QString &message);
 
89
 
 
90
    private:
 
91
        QHash<QString, PluginType> m_pluginList;
 
92
        QHash<GstCaps *, PluginType> m_capList;
 
93
        static bool init();
 
94
        static bool s_ready;
 
95
};
 
96
 
 
97
} // ns Gstreamer
 
98
} // ns Phonon 
 
99
 
 
100
QT_END_NAMESPACE
 
101
 
 
102
#endif // Phonon_GSTREAMER_PLUGININSTALLER_H