Skip to content

Instantly share code, notes, and snippets.

@fernandoc1
fernandoc1 / folder_streamer_test.cpp
Created August 14, 2020 00:03
Read H264 content from a directory and store it in a internal buffer.
#include "channelwriter.hpp"
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <dirent.h>
#include <fcntl.h>
#include <iostream>
#include <libgen.h>
#ifndef DESKTOP_COMPILATION
#include "dv_source.hpp"
#endif
#include "tcp_source.hpp"
#include "Samples.h"
#include "Include_i.h"
#include <stdio.h>
#include <stdlib.h>
CXX := arm-hisiv300-linux-g++
CC := arm-hisiv300-linux-gcc
BIN := REVOSender
INC_FLAGS := -I ../libStreamServer/libGetDVStream
INC_FLAGS += -I ../libStreamServer/libDVStream
INC_FLAGS += -I ../libStreamServer/libIpcUtils
INC_FLAGS += -I../REVOServer
INC_FLAGS += -I../libCipher
@fernandoc1
fernandoc1 / Compilation_command.sh
Created June 18, 2020 13:59
amazon-kinesis-video-streams-webrtc-sdk-c to compile with ARM Hisiv300
:
CC=arm-hisiv300-linux-gcc CXX=arm-hisiv300-linux-g++ AR=arm-hisiv300-linux-ar cmake .. -DBUILD_OPENSSL=TRUE -DBUILD_OPENSSL_PLATFORM=linux-generic32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi
#include "shared_memory_communicator.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
enum
{
MSG_DV_TYPE_START = 0,
MSG_DV_TYPE_MSG1,
<html>
<body>
</body>
</html>
<!-- Reference: https://github.com/brkho/client-server-webrtc-example/blob/master/client/example-client.js -->
<!-- stund -v -h 192.168.18.3 -a 127.0.0.1 -->
<script>
var config = {iceServers: [{ url: 'stun:localhost:3478'}]};
rtcPeerConnection = new RTCPeerConnection(config);
var dataChannelConfig = {ordered: true, maxRetransmits: 10};
@fernandoc1
fernandoc1 / serial_linux.txt
Created January 2, 2020 11:14
Connect serial to Linux
Connect to serial on Linux:
sudo chmod 777 /dev/ttyUSB0
screen -L /dev/ttyUSB0 115200
#include <stdio.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int main(int argc, char *argv[])
{
@fernandoc1
fernandoc1 / localtime_linux.c
Created November 21, 2019 16:31
This code prints the local time in Linux with a C program.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdint.h>
int main()
{
time_t currentTime = time(NULL);
struct tm* localTime = localtime(&currentTime);
char dateStr[100];
@fernandoc1
fernandoc1 / extract_roi.cpp
Created September 24, 2019 21:53
This extracts a ROI from images that are 16bits per pixel.
void extractRoi(cv::Mat& inImage, cv::Mat& outImage, cv::Rect roi)
{
/* Create the image */
outImage = cv::Mat(roi.height, roi.width, inImage.type());
/* Populate the image */
for (int i = roi.y; i < (roi.y+roi.height); i++)
{
uint16_t* inP = inImage.ptr<uint16_t>(i);
uint16_t* outP = outImage.ptr<uint16_t>(i-roi.y);