mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
uxplay 1.48 make video pipeline configurable for hardware h264 decoders
This commit is contained in:
46
uxplay.cpp
46
uxplay.cpp
@@ -44,7 +44,7 @@
|
||||
#include "renderers/video_renderer.h"
|
||||
#include "renderers/audio_renderer.h"
|
||||
|
||||
#define VERSION "1.47"
|
||||
#define VERSION "1.48"
|
||||
|
||||
#define DEFAULT_NAME "UxPlay"
|
||||
#define DEFAULT_DEBUG_LOG false
|
||||
@@ -77,8 +77,8 @@ static std::string audiosink = "autoaudiosink";
|
||||
static bool use_audio = true;
|
||||
static bool new_window_closing_behavior = true;
|
||||
static bool close_window;
|
||||
static std::string decoder = "decodebin ! ";
|
||||
static std::string converter = "videoconvert ! ";
|
||||
static std::string video_decoder = "decodebin";
|
||||
static std::string video_converter = "videoconvert";
|
||||
static bool show_client_FPS_data = false;
|
||||
static unsigned int max_ntp_timeouts = NTP_TIMEOUT_LIMIT;
|
||||
|
||||
@@ -226,13 +226,17 @@ static void print_info (char *name) {
|
||||
printf(" \"-p tcp n\" or \"-p udp n\" sets TCP or UDP ports separately\n");
|
||||
printf("-m Use random MAC address (use for concurrent UxPlay's)\n");
|
||||
printf("-t n Relaunch server if no connection existed in last n seconds\n");
|
||||
printf("-vs Choose the GStreamer videosink; default \"autovideosink\"\n");
|
||||
printf("-vd ... Choose the GStreamer h264 decoder; default \"decodebin\"\n");
|
||||
printf(" choices: avdec_h264,vaapih264dec,nvdec,nvh264dec,v4l2h264dec\n");
|
||||
printf("-vc ... Choose the GStreamer videoconverter; default \"videoconvert\"\n");
|
||||
printf(" another choice when using v4l2h264decode: v4l2convert\n");
|
||||
printf("-vs ... Choose the GStreamer videosink; default \"autovideosink\"\n");
|
||||
printf(" some choices: ximagesink,xvimagesink,vaapisink,glimagesink,\n");
|
||||
printf(" gtksink,waylandsink,osximagesink,fpsdisplaysink, etc.\n");
|
||||
printf("-vs 0 Streamed audio only, with no video display window\n");
|
||||
printf("-avdec Force software h264 video decoding with libav h264 decoder\n");
|
||||
printf("-as Choose the GStreamer audiosink; default \"autoaudiosink\"\n");
|
||||
printf(" choices: pulsesink,alsasink,osssink,oss4sink,osxaudiosink,etc.\n");
|
||||
printf("-as ... Choose the GStreamer audiosink; default \"autoaudiosink\"\n");
|
||||
printf(" choices: pulsesink,alsasink,osssink,oss4sink,osxaudiosink\n");
|
||||
printf("-as 0 (or -a) Turn audio off, streamed video only\n");
|
||||
printf("-reset n Reset after 3n seconds client silence (default %d, 0 = never)\n", NTP_TIMEOUT_LIMIT);
|
||||
printf("-nc do Not Close video window when client stops mirroring\n");
|
||||
@@ -443,6 +447,14 @@ int main (int argc, char *argv[]) {
|
||||
} else if (arg == "-h" || arg == "-v") {
|
||||
print_info(argv[0]);
|
||||
exit(0);
|
||||
} else if (arg == "-vd") {
|
||||
if (!option_has_value(i, argc, arg, argv[i+1])) exit(1);
|
||||
video_decoder.erase();
|
||||
video_decoder.append(argv[++i]);
|
||||
} else if (arg == "-vc") {
|
||||
if (!option_has_value(i, argc, arg, argv[i+1])) exit(1);
|
||||
video_converter.erase();
|
||||
video_converter.append(argv[++i]);
|
||||
} else if (arg == "-vs") {
|
||||
if (!option_has_value(i, argc, arg, argv[i+1])) exit(1);
|
||||
videosink.erase();
|
||||
@@ -462,20 +474,8 @@ int main (int argc, char *argv[]) {
|
||||
} else if (arg == "-nc") {
|
||||
new_window_closing_behavior = false;
|
||||
} else if (arg == "-avdec") {
|
||||
decoder.erase();
|
||||
decoder = "h264parse ! avdec_h264 ! ";
|
||||
converter.erase();
|
||||
converter = "videoconvert ! ";
|
||||
} else if (arg == "-nvdec") {
|
||||
decoder.erase();
|
||||
decoder = "h264parse ! nvh264dec ! "; /* undocumented option for NVIDIA graphics (may be removed without warning) */
|
||||
converter.erase();
|
||||
converter = "videoconvert ! ";
|
||||
} else if (arg == "-v4l2") {
|
||||
decoder.erase();
|
||||
decoder = "h264parse ! v4l2h264dec ! "; /* undocumented option for Raspberry PI (may be removed without warning) */
|
||||
converter.erase();
|
||||
converter = "v4l2convert ! ";
|
||||
video_decoder.erase();
|
||||
video_decoder = "avdec_h264";
|
||||
} else if (arg == "-FPSdata") {
|
||||
show_client_FPS_data = true;
|
||||
} else if (arg == "-reset") {
|
||||
@@ -522,7 +522,8 @@ int main (int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
if (use_video) {
|
||||
video_renderer_init(render_logger, server_name.c_str(), videoflip, decoder.c_str(), converter.c_str(), videosink.c_str());
|
||||
video_renderer_init(render_logger, server_name.c_str(), videoflip,
|
||||
video_decoder.c_str(), video_converter.c_str(), videosink.c_str());
|
||||
video_renderer_start();
|
||||
}
|
||||
|
||||
@@ -560,7 +561,8 @@ int main (int argc, char *argv[]) {
|
||||
if (use_audio) audio_renderer_stop();
|
||||
if (use_video && close_window) {
|
||||
video_renderer_destroy();
|
||||
video_renderer_init(render_logger, server_name.c_str(), videoflip, decoder.c_str(), converter.c_str(), videosink.c_str());
|
||||
video_renderer_init(render_logger, server_name.c_str(), videoflip,
|
||||
video_decoder.c_str(), video_converter.c_str(), videosink.c_str());
|
||||
video_renderer_start();
|
||||
}
|
||||
if (reset_loop) goto reconnect;
|
||||
|
||||
Reference in New Issue
Block a user