mirror of
https://github.com/albfan/miraclecast.git
synced 2025-02-12 15:41:57 +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
|
||||
|
||||
import gi
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
gi.require_version('Gst', '1.0')
|
||||
|
@ -32,6 +31,11 @@ class Player(object):
|
|||
self.width = int(split[0])
|
||||
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")
|
||||
|
||||
uri = kwargs.get("uri")
|
||||
|
|
|
@ -401,8 +401,13 @@ void launch_player(struct ctl_sink *s) {
|
|||
sprintf(uibc_portStr, "%d", uibc_port);
|
||||
argv[i++] = uibc_portStr;
|
||||
}
|
||||
if (cli_max_sev >= 7)
|
||||
argv[i++] = "-d 3";
|
||||
if (gst_debug) {
|
||||
argv[i++] = "-d";
|
||||
argv[i++] = gst_debug;
|
||||
} else if (cli_max_sev >= LOG_DEBUG) {
|
||||
argv[i++] = "-d";
|
||||
argv[i++] = "3";
|
||||
}
|
||||
if (gst_audio_en)
|
||||
argv[i++] = "-a";
|
||||
if (gst_scale_res) {
|
||||
|
@ -422,9 +427,9 @@ void launch_player(struct ctl_sink *s) {
|
|||
argv[i] = NULL;
|
||||
|
||||
i = 0;
|
||||
int size = 0;
|
||||
size_t size = 0;
|
||||
while (argv[i]) {
|
||||
size += strlen(argv[i++] + 1);
|
||||
size += strlen(argv[i++]) + 1;
|
||||
}
|
||||
|
||||
char* player_command = malloc(size);
|
||||
|
@ -668,18 +673,19 @@ void cli_fn_help()
|
|||
*/
|
||||
printf("%s [OPTIONS...] ...\n\n"
|
||||
"Control a dedicated local sink via MiracleCast.\n"
|
||||
" -h --help Show this help\n"
|
||||
" --version Show package version\n"
|
||||
" --log-level <lvl> Maximum level for log messages\n"
|
||||
" --log-journal-level <lvl> Maximum level for journal log messages\n"
|
||||
" --audio <0/1> Enable audio support (default %d)\n"
|
||||
" --scale WxH Scale to resolution\n"
|
||||
" --port <port> Port for rtsp (default %d)\n"
|
||||
" --uibc Enables UIBC\n"
|
||||
" --res <n,n,n> Supported resolutions masks (CEA, VESA, HH)\n"
|
||||
" default CEA %08X\n"
|
||||
" default VESA %08X\n"
|
||||
" default HH %08X\n"
|
||||
" -h --help Show this help\n"
|
||||
" --version Show package version\n"
|
||||
" --log-level <lvl> Maximum level for log messages\n"
|
||||
" --log-journal-level <lvl> Maximum level for journal log messages\n"
|
||||
" --gst-debug [cat:]lvl[,...] List of categories an level of debug\n"
|
||||
" --audio <0/1> Enable audio support (default %d)\n"
|
||||
" --scale WxH Scale to resolution\n"
|
||||
" --port <port> Port for rtsp (default %d)\n"
|
||||
" --uibc Enables UIBC\n"
|
||||
" --res <n,n,n> Supported resolutions masks (CEA, VESA, HH)\n"
|
||||
" default CEA %08X\n"
|
||||
" default VESA %08X\n"
|
||||
" default HH %08X\n"
|
||||
"\n"
|
||||
, program_invocation_short_name, gst_audio_en, DEFAULT_RSTP_PORT,
|
||||
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_LOG_LEVEL,
|
||||
ARG_JOURNAL_LEVEL,
|
||||
ARG_GST_DEBUG,
|
||||
ARG_AUDIO,
|
||||
ARG_SCALE,
|
||||
ARG_RES,
|
||||
|
@ -762,6 +769,7 @@ static int parse_argv(int argc, char *argv[])
|
|||
{ "version", no_argument, NULL, ARG_VERSION },
|
||||
{ "log-level", required_argument, NULL, ARG_LOG_LEVEL },
|
||||
{ "log-journal-level", required_argument, NULL, ARG_JOURNAL_LEVEL },
|
||||
{ "gst-debug", required_argument, NULL, ARG_GST_DEBUG },
|
||||
{ "audio", required_argument, NULL, ARG_AUDIO },
|
||||
{ "scale", required_argument, NULL, ARG_SCALE },
|
||||
{ "res", required_argument, NULL, ARG_RES },
|
||||
|
@ -785,6 +793,9 @@ static int parse_argv(int argc, char *argv[])
|
|||
case ARG_LOG_LEVEL:
|
||||
cli_max_sev = log_parse_arg(optarg);
|
||||
break;
|
||||
case ARG_GST_DEBUG:
|
||||
gst_debug = optarg;
|
||||
break;
|
||||
case ARG_JOURNAL_LEVEL:
|
||||
log_max_sev = log_parse_arg(optarg);
|
||||
break;
|
||||
|
|
|
@ -85,6 +85,8 @@ const char *LOG_SUBSYSTEM = NULL;
|
|||
|
||||
unsigned int log_max_sev = LOG_NOTICE;
|
||||
|
||||
char *gst_debug = NULL;
|
||||
|
||||
/*
|
||||
* Forward declaration so we can use the locked-versions in other functions
|
||||
* here. Be careful to avoid deadlocks, though.
|
||||
|
|
|
@ -61,6 +61,11 @@ enum log_severity {
|
|||
|
||||
extern unsigned int log_max_sev;
|
||||
|
||||
/*
|
||||
* Defines the debug configuration for gstreamer
|
||||
*/
|
||||
extern char* gst_debug;
|
||||
|
||||
/*
|
||||
* Timestamping
|
||||
* Call this to initialize timestamps and cause all log-messages to be prefixed
|
||||
|
|
Loading…
Reference in a new issue