diff --git a/README.html b/README.html index 3545624..7d0ad55 100644 --- a/README.html +++ b/README.html @@ -13,7 +13,9 @@ Live Streaming) video with the new “-hls” option. Click on the airplay icon in the YouTube app to stream video. (You may need to wait until advertisements have finished or been skipped before clicking the YouTube airplay icon.) Please report any issues with this new -feature of UxPlay. +feature of UxPlay. The default video player for HLS is +GStreamer playbin v3: use “-hls 2” to revert to playbin v2 if some +videos fail to play.
NEWS: macOS Sequoia 15.2 has an AirPlay bug: update to macOS 15.3 for mirroring screen with UxPlay.
@@ -955,10 +957,14 @@ and some iPhones) can send h265 video if a resolution “-s wxh” with h > 1080 is requested. The “-h265” option changes the default resolution (“-s” option) from 1920x1080 to 3840x2160, and leaves default maximum framerate (“-fps” option) at 30fps. --hls Activate HTTP Live Streaming support. With this -option YouTube videos can be streamed directly from YouTube servers to -UxPlay (without passing through the client) by clicking on the AirPlay -icon in the YouTube app.
+-hls [v] Activate HTTP Live Streaming support. With +this option YouTube videos can be streamed directly from YouTube servers +to UxPlay (without passing through the client) by clicking on the +AirPlay icon in the YouTube app. Optional [v] (allowed values 2 or 3, +default: 3) allows selection of the version of GStreamer’s "playbin" +video player to use for playing HLS video. (Playbin v3 is the +recommended player, but if some videos fail to play, you can try with +version 2.)
-pin [nnnn]: (since v1.67) use Apple-style (one-time) “pin” authentication when a new client connects for the first time: a four-digit pin code is displayed on the terminal, and the client diff --git a/README.md b/README.md index 71e6ddd..1f5f26f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ YouTube app to stream video. (You may need to wait until advertisements have finished or been skipped before clicking the YouTube airplay icon.) **Please report any issues with this new - feature of UxPlay**. + feature of UxPlay**. _The default video player for HLS is + GStreamer playbin v3: use "-hls 2" to revert to playbin v2 if + some videos fail to play_. ***NEWS***: macOS Sequoia 15.2 has an AirPlay bug: update to macOS 15.3 for mirroring screen with UxPlay. @@ -961,10 +963,14 @@ The "-h265" option changes the default resolution ("-s" option) from 1920x1080 to 3840x2160, and leaves default maximum framerate ("-fps" option) at 30fps. -**-hls** Activate HTTP Live Streaming support. With this option YouTube +**-hls \[v\]** Activate HTTP Live Streaming support. With this option YouTube videos can be streamed directly from YouTube servers to UxPlay (without passing through the client) by clicking on the AirPlay icon in the -YouTube app. +YouTube app. Optional \[v\] (allowed values 2 or 3, default: 3) +allows selection of the version of GStreamer's +\"playbin\" video player to use for playing HLS video. _(Playbin v3 +is the recommended player, but if some videos fail to play, you can try +with version 2.)_ **-pin \[nnnn\]**: (since v1.67) use Apple-style (one-time) "pin" authentication when a new client connects for the first time: a diff --git a/README.txt b/README.txt index 323f86a..0648b6c 100644 --- a/README.txt +++ b/README.txt @@ -7,7 +7,9 @@ YouTube app to stream video. (You may need to wait until advertisements have finished or been skipped before clicking the YouTube airplay icon.) **Please report any issues with this new - feature of UxPlay**. + feature of UxPlay**. *The default video player for HLS is GStreamer + playbin v3: use "-hls 2" to revert to playbin v2 if some videos fail + to play*. ***NEWS***: macOS Sequoia 15.2 has an AirPlay bug: update to macOS 15.3 for mirroring screen with UxPlay. @@ -962,10 +964,13 @@ The "-h265" option changes the default resolution ("-s" option) from 1920x1080 to 3840x2160, and leaves default maximum framerate ("-fps" option) at 30fps. -**-hls** Activate HTTP Live Streaming support. With this option YouTube -videos can be streamed directly from YouTube servers to UxPlay (without -passing through the client) by clicking on the AirPlay icon in the -YouTube app. +**-hls \[v\]** Activate HTTP Live Streaming support. With this option +YouTube videos can be streamed directly from YouTube servers to UxPlay +(without passing through the client) by clicking on the AirPlay icon in +the YouTube app. Optional \[v\] (allowed values 2 or 3, default: 3) +allows selection of the version of GStreamer's \"playbin\" video player +to use for playing HLS video. *(Playbin v3 is the recommended player, +but if some videos fail to play, you can try with version 2.)* **-pin \[nnnn\]**: (since v1.67) use Apple-style (one-time) "pin" authentication when a new client connects for the first time: a diff --git a/renderers/video_renderer.c b/renderers/video_renderer.c index 257a456..e722306 100644 --- a/renderers/video_renderer.c +++ b/renderers/video_renderer.c @@ -193,7 +193,7 @@ GstElement *make_video_sink(const char *videosink, const char *videosink_options void video_renderer_init(logger_t *render_logger, const char *server_name, videoflip_t videoflip[2], const char *parser, const char *decoder, const char *converter, const char *videosink, const char *videosink_options, - bool initial_fullscreen, bool video_sync, bool h265_support, const char *uri) { + bool initial_fullscreen, bool video_sync, bool h265_support, guint playbin_version, const char *uri) { GError *error = NULL; GstCaps *caps = NULL; hls_video = (uri != NULL); @@ -230,8 +230,19 @@ void video_renderer_init(logger_t *render_logger, const char *server_name, vide renderer_type[i]->id = i; renderer_type[i]->bus = NULL; if (hls_video) { - /* use playbin3 to play HLS video: replace "playbin3" by "playbin" to use playbin2 */ - renderer_type[i]->pipeline = gst_element_factory_make("playbin3", "hls-playbin3"); + /* use playbin3 to play HLS video: replace "playbin3" by "playbin" to use playbin2 */ + switch (playbin_version) { + case 2: + renderer_type[i]->pipeline = gst_element_factory_make("playbin", "hls-playbin2"); + break; + case 3: + renderer_type[i]->pipeline = gst_element_factory_make("playbin3", "hls-playbin3"); + break; + default: + logger_log(logger, LOGGER_ERR, "video_renderer_init: invalid playbin versiion %u", playbin_version); + g_assert(0); + } + logger_log(logger, LOGGER_INFO, "Will use GStreamer playbin version %u to play HLS streamed video", playbin_version); g_assert(renderer_type[i]->pipeline); renderer_type[i]->appsrc = NULL; renderer_type[i]->codec = hls; diff --git a/renderers/video_renderer.h b/renderers/video_renderer.h index 4db432a..a19e192 100644 --- a/renderers/video_renderer.h +++ b/renderers/video_renderer.h @@ -49,7 +49,7 @@ typedef struct video_renderer_s video_renderer_t; void video_renderer_init (logger_t *logger, const char *server_name, videoflip_t videoflip[2], const char *parser, const char *decoder, const char *converter, const char *videosink, const char *videosink_options, - bool initial_fullscreen, bool video_sync, bool h265_support, const char *uri); + bool initial_fullscreen, bool video_sync, bool h265_support, guint playbin_version, const char *uri); void video_renderer_start (); void video_renderer_stop (); void video_renderer_pause (); diff --git a/uxplay.1 b/uxplay.1 index dd7594d..35b8b8d 100644 --- a/uxplay.1 +++ b/uxplay.1 @@ -16,6 +16,8 @@ UxPlay 1.71: An open\-source AirPlay mirroring (+ audio streaming) server: \fB\-h265\fR Support h265 (4K) video (with h265 versions of h264 plugins) .TP \fB\-hls\fR Support HTTP Live Streaming (currently YouTube video only) +.IP + v = 2 or 3 (default 3) optionally selects video player version .TP \fB\-pin\fI[xxxx]\fRUse a 4-digit pin code to control client access (default: no) .IP diff --git a/uxplay.cpp b/uxplay.cpp index 34d517e..cb0a23b 100644 --- a/uxplay.cpp +++ b/uxplay.cpp @@ -71,6 +71,7 @@ #define LOWEST_ALLOWED_PORT 1024 #define HIGHEST_PORT 65535 #define MISSED_FEEDBACK_LIMIT 15 +#define DEFAULT_PLAYBIN_VERSION 3 #define BT709_FIX "capssetter caps=\"video/x-h264, colorimetry=bt709\"" #define SRGB_FIX " ! video/x-raw,colorimetry=sRGB,format=RGB ! " #ifdef FULL_RANGE_RGB_FIX @@ -157,7 +158,7 @@ static guint gst_hls_position_id = 0; static bool preserve_connections = false; static guint missed_feedback_limit = MISSED_FEEDBACK_LIMIT; static guint missed_feedback = 0; - +static guint playbin_version = DEFAULT_PLAYBIN_VERSION; /* logging */ static void log(int level, const char* format, ...) { @@ -639,7 +640,8 @@ static void print_info (char *name) { printf("-n name Specify the network name of the AirPlay server\n"); printf("-nh Do not add \"@hostname\" at the end of AirPlay server name\n"); printf("-h265 Support h265 (4K) video (with h265 versions of h264 plugins)\n"); - printf("-hls Support HTTP Live Streaming (currently Youtube video only) \n"); + printf("-hls [v] Support HTTP Live Streaming (currently Youtube video only) \n"); + printf(" v = 2 or 3 (default 3) optionally selects video player version\n"); printf("-pin[xxxx]Use a 4-digit pin code to control client access (default: no)\n"); printf(" default pin is random: optionally use fixed pin xxxx\n"); printf("-reg [fn] Keep a register in $HOME/.uxplay.register to verify returning\n"); @@ -1220,6 +1222,14 @@ static void parse_arguments (int argc, char *argv[]) { printf("db range %f:%f\n", db_low, db_high); } else if (arg == "-hls") { hls_support = true; + if (i < argc - 1 && *argv[i+1] != '-') { + unsigned int n = 3; + if (!get_value(argv[++i], &n) || playbin_version < 2) { + fprintf(stderr, "invalid \"-hls %s\"; -hls n only allows \"playbin\" video player versions 2 or 3\n", argv[i]); + exit(1); + } + playbin_version = (guint) n; + } } else if (arg == "-h265") { h265_support = true; } else if (arg == "-nofreeze") { @@ -2295,7 +2305,7 @@ int main (int argc, char *argv[]) { if (use_video) { video_renderer_init(render_logger, server_name.c_str(), videoflip, video_parser.c_str(), video_decoder.c_str(), video_converter.c_str(), videosink.c_str(), - videosink_options.c_str(), fullscreen, video_sync, h265_support, NULL); + videosink_options.c_str(), fullscreen, video_sync, h265_support, playbin_version, NULL); video_renderer_start(); } @@ -2370,7 +2380,7 @@ int main (int argc, char *argv[]) { const char *uri = (url.empty() ? NULL : url.c_str()); video_renderer_init(render_logger, server_name.c_str(), videoflip, video_parser.c_str(), video_decoder.c_str(), video_converter.c_str(), videosink.c_str(), - videosink_options.c_str(), fullscreen, video_sync, h265_support, uri); + videosink_options.c_str(), fullscreen, video_sync, h265_support, playbin_version, uri); video_renderer_start(); } if (relaunch_video) {