Exemplo n.º 1
0
XILOutputAssistor::XILOutputAssistor(int type,const char*fn,struct deviceattributes *devattr) : Renderer(type) {
	char	*cisname;
	XilDevice	device;

	filename_ = strdup(fn);
	memcpy(&deviceattributes_,devattr,sizeof(deviceattributes_));
	cisname=NULL;
	switch (type) {
	case FT_JPEG|FT_HW:
		cisname = "Jpeg";
		memcpy(jfif_header1,jfif_header1_,sizeof(jfif_header1_));
		memcpy(jfif_header2,jfif_header2_,sizeof(jfif_header2_));
		break;
	case FT_H261:
		cisname = "H261";
		break;
	case FT_CELLB:
		cisname = "CellB";
		break;
	default:
		fprintf(stderr,"	unknown cis %d???\n",type&~FT_HW);
		break;
	}
	type_ = type;
	imageYCC = NULL;
	xil_ = xil_open();
	if (xil_ == 0) {
		fprintf(stderr,"couldn't open xil.\n");
		return;//FIXME
	}
	device = xil_device_create(xil_,deviceattributes_.name);
	if (device == 0) {
		fprintf(stderr,"couldn't open %s\n",deviceattributes_.name);
		return;
	}
	xil_device_set_value(device,"DEVICE_NAME",(void*)filename_);
	//fprintf(stderr,"VIDEO_OUT\n");
	xil_device_set_value(device,"VIDEO_OUT",(void*)TRUE);
	o1kimage = xil_create_from_device(xil_,deviceattributes_.name,device);

	int arg;
	xil_get_device_attribute(o1kimage,"VIDEO_OUT",(void**)&arg);
	//fprintf(stderr,"VIDEO_OUT-> %d\n",arg);
	cis_ = xil_cis_create(xil_ , cisname);
	if (cis_ == 0) {
		fprintf(stderr,"couldn't create CIS for %s\n",cisname);
		return;
	}
	xil_cis_set_keep_frames(cis_, 3);
	xil_cis_set_max_frames(cis_, 3);

	//fprintf(stderr,"HW_DECOMPRESS_CIS\n");
	// use _THIS_ cis_ for HW decompression
	xil_set_attribute(o1kimage,"HW_DECOMPRESS_CIS",cis_);
}
Exemplo n.º 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;
}