-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsinglesound.h
60 lines (50 loc) · 987 Bytes
/
singlesound.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* singlesound.h
*/
#ifndef SINGLESOUND_H
#define SINGLESOUND_H
#include "config.h"
#ifdef GSTREAMER
#include <gst/gst.h>
#include <stdbool.h>
#include <QObject>
#include <ctime>
using namespace std;
/**
* @brief A class of a single sound using gstreamer.
*/
class SingleSound : public QObject
{
Q_OBJECT
private:
GMainLoop *loop;
GstElement *pipeline;
GstBus *bus;
bool end;
time_t createdTime;
const char* songUri;
int timeout;
public:
/**
* @brief cache the sound that it would not cause a small pause.
*/
static void cacheSound(const char* uri);
/**
* @brief Constructor with the path of the sound file and the time of the sound.
*/
SingleSound(const char* uri, const int outTime);
/**
* @brief Start the sound.
*/
void start();
/**
* @brief Whether the sound is end.
*/
bool isEnd();
/**
* @brief Destructor.
*/
~SingleSound();
};
#endif
#endif