/* * test_video.c - Test program for new API * * Copyright (C) 2000 Ralph Metzler * & Marcus Metzler for convergence integrated media GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include int videoStop(int fd) { int ans; if ( (ans = ioctl(fd,VIDEO_STOP,0) < 0)){ perror("VIDEO STOP: "); return -1; } return 0; } int videoPlay(int fd) { int ans; if ( (ans = ioctl(fd,VIDEO_PLAY) < 0)){ perror("VIDEO PLAY: "); return -1; } return 0; } int videoFreeze(int fd) { int ans; if ( (ans = ioctl(fd,VIDEO_FREEZE) < 0)){ perror("VIDEO FREEZE: "); return -1; } return 0; } int videoContinue(int fd) { int ans; if ( (ans = ioctl(fd,VIDEO_CONTINUE) < 0)){ perror("VIDEO CONTINUE: "); return -1; } return 0; } int videoSelectSource(int fd, video_stream_source_t source) { int ans; if ( (ans = ioctl(fd,VIDEO_SELECT_SOURCE, source) < 0)){ perror("VIDEO SELECT SOURCE: "); return -1; } return 0; } int videoSetBlank(int fd, boolean state) { int ans; if ( (ans = ioctl(fd,VIDEO_SET_BLANK, state) < 0)){ perror("VIDEO SET BLANK: "); return -1; } return 0; } int videoFastForward(int fd,int nframes) { int ans; if ( (ans = ioctl(fd,VIDEO_FAST_FORWARD, nframes) < 0)){ perror("VIDEO FAST FORWARD: "); return -1; } return 0; } int videoSlowMotion(int fd,int nframes) { int ans; if ( (ans = ioctl(fd,VIDEO_SLOWMOTION, nframes) < 0)){ perror("VIDEO SLOWMOTION: "); return -1; } return 0; } int videoGetStatus(int fd) { struct video_status stat; int ans; if ( (ans = ioctl(fd,VIDEO_GET_STATUS, &stat) < 0)){ perror("VIDEO GET STATUS: "); return -1; } printf("Video Status:\n"); printf(" Blank State : %s\n", (stat.video_blank ? "BLANK" : "STILL")); printf(" Play State : "); switch ((int)stat.play_state){ case VIDEO_STOPPED: printf("STOPPED (%d)\n",stat.play_state); break; case VIDEO_PLAYING: printf("PLAYING (%d)\n",stat.play_state); break; case VIDEO_FREEZED: printf("FREEZED (%d)\n",stat.play_state); break; default: printf("unknown (%d)\n",stat.play_state); break; } printf(" Stream Source : "); switch((int)stat.stream_source){ case VIDEO_SOURCE_DEMUX: printf("DEMUX (%d)\n",stat.stream_source); break; case VIDEO_SOURCE_MEMORY: printf("MEMORY (%d)\n",stat.stream_source); break; default: printf("unknown (%d)\n",stat.stream_source); break; } printf(" Format (Aspect Ratio): "); switch((int)stat.video_format){ case VIDEO_FORMAT_4_3: printf("4:3 (%d)\n",stat.video_format); break; case VIDEO_FORMAT_16_9: printf("16:9 (%d)\n",stat.video_format); break; default: printf("unknown (%d)\n",stat.video_format); break; } printf(" Display Format : "); switch((int)stat.display_format){ case VIDEO_PAN_SCAN: printf("Pan&Scan (%d)\n",stat.display_format); break; case VIDEO_LETTER_BOX: printf("Letterbox (%d)\n",stat.display_format); break; case VIDEO_CENTER_CUT_OUT: printf("Center cutout (%d)\n",stat.display_format); break; default: printf("unknown (%d)\n",stat.display_format); break; } return 0; } int videoStillPicture(int fd, struct video_still_picture *sp) { int ans; if ( (ans = ioctl(fd,VIDEO_STILLPICTURE, sp) < 0)){ perror("VIDEO STILLPICTURE: "); return -1; } return 0; } #define BUFFY 32768 #define NFD 2 void play_file_video(int filefd, int fd) { char buf[BUFFY]; int count; int written; struct pollfd pfd[NFD]; int stopped = 0; int ch; pfd[0].fd = STDIN_FILENO; pfd[0].events = POLLIN; pfd[1].fd = fd; pfd[1].events = POLLOUT; videoSelectSource(fd,VIDEO_SOURCE_MEMORY); videoPlay(fd); count = read(filefd,buf,BUFFY); write(fd,buf,count); while ( (count = read(filefd,buf,BUFFY)) >= 0 ){ written = 0; while(written < count){ if (poll(pfd,NFD,1)){ if (pfd[1].revents & POLLOUT){ written += write(fd,buf+written, count-written); } if (pfd[0].revents & POLLIN){ int c = getchar(); switch(c){ case 'z': videoFreeze(fd); printf("playback frozen\n"); stopped = 1; break; case 's': videoStop(fd); printf("playback stopped\n"); stopped = 1; break; case 'c': videoContinue(fd); printf("playback continued\n"); stopped = 0; break; case 'p': videoPlay(fd); printf("playback started\n"); stopped = 0; break; case 'f': videoFastForward(fd,0); printf("fastforward\n"); stopped = 0; break; case 'm': videoSlowMotion(fd,2); printf("slowmotion\n"); stopped = 0; break; case 'q': videoContinue(fd); exit(0); break; } } } } } } void load_iframe(int filefd, int fd) { struct stat st; struct video_still_picture 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); 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/video1",O_RDWR|O_NONBLOCK)) < 0){ perror("VIDEO DEVICE: "); return -1; } // videoSetBlank(fd,false); //videoPlay(fd); //sleep(4); //videoFreeze(fd); //sleep(3); //videoContinue(fd); //sleep(3); //videoStop(fd); videoGetStatus(fd); //load_iframe(filefd, fd); play_file_video(filefd, fd); close(fd); close(filefd); return 0; } 43 by reinelt]reinelt9-57/+188 icons for all remaining drivers git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@243 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-13[lcd4linux @ 2003-09-13 06:20:39 by reinelt]reinelt7-8673/+459 HD44780 timings changed; deactivated libtool git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@242 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-11[lcd4linux @ 2003-09-11 15:05:24 by reinelt]reinelt3-89/+1519 missing files for autoconf/automake/libtool git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@241 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-11[lcd4linux @ 2003-09-11 04:09:52 by reinelt]reinelt6-14/+46 minor cleanups git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@240 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-10[lcd4linux @ 2003-09-10 15:59:39 by reinelt]reinelt4-13/+391 minor cleanups git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@239 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-10[lcd4linux @ 2003-09-10 15:09:21 by reinelt]reinelt1-0/+28 ChangeLog git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@238 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-10[lcd4linux @ 2003-09-10 14:01:52 by reinelt]reinelt6-21/+110 icons nearly finished\! git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@237 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-10[lcd4linux @ 2003-09-10 08:37:09 by reinelt]reinelt2-50/+73 icons: reorganized tick_* again... git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@236 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-10[lcd4linux @ 2003-09-10 03:48:22 by reinelt]reinelt7-47/+130 Icons for M50530, new processing scheme (Ticks.Text...) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@235 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-09[lcd4linux @ 2003-09-09 11:47:47 by reinelt]reinelt3-14/+37 basic icon support for HD44780 git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@234 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-09[lcd4linux @ 2003-09-09 06:54:43 by reinelt]reinelt15-135/+177 new function 'cfg_number()' git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@233 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-09[lcd4linux @ 2003-09-09 05:30:33 by reinelt]reinelt11-90/+243 even more icons stuff git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@232 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-01[lcd4linux @ 2003-09-01 07:07:03 by reinelt]reinelt8-402/+13825 shared liblcd4linux git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@231 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-09-01[lcd4linux @ 2003-09-01 04:09:34 by reinelt]reinelt9-28/+127 icons nearly finished, but MatrixOrbital only git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@230 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-24[lcd4linux @ 2003-08-24 05:28:31 by reinelt]reinelt1-119/+156 ChangeLog git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@229 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-24[lcd4linux @ 2003-08-24 05:17:58 by reinelt]reinelt25-131/+217 liblcd4linux patch from Patrick Schemitz git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@228 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-24[lcd4linux @ 2003-08-24 04:31:56 by reinelt]reinelt6-11/+154 icon.c icon.h added git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@227 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-22[lcd4linux @ 2003-08-22 03:45:08 by reinelt]reinelt3-8/+25 bug in parallel port code fixed, more icons stuff git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@226 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-20[lcd4linux @ 2003-08-20 05:26:43 by reinelt]reinelt1-9/+11 small bug in bar compaction fixed git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@225 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-19[lcd4linux @ 2003-08-19 05:23:55 by reinelt]reinelt2-62/+123 HD44780 dual-controller patch from Jesse Brook Kovach git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@224 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-19[lcd4linux @ 2003-08-19 04:28:41 by reinelt]reinelt4-19/+42 more Icon stuff, minor glitches fixed git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@223 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-17[lcd4linux @ 2003-08-17 16:37:39 by reinelt]reinelt5-23/+77 more icon framework git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@222 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-17[lcd4linux @ 2003-08-17 12:11:58 by reinelt]reinelt6-27/+118 framework for icons prepared git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@221 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-17[lcd4linux @ 2003-08-17 08:25:30 by reinelt]reinelt6-46/+185 preparations for liblcd4linux; minor bugs in SIN.c and Skeleton.c git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@220 3ae390bd-cb1e-0410-b409-cd5a39f66f1f 2003-08-17[lcd4linux @ 2003-08-17 06:57:04 by reinelt]reinelt5-544/+325 complete rewrite of the Crystalfontz driver git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@219 3ae390bd-cb1e-0410-b409-cd5a39f66f1f