Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Components
Converter
ConverterFactory.h
1
/* ConverterFactory.h */
2
/*
3
* Copyright (C) 2011-2024 Michael Lugmair
4
*
5
* This file is part of sayonara player
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
#ifndef SAYONARA_PLAYER_CONVERTERFACTORY_H
21
#define SAYONARA_PLAYER_CONVERTERFACTORY_H
22
23
#include "Utils/Pimpl.h"
24
25
namespace
Playlist
26
{
27
class
Accessor
;
28
}
29
class
Converter
;
30
class
ConverterFactory
31
{
32
PIMPL(ConverterFactory)
33
34
public
:
35
enum class
ConvertType :
36
uint8_t
37
{
38
OggVorbis = 0,
39
OggOpus,
40
Lame
41
};
42
43
enum class
Bitrate :
44
uint8_t
45
{
46
Constant = 0,
47
Variable
48
};
49
50
explicit
ConverterFactory(
Playlist::Accessor
* playlistAccessor);
51
~ConverterFactory();
52
53
template
<ConvertType t,
typename
...Args>
54
typename
std::enable_if<t == ConvertType::OggVorbis, Converter*>::type
55
createConverter(Args&& ...args)
56
{
57
return
finalizeConverter(createOggConverter(args...));
58
}
59
60
template
<ConvertType t,
typename
...Args>
61
typename
std::enable_if<t == ConvertType::Lame || t == ConvertType::OggOpus, Converter*>::type
62
createConverter(Args&& ...args)
63
{
64
if
(t == ConvertType::Lame)
65
{
66
return
finalizeConverter(createLameConverter(args...));
67
}
68
69
else
if
(t == ConvertType::OggOpus)
70
{
71
return
finalizeConverter(createOpusConverter(args...));
72
}
73
74
else
75
{
76
return
nullptr
;
77
}
78
}
79
80
private
:
81
Converter
* createOggConverter(
int
quality);
82
Converter
* createLameConverter(Bitrate cbr,
int
quality);
83
Converter
* createOpusConverter(Bitrate cbr,
int
quality);
84
85
Converter
* finalizeConverter(
Converter
* converter);
86
};
87
88
#endif
//SAYONARA_PLAYER_CONVERTERFACTORY_H
Converter
Definition
Converter.h:33
Playlist::Accessor
Definition
PlaylistInterface.h:43
Generated on
for Sayonara Player by
1.17.0