You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

69 line
1.5 KiB

  1. /*
  2. * makemovie read image names from stdin and create a movie
  3. * Copyright (c) 2009 Sam Hocevar <sam@hocevar.net>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program is free software. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. #include "config.h"
  15. #include <stdlib.h>
  16. #include <stdio.h>
  17. #include <string.h>
  18. #include <pipi.h>
  19. #define WIDTH 1280
  20. #define HEIGHT 720
  21. #define FPS 30
  22. int main(int argc, char *argv[])
  23. {
  24. char file[1024];
  25. pipi_image_t *image;
  26. pipi_sequence_t *seq;
  27. pipi_pixels_t *p;
  28. int f;
  29. if(argc < 2)
  30. return EXIT_FAILURE;
  31. seq = pipi_open_sequence(argv[1], WIDTH, HEIGHT, FPS);
  32. if(!seq)
  33. return EXIT_FAILURE;
  34. for(f = 0; ; f++)
  35. {
  36. uint8_t *start;
  37. int w = 0, h = 0;
  38. if(!fgets(file, sizeof(file), stdin))
  39. break;
  40. file[strlen(file) - 1] = '\0';
  41. image = pipi_load(file);
  42. if(!image)
  43. return EXIT_FAILURE;
  44. p = pipi_get_pixels(image, PIPI_PIXELS_RGBA_U8);
  45. start = (uint8_t *)p->pixels;
  46. pipi_feed_sequence(seq, start, p->w, p->h);
  47. pipi_free(image);
  48. fprintf(stderr, "frame %d\r", f);
  49. }
  50. fprintf(stderr, "\n");
  51. pipi_close_sequence(seq);
  52. return EXIT_SUCCESS;
  53. }