Commit e699f678 authored by Max Kellermann's avatar Max Kellermann

decoder_control: rename to DecoderControl

parent 5f13c1cd
......@@ -41,7 +41,7 @@ decoder_initialized(Decoder &decoder,
const AudioFormat audio_format,
bool seekable, float total_time)
{
decoder_control &dc = decoder.dc;
DecoderControl &dc = decoder.dc;
struct audio_format_string af_string;
assert(dc.state == DecoderState::START);
......@@ -81,7 +81,7 @@ gcc_pure
static bool
decoder_prepare_initial_seek(Decoder &decoder)
{
const decoder_control &dc = decoder.dc;
const DecoderControl &dc = decoder.dc;
assert(dc.pipe != nullptr);
if (dc.state != DecoderState::DECODE)
......@@ -128,7 +128,7 @@ gcc_pure
static DecoderCommand
decoder_get_virtual_command(Decoder &decoder)
{
const decoder_control &dc = decoder.dc;
const DecoderControl &dc = decoder.dc;
assert(dc.pipe != nullptr);
if (decoder_prepare_initial_seek(decoder))
......@@ -146,7 +146,7 @@ decoder_get_command(Decoder &decoder)
void
decoder_command_finished(Decoder &decoder)
{
decoder_control &dc = decoder.dc;
DecoderControl &dc = decoder.dc;
dc.Lock();
......@@ -190,7 +190,7 @@ decoder_command_finished(Decoder &decoder)
double decoder_seek_where(gcc_unused Decoder & decoder)
{
const decoder_control &dc = decoder.dc;
const DecoderControl &dc = decoder.dc;
assert(dc.pipe != nullptr);
......@@ -206,7 +206,7 @@ double decoder_seek_where(gcc_unused Decoder & decoder)
void decoder_seek_error(Decoder & decoder)
{
decoder_control &dc = decoder.dc;
DecoderControl &dc = decoder.dc;
assert(dc.pipe != nullptr);
......@@ -236,7 +236,7 @@ decoder_check_cancel_read(const Decoder *decoder)
if (decoder == nullptr)
return false;
const decoder_control &dc = decoder->dc;
const DecoderControl &dc = decoder->dc;
if (dc.command == DecoderCommand::NONE)
return false;
......@@ -356,7 +356,7 @@ decoder_data(Decoder &decoder,
const void *data, size_t length,
uint16_t kbit_rate)
{
decoder_control &dc = decoder.dc;
DecoderControl &dc = decoder.dc;
DecoderCommand cmd;
assert(dc.state == DecoderState::DECODE);
......@@ -464,7 +464,7 @@ DecoderCommand
decoder_tag(Decoder &decoder, InputStream *is,
Tag &&tag)
{
gcc_unused const decoder_control &dc = decoder.dc;
gcc_unused const DecoderControl &dc = decoder.dc;
DecoderCommand cmd;
assert(dc.state == DecoderState::DECODE);
......@@ -543,7 +543,7 @@ decoder_replay_gain(Decoder &decoder,
void
decoder_mixramp(Decoder &decoder, MixRampInfo &&mix_ramp)
{
decoder_control &dc = decoder.dc;
DecoderControl &dc = decoder.dc;
dc.SetMixRamp(std::move(mix_ramp));
}
......@@ -26,13 +26,13 @@
#include <assert.h>
decoder_control::decoder_control()
DecoderControl::DecoderControl()
:state(DecoderState::STOP),
command(DecoderCommand::NONE),
song(nullptr),
replay_gain_db(0), replay_gain_prev_db(0) {}
decoder_control::~decoder_control()
DecoderControl::~DecoderControl()
{
ClearError();
......@@ -41,7 +41,7 @@ decoder_control::~decoder_control()
}
bool
decoder_control::IsCurrentSong(const Song &_song) const
DecoderControl::IsCurrentSong(const Song &_song) const
{
switch (state) {
case DecoderState::STOP:
......@@ -58,9 +58,9 @@ decoder_control::IsCurrentSong(const Song &_song) const
}
void
decoder_control::Start(Song *_song,
unsigned _start_ms, unsigned _end_ms,
MusicBuffer &_buffer, MusicPipe &_pipe)
DecoderControl::Start(Song *_song,
unsigned _start_ms, unsigned _end_ms,
MusicBuffer &_buffer, MusicPipe &_pipe)
{
assert(_song != nullptr);
assert(_pipe.IsEmpty());
......@@ -78,7 +78,7 @@ decoder_control::Start(Song *_song,
}
void
decoder_control::Stop()
DecoderControl::Stop()
{
Lock();
......@@ -96,7 +96,7 @@ decoder_control::Stop()
}
bool
decoder_control::Seek(double where)
DecoderControl::Seek(double where)
{
assert(state != DecoderState::START);
assert(where >= 0.0);
......@@ -113,7 +113,7 @@ decoder_control::Seek(double where)
}
void
decoder_control::Quit()
DecoderControl::Quit()
{
assert(thread.IsDefined());
......@@ -124,7 +124,7 @@ decoder_control::Quit()
}
void
decoder_control::CycleMixRamp()
DecoderControl::CycleMixRamp()
{
previous_mix_ramp = std::move(mix_ramp);
mix_ramp.Clear();
......
......@@ -54,7 +54,7 @@ enum class DecoderState : uint8_t {
ERROR,
};
struct decoder_control {
struct DecoderControl {
/**
* The handle of the decoder thread.
*/
......@@ -143,8 +143,8 @@ struct decoder_control {
MixRampInfo mix_ramp, previous_mix_ramp;
decoder_control();
~decoder_control();
DecoderControl();
~DecoderControl();
/**
* Locks the object.
......@@ -170,7 +170,7 @@ struct decoder_control {
}
/**
* Waits for a signal on the #decoder_control object. This function
* Waits for a signal on the #DecoderControl object. This function
* is only valid in the decoder thread. The object must be locked
* prior to calling this function.
*/
......@@ -336,8 +336,8 @@ public:
*
* @param song the song to be decoded; the given instance will be
* owned and freed by the decoder
* @param start_ms see #decoder_control
* @param end_ms see #decoder_control
* @param start_ms see #DecoderControl
* @param end_ms see #DecoderControl
* @param pipe the pipe which receives the decoded chunks (owned by
* the caller)
*/
......
......@@ -42,7 +42,7 @@ Decoder::~Decoder()
* one.
*/
static DecoderCommand
need_chunks(decoder_control &dc, bool do_wait)
need_chunks(DecoderControl &dc, bool do_wait)
{
if (dc.command == DecoderCommand::STOP ||
dc.command == DecoderCommand::SEEK)
......@@ -61,7 +61,7 @@ need_chunks(decoder_control &dc, bool do_wait)
struct music_chunk *
decoder_get_chunk(Decoder &decoder)
{
decoder_control &dc = decoder.dc;
DecoderControl &dc = decoder.dc;
DecoderCommand cmd;
if (decoder.chunk != nullptr)
......@@ -90,7 +90,7 @@ decoder_get_chunk(Decoder &decoder)
void
decoder_flush_chunk(Decoder &decoder)
{
decoder_control &dc = decoder.dc;
DecoderControl &dc = decoder.dc;
assert(decoder.chunk != nullptr);
......
......@@ -24,12 +24,12 @@
#include "pcm/PcmConvert.hxx"
#include "ReplayGainInfo.hxx"
struct decoder_control;
struct DecoderControl;
struct InputStream;
struct Tag;
struct Decoder {
decoder_control &dc;
DecoderControl &dc;
PcmConvert conv_state;
......@@ -83,7 +83,7 @@ struct Decoder {
*/
unsigned replay_gain_serial;
Decoder(decoder_control &_dc, bool _initial_seek_pending, Tag *_tag)
Decoder(DecoderControl &_dc, bool _initial_seek_pending, Tag *_tag)
:dc(_dc),
timestamp(0),
initial_seek_pending(_initial_seek_pending),
......
......@@ -44,10 +44,10 @@ static constexpr Domain decoder_thread_domain("decoder_thread");
* Marks the current decoder command as "finished" and notifies the
* player thread.
*
* @param dc the #decoder_control object; must be locked
* @param dc the #DecoderControl object; must be locked
*/
static void
decoder_command_finished_locked(decoder_control &dc)
decoder_command_finished_locked(DecoderControl &dc)
{
assert(dc.command != DecoderCommand::NONE);
......@@ -68,7 +68,7 @@ decoder_command_finished_locked(decoder_control &dc)
* received, nullptr on error
*/
static InputStream *
decoder_input_stream_open(decoder_control &dc, const char *uri)
decoder_input_stream_open(DecoderControl &dc, const char *uri)
{
Error error;
......@@ -237,7 +237,7 @@ decoder_run_stream_fallback(Decoder &decoder, InputStream &is)
static bool
decoder_run_stream(Decoder &decoder, const char *uri)
{
decoder_control &dc = decoder.dc;
DecoderControl &dc = decoder.dc;
InputStream *input_stream;
bool success;
......@@ -285,7 +285,7 @@ decoder_load_replay_gain(Decoder &decoder, const char *path_fs)
static bool
decoder_run_file(Decoder &decoder, const char *path_fs)
{
decoder_control &dc = decoder.dc;
DecoderControl &dc = decoder.dc;
const char *suffix = uri_get_suffix(path_fs);
const struct DecoderPlugin *plugin = nullptr;
......@@ -333,7 +333,7 @@ decoder_run_file(Decoder &decoder, const char *path_fs)
}
static void
decoder_run_song(decoder_control &dc,
decoder_run_song(DecoderControl &dc,
const Song *song, const char *uri)
{
Decoder decoder(dc, dc.start_ms > 0,
......@@ -376,7 +376,7 @@ decoder_run_song(decoder_control &dc,
}
static void
decoder_run(decoder_control &dc)
decoder_run(DecoderControl &dc)
{
dc.ClearError();
......@@ -402,7 +402,7 @@ decoder_run(decoder_control &dc)
static void
decoder_task(void *arg)
{
decoder_control &dc = *(decoder_control *)arg;
DecoderControl &dc = *(DecoderControl *)arg;
dc.Lock();
......@@ -436,7 +436,7 @@ decoder_task(void *arg)
}
void
decoder_thread_start(decoder_control &dc)
decoder_thread_start(DecoderControl &dc)
{
assert(!dc.thread.IsDefined());
......
......@@ -20,9 +20,9 @@
#ifndef MPD_DECODER_THREAD_HXX
#define MPD_DECODER_THREAD_HXX
struct decoder_control;
struct DecoderControl;
void
decoder_thread_start(decoder_control &dc);
decoder_thread_start(DecoderControl &dc);
#endif
......@@ -53,7 +53,7 @@ enum class CrossFadeState : int8_t {
class Player {
player_control &pc;
decoder_control &dc;
DecoderControl &dc;
MusicBuffer &buffer;
......@@ -130,7 +130,7 @@ class Player {
float elapsed_time;
public:
Player(player_control &_pc, decoder_control &_dc,
Player(player_control &_pc, DecoderControl &_dc,
MusicBuffer &_buffer)
:pc(_pc), dc(_dc), buffer(_buffer),
buffering(false),
......@@ -1095,7 +1095,7 @@ Player::Run()
}
static void
do_play(player_control &pc, decoder_control &dc,
do_play(player_control &pc, DecoderControl &dc,
MusicBuffer &buffer)
{
Player player(pc, dc, buffer);
......@@ -1107,7 +1107,7 @@ player_task(void *arg)
{
player_control &pc = *(player_control *)arg;
decoder_control dc;
DecoderControl dc;
decoder_thread_start(dc);
MusicBuffer buffer(pc.buffer_chunks);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment