~diwic/ubuntu/lucid/pulseaudio/bugfixes

« back to all changes in this revision

Viewing changes to src/modules/module-jack-source.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2008-11-04 15:46:00 UTC
  • mfrom: (1.2.1 upstream) (1.1.6 lenny)
  • Revision ID: james.westby@ubuntu.com-20081104154600-hlzknpcazaam0nxm
Tags: 0.9.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Don't build against, and create jack package. Jack is not in main.
  - Remove --disable-per-user-esound-socket from configure flags, as we still
    want per user esound sockets.
  - Remove stop links from rc0 and rc6.
  - Change default resample algorithm and bubffer size.
  - Add alsa configuration files to route alsa applications via pulseaudio.
  - Move libasound2-plugins from Recommends to Depends.
* debian/pulseaudio.preinst: When upgrading from intrepid, remove
  /etc/X11/Xsession.d/70pulseaudio, as this was used to minimize a race
  condition when starting GNOME in intrepid. This race should not exist in
  jaunty once libcanberra is built to use pulseaudio as a backend.
* Do not spawn a pulseaudio server if clients fail to find a running server.
* Remove explicit version dependency for libspeex-dev to allow the package
  to be built for now.
* Regenerate autotools files to work with Ubuntu's newer libtool/libltdl.
* debian/control: libpulsecore5 -> libpulsecore8 to match the library
  soname.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: module-jack-source.c 2159 2008-03-27 23:29:32Z lennart $ */
2
 
 
3
1
/***
4
2
  This file is part of PulseAudio.
5
3
 
118
116
            if (u->source->thread_info.state == PA_SOURCE_RUNNING)
119
117
                pa_source_post(u->source, chunk);
120
118
 
121
 
            u->saved_frame_time = offset;
 
119
            u->saved_frame_time = (jack_nframes_t) offset;
122
120
            u->saved_frame_time_valid = TRUE;
123
121
 
124
122
            return 0;
253
251
    pa_bool_t do_connect = TRUE;
254
252
    unsigned i;
255
253
    const char **ports = NULL, **p;
256
 
    char *t;
 
254
    pa_source_new_data data;
257
255
 
258
256
    pa_assert(m);
259
257
 
278
276
    m->userdata = u;
279
277
    u->saved_frame_time_valid = FALSE;
280
278
 
281
 
    pa_thread_mq_init(&u->thread_mq, m->core->mainloop);
282
279
    u->rtpoll = pa_rtpoll_new();
283
 
    pa_rtpoll_item_new_asyncmsgq(u->rtpoll, PA_RTPOLL_EARLY, u->thread_mq.inq);
 
280
    pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
284
281
 
285
282
    u->jack_msgq = pa_asyncmsgq_new(0);
286
 
    u->rtpoll_item = pa_rtpoll_item_new_asyncmsgq(u->rtpoll, PA_RTPOLL_EARLY-1, u->jack_msgq);
 
283
    u->rtpoll_item = pa_rtpoll_item_new_asyncmsgq_read(u->rtpoll, PA_RTPOLL_EARLY-1, u->jack_msgq);
287
284
 
288
285
    if (!(u->client = jack_client_open(client_name, server_name ? JackServerName : JackNullOption, &status, server_name))) {
289
286
        pa_log("jack_client_open() failed.");
304
301
        goto fail;
305
302
    }
306
303
 
307
 
    pa_assert_se(pa_channel_map_init_auto(&map, channels, PA_CHANNEL_MAP_AUX));
308
 
    pa_channel_map_init_auto(&map, channels, PA_CHANNEL_MAP_ALSA);
 
304
    pa_channel_map_init_extend(&map, channels, PA_CHANNEL_MAP_ALSA);
309
305
    if (pa_modargs_get_channel_map(ma, NULL, &map) < 0 || map.channels != channels) {
310
306
        pa_log("failed to parse channel_map= argument.");
311
307
        goto fail;
313
309
 
314
310
    pa_log_info("Successfully connected as '%s'", jack_get_client_name(u->client));
315
311
 
316
 
    ss.channels = u->channels = channels;
 
312
    u->channels = ss.channels = (uint8_t) channels;
317
313
    ss.rate = jack_get_sample_rate(u->client);
318
314
    ss.format = PA_SAMPLE_FLOAT32NE;
319
315
 
326
322
        }
327
323
    }
328
324
 
329
 
    if (!(u->source = pa_source_new(m->core, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, &map))) {
330
 
        pa_log("failed to create source.");
 
325
    pa_source_new_data_init(&data);
 
326
    data.driver = __FILE__;
 
327
    data.module = m;
 
328
    pa_source_new_data_set_name(&data, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME));
 
329
    pa_source_new_data_set_sample_spec(&data, &ss);
 
330
    pa_source_new_data_set_channel_map(&data, &map);
 
331
    pa_proplist_sets(data.proplist, PA_PROP_DEVICE_API, "jack");
 
332
    if (server_name)
 
333
        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, server_name);
 
334
    pa_proplist_setf(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Jack source (%s)", jack_get_client_name(u->client));
 
335
    pa_proplist_sets(data.proplist, "jack.client_name", jack_get_client_name(u->client));
 
336
 
 
337
    u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY);
 
338
    pa_source_new_data_done(&data);
 
339
 
 
340
    if (!u->source) {
 
341
        pa_log("Failed to create source.");
331
342
        goto fail;
332
343
    }
333
344
 
334
345
    u->source->parent.process_msg = source_process_msg;
335
346
    u->source->userdata = u;
336
 
    u->source->flags = PA_SOURCE_LATENCY;
337
347
 
338
 
    pa_source_set_module(u->source, m);
339
348
    pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
340
349
    pa_source_set_rtpoll(u->source, u->rtpoll);
341
 
    pa_source_set_description(u->source, t = pa_sprintf_malloc("Jack source (%s)", jack_get_client_name(u->client)));
342
 
    pa_xfree(t);
343
350
 
344
351
    jack_set_process_callback(u->client, jack_process, u);
345
352
    jack_on_shutdown(u->client, jack_shutdown, u);