output_api: no CamelCase in struct audio_output
Renamed audio_output struct members.
This commit is contained in:
parent
744702f266
commit
61e3075981
@ -56,22 +56,22 @@ audio_output_open(struct audio_output *audioOutput,
|
|||||||
audioOutput->reopen_after = 0;
|
audioOutput->reopen_after = 0;
|
||||||
|
|
||||||
if (audioOutput->open &&
|
if (audioOutput->open &&
|
||||||
audio_format_equals(audioFormat, &audioOutput->inAudioFormat)) {
|
audio_format_equals(audioFormat, &audioOutput->in_audio_format)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
audioOutput->inAudioFormat = *audioFormat;
|
audioOutput->in_audio_format = *audioFormat;
|
||||||
|
|
||||||
if (audio_format_defined(&audioOutput->reqAudioFormat)) {
|
if (audio_format_defined(&audioOutput->config_audio_format)) {
|
||||||
/* copy reqAudioFormat to outAudioFormat only if the
|
/* copy config_audio_format to out_audio_format only if the
|
||||||
device is not yet open; if it is already open,
|
device is not yet open; if it is already open,
|
||||||
plugin->open() may have modified outAudioFormat,
|
plugin->open() may have modified out_audio_format,
|
||||||
and the value is already ok */
|
and the value is already ok */
|
||||||
if (!audioOutput->open)
|
if (!audioOutput->open)
|
||||||
audioOutput->outAudioFormat =
|
audioOutput->out_audio_format =
|
||||||
audioOutput->reqAudioFormat;
|
audioOutput->config_audio_format;
|
||||||
} else {
|
} else {
|
||||||
audioOutput->outAudioFormat = audioOutput->inAudioFormat;
|
audioOutput->out_audio_format = audioOutput->in_audio_format;
|
||||||
if (audioOutput->open)
|
if (audioOutput->open)
|
||||||
audio_output_close(audioOutput);
|
audio_output_close(audioOutput);
|
||||||
}
|
}
|
||||||
|
@ -91,20 +91,21 @@ audio_output_init(struct audio_output *ao, const struct config_param *param)
|
|||||||
ao->open = false;
|
ao->open = false;
|
||||||
ao->reopen_after = 0;
|
ao->reopen_after = 0;
|
||||||
|
|
||||||
pcm_convert_init(&ao->convState);
|
pcm_convert_init(&ao->convert_state);
|
||||||
|
|
||||||
if (format) {
|
if (format) {
|
||||||
if (0 != parseAudioConfig(&ao->reqAudioFormat, format)) {
|
if (0 != parseAudioConfig(&ao->config_audio_format, format)) {
|
||||||
g_error("error parsing format at line %i\n", bp->line);
|
g_error("error parsing format at line %i\n", bp->line);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
audio_format_clear(&ao->reqAudioFormat);
|
audio_format_clear(&ao->config_audio_format);
|
||||||
|
|
||||||
ao->thread = NULL;
|
ao->thread = NULL;
|
||||||
notify_init(&ao->notify);
|
notify_init(&ao->notify);
|
||||||
ao->command = AO_COMMAND_NONE;
|
ao->command = AO_COMMAND_NONE;
|
||||||
|
|
||||||
ao->data = plugin->init(ao, format ? &ao->reqAudioFormat : NULL, param);
|
ao->data = plugin->init(ao, format ? &ao->config_audio_format : NULL,
|
||||||
|
param);
|
||||||
if (ao->data == NULL)
|
if (ao->data == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -63,23 +63,23 @@ struct audio_output {
|
|||||||
* The audio_format in which audio data is received from the
|
* The audio_format in which audio data is received from the
|
||||||
* player thread (which in turn receives it from the decoder).
|
* player thread (which in turn receives it from the decoder).
|
||||||
*/
|
*/
|
||||||
struct audio_format inAudioFormat;
|
struct audio_format in_audio_format;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The audio_format which is really sent to the device. This
|
* The audio_format which is really sent to the device. This
|
||||||
* is basically reqAudioFormat (if configured) or
|
* is basically config_audio_format (if configured) or
|
||||||
* inAudioFormat, but may have been modified by
|
* in_audio_format, but may have been modified by
|
||||||
* plugin->open().
|
* plugin->open().
|
||||||
*/
|
*/
|
||||||
struct audio_format outAudioFormat;
|
struct audio_format out_audio_format;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The audio_format which was configured. Only set if
|
* The audio_format which was configured. Only set if
|
||||||
* convertAudioFormat is true.
|
* convertAudioFormat is true.
|
||||||
*/
|
*/
|
||||||
struct audio_format reqAudioFormat;
|
struct audio_format config_audio_format;
|
||||||
|
|
||||||
struct pcm_convert_state convState;
|
struct pcm_convert_state convert_state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The thread handle, or NULL if the output thread isn't
|
* The thread handle, or NULL if the output thread isn't
|
||||||
|
@ -46,10 +46,10 @@ static void ao_play(struct audio_output *ao)
|
|||||||
|
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
|
|
||||||
if (!audio_format_equals(&ao->inAudioFormat, &ao->outAudioFormat)) {
|
if (!audio_format_equals(&ao->in_audio_format, &ao->out_audio_format)) {
|
||||||
data = pcm_convert(&ao->convState,
|
data = pcm_convert(&ao->convert_state,
|
||||||
&ao->inAudioFormat, data, size,
|
&ao->in_audio_format, data, size,
|
||||||
&ao->outAudioFormat, &size);
|
&ao->out_audio_format, &size);
|
||||||
|
|
||||||
/* under certain circumstances, pcm_convert() may
|
/* under certain circumstances, pcm_convert() may
|
||||||
return an empty buffer - this condition should be
|
return an empty buffer - this condition should be
|
||||||
@ -63,7 +63,7 @@ static void ao_play(struct audio_output *ao)
|
|||||||
if (!ret) {
|
if (!ret) {
|
||||||
ao->plugin->cancel(ao->data);
|
ao->plugin->cancel(ao->data);
|
||||||
ao->plugin->close(ao->data);
|
ao->plugin->close(ao->data);
|
||||||
pcm_convert_deinit(&ao->convState);
|
pcm_convert_deinit(&ao->convert_state);
|
||||||
ao->open = false;
|
ao->open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ static void ao_pause(struct audio_output *ao)
|
|||||||
ret = ao->plugin->pause(ao->data);
|
ret = ao->plugin->pause(ao->data);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ao->plugin->close(ao->data);
|
ao->plugin->close(ao->data);
|
||||||
pcm_convert_deinit(&ao->convState);
|
pcm_convert_deinit(&ao->convert_state);
|
||||||
ao->open = false;
|
ao->open = false;
|
||||||
}
|
}
|
||||||
} while (ao->command == AO_COMMAND_NONE);
|
} while (ao->command == AO_COMMAND_NONE);
|
||||||
@ -109,9 +109,9 @@ static gpointer audio_output_task(gpointer arg)
|
|||||||
case AO_COMMAND_OPEN:
|
case AO_COMMAND_OPEN:
|
||||||
assert(!ao->open);
|
assert(!ao->open);
|
||||||
|
|
||||||
pcm_convert_init(&ao->convState);
|
pcm_convert_init(&ao->convert_state);
|
||||||
ret = ao->plugin->open(ao->data,
|
ret = ao->plugin->open(ao->data,
|
||||||
&ao->outAudioFormat);
|
&ao->out_audio_format);
|
||||||
|
|
||||||
assert(!ao->open);
|
assert(!ao->open);
|
||||||
if (ret == true)
|
if (ret == true)
|
||||||
|
Loading…
Reference in New Issue
Block a user