mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
Added parameter to take screenshot with screendump as PNG
Currently screendump only supports PPM format, which is un-compressed. Added a "format" parameter to QMP and HMP screendump command to support PNG image capture using libpng. QMP example usage: { "execute": "screendump", "arguments": { "filename": "/tmp/image", "format":"png" } } HMP example usage: screendump /tmp/image -f png Resolves: https://gitlab.com/qemu-project/qemu/-/issues/718 Signed-off-by: Kshitij Suri <kshitij.suri@nutanix.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20220408071336.99839-3-kshitij.suri@nutanix.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
95f8510ef4
commit
9a0a119a38
4 changed files with 136 additions and 12 deletions
|
@ -1720,9 +1720,19 @@ hmp_screendump(Monitor *mon, const QDict *qdict)
|
|||
const char *filename = qdict_get_str(qdict, "filename");
|
||||
const char *id = qdict_get_try_str(qdict, "device");
|
||||
int64_t head = qdict_get_try_int(qdict, "head", 0);
|
||||
const char *input_format = qdict_get_try_str(qdict, "format");
|
||||
Error *err = NULL;
|
||||
ImageFormat format;
|
||||
|
||||
qmp_screendump(filename, id != NULL, id, id != NULL, head, &err);
|
||||
format = qapi_enum_parse(&ImageFormat_lookup, input_format,
|
||||
IMAGE_FORMAT_PPM, &err);
|
||||
if (err) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
qmp_screendump(filename, id != NULL, id, id != NULL, head,
|
||||
input_format != NULL, format, &err);
|
||||
end:
|
||||
hmp_handle_error(mon, err);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue