summaryrefslogtreecommitdiff
path: root/src/dvfile.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dvfile.cc')
-rw-r--r--src/dvfile.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/dvfile.cc b/src/dvfile.cc
index ef1db71..a0dccf3 100644
--- a/src/dvfile.cc
+++ b/src/dvfile.cc
@@ -27,3 +27,33 @@
#include "config.h"
#include "dvfile.h"
+#include "dv.h"
+
+#include <time.h>
+
+dvfile::dvfile(Info* i)
+{
+ info = i;
+ fp = fopen(TEST_MOVIE, "r");
+}
+
+dvfile::~dvfile()
+{
+ fclose(fp);
+}
+
+unsigned char *dvfile::readFrame()
+{
+ struct timespec ts;
+ unsigned char *frame = new unsigned char[DVPACKAGE_SIZE];
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = 1000000000L / 25L; // 1/25s
+ nanosleep(&ts, NULL);
+
+ while(fread(frame, DVPACKAGE_SIZE, 1, fp) == 0) {
+ fseek(fp, 0L, SEEK_SET);
+ }
+
+ return frame;
+}