1
Casio Calculators / Re: Video player for Casio Prizm
« on: February 08, 2012, 03:40:54 pm »I'm sorry to be a bother, but I'm a huge newbie to this type of thing, with minimal programming experience, although I hope to learn soon and go onto a computer science major. I downloaded your package yesterday, but could not figure out how to execute the steamer.cpp file to compile the jpegs.I have all of my jpegs stored in a folder, now what do I do to compile them together into a .mjp file?The mjp file format is simple, it is an array of "frames". Each frame is length of the jpg file (rounded up to be dividable 4; 32 bit value in little endian) and the jpg file itself.
I attached simple program which does exactly this compilation to the package (streamer.cpp). For your convenience I dump it here :Code: [Select]#include "stdio.h"
const char *pszInputFmt="%04u.jpg";
const char *pszOutputfile = "demo.mjp";
char gBuf[65536];
int LoadFile(int index)
{
char sName[1024]={0};
FILE *f;
int len;
sprintf(sName,pszInputFmt,index);
f=fopen(sName,"rb");
if(!f)
{
return -1;
}
len=fread(gBuf,1,sizeof(gBuf),f);
fclose(f);
len = (len+3) & ~3;
return len;
}
int main(int argc, char* argv[])
{
FILE *f = fopen(pszOutputfile,"wb");
int i,len;//max 5 240
for(i=1;;i++)
{
len = LoadFile(i);
if(len <=0)break;//read failed
if(i % 5)continue;//25 fps --> 5 fps conversion
fwrite(&len,4,1,f);//each frame (= jpg file) has 4 byte length (int32, little endian)
fwrite(gBuf,len,1,f);//the file itself
printf(".");
}
fclose(f);
return 0;
}