Compare commits
2 Commits
e3af31f1e0
...
2f991b1eaa
Author | SHA1 | Date | |
---|---|---|---|
2f991b1eaa
|
|||
4372684d00
|
@@ -5,6 +5,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "transfer.h"
|
#include "transfer.h"
|
||||||
|
#include "logging.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1756386758,
|
||||||
|
"narHash": "sha256-1wxxznpW2CKvI9VdniaUnTT2Os6rdRJcRUf65ZK9OtE=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "dfb2f12e899db4876308eba6d93455ab7da304cd",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
37
flake.nix
Normal file
37
flake.nix
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
description = "video-streaming-poc devShell";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils, ... }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
in with pkgs;
|
||||||
|
let
|
||||||
|
opencv-custom = pkgs.opencv.override {
|
||||||
|
enableGtk3 = true;
|
||||||
|
#enableCuda = true;
|
||||||
|
enablePython = true;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
devShells.default = mkShell rec {
|
||||||
|
buildInputs = [
|
||||||
|
# Meson
|
||||||
|
meson
|
||||||
|
pkg-config
|
||||||
|
ninja
|
||||||
|
|
||||||
|
# Boost
|
||||||
|
boost
|
||||||
|
|
||||||
|
# OpenCV
|
||||||
|
opencv-custom
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
20
logging.h
20
logging.h
@@ -19,7 +19,7 @@
|
|||||||
#define LOGGING_COLOR true // enable color
|
#define LOGGING_COLOR true // enable color
|
||||||
#define LOGGING_TIMESTAMP true // enable timestamp
|
#define LOGGING_TIMESTAMP true // enable timestamp
|
||||||
#define LOGGING_TIMESTAMP_FMT "%Y-%m-%dT%H:%M:%S%z" // timestamp format (local time)
|
#define LOGGING_TIMESTAMP_FMT "%Y-%m-%dT%H:%M:%S%z" // timestamp format (local time)
|
||||||
#define LOGGING_POSITION true // display position (only works on C++20 or newer)
|
#define LOGGING_POSITION false // display position (only works on C++20 or newer)
|
||||||
|
|
||||||
// Color codes
|
// Color codes
|
||||||
#define ANSI_RESET "\033[0m"
|
#define ANSI_RESET "\033[0m"
|
||||||
@@ -33,15 +33,9 @@
|
|||||||
#define ANSI_WHITE "\033[37m" /* White */
|
#define ANSI_WHITE "\033[37m" /* White */
|
||||||
#define ANSI_BOLD "\033[1m" /* Bold */
|
#define ANSI_BOLD "\033[1m" /* Bold */
|
||||||
|
|
||||||
template <typename T>
|
template <typename... Args>
|
||||||
void print(T t) {
|
void print(Args... args) {
|
||||||
std::cout << t << std::endl;
|
(std::cout << ... << args) << "\n";
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
|
||||||
void print(T t, Args... args) {
|
|
||||||
std::cout << t;
|
|
||||||
print(args...);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void printTimestamp() {
|
inline void printTimestamp() {
|
||||||
@@ -55,13 +49,11 @@ inline void printTimestamp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we're on C++20 or later, then use the source_location header and add source location to logs
|
// if we're on C++20 or later, then use the source_location header and add source location to logs
|
||||||
#if __cplusplus >= 202002L
|
#if __cplusplus >= 202002L && LOGGING_POSITION
|
||||||
#include <source_location>
|
#include <source_location>
|
||||||
|
|
||||||
inline void printPosition(std::source_location& location) {
|
inline void printPosition(std::source_location& location) {
|
||||||
#if LOGGING_POSITION
|
std::cout << location.file_name() << ":" << location.function_name() << ":" << ANSI_CYAN << location.line() << ANSI_RESET << ": ";
|
||||||
std::cout << location.file_name() << ":" << location.function_name << ":" << ANSI_CYAN << location.line() << ANSI_RESET << ": ";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void printHeader(std::string name, std::string color, std::source_location& location) {
|
inline void printHeader(std::string name, std::string color, std::source_location& location) {
|
||||||
|
@@ -9,6 +9,8 @@ project('video-streaming-poc', 'cpp', version : '0.0.1-SNAPSHOT',
|
|||||||
#=======================================================================================================================
|
#=======================================================================================================================
|
||||||
# opencv dependency
|
# opencv dependency
|
||||||
opencv = dependency('opencv4', version : '>=4.0.0')
|
opencv = dependency('opencv4', version : '>=4.0.0')
|
||||||
|
opencv_incl_dir = opencv.get_variable(cmake : 'OpenCV_INCLUDE_DIRECTORIES', pkgconfig : 'includedir')
|
||||||
|
include = include_directories(opencv_incl_dir)
|
||||||
# boost dependency
|
# boost dependency
|
||||||
boost = dependency('boost')
|
boost = dependency('boost')
|
||||||
|
|
||||||
@@ -27,7 +29,9 @@ server = common + ['server.cpp']
|
|||||||
#=======================================================================================================================
|
#=======================================================================================================================
|
||||||
# client executable
|
# client executable
|
||||||
client_exe = executable('client', client,
|
client_exe = executable('client', client,
|
||||||
dependencies : [opencv, boost])
|
dependencies : [opencv, boost],
|
||||||
|
include_directories : include)
|
||||||
# server executable
|
# server executable
|
||||||
server_exe = executable('server', server,
|
server_exe = executable('server', server,
|
||||||
dependencies : [opencv, boost])
|
dependencies : [opencv, boost],
|
||||||
|
include_directories : include)
|
@@ -6,6 +6,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "transfer.h"
|
#include "transfer.h"
|
||||||
|
#include "logging.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user