[PATCH weston] wcap-decode: Dump all frames with --dump.
Scott Moreau
oreaus at gmail.com
Thu May 24 18:06:56 PDT 2012
Instead of specifying a frame number, go ahead and just dump all frames
when --dump is passed.
---
src/wcap-decode.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/wcap-decode.c b/src/wcap-decode.c
index 9ff7ddb..4f36644 100644
--- a/src/wcap-decode.c
+++ b/src/wcap-decode.c
@@ -176,28 +176,23 @@ write_png(struct wcap_decoder *decoder, const char *filename)
int main(int argc, char *argv[])
{
struct wcap_decoder *decoder;
- int i, output_frame;
+ int i;
char filename[200];
if (argc != 2 && argc != 3) {
- fprintf(stderr, "usage: wcap-decode WCAP_FILE [FRAME]\n");
+ fprintf(stderr, "Usage: wcap-decode WCAP_FILE [--dump]\n");
return 1;
}
decoder = wcap_decoder_create(argv[1]);
- output_frame = -1;
- if (argc == 3)
- output_frame = strtol(argv[2], NULL, 0);
- i = 0;
- while (wcap_decoder_get_frame(decoder)) {
- if (i == output_frame) {
+ for (i = 0; wcap_decoder_get_frame(decoder); i++) {
+ if (argc == 3 && strcmp(argv[2], "--dump") == 0) {
snprintf(filename, sizeof filename,
"wcap-frame-%d.png", i);
write_png(decoder, filename);
- printf("wrote %s\n", filename);
+ printf("Creating %s\n", filename);
}
- i++;
}
printf("wcap file: size %dx%d, %d frames\n",
--
1.7.7.6
More information about the wayland-devel
mailing list