diff options
Diffstat (limited to 'src/dvfile.cc')
-rw-r--r-- | src/dvfile.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dvfile.cc b/src/dvfile.cc index a0dccf3..7eab867 100644 --- a/src/dvfile.cc +++ b/src/dvfile.cc @@ -35,6 +35,7 @@ dvfile::dvfile(Info* i) { info = i; fp = fopen(TEST_MOVIE, "r"); + if(!fp) info->error("Couldn't open %s for reading.", TEST_MOVIE); } dvfile::~dvfile() @@ -51,8 +52,12 @@ unsigned char *dvfile::readFrame() ts.tv_nsec = 1000000000L / 25L; // 1/25s nanosleep(&ts, NULL); - while(fread(frame, DVPACKAGE_SIZE, 1, fp) == 0) { - fseek(fp, 0L, SEEK_SET); + if(fp) { + while(fread(frame, DVPACKAGE_SIZE, 1, fp) == 0) { + fseek(fp, 0L, SEEK_SET); + } + } else { + memset(frame, 0, sizeof(frame)); } return frame; |