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

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Thu Dec 16 05:06:06 GMT 2010


Author: douglask
Date: Thu Dec 16 05:06:06 2010
New Revision: 4896

Modified:
   vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl
   vic/branches/mpeg4/tcl/ui-grabber.tcl
   vic/branches/mpeg4/tcl/ui-resource.tcl
   vic/branches/mpeg4/tcl/ui-util.tcl
   vic/branches/mpeg4/video/grabber-decklink.cpp
   vic/branches/mpeg4/video/grabber-win32DS.cpp
   vic/branches/mpeg4/video/grabber-win32DS.h

Log:
DirectShow and DeckLink grabbers now use the same resource for the Large size capture resolution

Modified: vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-ctrlmenu.tcl	Thu Dec 16 05:06:06 2010
@@ -793,7 +793,7 @@
 	} else {
 		insert_grabber_panel [$device nickname]
 	}
-	if [device_supports $device capture_resolution *] {
+	if [device_supports $device large_size_resolution *] {
 		$capResolutionButton configure -state normal
 		attach_capture_resolutions $device
 	}
@@ -1192,9 +1192,9 @@
 }
 
 proc attach_capture_resolutions device {
-	global capResolutionButton capResolution defaultCapResolution
+	global capResolutionButton defaultLargeSizeResolution largeSizeResolution
 	catch "destroy $capResolutionButton.menu"
-	set resolutions [attribute_class [$device attributes] capture_resolution]
+	set resolutions [attribute_class [$device attributes] large_size_resolution]
 	set f [smallfont]
 	set m $capResolutionButton.menu
 	menu $m
@@ -1202,28 +1202,28 @@
 	foreach resolution $resolutions {
 		$m add radiobutton -label $resolution \
 			-command "restart" \
-			-value $resolution -variable capResolution -font $f
+			-value $resolution -variable largeSizeResolution -font $f
 	}
-	if ![info exists defaultCapResolution($device)] {
+	if ![info exists defaultLargeSizeResolution($device)] {
 		set nn [$device nickname]
-		if [info exists defaultCapResolution($nn)] {
-			set defaultCapResolution($device) $defaultCapResolution($nn)
+		if [info exists defaultLargeSizeResolution($nn)] {
+			set defaultLargeSizeResolution($device) $defaultLargeSizeResolution($nn)
 		} else {
-			set s [resource defaultCapResolution($nn)]
+			set s [resource largeSizeResolution]
 			if { $s != "" } {
-				set defaultCapResolution($device) $s
+				set defaultLargeSizeResolution($device) $s
 			} else {
 				# use current resolution setting
 				set s [string trim [attribute_class [$device attributes] selected_resolution]]
 				if { $s != "" } {
-					set defaultCapResolution($device) $s
+					set defaultLargeSizeResolution($device) $s
 				} else {
-					set defaultCapResolution($device) [lindex $resolutions 0]
+					set defaultLargeSizeResolution($device) [lindex $resolutions 0]
 				}
 			}
 		}
 	}
-	set capResolution $defaultCapResolution($device)
+	set largeSizeResolution $defaultLargeSizeResolution($device)
 }
 
 proc build.encoder_buttons w {

Modified: vic/branches/mpeg4/tcl/ui-grabber.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-grabber.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-grabber.tcl	Thu Dec 16 05:06:06 2010
@@ -32,7 +32,7 @@
 }
 
 proc build.directshow w {
-    global capResolutionButton capResolution videoDevice
+    global capResolutionButton largeSizeResolution videoDevice
 
     label $w.title -text "DirectShow grabber controls"
     frame $w.f -relief sunken -borderwidth 2
@@ -59,8 +59,8 @@
     pack $w.f.resolution -fill x -side left
     pack $w.f.properties -fill x -side right
     pack $w.title $w.f -fill x -expand 1
+	set largeSizeResolution  [resource largeSizeResolution]
     set capResolutionButton $w.f.resolution
-    set capResolution  [resource capResolution]
     set_capture_resolution_button_state
 }
 
@@ -227,7 +227,7 @@
 }
 
 proc build.blackmagic w {
-    global scalerCapResolution scalerButtons
+    global largeSizeResolution scalerButtons
 
     label $w.title -text "Blackmagic DeckLink-Grabber"
     frame $w.f -relief sunken -borderwidth 2
@@ -236,38 +236,38 @@
 
     if {$::tk_version > 8.4 && [windowingsystem] != "x11"} {
         ttk::radiobutton $w.f.b0 -text "none" -command "restart" \
-           -variable scalerCapResolution -value "none"
+           -variable largeSizeResolution -value "none"
         ttk::radiobutton $w.f.b1 -text "960p" -command "restart" \
-            -variable scalerCapResolution -value "960p"
+            -variable largeSizeResolution -value "960p"
         ttk::radiobutton $w.f.b2 -text "720p" -command "restart" \
-            -variable scalerCapResolution -value "720p"
+            -variable largeSizeResolution -value "720p"
         ttk::radiobutton $w.f.b3 -text "576p" -command "restart" \
-            -variable scalerCapResolution -value "576p"
+            -variable largeSizeResolution -value "576p"
         ttk::radiobutton $w.f.b4 -text "480p" -command "restart" \
-            -variable scalerCapResolution -value "480p"
+            -variable largeSizeResolution -value "480p"
     } else {
         set f [smallfont]
         radiobutton $w.f.b0 -text "none" -command "restart" \
             -padx 0 -pady 0 \
-            -anchor w -variable scalerCapResolution -font $f -relief flat -value "none"
+            -anchor w -variable largeSizeResolution -font $f -relief flat -value "none"
         radiobutton $w.f.b1 -text "960p" -command "restart" \
             -padx 0 -pady 0 \
-            -anchor w -variable scalerCapResolution -font $f -relief flat -value "960p"
+            -anchor w -variable largeSizeResolution -font $f -relief flat -value "960p"
         radiobutton $w.f.b2 -text "720p" -command "restart" \
             -padx 0 -pady 0 \
-            -anchor w -variable scalerCapResolution -font $f -relief flat -value "720p"
+            -anchor w -variable largeSizeResolution -font $f -relief flat -value "720p"
         radiobutton $w.f.b3 -text "576p" -command "restart" \
             -padx 0 -pady 0 \
-            -anchor w -variable scalerCapResolution -font $f -relief flat -value "576p"
+            -anchor w -variable largeSizeResolution -font $f -relief flat -value "576p"
         radiobutton $w.f.b4 -text "480p" -command "restart" \
             -padx 0 -pady 0 \
-            -anchor w -variable scalerCapResolution -font $f -relief flat -value "480p"
+            -anchor w -variable largeSizeResolution -font $f -relief flat -value "480p"
     }
     pack $w.f.scaling $w.f.b0 $w.f.b1 $w.f.b2 $w.f.b3 $w.f.b4 -fill x -side left
 
     pack $w.title $w.f -fill x -expand 1
 
-    set scalerCapResolution [resource scalerCapResolution]
+    set largeSizeResolution [resource largeSizeResolution]
     set scalerButtons $w.f
     set_scaler_buttons_state
 }

Modified: vic/branches/mpeg4/tcl/ui-resource.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-resource.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-resource.tcl	Thu Dec 16 05:06:06 2010
@@ -185,8 +185,7 @@
 	option add Vic.siteDropTime "300" startupFile
 	option add Vic.quality "0" startupFile
 	option add Vic.inputType "ntsc" startupFile
-	option add Vic.capResolution "0" startupFile
-	option add Vic.scalerCapResolution "none" startupFile
+	option add Vic.largeSizeResolution "none" startupFile
 
 	option add Vic.brightness "128" startupFile
 	option add Vic.contrast "128" startupFile

Modified: vic/branches/mpeg4/tcl/ui-util.tcl
==============================================================================
--- vic/branches/mpeg4/tcl/ui-util.tcl	(original)
+++ vic/branches/mpeg4/tcl/ui-util.tcl	Thu Dec 16 05:06:06 2010
@@ -368,33 +368,22 @@
 					puts "			</sizes>"
 				}
 
-				if [device_supports $v capture_resolution *] {
-					set resolutionList [attribute_class [$v attributes] capture_resolution]
+				if [device_supports $v large_size_resolution *] {
+					set resolutionList [attribute_class [$v attributes] large_size_resolution]
 					if {[llength $resolutionList] == 0} {
-						puts "			<capture_resolutions />"
+						puts "			<large_size_resolutions />"
 					} else {
-						puts "			<capture_resolutions>"
+						puts "			<large_size_resolutions>"
 						foreach resolution $resolutionList {
 							set resolution [string map {"<" "&lt;"  ">" "&gt;"  "&" "&amp;"  "\"" "&quot;"  "'" "&apos;"} $resolution]
-							puts "				<capture_resolution>$resolution</capture_resolution>"
+							puts "				<large_size_resolution>$resolution</large_size_resolution>"
 						}
-						puts "			</capture_resolutions>"
+						puts "			</large_size_resolutions>"
 					}
 				} else {
-						puts "			<capture_resolutions />"
+						puts "			<large_size_resolutions />"
 				}
 
-				# for the moment only the Blackmagick DeckLink grabber has a scaler
-				if { [string first "Blackmagic-" "[$v nickname]"] == -1 } {
-					puts "			<scaler />"
-				} else {
-					set scaleList [list none 960p 720p 576p 480p]
-					puts "			<scaler>"
-					foreach scale  $scaleList {
-						puts "				<scale>$scale</scale>"
-					}
-					puts "			</scaler>"
-				}
 				puts "		</device>"
 			}
 		}

Modified: vic/branches/mpeg4/video/grabber-decklink.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-decklink.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-decklink.cpp	Thu Dec 16 05:06:06 2010
@@ -492,6 +492,8 @@
     }
     strcat(attr,"} ");
 
+    strcat(attr,"large_size_resolution { none 960p 720p 576p 480p } ");
+
     result = deckLink->QueryInterface(IID_IDeckLinkInput, (void**)&deckLinkInput);
     if (result != S_OK) {
         debug_msg("DeckLinkDevice: Could not obtain the IDeckLinkInput interface\n");
@@ -759,21 +761,21 @@
     HRESULT result;
     int flags = TCL_GLOBAL_ONLY;
     Tcl& tcl = Tcl::instance();
-    const char* scalerCapResolution = Tcl_GetVar(tcl.interp(), "scalerCapResolution", flags);
+    const char* largeSizeResolution = Tcl_GetVar(tcl.interp(), "largeSizeResolution", flags);
 
     // Set the image size.
     switch (decimate_) {
     case 1: // large-size
-        if (strcmp(scalerCapResolution, "960p") == 0) {
+        if (strcmp(largeSizeResolution, "960p") == 0) {
             width_ = int(960 * displayModeWidth_ / displayModeHeight_);
             height_ = 960;
-        } else if (strcmp(scalerCapResolution, "720p") == 0) {
+        } else if (strcmp(largeSizeResolution, "720p") == 0) {
             width_ = int(720 * displayModeWidth_ / displayModeHeight_);
             height_ = 720;
-        } else if (strcmp(scalerCapResolution, "576p") == 0) {
+        } else if (strcmp(largeSizeResolution, "576p") == 0) {
           width_ = int(576 * displayModeWidth_ / displayModeHeight_);
           height_ = 576;
-        } else if (strcmp(scalerCapResolution, "480p") == 0) {
+        } else if (strcmp(largeSizeResolution, "480p") == 0) {
           width_ = int(480 * displayModeWidth_ / displayModeHeight_);
           height_ = 480;
         } else {

Modified: vic/branches/mpeg4/video/grabber-win32DS.cpp
==============================================================================
--- vic/branches/mpeg4/video/grabber-win32DS.cpp	(original)
+++ vic/branches/mpeg4/video/grabber-win32DS.cpp	Thu Dec 16 05:06:06 2010
@@ -220,7 +220,7 @@
    capturing_=0;
    max_fps_ = 30;
    memset(inputPorts, 0, NUM_PORTS);
-   memset(captureResolutions, 0, NUM_CAPTURE_RESOLUTIONS * sizeof(SIZE));
+   memset(largeSizeResolutions, 0, NUM_LARGE_SIZE_RESOLUTIONS * sizeof(SIZE));
        
    numInputPorts = 0;
    initializedPorts = 0;
@@ -719,9 +719,9 @@
    if (decimate_ == 1 && !have_DVSD_){  //i.e. Large
 	   int flags = TCL_GLOBAL_ONLY;
 	   Tcl& tcl = Tcl::instance();
-	   const char* capResolution = Tcl_GetVar(tcl.interp(), "capResolution", flags);
-	   if (capResolution) {
-		   sscanf(capResolution, "%ix%i", &width_, &height_);
+	   const char* largeSizeResolution = Tcl_GetVar(tcl.interp(), "largeSizeResolution", flags);
+	   if (largeSizeResolution) {
+		   sscanf(largeSizeResolution, "%ix%i", &width_, &height_);
 	   } else {
 		   width_  = 640;
 		   height_ = 480;
@@ -956,10 +956,10 @@
    }
    int i=0;
    set<SIZE, bool(*)(SIZE, SIZE)>::iterator it;
-   for (it=resolutionSet.begin() ; it != resolutionSet.end() && i < NUM_CAPTURE_RESOLUTIONS; it++) {
+   for (it=resolutionSet.begin() ; it != resolutionSet.end() && i < NUM_LARGE_SIZE_RESOLUTIONS; it++) {
 	  if (it->cy < NTSC_BASE_HEIGHT) continue; // ignore resolutions < 640p for Large capture
-	  captureResolutions[i].cx = it->cx;
-	  captureResolutions[i].cy = it->cy;
+	  largeSizeResolutions[i].cx = it->cx;
+	  largeSizeResolutions[i].cy = it->cy;
 	  i++;
    }
    pConfig->Release();
@@ -1208,52 +1208,52 @@
 
 DirectShowDevice::DirectShowDevice(char *friendlyName, IBaseFilter *pCapFilt) : InputDevice(friendlyName, "directshow") {
 
-    attri_ = new char[255];
+    attri_ = new char[512];
     attri_[0] = 0;
 
     debug_msg("new DirectShowDevice():  friendlyName=%s\n", friendlyName);
     pDirectShowFilter_  = pCapFilt;
     DirectShowGrabber o(pDirectShowFilter_, "420", friendlyName);
 
-    StringCbCatA(attri_, 255, "format { 420 422 cif } size { ");
+    StringCbCatA(attri_, 511, "format { 420 422 cif } size { ");
 
     if ((o.minHeight() > (CIF_BASE_HEIGHT / 2)) && !o.hasDV_SD()) {
-        StringCbCatA(attri_, 255, "large");
+        StringCbCatA(attri_, 511, "large");
     } else if (o.maxWidth() < NTSC_BASE_WIDTH) {
-        StringCbCatA(attri_, 255, "small cif");
+        StringCbCatA(attri_, 511, "small cif");
     } else {
-        StringCbCatA(attri_, 255, "small cif large");
+        StringCbCatA(attri_, 511, "small cif large");
     }
 
-    StringCbCatA(attri_, 255, " } type { pal ntsc } port { ");
+    StringCbCatA(attri_, 511, " } type { pal ntsc } port { ");
 
     Port **inputPorts = o.getInputPorts();
     if(inputPorts[0] != NULL) {
         int i=0;
         while( i <  NUM_PORTS && inputPorts[i] != NULL ) {
-            StringCbCatA(attri_, 255, inputPorts[i]->name);
-            StringCbCatA(attri_, 255, " ");
+            StringCbCatA(attri_, 511, inputPorts[i]->name);
+            StringCbCatA(attri_, 511, " ");
             i++;
         }
     }else{
-        StringCbCatA(attri_, 255, "external-in ");
+        StringCbCatA(attri_, 511, "external-in ");
     }
-	StringCbCatA(attri_, 255, "} ");
+	StringCbCatA(attri_, 511, "} ");
     debug_msg("new DirectShowDevice():  after appending ports\n");
 
-	SIZE *captureResolutions = o.getCaptureResolutions();
-    if(captureResolutions[0].cx != 0) {
-		StringCbCatA(attri_, 255, "capture_resolution {");
+	SIZE *largeSizeResolutions = o.getLargeSizeResolutions();
+    if(largeSizeResolutions[0].cx != 0) {
+		StringCbCatA(attri_, 511, "large_size_resolution {");
         int i=0;
-        while( i <  NUM_CAPTURE_RESOLUTIONS && captureResolutions[i].cx != 0 ) {
-			StringCbPrintfA(attri_, 255, "%s %ix%i", attri_, captureResolutions[i].cx, captureResolutions[i].cy);
+        while( i <  NUM_LARGE_SIZE_RESOLUTIONS && largeSizeResolutions[i].cx != 0 ) {
+			StringCbPrintfA(attri_, 511, "%s %ix%i", attri_, largeSizeResolutions[i].cx, largeSizeResolutions[i].cy);
             i++;
         }
-		StringCbCatA(attri_, 255, "} ");
+		StringCbCatA(attri_, 511, "} ");
     }
 
     char *inport = o.getInputPort();
-    StringCbPrintfA(attri_, 255, "%s selected_port { %s }", attri_, inport );
+    StringCbPrintfA(attri_, 511, "%s selected_port { %s }", attri_, inport );
     free(inport);
 
     attributes_ = attri_;

Modified: vic/branches/mpeg4/video/grabber-win32DS.h
==============================================================================
--- vic/branches/mpeg4/video/grabber-win32DS.h	(original)
+++ vic/branches/mpeg4/video/grabber-win32DS.h	Thu Dec 16 05:06:06 2010
@@ -76,7 +76,7 @@
 
 #define NUM_DEVS 20   // max number of capture devices we'll support
 #define NUM_PORTS 20  // max number of ports on a capture device
-#define NUM_CAPTURE_RESOLUTIONS 20 // max number of capture resolutions of a capture device
+#define NUM_LARGE_SIZE_RESOLUTIONS 20 // max number of capture resolutions of a capture device
 
 //#define showErrorMessage(x)   ShowErrorMessage(x, __LINE__, __FILE__)
 
@@ -149,11 +149,11 @@
 		  return min_height_;
 	  }
 
-	  SIZE *	   getCaptureResolutions(){
-		  return captureResolutions;
+	  SIZE *	   getLargeSizeResolutions(){
+		  return largeSizeResolutions;
 	  }
 	  char *		getInputResolution(){
-		  return strdup(capture_resolution_);
+		  return strdup(large_size_resolution_);
 	  }
 	  Port **	   getInputPorts(){
 		  return inputPorts;
@@ -185,8 +185,8 @@
       int          height_;
       int          cformat_;
 
-      SIZE         captureResolutions[NUM_CAPTURE_RESOLUTIONS];
-      int          numCaptureResolutions;
+      SIZE         largeSizeResolutions[NUM_LARGE_SIZE_RESOLUTIONS];
+      int          numlargeSizeResolutions;
 
       Port *       inputPorts[NUM_PORTS];
       int          numInputPorts;
@@ -224,7 +224,7 @@
       IAMCrossbar            *pXBar_;
       Crossbar               *crossbar_;
       Crossbar               *crossbarCursor_;
-      char                   capture_resolution_[20];
+      char                   large_size_resolution_[20];
       char                   input_port_[20];
       bool                   findCrossbar(IBaseFilter *);
       void                   addCrossbar(IAMCrossbar *);



More information about the Sumover-dev mailing list