mirror of
https://github.com/albfan/miraclecast.git
synced 2025-03-09 23:38:56 +00:00
Allow to set resolution mask from command line
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
This commit is contained in:
parent
9be88e46bf
commit
c6334a7509
4 changed files with 38 additions and 6 deletions
|
@ -97,11 +97,10 @@ int cli_help(const struct cli_cmd *cmds)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
if (is_cli()) {
|
||||
cli_printf("Available commands:\n");
|
||||
} else {
|
||||
if (!is_cli()) {
|
||||
cli_fn_help();
|
||||
}
|
||||
cli_printf("Available commands:\n");
|
||||
|
||||
for (i = 0; cmds[i].cmd; ++i) {
|
||||
if (!cmds[i].desc)
|
||||
|
|
|
@ -51,6 +51,10 @@ struct ctl_sink {
|
|||
|
||||
bool connected : 1;
|
||||
bool hup : 1;
|
||||
|
||||
uint32_t resolutions_cea;
|
||||
uint32_t resolutions_vesa;
|
||||
uint32_t resolutions_hh;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -114,15 +118,19 @@ static void sink_handle_get_parameter(struct ctl_sink *s,
|
|||
struct rtsp_message *m)
|
||||
{
|
||||
_rtsp_message_unref_ struct rtsp_message *rep = NULL;
|
||||
char wfd_video_formats[128];
|
||||
int r;
|
||||
|
||||
r = rtsp_message_new_reply_for(m, &rep, RTSP_CODE_OK, NULL);
|
||||
if (r < 0)
|
||||
return cli_vERR(r);
|
||||
|
||||
sprintf(wfd_video_formats,
|
||||
"wfd_video_formats: 00 00 03 10 %08x %08x %08x 00 0000 0000 10 none none",
|
||||
s->resolutions_cea, s->resolutions_vesa, s->resolutions_hh);
|
||||
r = rtsp_message_append(rep, "{&&&&}",
|
||||
"wfd_content_protection: none",
|
||||
"wfd_video_formats: 00 00 01 01 0000007f 003fffff 00000000 00 0000 0000 00 none none",
|
||||
wfd_video_formats,
|
||||
"wfd_audio_codecs: AAC 00000007 00",
|
||||
"wfd_client_rtp_ports: RTP/AVP/UDP;unicast 1991 0 mode=play");
|
||||
if (r < 0)
|
||||
|
@ -447,6 +455,9 @@ int ctl_sink_new(struct ctl_sink **out,
|
|||
|
||||
s->event = sd_event_ref(event);
|
||||
s->fd = -1;
|
||||
s->resolutions_cea = wfd_supported_res_cea;
|
||||
s->resolutions_vesa = wfd_supported_res_vesa;
|
||||
s->resolutions_hh = wfd_supported_res_hh;
|
||||
|
||||
*out = s;
|
||||
return 0;
|
||||
|
|
|
@ -235,6 +235,10 @@ struct cli_cmd {
|
|||
extern sd_event *cli_event;
|
||||
extern sd_bus *cli_bus;
|
||||
|
||||
extern unsigned int wfd_supported_res_cea;
|
||||
extern unsigned int wfd_supported_res_vesa;
|
||||
extern unsigned int wfd_supported_res_hh;
|
||||
|
||||
int cli_init(sd_bus *bus, const struct cli_cmd *cmds);
|
||||
void cli_destroy(void);
|
||||
int cli_run(void);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include "ctl.h"
|
||||
#include "wfd.h"
|
||||
#include "shl_macro.h"
|
||||
#include "shl_util.h"
|
||||
|
||||
|
@ -52,6 +53,9 @@ static struct ctl_peer *running_peer;
|
|||
|
||||
char *gst_scale_res;
|
||||
int gst_audio_en = 1;
|
||||
unsigned int wfd_supported_res_cea = 0x0000001f; /* up to 720x576 */
|
||||
unsigned int wfd_supported_res_vesa = 0x00000003; /* up to 800x600 */
|
||||
unsigned int wfd_supported_res_hh = 0x00000000; /* not supported */
|
||||
|
||||
/*
|
||||
* cmd list
|
||||
|
@ -569,9 +573,15 @@ void cli_fn_help()
|
|||
" --log-level <lvl> Maximum level for log messages\n"
|
||||
" --audio <0/1> Enable audio support (default %d)\n"
|
||||
" --scale WxH Scale to resolution\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"
|
||||
"Commands:\n"
|
||||
, program_invocation_short_name, gst_audio_en);
|
||||
, program_invocation_short_name, gst_audio_en,
|
||||
wfd_supported_res_cea, wfd_supported_res_vesa, wfd_supported_res_hh
|
||||
);
|
||||
wfd_print_resolutions();
|
||||
/*
|
||||
* 80-char barrier:
|
||||
* 01234567890123456789012345678901234567890123456789012345678901234567890123456789
|
||||
|
@ -639,6 +649,7 @@ static int parse_argv(int argc, char *argv[])
|
|||
ARG_LOG_LEVEL,
|
||||
ARG_AUDIO,
|
||||
ARG_SCALE,
|
||||
ARG_RES,
|
||||
};
|
||||
static const struct option options[] = {
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
|
@ -646,6 +657,7 @@ static int parse_argv(int argc, char *argv[])
|
|||
{ "log-level", required_argument, NULL, ARG_LOG_LEVEL },
|
||||
{ "audio", required_argument, NULL, ARG_AUDIO },
|
||||
{ "scale", required_argument, NULL, ARG_SCALE },
|
||||
{ "res", required_argument, NULL, ARG_RES },
|
||||
{}
|
||||
};
|
||||
int c;
|
||||
|
@ -666,6 +678,12 @@ static int parse_argv(int argc, char *argv[])
|
|||
case ARG_SCALE:
|
||||
gst_scale_res = optarg;
|
||||
break;
|
||||
case ARG_RES:
|
||||
sscanf(optarg, "%x,%x,%x",
|
||||
&wfd_supported_res_cea,
|
||||
&wfd_supported_res_vesa,
|
||||
&wfd_supported_res_hh);
|
||||
break;
|
||||
case '?':
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue