MythTV master
audioconvert.h
Go to the documentation of this file.
1
2/*
3 * Class AudioConvert
4 * Created by Jean-Yves Avenard on 10/06/13.
5 *
6 * Copyright (C) Bubblestuff Pty Ltd 2013
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23
24#ifndef MythXCode_audioconvert
25#define MythXCode_audioconvert
26
27#include "libmyth/mythexp.h"
29
31
33{
34public:
35
37 : m_in(in), m_out(out) {}
38 virtual ~AudioConvert();
48 int Process(void* out, const void* in, int bytes, bool noclip = false);
49 AudioFormat Out(void) { return m_out; }
50 AudioFormat In(void) { return m_in; }
51
52 bool operator==(const AudioConvert& rhs) const
53 { return m_in == rhs.m_in && m_out == rhs.m_out; }
54 bool operator!=(const AudioConvert& rhs) const
55 { return m_in != rhs.m_in || m_out != rhs.m_out; }
56
57 void DeinterleaveSamples(int channels,
58 uint8_t* output, const uint8_t* input,
59 int data_size);
60 void InterleaveSamples(int channels,
61 uint8_t* output, const uint8_t* const* input,
62 int data_size);
63 void InterleaveSamples(int channels,
64 uint8_t* output, const uint8_t* input,
65 int data_size);
66
67 // static utilities
68 static int toFloat(AudioFormat format, void* out, const void* in, int bytes);
69 static int fromFloat(AudioFormat format, void* out, const void* in, int bytes);
70 static void MonoToStereo(void* dst, const void* src, int samples);
71 static void DeinterleaveSamples(AudioFormat format, int channels,
72 uint8_t* output, const uint8_t* input,
73 int data_size);
74 static void InterleaveSamples(AudioFormat format, int channels,
75 uint8_t* output, const uint8_t* const* input,
76 int data_size);
77 static void InterleaveSamples(AudioFormat format, int channels,
78 uint8_t* output, const uint8_t* input,
79 int data_size);
80private:
81 AudioConvertInternal* m_ctx {nullptr};
83};
84
85#endif /* defined(MythXCode_audioconvert) */
bool operator!=(const AudioConvert &rhs) const
Definition: audioconvert.h:54
bool operator==(const AudioConvert &rhs) const
Definition: audioconvert.h:52
AudioFormat Out(void)
Definition: audioconvert.h:49
AudioFormat In(void)
Definition: audioconvert.h:50
AudioConvert(AudioFormat in, AudioFormat out)
Definition: audioconvert.h:36
AudioFormat m_in
Definition: audioconvert.h:82
AudioFormat m_out
Definition: audioconvert.h:82
static const std::array< const uint64_t, 4 > samples
Definition: element.cpp:46
#define MPUBLIC
Definition: mythexp.h:10
#define output