Example #1
0
int XILWindowAssistor::command(int argc, const char*const* argv)
{
	u_int		nbands;
	XilDataType	datatype;

//	fprintf(stderr,"XILWindowAssistor::"__FUNCTION__"\n");
	if (argc == 3 && strcmp(argv[1], "window") == 0) {
		sentfirstheader=0;
		imageYCC = NULL;
		ximage_ = NULL;
		window_ = VideoWindow::lookup(argv[2]);
		Tk_MakeWindowExist(window_->tkwin());
		// gc_ = Tk_GetGC(window_->tkwin(), 0, 0);
		gc_ = XCreateGC(Tk_Display(window_->tkwin()),
				Tk_WindowId(window_->tkwin()), 0, NULL);
		Tk_CreateEventHandler(window_->tkwin(), ExposureMask,
				      handle_exposure_callback,
				      (ClientData)this);
		//fprintf(stderr,"xil_create_from_window(%p,%p,%08lx)\n", xil_,Tk_Display(window_->tkwin()),Tk_WindowId(window_->tkwin()));
		displayimage_=xil_create_from_window(xil_,Tk_Display(window_->tkwin()),Tk_WindowId(window_->tkwin()));
		//fprintf(stderr,"HW_DECOMPRESS_CIS\n");
		// disable (osprey) hardware decompression for Windowed Display.
		// the software decoder is fast enough
		xil_set_attribute(displayimage_,"HW_DECOMPRESS_CIS",(void *)-1);
/*
		int arg;
		xil_get_device_attribute(displayimage_,"VIDEO_OUT",(void**)&arg);
		//fprintf(stderr,"VIDEO_OUT-> %d\n",arg);

		xil_set_device_attribute(displayimage_,"VIDEO_OUT",(void*)FALSE);

 */
//		xil_set_device_attribute(displayimage_,"H261_PIP",(void*)TRUE);

		xil_get_info(displayimage_, &targetw_, &targeth_, &nbands, &datatype);
		//fprintf(stderr,"w=%d,h=%d,bands=%d,dt=%d\n", targetw_,targeth_,nbands,datatype);
		switch (Tk_Depth(window_->tkwin())) {
		case 8:
			visual = PSEUDOCOLOR;
			break;
		case 24:
			visual = TRUECOLOR;
			break;
		default:
			fprintf(stderr,"XILWindowAssistor:command(window), unknown depth %d!\n",Tk_Depth(window_->tkwin()));
			visual = PSEUDOCOLOR;
			break;
		}
		x_cmap = 0;
		return (TCL_OK);
	}
	return (Renderer::command(argc, argv));
}
Example #2
0
static int
tryPort(JNIEnv *env, jobject jxil, InstanceState *inst)
{
    XilDataType datatype;
    int i;

    inst->signal = 0;
    inst->inWidth = 0;
    inst->inHeight = 0;

    xil_set_device_attribute(inst->rtvc_image, "PORT_V", (void *)inst->port);
    /*    Debug Message */
    PRINT("XILCapture xil_set_device_attribute() completed \n");
    /*
     * On a busy system attempts to get the signal format fail so try
     * multiple times. In addition, some video sources (like VCRs)
     * have a poor signal unless actively transmitting so signal format
     * may report unknown (0).
     */
    for (i = 0; i < 10; i++) {
	if (xil_get_device_attribute(inst->rtvc_image, "FORMAT_V",
		(void **) &inst->signal) == XIL_SUCCESS)
	    break;
    }
    /*    Debug Message */
    if (inst->signal == 0) {
	/* signal format unknown, may not be a camera or video source */
	PRINT("XILCapture xil_get_device_attribute() == unknown signal \n");
    }
    xil_get_info(inst->rtvc_image, &inst->inWidth, &inst->inHeight,
		    &inst->inBands, &datatype);
    /*    Debug Message */
    PRINT("XILCapture xil_get_info() completed \n");

    return 1;
}