示例#1
0
CentralWidget::CentralWidget(QWidget *parent) :
    QWidget(parent)
{
    createVideoPlayer();
    createAudioPlayer();
    createTcpClient();
    createCmd();
#ifdef CONFIG_SPEAKER
    createSpeaker();
#endif

    setLayout(createLayout());

    setupKeyHook();

    readLocalSettings();

    initRemoteSettings();
}
示例#2
0
SLresult AudioOutput::initSoundTrack(int channels, int accompanySampleRate,
                                     audioCallback produceDataCallback, void* ctx) {
    ALOGI("enter AudioOutput::initSoundTrack");

    this->ctx = ctx;
    this->produceDataCallback = produceDataCallback;
    SLresult result = SL_RESULT_UNKNOWN_ERROR;
    SLESContext* SLESContext = SLESContext::GetInstance();
    engineEngine = SLESContext->getEngine();

    if (engineEngine == NULL){
        return result;
    }

    ALOGI("Create output mix object");

    result = createOutputMix();
    if (SL_RESULT_SUCCESS != result) {
        return result;
    }

    ALOGI("Realize output mix object");
    result = realizeObject(outputMixObject);
    if (SL_RESULT_SUCCESS != result) {
        return result;
    }

    ALOGI("Initialize buffer");
    bufferSize = channels * accompanySampleRate * 2 * DEFAULT_AUDIO_BUFFER_DURATION_IN_SECS;
    // Initialize buffer
    initPlayerBuffer();

    ALOGI("Create the buffer queue audio player object");
    // Create the buffer queue audio player object
    result = createAudioPlayer(channels, accompanySampleRate);
    if (SL_RESULT_SUCCESS != result) {
        freePlayerBuffer();
        destroyObject(outputMixObject);
        return result;
    }

    ALOGI("Realize audio player object");
    // Realize audio player object
    result = realizeObject(audioPlayerObject);
    if (SL_RESULT_SUCCESS != result) {
        freePlayerBuffer();
        destroyObject(outputMixObject);
        return result;
    }

    ALOGI("Get audio player buffer queue interface");
    // Get audio player buffer queue interface
    result = getAudioPlayerBufferQueueInterface();
    if (SL_RESULT_SUCCESS != result) {
        destroyObject(audioPlayerObject);
        freePlayerBuffer();
        destroyObject(outputMixObject);
        return result;
    }

    ALOGI("Registers the player callback");
    // Registers the player callback
    result = registerPlayerCallback();
    if (SL_RESULT_SUCCESS != result) {
        destroyObject(audioPlayerObject);
        freePlayerBuffer();
        destroyObject(outputMixObject);
        return result;
    }

    ALOGI("Get audio player play interface");
    // Get audio player play interface
    result = getAudioPlayerPlayInterface();
    if (SL_RESULT_SUCCESS != result) {
        destroyObject(audioPlayerObject);
        freePlayerBuffer();
        destroyObject(outputMixObject);
        return result;
    }	ALOGI("leave init");
    return SL_RESULT_SUCCESS;
}