[Sumover-dev] [svn commit] r4377 - in vic/branches/mpeg4: tcl video

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Thu Feb 5 16:22:17 GMT 2009


Author: soohyunc
Date: Thu Feb  5 16:22:16 2009
New Revision: 4377

Added:
   vic/branches/mpeg4/video/grabber-file.cpp   (contents, props changed)
      - copied, changed from r4376, /vic/branches/mpeg4/video/grabber-yuv.cpp
Removed:
   vic/branches/mpeg4/video/grabber-yuv.cpp
Modified:
   vic/branches/mpeg4/Makefile.in
   vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl
   vic/branches/mpeg4/tcl/ui-grabber.tcl
   vic/branches/mpeg4/tcl/ui-resource.tcl

Log:
o  Re-named StillYuvGrabber and StillYuvDevice to FileGrabber and FileDevice,
   respectively.

o  Removed unsupported entries in attributes_ at FileDevice constructor.
   (Currently, CIF 4:2:0 is only supported.)

o  Re-named grabber-yuv.cpp to grabber-file.cpp

o  Re-named "yuv" FileDevice in UI window to "filedev"

In order to use this FileGrabber, one can enable it as belows:

    ./vic -XfileGrabber <IP address>/<port number>

Then, select "filedev" device in the "Device" option.
And, type a file name for testing.

Finally, click on "Transmit" button.



Modified: vic/branches/mpeg4/Makefile.in
==============================================================================
--- vic/branches/mpeg4/Makefile.in	(original)
+++ vic/branches/mpeg4/Makefile.in	Thu Feb  5 16:22:16 2009
@@ -137,7 +137,7 @@
 	net/net.o net/net-ip.o net/net-addr.o net/net-ipv6.o \
 	net/mbus_handler.o net/mbus_engine.o net/group-ipc.o net/confbus.o \
 	rtp/session.o rtp/source.o rtp/transmitter.o rtp/pktbuf-rtp.o \
-	video/device.o video/grabber.o video/grabber-still.o video/grabber-yuv.o \
+	video/device.o video/grabber.o video/grabber-still.o video/grabber-file.o \
 	codec/encoder-h261.o codec/encoder-jpeg.o codec/encoder-raw.o \
 	codec/encoder-h263.o codec/encoder-h263v2.o codec/encoder-nv.o \
 	codec/encoder-cellb.o codec/encoder-pvh.o codec/compositor.o \

Modified: vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl	Thu Feb  5 16:22:16 2009
@@ -789,7 +789,7 @@
 			set defaultFormat($d) $videoFormat
 			continue
 		}
-		if { [$d nickname] == "yuv" && ![yesno stillGrabber] } {
+		if { [$d nickname] == "filedev" && ![yesno fileGrabber] } {
 			set defaultFormat($d) $videoFormat
 			continue
 		}

Modified: vic/branches/mpeg4/tcl/ui-grabber.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-grabber.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-grabber.tcl	Thu Feb  5 16:22:16 2009
@@ -645,9 +645,9 @@
     pack $w.f.entry -side left -fill x -expand 1
 }
 
-proc build.yuv w {
+proc build.filedev w {
 	set f [smallfont]
-	label $w.title -text "StillYuvGrabber"
+	label $w.title -text "FileGrabber"
 
     frame $w.f -relief sunken -borderwidth 2
     label $w.f.label  -font $f -anchor e -text "File"

Modified: vic/branches/mpeg4/tcl/ui-resource.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-resource.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-resource.tcl	Thu Feb  5 16:22:16 2009
@@ -171,6 +171,7 @@
 	option add Vic.useJPEGforH261 false startupFile
 	option add Vic.useHardwareComp false startupFile
 	option add Vic.stillGrabber false startupFile 
+	option add Vic.fileGrabber false startupFile 
 	option add Vic.siteDropTime "300" startupFile
 	option add Vic.quality "0" startupFile
 	option add Vic.inputType "ntsc" startupFile

Copied: vic/branches/mpeg4/video/grabber-file.cpp (from r4376, /vic/branches/mpeg4/video/grabber-yuv.cpp)
==============================================================================
--- /vic/branches/mpeg4/video/grabber-yuv.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-file.cpp	Thu Feb  5 16:22:16 2009
@@ -1,6 +1,7 @@
 /*
- * FILE:	grabber-yuv.cpp
+ * FILE:	grabber-file.cpp
  * AUTHOR:	Soo-Hyun Choi <s.choi at cs.ucl.ac.uk>
+ * 			Piers O'Hanlon <p.ohanlon at cs.ucl.ac.uk>
  *
  * Copyright (c) 2009 University College London
  * All rights reserved.
@@ -62,10 +63,10 @@
 //#define DEBUG 1
 #undef DEBUG
 
-class StillYuvGrabber : public Grabber {
+class FileGrabber : public Grabber {
 public:
-	StillYuvGrabber();
-	virtual ~StillYuvGrabber();
+	FileGrabber();
+	virtual ~FileGrabber();
 	virtual int command(int argc, const char* const* argv);
 protected:
 	void start();
@@ -79,11 +80,11 @@
 	int num_frame_;		// current frame number
 };
 
-class StillYuvDevice : public InputDevice {
+class FileDevice : public InputDevice {
 public:
-    StillYuvDevice(const char* s);
+    FileDevice(const char* s);
     virtual int command(int argc, const char * const * argv);
-    virtual Grabber* still_yuv_grabber();
+    virtual Grabber* file_grabber();
 
     void load_file(const char * const file);
     char *frame_;
@@ -92,25 +93,25 @@
 private:
 };
 
-static StillYuvDevice yuv_device("yuv");
+static FileDevice file_device("filedev");
 
-StillYuvDevice::StillYuvDevice(const char* s) : InputDevice(s),
+FileDevice::FileDevice(const char* s) : InputDevice(s),
 		frame_(NULL), len_(0), devstat_(-1)
 {
-    attributes_ = "format { 420 422 jpeg cif } size { small large cif }";
+	attributes_ = "format { 420 } size { small large cif }";
 
 #ifdef DEBUG
-    debug_msg("StillYuvDevice::StillYuvDevice name=%s\n", s);
+    debug_msg("FileDevice::FileDevice name=%s\n", s);
 #endif /* DEBUG */
 }
 
 /*
- * StillYuvDevice
+ * FileDevice
  */
-int StillYuvDevice::command(int argc, const char*const* argv) {
+int FileDevice::command(int argc, const char*const* argv) {
 #ifdef DEBUG
 	for (int i = 0; i < argc; i++)
-		debug_msg("StillYuvDevice\t%s\n", argv[i]);
+		debug_msg("FileDevice\t%s\n", argv[i]);
 #endif
     if (argc == 3)
     {
@@ -119,7 +120,7 @@
 		    const char* fmt = argv[2];
 			TclObject* o = 0;
 			if (strcmp(fmt, "cif") == 0) 
-				o = still_yuv_grabber();
+				o = file_grabber();
 		    if (o != 0)
 				Tcl::instance().result(o->name());
 		    return (TCL_OK);
@@ -133,14 +134,14 @@
     return (InputDevice::command(argc, argv));
 }
 
-Grabber* StillYuvDevice::still_yuv_grabber() {
-	return (new StillYuvGrabber());
+Grabber* FileDevice::file_grabber() {
+	return (new FileGrabber());
 }
 
 /*
  * File loading
  */
-void StillYuvDevice::load_file(const char * const f) {
+void FileDevice::load_file(const char * const f) {
     FILE *fp;
     struct stat s;
     
@@ -173,70 +174,50 @@
 /*
  * StillYuvGraber
  */
-int StillYuvGrabber::command(int argc, const char* const* argv) {
+int FileGrabber::command(int argc, const char* const* argv) {
 #ifdef DEBUG
-	debug_msg("StillYuvGrabber::command argc=%d\n", argc);
+	debug_msg("FileGrabber::command argc=%d\n", argc);
 	for (int i = 0; i < argc; i++)
 		debug_msg("\"%s\"\n", argv[i]);
 #endif
-	Tcl& tcl = Tcl::instance();
+	//Tcl& tcl = Tcl::instance();
 
-    if (argc == 2)
-    {
-        if (strcmp(argv[1], "status") == 0)
-        {
-            sprintf(tcl.buffer(), "%d", status_);
-            tcl.result(tcl.buffer());
-            return (TCL_OK);
-        }
-        if (strcmp(argv[1], "need-capwin") == 0)
-        {
-            tcl.result("0");
-            return (TCL_OK);
-        }
-    }
-
-    if (argc == 3)
-    {
-        if (strcmp(argv[1], "q") == 0)
-        {
-            return (TCL_OK);
-        }
-        if (strcmp(argv[1], "decimate") == 0)
-        {
+    if (argc == 3) {
+        if (strcmp(argv[1], "decimate") == 0) {
             decimate_ = atoi(argv[2]);
             setsize();
             if (running_)
                 start();
         }
-    }
-    return (Grabber::command(argc, argv));
+	}
+	
+	return (Grabber::command(argc, argv));
 }
 
-StillYuvGrabber::StillYuvGrabber() :
+FileGrabber::FileGrabber() :
 	width_(0), height_(0), num_frame_(0)
 {
 	// set device status 
-	status_ = yuv_device.devstat_;
+	status_ = file_device.devstat_;
 }
 
-StillYuvGrabber::~StillYuvGrabber() {
+FileGrabber::~FileGrabber() {
 #ifdef DEBUG
-    debug_msg("Destroy StillYuvGrabber\n");
+    debug_msg("Destroy FileGrabber\n");
 #endif
 }
 
-void StillYuvGrabber::start() {
+void FileGrabber::start() {
 	Grabber::start();
 }
 
-void StillYuvGrabber::stop() {
+void FileGrabber::stop() {
     cancel();
 }
 
-void StillYuvGrabber::setsize() {
+void FileGrabber::setsize() {
 #ifdef DEBUG
-	debug_msg("StillYuvGrabber::setsize()\n");
+	debug_msg("FileGrabber::setsize()\n");
 #endif
 
 	if(running_)
@@ -251,20 +232,20 @@
 	allocref();
 }
 
-int StillYuvGrabber::grab() {
+int FileGrabber::grab() {
 #ifdef DEBUG
-	debug_msg("StillYuvGrabber::grab() called\n");
+	debug_msg("FileGrabber::grab() called\n");
 #endif
 
     int frc = 0; 
 
 	// "framesize_" is just the number of pixels, 
 	// so the number of bytes becomes "3 * framesize_ / 2"
-	memcpy (frame_, yuv_device.frame_ + num_frame_, 
+	memcpy (frame_, file_device.frame_ + num_frame_, 
 			framesize_ + (framesize_ >> 1));
 
 	if ((num_frame_ += framesize_ + (framesize_ >> 1)) 
-			< yuv_device.len_) {
+			< file_device.len_) {
 		// we are good here
 	} else {
 		num_frame_=0;



More information about the Sumover-dev mailing list