From 84e9873f846478476487d5cd2587e5879a0be8ea Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 28 Jul 2005 16:31:18 +0000 Subject: *** empty log message *** --- pixmaps/Makefile.am | 2 ++ pixmaps/maage.dv | Bin 0 -> 3600000 bytes src/Makefile.am | 2 ++ src/decoder.cc | 15 ++++++++------- src/dvfile.cc | 30 ++++++++++++++++++++++++++++++ src/dvfile.h | 21 +++++++++++++++++++++ tools/MIaVAdd | 2 +- 7 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 pixmaps/maage.dv diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am index 790741f..f6e4775 100644 --- a/pixmaps/Makefile.am +++ b/pixmaps/Makefile.am @@ -1,4 +1,5 @@ EXTRA_DIST = \ + maage.dv\ about.png \ clear.png \ cpr.png \ @@ -18,6 +19,7 @@ EXTRA_DIST = \ pixmapdir = $(datadir)/pixmaps pixmap_DATA = \ + maage.dv\ about.png \ clear.png \ cpr.png \ diff --git a/pixmaps/maage.dv b/pixmaps/maage.dv new file mode 100644 index 0000000..ced68b6 Binary files /dev/null and b/pixmaps/maage.dv differ diff --git a/src/Makefile.am b/src/Makefile.am index cff93b1..2382214 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,6 +12,7 @@ miav_SOURCES = $(shell if [ $QT_CXXFLAGS ] ; then ../tools/MocList cc; fi ) \ daemon.cc \ decoder.cc \ dv1394.cc \ + dvfile.cc \ encoder.cc \ file.cc \ frame.cc \ @@ -49,6 +50,7 @@ EXTRA_DIST = \ decoder.h \ dv.h \ dv1394.h \ + dvfile.h \ encoder.h \ file.h \ frame.h \ diff --git a/src/decoder.cc b/src/decoder.cc index 0655f61..dea0ae4 100644 --- a/src/decoder.cc +++ b/src/decoder.cc @@ -47,8 +47,9 @@ #include -#include "dv1394.h" #include "dv.h" +#include "dvfile.h" +#include "dv1394.h" #include "decoder.h" #include "debug.h" @@ -85,7 +86,7 @@ Decoder::~Decoder() void Decoder::decode() { - frame_stream *stream; + frame_stream *dvstream; bool local_shoot; int local_freeze; @@ -96,12 +97,12 @@ void Decoder::decode() dv1394 dv1394_stream = dv1394(info); // Use default port and channel. dvfile dvfile_stream = dvfile(info); - if(dv_stream.connect()) { + if(dv1394_stream.connect()) { // Use the dv1394 stream for input. - stream = &dv1394_stream; + dvstream = &dv1394_stream; } else { // Use the fallback dv filereader for input. - stream = &dvfile_stream; + dvstream = &dvfile_stream; } while(*running) { @@ -109,8 +110,8 @@ void Decoder::decode() SDL_Event user_event; // Read a dvframe - ptr = stream->readFrame(); - if(!ptr) return; // No frame read. (Due to firewire error) + ptr = dvstream->readFrame(); + if(!ptr) return; // No frame read. (Due to dv read error) old_record = local_record; local_shoot = b_shoot; 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 + +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; +} diff --git a/src/dvfile.h b/src/dvfile.h index 3a4d600..cf78d1a 100644 --- a/src/dvfile.h +++ b/src/dvfile.h @@ -27,4 +27,25 @@ #include "config.h" #ifndef __MIAV_DVFILE_H__ #define __MIAV_DVFILE_H__ + +#include "frame_stream.h" + +#include + +#include "info.h" + +#define TEST_MOVIE PIXMAPS"/maage.dv" + +class dvfile : public frame_stream { +public: + dvfile(Info* info); + ~dvfile(); + + unsigned char *readFrame(); + +private: + Info* info; + FILE* fp; +}; + #endif/*__MIAV_DVFILE_H__*/ diff --git a/tools/MIaVAdd b/tools/MIaVAdd index 167fe40..7463fb4 100755 --- a/tools/MIaVAdd +++ b/tools/MIaVAdd @@ -27,7 +27,7 @@ function allfile() { echo " * along with MIaV; if not, write to the Free Software" >> $1; echo " * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA." >> $1; echo " */" >> $1; - echo "#include " >> $1; + echo "#include \"config.h\"" >> $1; } function ccfile() { -- cgit v1.2.3