Skip to content

Commit

Permalink
[Refact] encoder.
Browse files Browse the repository at this point in the history
  • Loading branch information
SighingSnow committed Jul 19, 2022
1 parent e09a334 commit 786112f
Show file tree
Hide file tree
Showing 6 changed files with 302 additions and 127 deletions.
9 changes: 6 additions & 3 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
#define COMMON_H
#include <thread>
#include <mutex>

#include <vector>
// For debug
static char* out_h264 = "out.h264";
const std::string out_h264 = "out.h264";
static char* RTMP_LIVESTEAM = "rtmp://localhost/live/livestream";
static bool dump_video_option = false;
static bool rtmp_publish_option = false;
static bool rtc_publish_option = true;
static bool docker_option = false;
// This is for screen saving
#ifdef __APPLE__
const int scale = 2;
Expand All @@ -26,7 +27,7 @@ const unsigned int screen_height = 600;
const unsigned int SCR_WIDTH = screen_width * scale;
const unsigned int SCR_HEIGHT = screen_height * scale;
// webrtc
const std::string DEFAULT_IP_ADDRESS = "host.docker.internal";
const std::string DEFAULT_IP_ADDRESS = "127.0.0.1";
const uint16_t defaultPort = 8000;
// FFMPEG parameters
const int inlinesize[2] = {SCR_WIDTH*3,0}; // For sws_scale convert function
Expand All @@ -41,6 +42,8 @@ const std::string mcube_fs = "../src/Shaders/mcube.fs";
const std::string text_vs = "../src/Shaders/text.vs";
const std::string text_fs = "../src/Shaders/text.fs";

const std::vector<std::string> gpu_str = {"cpu","nvenc-nvidia","amf-amd","qsv-intel","videotoolbox-macos"};

const float vertices[] = {
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,
0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,
Expand Down
Loading

0 comments on commit 786112f

Please sign in to comment.