diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2017-01-20 12:27:00 +0000 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2017-01-25 09:52:48 +0000 |
commit | 8643276af8ac39f35ade93011b01fee793adaaaa (patch) | |
tree | f5dc2106ed585ac62eb9b24a31c1ec889c6249b1 | |
parent | 37f0d8e6701e8476df77d5f7734afbfbe8acdd12 (diff) |
Allows to specify stream geometry
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r-- | src/stream-send.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/stream-send.c b/src/stream-send.c index e5f6acd..27504c0 100644 --- a/src/stream-send.c +++ b/src/stream-send.c @@ -44,6 +44,7 @@ static void usage(FILE *fp) "Options:\n" " -h print this text\n" " -s <port> set virtio serial port [%s]\n" + " -g <WxH> geometry\n" ,VERSION, portdev); } @@ -67,14 +68,20 @@ write_all(int fd, const void *buf, size_t len) int main(int argc, char *argv[]) { int c; + int width = 1024, height = 768; for (;;) { - if (-1 == (c = getopt(argc, argv, "hs:"))) + if (-1 == (c = getopt(argc, argv, "hs:g:"))) break; switch (c) { case 's': portdev = optarg; break; + case 'g': + if (sscanf(optarg, "%dx%d", &width, &height) != 2 || width <= 0 || height <= 0) { + errx(1, "Wrong geometry \"%s\"", optarg); + } + break; case 'h': usage(stdout); return 0; @@ -106,7 +113,7 @@ int main(int argc, char *argv[]) hdr.padding = 0; // TODO not fixed !!! - StreamMsgStreamFormat fmt = { 1024, 768, SPICE_VIDEO_CODEC_TYPE_H264, }; + StreamMsgStreamFormat fmt = { width, height, SPICE_VIDEO_CODEC_TYPE_H264, }; hdr.type = STREAM_TYPE_STREAM_FORMAT; hdr.size = sizeof(fmt); printf("writing format\n"); |