Пример #1
0
/*
 * Class:	com_sun_media_protocol_sunvideo_XILCapture
 * Method:	xilGetLineStride
 * Signature:	()I
 */
JNIEXPORT jint JNICALL
Java_com_sun_media_protocol_sunvideo_XILCapture_xilGetLineStride(JNIEnv *env,
						      jobject jxil)
{
    int w;
    InstanceState *inst = (InstanceState *) GetLongField(env, jxil, "peer");

    if (inst == NULL)
	return -1;
    if (!inst->started || (inst->do_cis != RAW)) {
	/*    Debug Message */
	PRINT("XILCapture xilLineStride() not started \n");
	/* return a guess at what it will be */
	return (jint) (inst->inWidth * 3);
    }

    /*    Debug Message*/
    PRINT("In xilGetLineStride\n");

    if (inst->firstRawRead) {
	XilMemoryStorage storage;
	int stride = 0;
	xil_export(inst->colored_image);
	xil_get_memory_storage(inst->colored_image, &storage);
	stride = storage.byte.scanline_stride;
	xil_import(inst->colored_image, 0);
	/*    Debug Message */
	PRINT("XILCapture xilLineStride() no read done \n");
	return (jint) stride;
    }

    return (jint) inst->inStrideX;

}
Пример #2
0
void ResetXILFrameBuffers( void )
{
  XilMemoryStorage storage_info;

  if( (xil_state = xil_open()) == NULL ) {
    Sys_Error( "can't start XIL\n" );
  }

  create_xil_window();

  draw_image = xil_create( xil_state, vid.width, vid.height, 1, XIL_BYTE );
  xil_export( draw_image );
  xil_get_memory_storage( draw_image, &storage_info );
  vid.buffer = (byte *)storage_info.byte.data;
  vid.rowbytes = vid.width;

  /*
   * If the window is 24-bit, then create an intermediate image that
   * is used to convert from 8-bit indexed colour to 24-bit true colour.
   */
  if( use_truecolour ) {
    static unsigned char tmp_palette[ 256 * 4 ];
    tmp8to24_image = xil_create( xil_state, vid.width, vid.height, 3, XIL_BYTE );
    xil_8to24_lookup = xil_lookup_create( xil_state, XIL_BYTE, XIL_BYTE, 3, 256,
					  0, tmp_palette );
  }
}
Пример #3
0
static int
readRaw(InstanceState *inst, void *buf, int len)
{
    XilImage image;
    XilMemoryStorage storage;
    int clen;

    /*    Debug Message */
    /*	PRINT("In readRaw\n");	*/
    
    if (inst == NULL) {
	return -1;
    }
    if (inst->scaled_image) {
	xil_scale(inst->rtvc_image, inst->scaled_image, "nearest",
			inst->sx, inst->sy);
	image = inst->scaled_image;
    } else {
	image = inst->rtvc_image;
    }
    xil_color_convert(image, inst->colored_image);
    xil_toss(image);
    xil_export(inst->colored_image);
    xil_get_memory_storage(inst->colored_image, &storage);
    inst->inStrideX = storage.byte.scanline_stride;
    clen = storage.byte.scanline_stride * inst->outHeight;
    if (clen > len) {
	/*    Debug Message */
	PRINT("readRaw: buffer too short\n");
	clen = -1;
    } else {
	memcpy(buf, (void *)storage.byte.data, clen);
    }
    xil_import(inst->colored_image, 0);
    xil_toss(inst->colored_image);

    return clen;
}