diff options
Diffstat (limited to 'src/dvfile.cc')
-rw-r--r-- | src/dvfile.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/dvfile.cc b/src/dvfile.cc index b942e42..b7c7f47 100644 --- a/src/dvfile.cc +++ b/src/dvfile.cc @@ -32,15 +32,17 @@ #include "util.h" dvfile::dvfile(Info* i) + : fp(QString(TEST_MOVIE)) { info = i; - fp = fopen(TEST_MOVIE, "r"); - if(!fp) info->error("Couldn't open %s for reading.", TEST_MOVIE); + if(!fp.open(QIODevice::ReadOnly)) { + info->error("Couldn't open %s for reading.", TEST_MOVIE); + } } dvfile::~dvfile() { - fclose(fp); + fp.close(); } unsigned char *dvfile::readFrame() @@ -49,9 +51,9 @@ unsigned char *dvfile::readFrame() sleep_1_frame(); - if(fp) { - while(fread(frame, DVPACKAGE_SIZE, 1, fp) == 0) { - fseek(fp, 0L, SEEK_SET); + if(fp.isReadable()) { + while(fp.read((char *)frame, DVPACKAGE_SIZE) == 0) { + fp.seek(0); } } else { memset(frame, 0, sizeof(frame)); |