summaryrefslogtreecommitdiff
path: root/src/dvfile.cc
diff options
context:
space:
mode:
authordeva <deva>2005-09-20 19:39:49 +0000
committerdeva <deva>2005-09-20 19:39:49 +0000
commit48b768db44cb9e00adfead71b973074685cec417 (patch)
treee606f6f93b5fee42335b6f4f3cfaf7b3dc487cae /src/dvfile.cc
parent5298cdacd41efbf2ffd0282b14e401734b31d90a (diff)
*** empty log message ***R0_2_8
Diffstat (limited to 'src/dvfile.cc')
-rw-r--r--src/dvfile.cc9
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;