Giter Site home page Giter Site logo

libssp's People

Contributors

ailike avatar jilternj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

libssp's Issues

Need to set "#define _GLIBCXX_USE_CXX11_ABI 0" in libssp_test.cpp to compile with g++ 9.3.0

When compiling with g++ 9.3.0 linking fails with:

/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/CMakeFiles/example.dir/__/libssp/example/libssp_test.cpp.o: in function `setup(imf::Loop*)':
libssp_test.cpp:(.text+0x1c1): undefined reference to `imf::SspClient::SspClient(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, imf::Loop*, unsigned long, unsigned short, unsigned int)'
collect2: error: ld returned 1 exit status

Changing the macro definition to
#define _GLIBCXX_USE_CXX11_ABI 0
results in a successful compile and an executable that can be started.

This is related to issue #1, only this time, the solution seems to be inverted.

z-cam libssp example not working

I downloaded the source code and created a build folder inside the examples and ran the following command,

g++ ../libssp_test.cpp -std=c++11 -L../../lib/linux_x64/ -lssp -lpthread -I../../include/ -I../../include/libuv/include/ -lrt -o libssp_test

ERROR

/usr/bin/ld: cannot find -lssp


Environment,
Ubuntu 16.04
gcc compiler verison is 5.4.0

Kind of urgent can you help resolve this?

I tried to remove -lssp and got this,

g++ ../libssp_test.cpp -std=c++11 -L../../lib/linux_x64/ -lpthread -I../../include/ -I../../include/libuv/include/ -lrt -o libssp_test

ERROR:

../libssp_test.cpp: In function ‘void on_264_1(imf::SspH264Data*)’:
../libssp_test.cpp:24:91: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
264 [%d] [%lld] [%d] [%d]\n", h264->frm_no, h264->pts, h264->type, h264->len);
^
../libssp_test.cpp:24:91: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
../libssp_test.cpp: In function ‘void on_264_2(imf::SspH264Data*)’:
../libssp_test.cpp:29:91: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
264 [%d] [%lld] [%d] [%d]\n", h264->frm_no, h264->pts, h264->type, h264->len);
^
../libssp_test.cpp:29:91: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
/tmp/ccY7iUs4.o: In function setup(imf::Loop*)': libssp_test.cpp:(.text+0x287): undefined reference to imf::SspClient::SspClient(std::string const&, imf::Loop*, unsigned long, unsigned short, unsigned int)'
libssp_test.cpp:(.text+0x29d): undefined reference to imf::SspClient::init()' libssp_test.cpp:(.text+0x2e8): undefined reference to imf::SspClient::setOnH264DataCallback(std::function<void (imf::SspH264Data*)> const&)'
libssp_test.cpp:(.text+0x347): undefined reference to imf::SspClient::setOnMetaCallback(std::function<void (imf::SspVideoMeta*, imf::SspAudioMeta*, imf::SspMeta*)> const&)' libssp_test.cpp:(.text+0x393): undefined reference to imf::SspClient::setOnDisconnectedCallback(std::function<void ()> const&)'
libssp_test.cpp:(.text+0x3e4): undefined reference to imf::SspClient::setOnAudioDataCallback(std::function<void (imf::SspAudioData*)> const&)' libssp_test.cpp:(.text+0x3ff): undefined reference to imf::SspClient::start()'
/tmp/ccY7iUs4.o: In function imf::ThreadLoop::~ThreadLoop()': libssp_test.cpp:(.text._ZN3imf10ThreadLoopD2Ev[_ZN3imf10ThreadLoopD5Ev]+0x2c): undefined reference to imf::Loop::quit()'
/tmp/ccY7iUs4.o: In function imf::ThreadLoop::run()': libssp_test.cpp:(.text._ZN3imf10ThreadLoop3runEv[_ZN3imf10ThreadLoop3runEv]+0x20): undefined reference to imf::Loop::Loop()'
libssp_test.cpp:(.text._ZN3imf10ThreadLoop3runEv[_ZN3imf10ThreadLoop3runEv]+0x4b): undefined reference to imf::Loop::init()' libssp_test.cpp:(.text._ZN3imf10ThreadLoop3runEv[_ZN3imf10ThreadLoop3runEv]+0x95): undefined reference to imf::Loop::loop()'
/tmp/ccY7iUs4.o: In function std::default_delete<imf::Loop>::operator()(imf::Loop*) const': libssp_test.cpp:(.text._ZNKSt14default_deleteIN3imf4LoopEEclEPS1_[_ZNKSt14default_deleteIN3imf4LoopEEclEPS1_]+0x1e): undefined reference to imf::Loop::~Loop()'
collect2: error: ld returned 1 exit status


ARM support

Can you provide version for ARM? I want to use this library on Allwinner H3 CPU (Quad-Core ARM Cortex-A7) under Linux.

linux libssp.so soname not right

libssp.so soname not right,the real soname is:
image

and it result in so not found error,when complie and link example application.

image

Linux - Undefined reference

I can't compile with the Linux library since commit 5102654.
There was no problem with commit 051f1a3.

This is the error I get when trying to 'make' the example (libssp_test.cpp):
libssp_test.cpp:(.text+0x1c1): undefined reference to `imf::SspClient::SspClient(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, imf::Loop*, unsigned long, unsigned short, unsigned int)'

When linking with libssp, the program requires liblibssp

When linking the example with
g++ -std=c++11 libssp_test.cpp -pthread -lssp

ldd a.out will show a dependency on liblibssp:
liblibssp.so => not found

The reason is that the soname is incorrectly set. Probably one lib to much while linking.
$ patchelf --print-soname libssp.so
prints
liblibssp.so

Using
$ patchelf --set-soname libssp.so libssp.so
fixes the issue.

How to write out H264 data in a valid way?

Hello, I'm on Linux CentOS 7 x64. I have a Zcam V1 Pro.

I'm not a C++ expert so this may not be the best way, but I've modified the libssp_test.cpp file a little bit to:

  • dump h264 data to a file called "output.h264"
  • catch ctrl+c and close the file.
  • assume zcam IP from the "ZCAM_IP" env variable
  • print debug prints to stderr instead of stdout
  • only print debug prints when "DEBUG" env variable is set.

Here is my code in full:

#define _GLIBCXX_USE_CXX11_ABI 1
#include <functional>
#include <memory>
#include <thread>
#include <string>

#include <stdlib.h>

#include "imf/net/loop.h"
#include "imf/net/threadloop.h"
#include "imf/ssp/sspclient.h"

using namespace std::placeholders;

#ifdef _DEBUG
#pragma comment (lib, "libsspd.lib")
#else
#pragma comment (lib, "libssp.lib")
#endif

static FILE* output_file;


static void on_264_1(struct imf::SspH264Data * h264)
{
	if (std::getenv("DEBUG"))
		fprintf(stderr, "on 1 264 [frm_no: %i] [pts: %lld] [type: %d] [ntp_timestamp: %lld] [data length: %d]\n", h264->frm_no, h264->pts, h264->type, h264->ntp_timestamp, h264->len);

	fwrite(h264->data, 1, h264->len, output_file);
}

static void on_264_2(struct imf::SspH264Data * h264)
{
	fprintf(stderr, "on 2 264 [frm_no: %i] [pts: %lld] [type: %d] [ntp_timestamp: %lld] [data length: %d]\n", h264->frm_no, h264->pts, h264->type, h264->ntp_timestamp, h264->len);
}

static void on_audio_data_1(struct imf::SspAudioData * audio)
{
	if (std::getenv("DEBUG"))
		fprintf(stderr, "on audio data 1 [pts: %lld] [ntp_timestamp: %lld] [data length: %d]\n", audio->pts, audio->ntp_timestamp, audio->len);
}

static void on_meta_1(struct imf::SspVideoMeta *v, struct imf::SspAudioMeta *a, struct imf::SspMeta * m)
{
	fprintf(stderr, "on meta 1 wall clock %d", m->pts_is_wall_clock);
	fprintf(stderr, "              video %dx%d %d/%d\n", v->width, v->height, v->unit, v->timescale);
	fprintf(stderr, "              audio %d\n", a->sample_rate);
}

static void on_disconnect()
{
	fclose(output_file);
	fprintf(stderr, "on disconnect\n");
}

void signal_handler(int s)
{
	printf("Caught signal %d\n", s);
	fclose(output_file);
	exit(1);
}

static void setup(imf::Loop *loop)
{
	signal(SIGINT, signal_handler);

	output_file = fopen("output.h264", "w+b");
	std::string ip = std::getenv("ZCAM_IP");
	imf::SspClient * client = new imf::SspClient(ip, loop, 0x400000);
	client->init();

	client->setOnH264DataCallback(std::bind(on_264_1, _1));
	client->setOnMetaCallback(std::bind(on_meta_1, _1, _2, _3));
	client->setOnDisconnectedCallback(std::bind(on_disconnect));
	client->setOnAudioDataCallback(std::bind(on_audio_data_1, _1));

	client->start();

}

int main(int argc, char ** argv)
{
	std::unique_ptr<imf::ThreadLoop> threadLooper(new imf::ThreadLoop(std::bind(setup, _1)));
	threadLooper->start();

	while (1) {
		std::this_thread::sleep_for(std::chrono::seconds(1));
	}

	threadLooper->stop();
	return 0;
}

I can compile it and it runs and writes my file. I have a few questions though:

  1. What sets the encoding settings? Is it using the settings for video mode on the zcam?

  2. In your opinion, am I dumping the data to disk in a valid way? (fwrite(h264->data, 1, h264->len, output_file); = OK?)

  3. The written file is supposed to be a raw H264 stream, correct?

I tried calling ffmpeg's ffprobe utility on it and it seems to hint that it may be invalid/corrupt:

$ ffprobe output.h264 
ffprobe version 3.1 Copyright © 2007-2016 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
  configuration: --prefix=/Volumes/fpsan1-nas/fps/people/greg/ffmpeg-libs --enable-static --extra-cflags='-I/Volumes/fpsan1-nas/fps/people/greg/ffmpeg-libs/include -fopenmp -static' --extra-ldflags=-fopenmp --pkg-config-flags=--static --prefix=/Volumes/fpsan1-nas/fps/people/greg/ffmpeg-libs --enable-libfdk-aac --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --cc=gcc --enable-nonfree
  libavutil      55. 27.100 / 55. 27.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 40.101 / 57. 40.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.102 /  6. 46.102
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[h264 @ 0x388bac0] Format h264 detected only with low score of 1, misdetection possible!
[h264 @ 0x388cfa0] non-existing PPS 0 referenced
[h264 @ 0x388cfa0] Invalid NAL unit 0, skipping.
    Last message repeated 6 times
[h264 @ 0x388cfa0] slice type 32 too large at -1
[h264 @ 0x388cfa0] decode_slice_header error
[h264 @ 0x388cfa0] no frame!
[h264 @ 0x388cfa0] missing picture in access unit with size 98288
[h264 @ 0x388cfa0] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x388cfa0] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. ([email protected])
[h264 @ 0x388cfa0] no frame!
[h264 @ 0x388cfa0] sps_id 1 out of range
[h264 @ 0x388cfa0] non-existing PPS 0 referenced
[h264 @ 0x388cfa0] Invalid NAL unit 2, skipping.
[h264 @ 0x388cfa0] Invalid NAL unit 0, skipping.
    Last message repeated 4 times
[h264 @ 0x388cfa0] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x388cfa0] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. ([email protected])
[h264 @ 0x388cfa0] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x388cfa0] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. ([email protected])
[h264 @ 0x388cfa0] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x388cfa0] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. ([email protected])
[h264 @ 0x388cfa0] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x388cfa0] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. ([email protected])
[h264 @ 0x388cfa0] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x388cfa0] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. ([email protected])
[h264 @ 0x388cfa0] no frame!
[h264 @ 0x388bac0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[h264 @ 0x388bac0] decoding for stream 0 failed
[h264 @ 0x388bac0] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, h264, from 'output.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264, none, 25 fps, 25 tbr, 1200k tbn, 50 tbc

Likewise, ffmpeg fails to encode me an mp4 from it, so something is wrong... but I don't understand where.

Any advice?? :/

How to compile the example in windows?

I am trying to compile the example on windows using clion and vs19, which according to windows should work. vs15, vs17 and vs19 all have compatible libs. Now I have following CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.9)
project (zcam)

include_directories(include)

add_executable(ssp_test example/libssp_test.cpp)

target_link_libraries(ssp_test lib/win_x64_vs2017/libsspd)

But I get following error:

LINK : fatal error LNK1104: cannot open file 'lib\win_x64_vs2017\libsspd.lib'
NMAKE : fatal error U1077: '"C:\Program Files\JetBrains\CLion 2020.1.2\bin\cmake\win\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.

Could you provide an example CMakeLists.txt or some instructions how to build the example?

Linux compilation error: "collect2: error: ld returned 1 exit status"

Do these errors say anything to you?

$ cd example/linux/
$ make all
g++ ../libssp_test.cpp -std=c++11 -L../../lib/linux_x64/ -lssp -lpthread -I../../include/ -I../../include/libuv/include/ -lrt -o libssp_test
../libssp_test.cpp: In function ‘void on_264_1(imf::SspH264Data*)’:
../libssp_test.cpp:24:91: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
  printf("on 1 264 [%d] [%lld] [%d] [%d]\n", h264->frm_no, h264->pts, h264->type, h264->len);
                                                                                           ^
../libssp_test.cpp:24:91: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
../libssp_test.cpp: In function ‘void on_264_2(imf::SspH264Data*)’:
../libssp_test.cpp:29:91: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
  printf("on 2 264 [%d] [%lld] [%d] [%d]\n", h264->frm_no, h264->pts, h264->type, h264->len);
                                                                                           ^
../libssp_test.cpp:29:91: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
/tmp/ccVSbn5M.o: In function `setup(imf::Loop*)':
libssp_test.cpp:(.text+0x287): undefined reference to `imf::SspClient::SspClient(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, imf::Loop*, unsigned long, unsigned short, unsigned int)'
collect2: error: ld returned 1 exit status
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

I have g++ 5.4.0 on Ubuntu 16.04 LTS.

Curiously, at work on a CentOS 7 machine I was able to compile it just fine.

What are the real minimum requirements for a successful build? Which versions of what?

Streaming resolution over ethernet

I have implemented the c++ code as provided and able to get the stream from the camera over LAN. I am using ZCam E2.

I notice that whatever be the setting i set in the camera, C4K, 4K or 3696 x 2772, the max resolution of the stream in 1920 x 1080. Is this a bug or a limitation?

Missing 'create_ssp_class' in linux .so

I see there is no create_ssp_class function in the linux_x64 variant of the library. Function exists in macos and windows variant and it's suppose to return the pointer to imf::SspClient. This function is useful when want get the imf::SspClient from dlopen/dlsym like in this example: https://github.com/summershrimp/obs-ssp/blob/be1282a/src/obs-ssp.cpp#L51 however from what I see it's impossible on linux.

windows:

$ strings lib/win_x64_vs2017/libssp.dll | grep create_ssp_class
create_ssp_class

macos:

$ strings lib/mac/libssp.dylib | grep create_ssp_class         
_create_ssp_class

linux/android return no symbols

$ strings lib/linux_x64/libssp.so | grep create_ssp_class
$ nm -C lib/linux_x64/libssp.so | grep create_ssp_class

How to configure the stream

Is it possible to configure the stream with libssp?
Or should one create a parallel http connection on port 80 to configure the stream?
Unfortunately, the library does not include documentation concerning this issue and not documentation at all.

ARM version

Can you provide arm-version of libssp for linux? (armbian/debian/ubuntu)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.