Example #1
0
CoreAV::CoreAV(Tox* tox)
    : coreavThread{new QThread}
    , iterateTimer{new QTimer{this}}
    , threadSwitchLock{false}
{
    coreavThread->setObjectName("qTox CoreAV");
    moveToThread(coreavThread.get());

    iterateTimer->setSingleShot(true);
    connect(iterateTimer.get(), &QTimer::timeout, this, &CoreAV::process);

    toxav = toxav_new(tox, nullptr);

    toxav_callback_call(toxav, CoreAV::callCallback, this);
    toxav_callback_call_state(toxav, CoreAV::stateCallback, this);
#if TOX_VERSION_IS_API_COMPATIBLE(0, 2, 0)
    toxav_callback_audio_bit_rate(toxav, CoreAV::audioBitrateCallback, this);
    toxav_callback_video_bit_rate(toxav, CoreAV::videoBitrateCallback, this);
#else
    toxav_callback_bit_rate_status(toxav, CoreAV::bitrateCallback, this);
#endif
    toxav_callback_audio_receive_frame(toxav, CoreAV::audioFrameCallback, this);
    toxav_callback_video_receive_frame(toxav, CoreAV::videoFrameCallback, this);

    coreavThread->start();
}
Example #2
0
void setToxAvCallbacks(ToxAV* av, void* userData)
{
    toxav_callback_call(av, _friendCallRequestCb, userData);
    toxav_callback_call_state(av, _friendCallStateChangeCb, userData);
    toxav_callback_audio_receive_frame(av, _friendAudioFrameReceivedCb, userData);
    toxav_callback_video_receive_frame(av, _friendVideoFrameReceivedCb, userData);
    toxav_callback_bit_rate_status(av, _friendAvRateChangeCb, userData);

    return;
}