mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-15 00:34:05 +09:00
allow choice between playbin3 and playbin2 for HLS video
This commit is contained in:
16
README.html
16
README.html
@@ -13,7 +13,9 @@ Live Streaming) video with the new “-hls” option.</em> Click on the
|
|||||||
airplay icon in the YouTube app to stream video. (You may need to wait
|
airplay icon in the YouTube app to stream video. (You may need to wait
|
||||||
until advertisements have finished or been skipped before clicking the
|
until advertisements have finished or been skipped before clicking the
|
||||||
YouTube airplay icon.) <strong>Please report any issues with this new
|
YouTube airplay icon.) <strong>Please report any issues with this new
|
||||||
feature of UxPlay</strong>.</li>
|
feature of UxPlay</strong>. <em>The default video player for HLS is
|
||||||
|
GStreamer playbin v3: use “-hls 2” to revert to playbin v2 if some
|
||||||
|
videos fail to play</em>.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p><strong><em>NEWS</em></strong>: macOS Sequoia 15.2 has an AirPlay
|
<p><strong><em>NEWS</em></strong>: macOS Sequoia 15.2 has an AirPlay
|
||||||
bug: update to macOS 15.3 for mirroring screen with UxPlay.</p>
|
bug: update to macOS 15.3 for mirroring screen with UxPlay.</p>
|
||||||
@@ -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
|
> 1080 is requested. The “-h265” option changes the default
|
||||||
resolution (“-s” option) from 1920x1080 to 3840x2160, and leaves default
|
resolution (“-s” option) from 1920x1080 to 3840x2160, and leaves default
|
||||||
maximum framerate (“-fps” option) at 30fps.</p>
|
maximum framerate (“-fps” option) at 30fps.</p>
|
||||||
<p><strong>-hls</strong> Activate HTTP Live Streaming support. With this
|
<p><strong>-hls [v]</strong> Activate HTTP Live Streaming support. With
|
||||||
option YouTube videos can be streamed directly from YouTube servers to
|
this option YouTube videos can be streamed directly from YouTube servers
|
||||||
UxPlay (without passing through the client) by clicking on the AirPlay
|
to UxPlay (without passing through the client) by clicking on the
|
||||||
icon in the YouTube app.</p>
|
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. <em>(Playbin v3 is the
|
||||||
|
recommended player, but if some videos fail to play, you can try with
|
||||||
|
version 2.)</em></p>
|
||||||
<p><strong>-pin [nnnn]</strong>: (since v1.67) use Apple-style
|
<p><strong>-pin [nnnn]</strong>: (since v1.67) use Apple-style
|
||||||
(one-time) “pin” authentication when a new client connects for the first
|
(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
|
time: a four-digit pin code is displayed on the terminal, and the client
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -7,7 +7,9 @@
|
|||||||
YouTube app to stream video. (You may need to wait until
|
YouTube app to stream video. (You may need to wait until
|
||||||
advertisements have finished or been skipped before clicking the
|
advertisements have finished or been skipped before clicking the
|
||||||
YouTube airplay icon.) **Please report any issues with this new
|
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
|
***NEWS***: macOS Sequoia 15.2 has an AirPlay bug: update to macOS 15.3
|
||||||
for mirroring screen with UxPlay.
|
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"
|
1920x1080 to 3840x2160, and leaves default maximum framerate ("-fps"
|
||||||
option) at 30fps.
|
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
|
videos can be streamed directly from YouTube servers to UxPlay (without
|
||||||
passing through the client) by clicking on the AirPlay icon in the
|
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"
|
**-pin \[nnnn\]**: (since v1.67) use Apple-style (one-time) "pin"
|
||||||
authentication when a new client connects for the first time: a
|
authentication when a new client connects for the first time: a
|
||||||
|
|||||||
15
README.txt
15
README.txt
@@ -7,7 +7,9 @@
|
|||||||
YouTube app to stream video. (You may need to wait until
|
YouTube app to stream video. (You may need to wait until
|
||||||
advertisements have finished or been skipped before clicking the
|
advertisements have finished or been skipped before clicking the
|
||||||
YouTube airplay icon.) **Please report any issues with this new
|
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
|
***NEWS***: macOS Sequoia 15.2 has an AirPlay bug: update to macOS 15.3
|
||||||
for mirroring screen with UxPlay.
|
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"
|
1920x1080 to 3840x2160, and leaves default maximum framerate ("-fps"
|
||||||
option) at 30fps.
|
option) at 30fps.
|
||||||
|
|
||||||
**-hls** Activate HTTP Live Streaming support. With this option YouTube
|
**-hls \[v\]** Activate HTTP Live Streaming support. With this option
|
||||||
videos can be streamed directly from YouTube servers to UxPlay (without
|
YouTube videos can be streamed directly from YouTube servers to UxPlay
|
||||||
passing through the client) by clicking on the AirPlay icon in the
|
(without passing through the client) by clicking on the AirPlay icon in
|
||||||
YouTube app.
|
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"
|
**-pin \[nnnn\]**: (since v1.67) use Apple-style (one-time) "pin"
|
||||||
authentication when a new client connects for the first time: a
|
authentication when a new client connects for the first time: a
|
||||||
|
|||||||
@@ -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,
|
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,
|
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;
|
GError *error = NULL;
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
hls_video = (uri != 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]->id = i;
|
||||||
renderer_type[i]->bus = NULL;
|
renderer_type[i]->bus = NULL;
|
||||||
if (hls_video) {
|
if (hls_video) {
|
||||||
/* use playbin3 to play HLS video: replace "playbin3" by "playbin" to use playbin2 */
|
/* use playbin3 to play HLS video: replace "playbin3" by "playbin" to use playbin2 */
|
||||||
renderer_type[i]->pipeline = gst_element_factory_make("playbin3", "hls-playbin3");
|
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);
|
g_assert(renderer_type[i]->pipeline);
|
||||||
renderer_type[i]->appsrc = NULL;
|
renderer_type[i]->appsrc = NULL;
|
||||||
renderer_type[i]->codec = hls;
|
renderer_type[i]->codec = hls;
|
||||||
|
|||||||
@@ -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,
|
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,
|
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_start ();
|
||||||
void video_renderer_stop ();
|
void video_renderer_stop ();
|
||||||
void video_renderer_pause ();
|
void video_renderer_pause ();
|
||||||
|
|||||||
2
uxplay.1
2
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)
|
\fB\-h265\fR Support h265 (4K) video (with h265 versions of h264 plugins)
|
||||||
.TP
|
.TP
|
||||||
\fB\-hls\fR Support HTTP Live Streaming (currently YouTube video only)
|
\fB\-hls\fR Support HTTP Live Streaming (currently YouTube video only)
|
||||||
|
.IP
|
||||||
|
v = 2 or 3 (default 3) optionally selects video player version
|
||||||
.TP
|
.TP
|
||||||
\fB\-pin\fI[xxxx]\fRUse a 4-digit pin code to control client access (default: no)
|
\fB\-pin\fI[xxxx]\fRUse a 4-digit pin code to control client access (default: no)
|
||||||
.IP
|
.IP
|
||||||
|
|||||||
18
uxplay.cpp
18
uxplay.cpp
@@ -71,6 +71,7 @@
|
|||||||
#define LOWEST_ALLOWED_PORT 1024
|
#define LOWEST_ALLOWED_PORT 1024
|
||||||
#define HIGHEST_PORT 65535
|
#define HIGHEST_PORT 65535
|
||||||
#define MISSED_FEEDBACK_LIMIT 15
|
#define MISSED_FEEDBACK_LIMIT 15
|
||||||
|
#define DEFAULT_PLAYBIN_VERSION 3
|
||||||
#define BT709_FIX "capssetter caps=\"video/x-h264, colorimetry=bt709\""
|
#define BT709_FIX "capssetter caps=\"video/x-h264, colorimetry=bt709\""
|
||||||
#define SRGB_FIX " ! video/x-raw,colorimetry=sRGB,format=RGB ! "
|
#define SRGB_FIX " ! video/x-raw,colorimetry=sRGB,format=RGB ! "
|
||||||
#ifdef FULL_RANGE_RGB_FIX
|
#ifdef FULL_RANGE_RGB_FIX
|
||||||
@@ -157,7 +158,7 @@ static guint gst_hls_position_id = 0;
|
|||||||
static bool preserve_connections = false;
|
static bool preserve_connections = false;
|
||||||
static guint missed_feedback_limit = MISSED_FEEDBACK_LIMIT;
|
static guint missed_feedback_limit = MISSED_FEEDBACK_LIMIT;
|
||||||
static guint missed_feedback = 0;
|
static guint missed_feedback = 0;
|
||||||
|
static guint playbin_version = DEFAULT_PLAYBIN_VERSION;
|
||||||
/* logging */
|
/* logging */
|
||||||
|
|
||||||
static void log(int level, const char* format, ...) {
|
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("-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("-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("-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("-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(" default pin is random: optionally use fixed pin xxxx\n");
|
||||||
printf("-reg [fn] Keep a register in $HOME/.uxplay.register to verify returning\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);
|
printf("db range %f:%f\n", db_low, db_high);
|
||||||
} else if (arg == "-hls") {
|
} else if (arg == "-hls") {
|
||||||
hls_support = true;
|
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") {
|
} else if (arg == "-h265") {
|
||||||
h265_support = true;
|
h265_support = true;
|
||||||
} else if (arg == "-nofreeze") {
|
} else if (arg == "-nofreeze") {
|
||||||
@@ -2295,7 +2305,7 @@ int main (int argc, char *argv[]) {
|
|||||||
if (use_video) {
|
if (use_video) {
|
||||||
video_renderer_init(render_logger, server_name.c_str(), videoflip, video_parser.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(),
|
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();
|
video_renderer_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2370,7 +2380,7 @@ int main (int argc, char *argv[]) {
|
|||||||
const char *uri = (url.empty() ? NULL : url.c_str());
|
const char *uri = (url.empty() ? NULL : url.c_str());
|
||||||
video_renderer_init(render_logger, server_name.c_str(), videoflip, video_parser.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(),
|
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();
|
video_renderer_start();
|
||||||
}
|
}
|
||||||
if (relaunch_video) {
|
if (relaunch_video) {
|
||||||
|
|||||||
Reference in New Issue
Block a user