VSourceFile C++ lib. Compressed video capture from encoded H264 and HEVC (*.h264 and *.hevc) video files

€200.00

VSourceFile C++ library provides compressed video frame capture from encoded H264 and HEVC (*.h264 and *.hevc) video files.

We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive license. You pay once and can use this library in your software and hardware products without limits. Please read the license agreement before purchasing: LICENSE.

VSourceFile C++ library provides compressed video frame capture from encoded H264 and HEVC (*.h264 and *.hevc) video files.

We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive license. You pay once and can use this library in your software and hardware products without limits. Please read the license agreement before purchasing: LICENSE.

Overview

VSourceFile C++ library provides compressed video frame capture from encoded H264 and HEVC (*.h264 and *.hevc) video files. The library inherits interface from open source VSource interface class. VSource.h file contains data structures VSourceParams class, VSourceCommand enum, VSourceParam enum and includes VSource class declaration. VSourceParams class contains video source parameters and methods to encode (serialize) and decode (deserialize) video source params. VSourceCommands enum contains IDs of commands supported by VSource class. VSourceParam enum contains IDs of parameters supported by VSource class. VSourceFile depends on libraries: VSource interface class (provides interface for video sources, source code included, Apache 2.0 license) and open source Logger library (provides method to write logs, source code included, Apache 2.0 license). The library supports C++17 standard.

Documentation

Documentation: GO TO DOCUMENTATION

Simple interface

class VSourceFile : public VSource
{
public:
    /// Get string of current library version.
    static std::string getVersion();

    /// Open video source.
    bool openVSource(std::string& initString) override;

    /// Init video source.
    bool initVSource(VSourceParams& params) override;

    /// Get open status.
    bool isVSourceOpen() override;

    /// Close video source.
    void closeVSource() override;

    /// Get new video frame.
    bool getFrame(Frame& frame, int32_t timeoutMsec = 0) override;

    /// Set video source parameter.
    bool setParam(VSourceParam id, float value) override;

    /// Get video source param value.
    float getParam(VSourceParam id) override;

    /// Get video source params structure.
    void getParams(VSourceParams& params) override;

    /// Execute command.
    bool executeCommand(VSourceCommand id) override;
            
    /// Decode and execute command.
    bool decodeAndExecuteCommand(uint8_t* data, int size) override;
};

Simple example

#include <iostream>
#include "VSourceFile.h"

int main(void)
{
    // Init video source.
    std::string initString = "test.h264;1280;720;30";
    cr::video::VSource* source = new cr::video::VSourceFile();
    if (!source->openVSource(initString))
        return -1;

    // Main loop.
    cr::video::Frame frame;
    while (true)
    {
        // Wait new frame 1 sec.
        if (!source->getFrame(frame, 1000))
        {
            std::cout << "No input frame" << std::endl;
            continue;
        }

        std::cout << "New frame " << frame.frameId <<
        " (" << frame.width << "x" << frame.height << ") " <<
        frame.size << " bytes cycle time " <<
        (int)source->getParam(cr::video::VSourceParam::CYCLE_TIME_MKS) <<
        " us" << std::endl; 
    }

    return 1;
}