mirror of
https://github.com/albfan/miraclecast.git
synced 2025-03-09 23:38:56 +00:00
Check source UIBC capability
If source has no UIBC capability don't try to connect UIBC controller, and listen UIBC setting to disable UIBC relates to #115
This commit is contained in:
parent
5e93ad0638
commit
472fbf4a24
3 changed files with 39 additions and 31 deletions
|
@ -122,7 +122,7 @@ static void sink_handle_get_parameter(struct ctl_sink *s,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wfd_uibc_capability */
|
/* wfd_uibc_capability */
|
||||||
if (rtsp_message_read(m, "{<>}", "wfd_uibc_capability") >= 0 && uibc) {
|
if (rtsp_message_read(m, "{<>}", "wfd_uibc_capability") >= 0 && uibc_option) {
|
||||||
char wfd_uibc_capability[512];
|
char wfd_uibc_capability[512];
|
||||||
sprintf(wfd_uibc_capability,
|
sprintf(wfd_uibc_capability,
|
||||||
"wfd_uibc_capability: input_category_list=GENERIC;"
|
"wfd_uibc_capability: input_category_list=GENERIC;"
|
||||||
|
@ -258,16 +258,22 @@ static void sink_handle_set_parameter(struct ctl_sink *s,
|
||||||
free(s->uibc_config);
|
free(s->uibc_config);
|
||||||
s->uibc_config = nu;
|
s->uibc_config = nu;
|
||||||
|
|
||||||
|
if (!strcasecmp(uibc_config, "none")) {
|
||||||
|
uibc_enabled = false;
|
||||||
|
} else {
|
||||||
char* token = strtok(uibc_config, ";");
|
char* token = strtok(uibc_config, ";");
|
||||||
|
|
||||||
while (token) {
|
while (token) {
|
||||||
if (sscanf(token, "port=%d", &uibc_port)) {
|
if (sscanf(token, "port=%d", &uibc_port)) {
|
||||||
|
log_debug("UIBC port: %d\n", uibc_port);
|
||||||
|
if (uibc_option) {
|
||||||
|
uibc_enabled = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
token = strtok(0, ";");
|
token = strtok(0, ";");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
cli_debug("Got URL: %s\n", s->url);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@
|
||||||
#include "wfd.h"
|
#include "wfd.h"
|
||||||
|
|
||||||
extern int rstp_port;
|
extern int rstp_port;
|
||||||
extern bool uibc;
|
extern bool uibc_option;
|
||||||
|
extern bool uibc_enabled;
|
||||||
extern int uibc_port;
|
extern int uibc_port;
|
||||||
|
|
||||||
struct ctl_sink {
|
struct ctl_sink {
|
||||||
|
|
|
@ -59,7 +59,8 @@ void launch_player(struct ctl_sink *s);
|
||||||
char *gst_scale_res;
|
char *gst_scale_res;
|
||||||
int gst_audio_en = 1;
|
int gst_audio_en = 1;
|
||||||
static const int DEFAULT_RSTP_PORT = 1991;
|
static const int DEFAULT_RSTP_PORT = 1991;
|
||||||
bool uibc;
|
bool uibc_option;
|
||||||
|
bool uibc_enabled;
|
||||||
int rstp_port;
|
int rstp_port;
|
||||||
int uibc_port;
|
int uibc_port;
|
||||||
|
|
||||||
|
@ -388,14 +389,14 @@ void launch_player(struct ctl_sink *s) {
|
||||||
char uibc_portStr[64];
|
char uibc_portStr[64];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char* player;
|
char* player;
|
||||||
if (uibc) {
|
if (uibc_enabled) {
|
||||||
player = "uibc-viewer";
|
player = "uibc-viewer";
|
||||||
} else {
|
} else {
|
||||||
player = "miracle-gst";
|
player = "miracle-gst";
|
||||||
}
|
}
|
||||||
|
|
||||||
argv[i++] = player;
|
argv[i++] = player;
|
||||||
if (uibc) {
|
if (uibc_enabled) {
|
||||||
argv[i++] = s->target;
|
argv[i++] = s->target;
|
||||||
sprintf(uibc_portStr, "%d", uibc_port);
|
sprintf(uibc_portStr, "%d", uibc_port);
|
||||||
argv[i++] = uibc_portStr;
|
argv[i++] = uibc_portStr;
|
||||||
|
@ -434,7 +435,6 @@ void launch_player(struct ctl_sink *s) {
|
||||||
strcat(player_command, argv[i++]);
|
strcat(player_command, argv[i++]);
|
||||||
}
|
}
|
||||||
log_debug("player command: %s", player_command);
|
log_debug("player command: %s", player_command);
|
||||||
//free(player_command);
|
|
||||||
if (execvpe(argv[0], argv, environ) < 0) {
|
if (execvpe(argv[0], argv, environ) < 0) {
|
||||||
cli_debug("stream player failed (%d): %m", errno);
|
cli_debug("stream player failed (%d): %m", errno);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -771,7 +771,8 @@ static int parse_argv(int argc, char *argv[])
|
||||||
};
|
};
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
uibc = false;
|
uibc_option = false;
|
||||||
|
uibc_enabled = false;
|
||||||
rstp_port = DEFAULT_RSTP_PORT;
|
rstp_port = DEFAULT_RSTP_PORT;
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0) {
|
while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0) {
|
||||||
|
@ -803,7 +804,7 @@ static int parse_argv(int argc, char *argv[])
|
||||||
rstp_port = atoi(optarg);
|
rstp_port = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case ARG_UIBC:
|
case ARG_UIBC:
|
||||||
uibc = true;
|
uibc_option = true;
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue