月份:九月 2007

EM8621L get media duration

Posted on

  1. to get mp4’s duration, open track video/audio first.

sample code.tgz

廣告

stray ‘\’ in program

Posted on Updated on

problem
compiling error:

mmi_gfx_macro.h:21: parse error before `{‘
mmi_gfx_macro.h:21: stray ‘\’ in program
mmi_gfx_macro.h:22: stray ‘\’ in program

root cause
Possibly \ at “end" of a CRLF terminated line is not seen as
line-continued?
solution:
%dos2unix <your_c_file>

select block poblem

Posted on

solve IR controller blocking problem

int init_irdev(const char *fname)
{
unsigned long val;
unsigned long rptkey[] = {8,
IR_KEY_ARROW_UP,
IR_KEY_ARROW_DOWN,
IR_KEY_ARROW_RIGHT,
IR_KEY_ARROW_LEFT,
IR_KEY_MOUSE_UP,
IR_KEY_MOUSE_LEFT,
IR_KEY_MOUSE_DOWN,
IR_KEY_MOUSE_RIGHT
};

fd_irkey=open(“/dev/ir", O_RDONLY| O_NONBLOCK );
//fd_irkey=open(fname, O_NONBLOCK);

if (fd_irkey <0 ){
fprintf(stderr,"init_irdev(): Can’t opening %s.\n",fname);
return -1;
}

if( ioctl(fd_irkey,IR_IOCSETREPEATKEYS, rptkey))
{
close (fd_irkey);
fprintf(stderr,"init_irdev(): can’t set repeat.\n");
return -1;
}

val = 0;
if(ioctl(fd_irkey,IR_IOCSETWAITPERIOD, &val)){
close (fd_irkey);
fprintf(stderr,"init_irdev(): can’t set wait period.\n");
return -1;
}

val = 1;
if(ioctl(fd_irkey,IR_IOCSETLOOPCOUNT, &val)){
close (fd_irkey);
fprintf(stderr,"init_irdev(): Can’t set loop count.\n");
return -1;
}

return fd_irkey;
}

FD_ZERO(&copyfds);
FD_SET(awibm->fd_ir, &copyfds);
if( select(maxfd +1, &readfds, NULL, NULL, &tv) > 0)

man select to get the return value and man open to get the information about O_NONBLOCK flag setting