Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Apr 1997 18:02:20 -0700
From:      Amancio Hasty <hasty@rah.star-gate.com>
To:        multimedia@freebsd.org
Subject:   Feed back on latest driver?
Message-ID:  <199704220102.SAA08153@rah.star-gate.com>

index | next in thread | raw e-mail



Also, here is sample code to build a sorted clip list:



struct bktr_clip {
    int          x_min;
    int          x_max;
    int          y_min;
    int          y_max;
};

 #define BT848_MAX_CLIP_NODE 100
struct _bktr_clip {
    struct bktr_clip x[BT848_MAX_CLIP_NODE];
};

clip_cmp(u1, u2)
	struct bktr_clip *u1, *u2;
{
	if (u1->x_min < u2->x_min) return -1;
	if (u1->x_min == u2->x_min) return 1;
	if (u1->x_min == u2->x_min) {
	    if (u1->y_min < u2->y_min) return -1;
	    if (u1->y_min > u2->y_min) return 1;
	    if (u1->y_min > u2->y_min) return 0;
	    if (u1->y_max < u2->y_max) return -1;
	    if (u1->y_max > u2->y_max) return 1;
	    return 0;
	}
}

delete_clip(struct bktr_clip *list, int x1, int x2, int y1,int  y2) {
    int i, j;
    for (i = 0 ; i < 100; i++ ) {
	if (list->x_min == x1 &&
	    list->x_max == x2 &&
	    list->y_min == y1 &&
	    list->y_max == y2) {
	    for (j = i; j < 99; j++ ) {
		list[j].x_min = list[j+1].x_min;
		list[j].x_max = list[j+1].x_max;
		list[j].y_min = list[j+1].y_min;
		list[j].y_max = list[j+1].y_max;
		
	    }
	    break;
	}
    }
}
add_clip(struct bktr_clip *list, int x1, int x2, int y1,int  y2) {
    for (i = 0 ; i < 99; i++ ) {
	if (list->x_min == 0 &&
	    list->x_max == 0 &&
	    list->y_min == 0 &&
	    list->y_max == 0) {
		list[i].x_min = x1;
		list[i].x_max = x2;
		list[i].y_min = y1;
		list[i].y_max = y2;
		list[i+1].x_min = 0;
		list[i+1].x_max = 0;
		list[i+1].y_min = 0;
		list[i+1].y_max = 0;
	    }
	    break;
	}
    }
}

}
main() {
struct bktr_clip list[100];

list[0].x_min = 100;
list[0].x_max = 120;
list[0].y_min = 11;
list[0].y_max = 120;

list[1].x_min = 90;
list[1].x_max = 100;
list[1].y_min = 10;
list[1].y_max = 20;


list[2].x_min = 100;
list[2].x_max = 120;
list[2].y_min = 11;
list[2].y_max = 130;

list[3].x_min = 1;
list[3].x_max = 20;
list[3].y_min = 30;
list[3].y_max = 40;


	qsort((char *)&list, 4, sizeof (struct bktr_clip ), clip_cmp);

	delete_clip(&list, 100,120, 11, 120);
}

---
The sample is close enough that using  the hardware clip ioctl 
for apps such as fxtv should be trivial provided that the application
handles properly expose events.

	Cheers,
	Amancio




home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704220102.SAA08153>