-
Notifications
You must be signed in to change notification settings - Fork 1
/
avobject.cpp
83 lines (68 loc) · 1.69 KB
/
avobject.cpp
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include "avobject.h"
#include "avexception.h"
AVObject::AVObject():
_input(0), _output(0), _sample_rate(0), _channels(0)
{
}
AVObject::~AVObject() {
if (_output) _output->disconnectInput(this);
if (_input) _input->disconnectOutput(this);
}
const char * AVObject::getRepr()
{
return getName();
}
void AVObject::connectInput(AVObject *object, bool recursive)
{
if (_input) {
throw AVException("connectInput: already connected");
}
_input = object;
if (recursive)
object->connectOutput(this, false);
}
void AVObject::connectOutput(AVObject *object, bool recursive)
{
if (_output)
throw AVException("connectOutput: already connected");
_output = object;
if (recursive)
object->connectInput(this, false);
}
void AVObject::disconnectInput(AVObject *object, bool recursive)
{
if (_input != object)
throw AVException("disconnectInput: programming error");
_input = 0;
if (recursive)
object->disconnectOutput(this, false);
}
void AVObject::disconnectOutput(AVObject *object, bool recursive)
{
if (_output != object)
throw AVException("disconnectOutput: programming error");
_output = 0;
if (recursive)
object->disconnectInput(this, false);
}
av_sample_rate_t AVObject::getSamplerate()
{
return _sample_rate;
}
void AVObject::setSamplerate(av_sample_rate_t sample_rate) {
_sample_rate = sample_rate;
if (_output) {
_output->setSamplerate(sample_rate);
}
}
av_channels_t AVObject::getChannels()
{
return _channels;
}
void AVObject::setChannels(av_channels_t channels)
{
_channels = channels;
if (_output) {
_output->setChannels(channels);
}
}