mirror of
https://github.com/qemu/qemu.git
synced 2026-02-04 02:24:51 +00:00
audio/replay: fix type punning
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
@@ -171,9 +171,11 @@ int wav_start_capture(AudioState *state, CaptureState *s, const char *path,
|
||||
|
||||
void audio_cleanup(void);
|
||||
|
||||
void audio_sample_to_uint64(const void *samples, int pos,
|
||||
typedef struct st_sample st_sample;
|
||||
|
||||
void audio_sample_to_uint64(const st_sample *sample, int pos,
|
||||
uint64_t *left, uint64_t *right);
|
||||
void audio_sample_from_uint64(void *samples, int pos,
|
||||
void audio_sample_from_uint64(st_sample *sample, int pos,
|
||||
uint64_t left, uint64_t right);
|
||||
|
||||
void audio_add_audiodev(Audiodev *audio);
|
||||
|
||||
@@ -404,7 +404,7 @@ f_sample *mixeng_clip_float[2][2] = {
|
||||
}
|
||||
};
|
||||
|
||||
void audio_sample_to_uint64(const void *samples, int pos,
|
||||
void audio_sample_to_uint64(const st_sample *sample, int pos,
|
||||
uint64_t *left, uint64_t *right)
|
||||
{
|
||||
#ifdef FLOAT_MIXENG
|
||||
@@ -412,14 +412,13 @@ void audio_sample_to_uint64(const void *samples, int pos,
|
||||
"Coreaudio and floating point samples are not supported by replay yet");
|
||||
abort();
|
||||
#else
|
||||
const struct st_sample *sample = samples;
|
||||
sample += pos;
|
||||
*left = sample->l;
|
||||
*right = sample->r;
|
||||
#endif
|
||||
}
|
||||
|
||||
void audio_sample_from_uint64(void *samples, int pos,
|
||||
void audio_sample_from_uint64(st_sample *sample, int pos,
|
||||
uint64_t left, uint64_t right)
|
||||
{
|
||||
#ifdef FLOAT_MIXENG
|
||||
@@ -427,7 +426,6 @@ void audio_sample_from_uint64(void *samples, int pos,
|
||||
"Coreaudio and floating point samples are not supported by replay yet");
|
||||
abort();
|
||||
#else
|
||||
struct st_sample *sample = samples;
|
||||
sample += pos;
|
||||
sample->l = left;
|
||||
sample->r = right;
|
||||
|
||||
@@ -33,7 +33,6 @@ struct st_sample { mixeng_real l; mixeng_real r; };
|
||||
struct mixeng_volume { int mute; int64_t r; int64_t l; };
|
||||
struct st_sample { int64_t l; int64_t r; };
|
||||
#endif
|
||||
typedef struct st_sample st_sample;
|
||||
|
||||
typedef void (t_sample) (struct st_sample *dst, const void *src, int samples);
|
||||
typedef void (f_sample) (void *dst, const struct st_sample *src, int samples);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "qapi/qapi-types-run-state.h"
|
||||
#include "qapi/qapi-types-ui.h"
|
||||
#include "block/aio.h"
|
||||
#include "audio/audio.h"
|
||||
|
||||
/* replay clock kinds */
|
||||
enum ReplayClockKind {
|
||||
@@ -165,7 +166,7 @@ void replay_net_packet_event(ReplayNetState *rns, unsigned flags,
|
||||
/*! Saves/restores number of played samples of audio out operation. */
|
||||
void replay_audio_out(size_t *played);
|
||||
/*! Saves/restores recorded samples of audio in operation. */
|
||||
void replay_audio_in(size_t *recorded, void *samples, size_t *wpos, size_t size);
|
||||
void replay_audio_in(size_t *recorded, st_sample *samples, size_t *wpos, size_t size);
|
||||
|
||||
/* VM state operations */
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ void replay_audio_out(size_t *played)
|
||||
}
|
||||
}
|
||||
|
||||
void replay_audio_in(size_t *recorded, void *samples, size_t *wpos, size_t size)
|
||||
void replay_audio_in(size_t *recorded, st_sample *samples, size_t *wpos, size_t size)
|
||||
{
|
||||
int pos;
|
||||
uint64_t left, right;
|
||||
|
||||
@@ -15,7 +15,7 @@ void replay_input_sync_event(void)
|
||||
void replay_add_blocker(const char *feature)
|
||||
{
|
||||
}
|
||||
void replay_audio_in(size_t *recorded, void *samples, size_t *wpos, size_t size)
|
||||
void replay_audio_in(size_t *recorded, st_sample *samples, size_t *wpos, size_t size)
|
||||
{
|
||||
}
|
||||
void replay_audio_out(size_t *played)
|
||||
|
||||
Reference in New Issue
Block a user