diff options
Diffstat (limited to 'test/test_video.c')
-rw-r--r-- | test/test_video.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/test/test_video.c b/test/test_video.c index 09c2be1..ac66050 100644 --- a/test/test_video.c +++ b/test/test_video.c @@ -1,4 +1,4 @@ -/* +/* * test_video.c - Test program for new API * * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> @@ -40,7 +40,7 @@ int videoStop(int fd) { int ans; - if ( (ans = ioctl(fd,VIDEO_STOP,0) < 0)){ + if ((ans = ioctl(fd,VIDEO_STOP,0)) < 0) { perror("VIDEO STOP: "); return -1; } @@ -52,7 +52,7 @@ int videoPlay(int fd) { int ans; - if ( (ans = ioctl(fd,VIDEO_PLAY) < 0)){ + if ((ans = ioctl(fd,VIDEO_PLAY)) < 0) { perror("VIDEO PLAY: "); return -1; } @@ -65,7 +65,7 @@ int videoFreeze(int fd) { int ans; - if ( (ans = ioctl(fd,VIDEO_FREEZE) < 0)){ + if ((ans = ioctl(fd,VIDEO_FREEZE)) < 0) { perror("VIDEO FREEZE: "); return -1; } @@ -78,7 +78,7 @@ int videoContinue(int fd) { int ans; - if ( (ans = ioctl(fd,VIDEO_CONTINUE) < 0)){ + if ((ans = ioctl(fd,VIDEO_CONTINUE)) < 0) { perror("VIDEO CONTINUE: "); return -1; } @@ -90,7 +90,7 @@ int videoSelectSource(int fd, video_stream_source_t source) { int ans; - if ( (ans = ioctl(fd,VIDEO_SELECT_SOURCE, source) < 0)){ + if ((ans = ioctl(fd,VIDEO_SELECT_SOURCE, source)) < 0) { perror("VIDEO SELECT SOURCE: "); return -1; } @@ -104,7 +104,7 @@ int videoSetBlank(int fd, boolean state) { int ans; - if ( (ans = ioctl(fd,VIDEO_SET_BLANK, state) < 0)){ + if ((ans = ioctl(fd,VIDEO_SET_BLANK, state)) < 0) { perror("VIDEO SET BLANK: "); return -1; } @@ -116,7 +116,7 @@ int videoFastForward(int fd,int nframes) { int ans; - if ( (ans = ioctl(fd,VIDEO_FAST_FORWARD, nframes) < 0)){ + if ((ans = ioctl(fd,VIDEO_FAST_FORWARD, nframes)) < 0) { perror("VIDEO FAST FORWARD: "); return -1; } @@ -128,7 +128,7 @@ int videoSlowMotion(int fd,int nframes) { int ans; - if ( (ans = ioctl(fd,VIDEO_SLOWMOTION, nframes) < 0)){ + if ((ans = ioctl(fd,VIDEO_SLOWMOTION, nframes)) < 0) { perror("VIDEO SLOWMOTION: "); return -1; } @@ -141,7 +141,7 @@ int videoGetStatus(int fd) struct video_status stat; int ans; - if ( (ans = ioctl(fd,VIDEO_GET_STATUS, &stat) < 0)){ + if ((ans = ioctl(fd,VIDEO_GET_STATUS, &stat)) < 0) { perror("VIDEO GET STATUS: "); return -1; } @@ -164,7 +164,7 @@ int videoGetStatus(int fd) printf("unknown (%d)\n",stat.play_state); break; } - + printf(" Stream Source : "); switch((int)stat.stream_source){ case VIDEO_SOURCE_DEMUX: @@ -213,7 +213,7 @@ int videoStillPicture(int fd, struct video_still_picture *sp) { int ans; - if ( (ans = ioctl(fd,VIDEO_STILLPICTURE, sp) < 0)){ + if ((ans = ioctl(fd,VIDEO_STILLPICTURE, sp)) < 0) { perror("VIDEO STILLPICTURE: "); return -1; } @@ -234,17 +234,17 @@ void play_file_video(int filefd, int fd) 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){ @@ -267,7 +267,7 @@ void play_file_video(int filefd, int fd) printf("playback stopped\n"); stopped = 1; break; - + case 'c': videoContinue(fd); printf("playback continued\n"); @@ -298,7 +298,7 @@ void play_file_video(int filefd, int fd) break; } } - + } } } @@ -310,12 +310,12 @@ void load_iframe(int filefd, int fd) 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) { + + if (!sp.iFrame) { printf("No memory for I-Frame\n"); return; } @@ -338,12 +338,12 @@ main(int argc, char **argv) perror("File open:"); return -1; } - if((fd = open("/dev/ost/video1",O_RDWR|O_NONBLOCK)) < 0){ + if ((fd = open("/dev/ost/video1",O_RDWR|O_NONBLOCK)) < 0){ perror("VIDEO DEVICE: "); return -1; } - - + + // videoSetBlank(fd,false); @@ -365,4 +365,3 @@ main(int argc, char **argv) } - |