Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] I found a way to display still .jpg and .ppm s on the TV
Jan Panteltje writes:
> Maybe all of you already figured this out.
> the way I am doing it is a bit complicated:
>
> I have: xx.jpg
> Then I resize it with 'display' (part of imagemagick) to 352x288
> Nwxt convert it to .ppm with djpeg -pnm xx.jpg >frame.1.ppm
>
> Make a special parameter file for mpeg_encode (for just frame.1.ppm)
> mpeg_encode single-frame.param
> This results in (for example) movie.mpg (VERY short)
>
> Then I wrote a very small C program that sends the movie.mpg
> REPEATEDLY to /dev/video
> (without closing that device)
Are you aware that there is a call in the DVB API where you can send
an I-frame to be displayed as a still picture?
So you could do something like this:
int videoStillPicture(int fd, struct videoDisplayStillPicture *sp)
{
int ans;
if ( (ans = ioctl(fd,VIDEO_STILLPICTURE, sp) < 0)){
perror("VIDEO STILLPICTURE: ");
return -1;
}
return 0;
}
void load_iframe(int filefd, int fd)
{
struct stat st;
struct videoDisplayStillPicture sp;
fstat(filefd, &st);
sp.iFrame = (char *) malloc(st.st_size);
sp.size = st.st_size;
printf("I-frame size: %d\n", sp.size);
if(!sp.iFrame) {
printf("No memory for I-Frame\n");
return;
}
printf("read: %d bytes\n",read(filefd,sp.iFrame,sp.size));
videoStillPicture(fd,&sp);
sleep(3); //hold picture for 3 secs and then start replay again
videoPlay(fd);
}
main(int argc, char **argv)
{
int fd;
int filefd;
if (argc < 2) return -1;
if ( (filefd = open(argv[1],O_RDONLY)) < 0){
perror("File open:");
return -1;
}
if((fd = open("/dev/ost/video",O_RDWR|O_NONBLOCK)) < 0){
perror("VIDEO DEVICE: ");
return -1;
}
load_iframe(filefd, fd);
play_file_video(filefd, fd);
close(fd);
close(filefd);
return 0;
}
Marcus
---------------------------------------------------------------------
Dr. Marcus Metzler
mocm@netcologne.de http://www.metzlerbros.de
mocm@convergence.de http://www.convergence.de
Convergence Integrated Media GmbH
Rosenthaler Str. 51
D-10178 Berlin
---------------------------------------------------------------------
---
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.
Home |
Main Index |
Thread Index