C++ 高性能网络开发库 LibSourcey

码农软件 · 软件分类 · 高性能网络开发库 · 2019-08-31 15:12:09

软件介绍

LibSourcey 是跨平台 C++11 模块和类的集合,为开发人员提供了一个快速开发基于 p2p 和媒体流应用程序的高性能网络的库。可以把它看作 libuv 与 FFmpeg,OpenCV 和 WebRTC 特性的高度结合,所有这些都具有 stl(C++标准库)的易用性和可读性。

使用 LibSourcey 一个很好的出发点是 PacketStream,它可用来创建用于管道,处理并输出任意数据分组的动态委托链。分层分组处理器和动态功能的方法使得它能够快速且容易地开发出复杂的数据处理应用程序。

例如,下面的代码将介绍如何捕捉实时摄像头流,将其编码为 H.264,并通过互联网实时广播它:

// Create a PacketStream to pass packets from the
// input device captures => encoder => socket
PacketStream stream;

// Setup the encoder options
av::EncoderOptions options;
options.oformat = av::Format("MP4", "mp4",
    av::VideoCodec("H.264", "libx264", 400, 300, 25, 48000, 128000, "yuv420p"),
    av::AudioCodec("AAC", "libfdk_aac", 2, 44100, 64000, "s16"));

// Create a device manager instance to enumerate system devices
av::DeviceManager devman;
av::Device device;

// Create and attach the default video capture
av::VideoCapture::Ptr video;
if (devman.getDefaultCamera(device)) {
    video.open(device.id, 640, 480, 30);
    video.getEncoderFormat(options.iformat);
    stream.attachSource(video, true);
}

// Create and attach the default audio capture
av::AudioCapture::Ptr audio;
if (devman.getDefaultMicrophone(device)) {
    audio.open(device.id, 2, 44100);
    audio.getEncoderFormat(options.iformat);
    stream.attachSource(audio, true);
}

// Create and attach the multiplex encoder
av::MultiplexPacketEncoder::Ptr encoder(options);
stream.attach(encoder);

// Attach the output net::Socket instance (instantiated elsewhere)
// to broadcast encoded packets over the network
stream.attach(socket);

// Start the stream
// This method call will start the device captures and begin
// pumping encoded media into the output socket
stream.start();

本文地址:https://codercto.com/soft/d/13577.html

Rework

Rework

Jason Fried、David Heinemeier Hansson / Crown Business / 2010-3-9 / USD 22.00

"Jason Fried and David Hansson follow their own advice in REWORK, laying bare the surprising philosophies at the core of 37signals' success and inspiring us to put them into practice. There's no jarg......一起来看看 《Rework》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具