audio/jack: add JACK client audiodev
PATCH 1/1 audio/jack: add JACK client audiodev
This commit adds a new audiodev backend to allow QEMU to use JACK as both an audio sink and source.
--- audio/Makefile.objs | 5 + audio/audio.c | 1 + audio/audio_template.h | 2 + audio/jackaudio.c | 583 +++++++++++++++++++++++++++++++++++++++++ configure | 17 ++ qapi/audio.json | 50 +++- 6 files changed, 656 insertions(+), 2 deletions(-) create mode 100644 audio/jackaudio.c
audio/Makefile.objs +5 -0
@@ -28,3 +28,8 @@ common-obj-$(CONFIG_AUDIO_SDL) += sdl.mo sdl.mo-objs = sdlaudio.o sdl.mo-cflags := $(SDL_CFLAGS) sdl.mo-libs := $(SDL_LIBS) + +# jack module +common-obj-$(CONFIG_AUDIO_JACK) += jack.mo +jack.mo-objs = jackaudio.o +jack.mo-libs := $(JACK_LIBS)
audio/audio.c +1 -0
@@ -1969,6 +1969,7 @@ void audio_create_pdos(Audiodev *dev)CASE (ALSA , alsa, Alsa);CASE (COREAUDIO , coreaudio, Coreaudio); CASE(DSOUND, dsound, ); +CASE (JACK , jack, Jack);CASE (OSS , oss, Oss);CASE (PA , pa, Pa); CASE(SDL, sdl, );
audio/audio_template.h +2 -0
@@ -330,6 +330,8 @@ AudiodevPerDirectionOptions *glue(audio_get_pdo_, TYPE)(Audiodev *dev) dev->u.coreaudio.TYPE);case AUDIODEV_DRIVER_DSOUND :return dev->u.dsound.TYPE; +case AUDIODEV_DRIVER_JACK : +return qapi_AudiodevJackPerDirectionOptions_base (dev->u.jack.TYPE);case AUDIODEV_DRIVER_OSS :return qapi_AudiodevOssPerDirectionOptions_base (dev->u.oss.TYPE);case AUDIODEV_DRIVER_PA :
audio/jackaudio.c new file +583 -0
583 lines not on this page · raw message
configure +17 -0
@@ -3629,6 +3629,22 @@ for drv in $audio_drv_list; do oss_libs="$oss_lib" ;; + jack | try-jack) + if $pkg_config jack --exists; then + jack_libs=$($pkg_config jack --libs) + if test "$drv" = "try-jack"; then + audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack/jack/') + fi + else + if test "$drv" = "try-jack"; then + audio_drv_list=$(echo "$audio_drv_list" | sed -e 's/try-jack//') + else + error_exit "$drv check failed" \ + "Make sure to have the $drv libs and headers installed." + fi + fi + ;; + *) echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { error_exit "Unknown driver '$drv' selected" \
@@ -6904,6 +6920,7 @@ echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak echo "OSS_LIBS=$oss_libs" >> $config_host_mak +echo "JACK_LIBS=$jack_libs" >> $config_host_mak if test "$audio_win_int" = "yes" ; then echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak fi
qapi/audio.json +48 -2
68 lines not on this page · raw message
Signature · 1 line
2.20.1
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [PATCH] audio/jack: add JACK client audiodev
Message-id: [email protected]
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/[email protected] -> patchew/[email protected]
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
aaf9cf2 audio/jack: add JACK client audiodev
=== OUTPUT BEGIN ===
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #52:
new file mode 100644
ERROR: open brace '{' following enum go on the same line #97: FILE: audio/jackaudio.c:41:
+typedef enum QJackState
+{
ERROR: open brace '{' following struct go on the same line #108: FILE: audio/jackaudio.c:52:
+typedef struct QJackBuffer
+{
ERROR: "foo ** bar" should be "foo **bar"
#113: FILE: audio/jackaudio.c:57:
+ float ** data;
ERROR: open brace '{' following struct go on the same line #118: FILE: audio/jackaudio.c:62:
+typedef struct QJackClient
+{
ERROR: "foo * bar" should be "foo *bar"
#121: FILE: audio/jackaudio.c:65:
+ jack_client_t * client;
ERROR: "foo * bar" should be "foo *bar"
#124: FILE: audio/jackaudio.c:68:
+ struct QJack * j;
ERROR: "foo ** bar" should be "foo **bar"
#127: FILE: audio/jackaudio.c:71:
+ jack_port_t ** port;
ERROR: open brace '{' following struct go on the same line #133: FILE: audio/jackaudio.c:77:
+typedef struct QJackOut
+{
ERROR: open brace '{' following struct go on the same line #140: FILE: audio/jackaudio.c:84:
+typedef struct QJackIn
+{
ERROR: "foo * bar" should be "foo *bar"
#146: FILE: audio/jackaudio.c:90:
+static void qjack_buffer_create(QJackBuffer * buffer, int channels, int frames)
ERROR: space required before the open parenthesis '(' #154: FILE: audio/jackaudio.c:98:
+ for(int i = 0; i < channels; ++i)
ERROR: braces {} are necessary for all arms of this statement #154: FILE: audio/jackaudio.c:98:
+ for(int i = 0; i < channels; ++i)
[...]
ERROR: "foo * bar" should be "foo *bar"
#158: FILE: audio/jackaudio.c:102:
+static void qjack_buffer_clear(QJackBuffer * buffer)
ERROR: "foo * bar" should be "foo *bar" #165: FILE: audio/jackaudio.c:109:
+static void qjack_buffer_free(QJackBuffer * buffer)
ERROR: space required before the open parenthesis '(' #167: FILE: audio/jackaudio.c:111:
+ for(int i = 0; i < buffer->channels; ++i)
ERROR: braces {} are necessary for all arms of this statement #167: FILE: audio/jackaudio.c:111:
+ for(int i = 0; i < buffer->channels; ++i)
[...]
ERROR: "foo * bar" should be "foo *bar"
#174: FILE: audio/jackaudio.c:118:
+inline static int qjack_buffer_used(QJackBuffer * buffer)
ERROR: storage class should be at the beginning of the declaration #174: FILE: audio/jackaudio.c:118:
+inline static int qjack_buffer_used(QJackBuffer * buffer)
ERROR: inline keyword should sit between storage class and type #174: FILE: audio/jackaudio.c:118:
+inline static int qjack_buffer_used(QJackBuffer * buffer)
ERROR: "foo * bar" should be "foo *bar"
#180: FILE: audio/jackaudio.c:124:
+static int qjack_buffer_write(QJackBuffer * buffer, float * data, int size)
ERROR: braces {} are necessary for all arms of this statement #187: FILE: audio/jackaudio.c:131:
+ if (frames > avail)
[...]
ERROR: space required before the open parenthesis '(' #193: FILE: audio/jackaudio.c:137:
+ while(copy) {
ERROR: space required before the open parenthesis '(' #195: FILE: audio/jackaudio.c:139:
+ for(int c = 0; c < buffer->channels; ++c)
ERROR: braces {} are necessary for all arms of this statement #195: FILE: audio/jackaudio.c:139:
+ for(int c = 0; c < buffer->channels; ++c)
[...]
ERROR: braces {} are necessary for all arms of this statement #198: FILE: audio/jackaudio.c:142:
+ if (++wptr == buffer->frames)
[...]
ERROR: "foo * bar" should be "foo *bar"
#211: FILE: audio/jackaudio.c:155:
+static int qjack_buffer_write_l(QJackBuffer * buffer, float ** dest, int frames)
ERROR: braces {} are necessary for all arms of this statement #217: FILE: audio/jackaudio.c:161:
+ if (frames > avail)
[...]
ERROR: suspect code indent for conditional statements (4, 6) #221: FILE: audio/jackaudio.c:165:
+ if (right > frames)
+ right = frames;
ERROR: braces {} are necessary for all arms of this statement #221: FILE: audio/jackaudio.c:165:
+ if (right > frames)
[...]
ERROR: space required before the open parenthesis '(' #225: FILE: audio/jackaudio.c:169:
+ for(int c = 0; c < buffer->channels; ++c) {
ERROR: suspect code indent for conditional statements (4, 6) #231: FILE: audio/jackaudio.c:175:
+ if (wptr >= buffer->frames)
+ wptr -= buffer->frames;
ERROR: braces {} are necessary for all arms of this statement #231: FILE: audio/jackaudio.c:175:
+ if (wptr >= buffer->frames)
[...]
ERROR: "foo * bar" should be "foo *bar"
#240: FILE: audio/jackaudio.c:184:
+static int qjack_buffer_read(QJackBuffer * buffer, float * dest, int size)
ERROR: braces {} are necessary for all arms of this statement #247: FILE: audio/jackaudio.c:191:
+ if (frames > avail)
[...]
ERROR: space required before the open parenthesis '(' #253: FILE: audio/jackaudio.c:197:
+ while(copy) {
ERROR: space required before the open parenthesis '(' #255: FILE: audio/jackaudio.c:199:
+ for(int c = 0; c < buffer->channels; ++c)
ERROR: braces {} are necessary for all arms of this statement #255: FILE: audio/jackaudio.c:199:
+ for(int c = 0; c < buffer->channels; ++c)
[...]
ERROR: braces {} are necessary for all arms of this statement #258: FILE: audio/jackaudio.c:202:
+ if (++rptr == buffer->frames)
[...]
ERROR: "foo * bar" should be "foo *bar"
#271: FILE: audio/jackaudio.c:215:
+static int qjack_buffer_read_l(QJackBuffer * buffer, float ** dest, int frames)
ERROR: braces {} are necessary for all arms of this statement #277: FILE: audio/jackaudio.c:221:
+ if (copy > used)
[...]
ERROR: braces {} are necessary for all arms of this statement #281: FILE: audio/jackaudio.c:225:
+ if (right > copy)
[...]
ERROR: space required before the open parenthesis '(' #285: FILE: audio/jackaudio.c:229:
+ for(int c = 0; c < buffer->channels; ++c) {
ERROR: braces {} are necessary for all arms of this statement #291: FILE: audio/jackaudio.c:235:
+ if (rptr >= buffer->frames)
[...]
ERROR: braces {} are necessary for all arms of this statement #306: FILE: audio/jackaudio.c:250:
+ if (c->state != QJACK_STATE_RUNNING)
[...]
ERROR: "foo * bar" should be "foo *bar"
#310: FILE: audio/jackaudio.c:254:
+ float * buffers[c->nchannels];
ERROR: space required before the open parenthesis '(' #311: FILE: audio/jackaudio.c:255:
+ for(int i = 0; i < c->nchannels; ++i)
ERROR: braces {} are necessary for all arms of this statement #311: FILE: audio/jackaudio.c:255:
+ for(int i = 0; i < c->nchannels; ++i)
[...]
ERROR: braces {} are necessary for all arms of this statement #314: FILE: audio/jackaudio.c:258:
+ if (c->out)
[...]
+ else
[...]
ERROR: braces {} are necessary for all arms of this statement #321: FILE: audio/jackaudio.c:265:
+ if (c->state == QJACK_STATE_RUNNING)
[...]
ERROR: "foo * bar" should be "foo *bar"
#329: FILE: audio/jackaudio.c:273:
+static int qjack_xrun(void * arg)
ERROR: braces {} are necessary for all arms of this statement #333: FILE: audio/jackaudio.c:277:
+ if (c->state != QJACK_STATE_RUNNING)
[...]
ERROR: that open brace { should be on the previous line #344: FILE: audio/jackaudio.c:288:
+ switch(c->state)
+ {
ERROR: space required before the open parenthesis '(' #344: FILE: audio/jackaudio.c:288:
+ switch(c->state)
ERROR: suspect code indent for conditional statements (4, 6) #369: FILE: audio/jackaudio.c:313:
+ if (jo->c.state != QJACK_STATE_RUNNING)
+ return len;
ERROR: braces {} are necessary for all arms of this statement #369: FILE: audio/jackaudio.c:313:
+ if (jo->c.state != QJACK_STATE_RUNNING)
[...]
ERROR: suspect code indent for conditional statements (4, 6) #379: FILE: audio/jackaudio.c:323:
+ if (ji->c.state != QJACK_STATE_RUNNING)
+ return len;
ERROR: braces {} are necessary for all arms of this statement #379: FILE: audio/jackaudio.c:323:
+ if (ji->c.state != QJACK_STATE_RUNNING)
[...]
ERROR: suspect code indent for conditional statements (4, 6) #398: FILE: audio/jackaudio.c:342:
+ if (opt->exact_name)
+ options |= JackUseExactName;
ERROR: braces {} are necessary for all arms of this statement #398: FILE: audio/jackaudio.c:342:
+ if (opt->exact_name)
[...]
ERROR: suspect code indent for conditional statements (4, 6) #401: FILE: audio/jackaudio.c:345:
+ if (!opt->start_server)
+ options |= JackNoStartServer;
ERROR: braces {} are necessary for all arms of this statement #401: FILE: audio/jackaudio.c:345:
+ if (!opt->start_server)
[...]
ERROR: suspect code indent for conditional statements (4, 6) #404: FILE: audio/jackaudio.c:348:
+ if (opt->server_name)
+ options |= JackServerName;
ERROR: braces {} are necessary for all arms of this statement #404: FILE: audio/jackaudio.c:348:
+ if (opt->server_name)
[...]
ERROR: suspect code indent for conditional statements (8, 10) #412: FILE: audio/jackaudio.c:356:
+ if (status & JackServerFailed)
+ dolog("unable to connect to JACK server\n");
ERROR: braces {} are necessary for all arms of this statement #412: FILE: audio/jackaudio.c:356:
+ if (status & JackServerFailed)
[...]
ERROR: space prohibited between function name and open parenthesis '(' #429: FILE: audio/jackaudio.c:373:
+ jack_set_xrun_callback (c->client, qjack_xrun , c);
ERROR: space prohibited between function name and open parenthesis '(' #430: FILE: audio/jackaudio.c:374:
+ jack_on_shutdown (c->client, qjack_shutdown, c);
WARNING: Block comments use a leading /* on a separate line #440: FILE: audio/jackaudio.c:384:
+ /* ensure the buffersize is no smaller then 512 samples, some (all?) qemu
WARNING: Block comments use a trailing */ on a separate line #441: FILE: audio/jackaudio.c:385:
+ * virtual devices do not work correctly otherwise */
ERROR: braces {} are necessary for all arms of this statement #442: FILE: audio/jackaudio.c:386:
+ if (c->buffersize < 512)
[...]
ERROR: space required before the open parenthesis '(' #450: FILE: audio/jackaudio.c:394:
+ for(int i = 0; i < c->nchannels; ++i) {
ERROR: braces {} are necessary for all arms of this statement #477: FILE: audio/jackaudio.c:421:
+ if (jo->c.state != QJACK_STATE_DISCONNECTED)
[...]
ERROR: braces {} are necessary for all arms of this statement #481: FILE: audio/jackaudio.c:425:
+ if (ret != 0)
[...]
ERROR: braces {} are necessary for all arms of this statement #508: FILE: audio/jackaudio.c:452:
+ if (ji->c.state != QJACK_STATE_DISCONNECTED)
[...]
ERROR: braces {} are necessary for all arms of this statement #512: FILE: audio/jackaudio.c:456:
+ if (ret != 0)
[...]
ERROR: space required before the open parenthesis '(' #539: FILE: audio/jackaudio.c:483:
+ for(int i = 0; i < c->nchannels; ++i)
ERROR: braces {} are necessary for all arms of this statement #539: FILE: audio/jackaudio.c:483:
+ for(int i = 0; i < c->nchannels; ++i)
[...]
ERROR: braces {} are necessary for all arms of this statement #558: FILE: audio/jackaudio.c:502:
+ if (c->state != QJACK_STATE_IDLE)
[...]
ERROR: "foo * bar" should be "foo *bar"
#582: FILE: audio/jackaudio.c:526:
+static int qjack_thread_creator(jack_native_thread_t * thread,
ERROR: braces {} are necessary for all arms of this statement #586: FILE: audio/jackaudio.c:530:
+ if (ret != 0)
[...]
ERROR: "foo* bar" should be "foo *bar"
#595: FILE: audio/jackaudio.c:539:
+static void* qjack_init(Audiodev *dev)
ERROR: space prohibited between function name and open parenthesis '(' #604: FILE: audio/jackaudio.c:548:
+static void qjack_fini (void *opaque)
total: 80 errors, 3 warnings, 703 lines checked
Commit aaf9cf216407 (audio/jack: add JACK client audiodev) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]