aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/JackOutputPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-03 21:00:50 +0200
committerMax Kellermann <max@duempel.org>2013-08-03 21:37:56 +0200
commitd1e7b4e38136f9342aad76c685a13adf0e69f869 (patch)
tree49643b937ddfe735511b566a71398da5a945d7aa /src/output/JackOutputPlugin.cxx
parent67f591a9ce60651da41afc499bd9a22e25314e35 (diff)
downloadmpd-d1e7b4e38136f9342aad76c685a13adf0e69f869.tar.gz
mpd-d1e7b4e38136f9342aad76c685a13adf0e69f869.tar.xz
mpd-d1e7b4e38136f9342aad76c685a13adf0e69f869.zip
audio_format: convert to C++
Diffstat (limited to 'src/output/JackOutputPlugin.cxx')
-rw-r--r--src/output/JackOutputPlugin.cxx28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/output/JackOutputPlugin.cxx b/src/output/JackOutputPlugin.cxx
index 4f21b36f8..6c9ee9335 100644
--- a/src/output/JackOutputPlugin.cxx
+++ b/src/output/JackOutputPlugin.cxx
@@ -67,7 +67,7 @@ struct JackOutput {
size_t ringbuffer_size;
/* the current audio format */
- struct audio_format audio_format;
+ AudioFormat audio_format;
/* jack library stuff */
jack_port_t *ports[MAX_PORTS];
@@ -203,18 +203,18 @@ mpd_jack_shutdown(void *arg)
}
static void
-set_audioformat(JackOutput *jd, struct audio_format *audio_format)
+set_audioformat(JackOutput *jd, AudioFormat &audio_format)
{
- audio_format->sample_rate = jack_get_sample_rate(jd->client);
+ audio_format.sample_rate = jack_get_sample_rate(jd->client);
if (jd->num_source_ports == 1)
- audio_format->channels = 1;
- else if (audio_format->channels > jd->num_source_ports)
- audio_format->channels = 2;
+ audio_format.channels = 1;
+ else if (audio_format.channels > jd->num_source_ports)
+ audio_format.channels = 2;
- if (audio_format->format != SAMPLE_FORMAT_S16 &&
- audio_format->format != SAMPLE_FORMAT_S24_P32)
- audio_format->format = SAMPLE_FORMAT_S24_P32;
+ if (audio_format.format != SampleFormat::S16 &&
+ audio_format.format != SampleFormat::S24_P32)
+ audio_format.format = SampleFormat::S24_P32;
}
static void
@@ -591,7 +591,7 @@ mpd_jack_start(JackOutput *jd, GError **error_r)
}
static bool
-mpd_jack_open(struct audio_output *ao, struct audio_format *audio_format,
+mpd_jack_open(struct audio_output *ao, AudioFormat &audio_format,
GError **error_r)
{
JackOutput *jd = (JackOutput *)ao;
@@ -607,7 +607,7 @@ mpd_jack_open(struct audio_output *ao, struct audio_format *audio_format,
return false;
set_audioformat(jd, audio_format);
- jd->audio_format = *audio_format;
+ jd->audio_format = audio_format;
if (!mpd_jack_start(jd, error_r))
return false;
@@ -684,12 +684,12 @@ mpd_jack_write_samples(JackOutput *jd, const void *src,
unsigned num_samples)
{
switch (jd->audio_format.format) {
- case SAMPLE_FORMAT_S16:
+ case SampleFormat::S16:
mpd_jack_write_samples_16(jd, (const int16_t*)src,
num_samples);
break;
- case SAMPLE_FORMAT_S24_P32:
+ case SampleFormat::S24_P32:
mpd_jack_write_samples_24(jd, (const int32_t*)src,
num_samples);
break;
@@ -705,7 +705,7 @@ mpd_jack_play(struct audio_output *ao, const void *chunk, size_t size,
GError **error_r)
{
JackOutput *jd = (JackOutput *)ao;
- const size_t frame_size = audio_format_frame_size(&jd->audio_format);
+ const size_t frame_size = jd->audio_format.GetFrameSize();
size_t space = 0, space1;
jd->pause = false;