Changeset View
Changeset View
Standalone View
Standalone View
src/context.cpp
Show First 20 Lines • Show All 425 Lines • ▼ Show 20 Line(s) | |||||
426 | 426 | | |||
427 | void Context::serverCallback(const pa_server_info *info) | 427 | void Context::serverCallback(const pa_server_info *info) | ||
428 | { | 428 | { | ||
429 | m_server->update(info); | 429 | m_server->update(info); | ||
430 | } | 430 | } | ||
431 | 431 | | |||
432 | void Context::setCardProfile(quint32 index, const QString &profile) | 432 | void Context::setCardProfile(quint32 index, const QString &profile) | ||
433 | { | 433 | { | ||
434 | if (!m_context) { | ||||
435 | return; | ||||
436 | } | ||||
434 | qCDebug(PLASMAPA) << index << profile; | 437 | qCDebug(PLASMAPA) << index << profile; | ||
435 | if (!PAOperation(pa_context_set_card_profile_by_index(m_context, | 438 | if (!PAOperation(pa_context_set_card_profile_by_index(m_context, | ||
436 | index, | 439 | index, | ||
437 | profile.toUtf8().constData(), | 440 | profile.toUtf8().constData(), | ||
438 | nullptr, nullptr))) { | 441 | nullptr, nullptr))) { | ||
439 | qCWarning(PLASMAPA) << "pa_context_set_card_profile_by_index failed"; | 442 | qCWarning(PLASMAPA) << "pa_context_set_card_profile_by_index failed"; | ||
440 | return; | 443 | return; | ||
441 | } | 444 | } | ||
442 | } | 445 | } | ||
443 | 446 | | |||
444 | void Context::setDefaultSink(const QString &name) | 447 | void Context::setDefaultSink(const QString &name) | ||
445 | { | 448 | { | ||
449 | if (!m_context) { | ||||
450 | return; | ||||
451 | } | ||||
446 | const QByteArray nameData = name.toUtf8(); | 452 | const QByteArray nameData = name.toUtf8(); | ||
447 | if (!PAOperation(pa_context_set_default_sink(m_context, | 453 | if (!PAOperation(pa_context_set_default_sink(m_context, | ||
448 | nameData.constData(), | 454 | nameData.constData(), | ||
449 | nullptr, | 455 | nullptr, | ||
450 | nullptr))) { | 456 | nullptr))) { | ||
451 | qCWarning(PLASMAPA) << "pa_context_set_default_sink failed"; | 457 | qCWarning(PLASMAPA) << "pa_context_set_default_sink failed"; | ||
452 | } | 458 | } | ||
453 | } | 459 | } | ||
454 | 460 | | |||
455 | void Context::setDefaultSource(const QString &name) | 461 | void Context::setDefaultSource(const QString &name) | ||
456 | { | 462 | { | ||
463 | if (!m_context) { | ||||
464 | return; | ||||
465 | } | ||||
457 | const QByteArray nameData = name.toUtf8(); | 466 | const QByteArray nameData = name.toUtf8(); | ||
458 | if (!PAOperation(pa_context_set_default_source(m_context, | 467 | if (!PAOperation(pa_context_set_default_source(m_context, | ||
459 | nameData.constData(), | 468 | nameData.constData(), | ||
460 | nullptr, | 469 | nullptr, | ||
461 | nullptr))) { | 470 | nullptr))) { | ||
462 | qCWarning(PLASMAPA) << "pa_context_set_default_source failed"; | 471 | qCWarning(PLASMAPA) << "pa_context_set_default_source failed"; | ||
463 | } | 472 | } | ||
464 | } | 473 | } | ||
465 | 474 | | |||
466 | void Context::streamRestoreWrite(const pa_ext_stream_restore_info *info) | 475 | void Context::streamRestoreWrite(const pa_ext_stream_restore_info *info) | ||
467 | { | 476 | { | ||
477 | if (!m_context) { | ||||
478 | return; | ||||
479 | } | ||||
468 | if (!PAOperation(pa_ext_stream_restore_write(m_context, | 480 | if (!PAOperation(pa_ext_stream_restore_write(m_context, | ||
469 | PA_UPDATE_REPLACE, | 481 | PA_UPDATE_REPLACE, | ||
470 | info, | 482 | info, | ||
471 | 1, | 483 | 1, | ||
472 | true, | 484 | true, | ||
473 | nullptr, | 485 | nullptr, | ||
474 | nullptr))) { | 486 | nullptr))) { | ||
475 | qCWarning(PLASMAPA) << "pa_ext_stream_restore_write failed"; | 487 | qCWarning(PLASMAPA) << "pa_ext_stream_restore_write failed"; | ||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |