diff options
author | wm4 <wm4@nowhere> | 2014-11-25 11:11:31 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-25 11:11:31 +0100 |
commit | 7d6e58471f378215d4f104b85ca6190d7e98abcf (patch) | |
tree | b3af4c1d3e3744d00ee9603007f20b5630eec894 /audio/audio.c | |
parent | 8a7b6865972f5aeb4aec4af9bab7f0dbc147da17 (diff) | |
download | mpv-7d6e58471f378215d4f104b85ca6190d7e98abcf.tar.bz2 mpv-7d6e58471f378215d4f104b85ca6190d7e98abcf.tar.xz |
audio: make mp_audio_config_to_str return a stack-allocated string
Simpler overall.
Diffstat (limited to 'audio/audio.c')
-rw-r--r-- | audio/audio.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/audio/audio.c b/audio/audio.c index 2cda1ba110..93e9f1814b 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -91,17 +91,12 @@ bool mp_audio_config_valid(const struct mp_audio *mpa) && mpa->rate >= 1 && mpa->rate < 10000000; } -char *mp_audio_fmt_to_str(int srate, const struct mp_chmap *chmap, int format) +char *mp_audio_config_to_str_buf(char *buf, size_t buf_sz, struct mp_audio *mpa) { - char *res = talloc_asprintf(NULL, "%dHz %s %dch %s", srate, - mp_chmap_to_str(chmap), chmap->num, - af_fmt_to_str(format)); - return res; -} - -char *mp_audio_config_to_str(struct mp_audio *mpa) -{ - return mp_audio_fmt_to_str(mpa->rate, &mpa->channels, mpa->format); + snprintf(buf, buf_sz, "%dHz %s %dch %s", mpa->rate, + mp_chmap_to_str(&mpa->channels), mpa->channels.num, + af_fmt_to_str(mpa->format)); + return buf; } void mp_audio_force_interleaved_format(struct mp_audio *mpa) |