mirror of
https://github.com/albfan/miraclecast.git
synced 2025-03-09 23:38:56 +00:00
Debug GStreamer execution
Allow to config gstreamer log level
This commit is contained in:
parent
472fbf4a24
commit
cedfeeebe1
4 changed files with 39 additions and 17 deletions
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/python3 -u
|
#!/usr/bin/python3 -u
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
import sys
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
gi.require_version('Gst', '1.0')
|
gi.require_version('Gst', '1.0')
|
||||||
|
@ -32,6 +31,11 @@ class Player(object):
|
||||||
self.width = int(split[0])
|
self.width = int(split[0])
|
||||||
self.height = int(split[1])
|
self.height = int(split[1])
|
||||||
|
|
||||||
|
debug = kwargs.get("debug")
|
||||||
|
if debug:
|
||||||
|
Gst.debug_set_active(True)
|
||||||
|
Gst.debug_set_threshold_from_string(debug, True)
|
||||||
|
|
||||||
port = kwargs.get("port")
|
port = kwargs.get("port")
|
||||||
|
|
||||||
uri = kwargs.get("uri")
|
uri = kwargs.get("uri")
|
||||||
|
|
|
@ -401,8 +401,13 @@ void launch_player(struct ctl_sink *s) {
|
||||||
sprintf(uibc_portStr, "%d", uibc_port);
|
sprintf(uibc_portStr, "%d", uibc_port);
|
||||||
argv[i++] = uibc_portStr;
|
argv[i++] = uibc_portStr;
|
||||||
}
|
}
|
||||||
if (cli_max_sev >= 7)
|
if (gst_debug) {
|
||||||
argv[i++] = "-d 3";
|
argv[i++] = "-d";
|
||||||
|
argv[i++] = gst_debug;
|
||||||
|
} else if (cli_max_sev >= LOG_DEBUG) {
|
||||||
|
argv[i++] = "-d";
|
||||||
|
argv[i++] = "3";
|
||||||
|
}
|
||||||
if (gst_audio_en)
|
if (gst_audio_en)
|
||||||
argv[i++] = "-a";
|
argv[i++] = "-a";
|
||||||
if (gst_scale_res) {
|
if (gst_scale_res) {
|
||||||
|
@ -422,9 +427,9 @@ void launch_player(struct ctl_sink *s) {
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
int size = 0;
|
size_t size = 0;
|
||||||
while (argv[i]) {
|
while (argv[i]) {
|
||||||
size += strlen(argv[i++] + 1);
|
size += strlen(argv[i++]) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* player_command = malloc(size);
|
char* player_command = malloc(size);
|
||||||
|
@ -668,18 +673,19 @@ void cli_fn_help()
|
||||||
*/
|
*/
|
||||||
printf("%s [OPTIONS...] ...\n\n"
|
printf("%s [OPTIONS...] ...\n\n"
|
||||||
"Control a dedicated local sink via MiracleCast.\n"
|
"Control a dedicated local sink via MiracleCast.\n"
|
||||||
" -h --help Show this help\n"
|
" -h --help Show this help\n"
|
||||||
" --version Show package version\n"
|
" --version Show package version\n"
|
||||||
" --log-level <lvl> Maximum level for log messages\n"
|
" --log-level <lvl> Maximum level for log messages\n"
|
||||||
" --log-journal-level <lvl> Maximum level for journal log messages\n"
|
" --log-journal-level <lvl> Maximum level for journal log messages\n"
|
||||||
" --audio <0/1> Enable audio support (default %d)\n"
|
" --gst-debug [cat:]lvl[,...] List of categories an level of debug\n"
|
||||||
" --scale WxH Scale to resolution\n"
|
" --audio <0/1> Enable audio support (default %d)\n"
|
||||||
" --port <port> Port for rtsp (default %d)\n"
|
" --scale WxH Scale to resolution\n"
|
||||||
" --uibc Enables UIBC\n"
|
" --port <port> Port for rtsp (default %d)\n"
|
||||||
" --res <n,n,n> Supported resolutions masks (CEA, VESA, HH)\n"
|
" --uibc Enables UIBC\n"
|
||||||
" default CEA %08X\n"
|
" --res <n,n,n> Supported resolutions masks (CEA, VESA, HH)\n"
|
||||||
" default VESA %08X\n"
|
" default CEA %08X\n"
|
||||||
" default HH %08X\n"
|
" default VESA %08X\n"
|
||||||
|
" default HH %08X\n"
|
||||||
"\n"
|
"\n"
|
||||||
, program_invocation_short_name, gst_audio_en, DEFAULT_RSTP_PORT,
|
, program_invocation_short_name, gst_audio_en, DEFAULT_RSTP_PORT,
|
||||||
wfd_supported_res_cea, wfd_supported_res_vesa, wfd_supported_res_hh
|
wfd_supported_res_cea, wfd_supported_res_vesa, wfd_supported_res_hh
|
||||||
|
@ -751,6 +757,7 @@ static int parse_argv(int argc, char *argv[])
|
||||||
ARG_VERSION = 0x100,
|
ARG_VERSION = 0x100,
|
||||||
ARG_LOG_LEVEL,
|
ARG_LOG_LEVEL,
|
||||||
ARG_JOURNAL_LEVEL,
|
ARG_JOURNAL_LEVEL,
|
||||||
|
ARG_GST_DEBUG,
|
||||||
ARG_AUDIO,
|
ARG_AUDIO,
|
||||||
ARG_SCALE,
|
ARG_SCALE,
|
||||||
ARG_RES,
|
ARG_RES,
|
||||||
|
@ -762,6 +769,7 @@ static int parse_argv(int argc, char *argv[])
|
||||||
{ "version", no_argument, NULL, ARG_VERSION },
|
{ "version", no_argument, NULL, ARG_VERSION },
|
||||||
{ "log-level", required_argument, NULL, ARG_LOG_LEVEL },
|
{ "log-level", required_argument, NULL, ARG_LOG_LEVEL },
|
||||||
{ "log-journal-level", required_argument, NULL, ARG_JOURNAL_LEVEL },
|
{ "log-journal-level", required_argument, NULL, ARG_JOURNAL_LEVEL },
|
||||||
|
{ "gst-debug", required_argument, NULL, ARG_GST_DEBUG },
|
||||||
{ "audio", required_argument, NULL, ARG_AUDIO },
|
{ "audio", required_argument, NULL, ARG_AUDIO },
|
||||||
{ "scale", required_argument, NULL, ARG_SCALE },
|
{ "scale", required_argument, NULL, ARG_SCALE },
|
||||||
{ "res", required_argument, NULL, ARG_RES },
|
{ "res", required_argument, NULL, ARG_RES },
|
||||||
|
@ -785,6 +793,9 @@ static int parse_argv(int argc, char *argv[])
|
||||||
case ARG_LOG_LEVEL:
|
case ARG_LOG_LEVEL:
|
||||||
cli_max_sev = log_parse_arg(optarg);
|
cli_max_sev = log_parse_arg(optarg);
|
||||||
break;
|
break;
|
||||||
|
case ARG_GST_DEBUG:
|
||||||
|
gst_debug = optarg;
|
||||||
|
break;
|
||||||
case ARG_JOURNAL_LEVEL:
|
case ARG_JOURNAL_LEVEL:
|
||||||
log_max_sev = log_parse_arg(optarg);
|
log_max_sev = log_parse_arg(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -85,6 +85,8 @@ const char *LOG_SUBSYSTEM = NULL;
|
||||||
|
|
||||||
unsigned int log_max_sev = LOG_NOTICE;
|
unsigned int log_max_sev = LOG_NOTICE;
|
||||||
|
|
||||||
|
char *gst_debug = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Forward declaration so we can use the locked-versions in other functions
|
* Forward declaration so we can use the locked-versions in other functions
|
||||||
* here. Be careful to avoid deadlocks, though.
|
* here. Be careful to avoid deadlocks, though.
|
||||||
|
|
|
@ -61,6 +61,11 @@ enum log_severity {
|
||||||
|
|
||||||
extern unsigned int log_max_sev;
|
extern unsigned int log_max_sev;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Defines the debug configuration for gstreamer
|
||||||
|
*/
|
||||||
|
extern char* gst_debug;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Timestamping
|
* Timestamping
|
||||||
* Call this to initialize timestamps and cause all log-messages to be prefixed
|
* Call this to initialize timestamps and cause all log-messages to be prefixed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue