GStreamer Buffer Synchronization: Documentation - api reference

From RidgeRun Developer Wiki


Previous: Documentation Index Next: Documentation/GStreamer





Library API

The API documentation for the library is available on this link:

Link to the library API documentation

This is the auto-generated API documentation that includes the ISynchronizer and the IBuffer, which define the public API of the library.

Library example

A functional code should look like

#include <iostream>
#include <vector>
#include <memory>
#include <rrsyncer/isynchronizer.hpp>
#include <rrsyncer/buffer/buffer.hpp>

int main() {
    size_t stream_count = 3;

    std::shared_ptr<rrsyncer::ISynchronizer> syncer = rrsyncer::ISynchronizer::Build(
        rrsyncer::ISynchronizer::Synchronizers::kVideo);

    std::vector<std::shared_ptr<rrsyncer::Buffer<int>>> buffers(stream_count);
    for (size_t i = 0; i < stream_count; ++i) {
        buffers[i] = std::make_shared<rrsyncer::Buffer<int>>();
        buffers[i]->SetTimeStamp(i);
    }

    auto settings = std::make_shared<rrsyncer::ISynchronizer::Settings>();
    settings->function = rrsyncer::ISynchronizer::Function::kNearestNeighbor;
    settings->mode = rrsyncer::ISynchronizer::OperationMode::kOnCall;
    settings->point = rrsyncer::ISynchronizer::CentralPoint::kMedian;
    settings->rate = 30;
    settings->timeout = 0;

    syncer->Configure(settings, stream_count);

    syncer->PushBuffer(buffers.at(0), 0);
    syncer->PushBuffer(buffers.at(0), 1);
    syncer->PushBuffer(buffers.at(0), 2);

    std::vector<std::shared_ptr<rrsyncer::IBuffer>> bufferspopped(stream_count);
    syncer->PopBuffers(bufferspopped);

    std::cout << "Popped buffers successfully.\n";
    return 0;
}

And, can be compiled with

 
g++ -std=c++14 test.cpp -o syncer_example $(pkg-config --cflags --libs rrsyncer)

You can find more functional examples in the api examples page.



Previous: Documentation Index Next: Documentation/GStreamer