aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_video.c
diff options
context:
space:
mode:
authoretobi <git@e-tobi.net>2013-09-03 09:48:41 +0200
committeretobi <git@e-tobi.net>2013-09-03 09:48:41 +0200
commitab959d7b4194715870128e616b8e29d4a101e488 (patch)
tree61a746231d30817be73416a7d67763fd677a1042 /test/test_video.c
parent6b350466c4902c5b137e0efaf1d189128a7f18f5 (diff)
downloadlinux-dvb-apps-ab959d7b4194715870128e616b8e29d4a101e488.tar.gz
Imported Upstream version 1.1.1+rev1207upstream/1.1.1+rev1207
Diffstat (limited to 'test/test_video.c')
-rw-r--r--test/test_video.c51
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)
}
-