/* BlinkenLib
Copyright 2004-2014 Stefan Schuermans <stefan@schuermans.info>
Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
a blinkenarea.org project */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <BlinkenLib/BlinkenLib.h>
/**
* @brief generate test movie
* @param[in,out] *pMovie pointer to old/new/changed movie
* @param[in] str_format format of new video to generate,
* may be NULL for appending to video
* @param[in] str_mode test movie mode: black, white, dots, lines, trans
* @param[in] str_duration duration of each frame in ms (as string)
*/
static void gen_test_movie(stBlinkenMovie **ppMovie, const char *str_format,
const char *str_mode, const char *str_duration)
{
unsigned int height, width, channels, colors;
enum {
ModeNone, ModeBlack, ModeWhite, ModeDots, ModeLines, ModeTrans
} mode = ModeNone;
int fmt_ok, append, duration;
//format
if (str_format == NULL) {
if (*ppMovie == NULL) {
str_format = "<none>";
fmt_ok = 0;
append = 0;
} else {
height = BlinkenMovieGetHeight(*ppMovie);
width = BlinkenMovieGetWidth(*ppMovie);
channels = BlinkenMovieGetChannels(*ppMovie);
colors = BlinkenMovieGetMaxval(*ppMovie) + 1;
fmt_ok = 1;
append = 1;
}
} else {
fmt_ok = sscanf(str_format, "%ux%u-%u/%u",
&width, &height, &channels, &colors) == 4;
append = 0;
}
//mode
if (strcmp(str_mode, "black") == 0)
mode = ModeBlack;
if (strcmp(str_mode, "white") == 0)