|
|
|
@ -189,6 +189,23 @@ void video_convert (VideoFrame *vf, GdkPixbuf *pixbuf) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cb_videoda_draw(GtkWidget *area, cairo_t *cr, int w, int h, gpointer data) {
|
|
|
|
|
GdkRGBA color;
|
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (area);
|
|
|
|
|
|
|
|
|
|
if (video_da == NULL) return;
|
|
|
|
|
|
|
|
|
|
//cairo_move_to(cr, 30, 30);
|
|
|
|
|
//cairo_set_font_size(cr,15);
|
|
|
|
|
//cairo_show_text(cr, "hello world");
|
|
|
|
|
|
|
|
|
|
gdk_cairo_set_source_pixbuf(cr, video_pixbuf, 0, 0);
|
|
|
|
|
cairo_paint(cr);
|
|
|
|
|
cairo_fill (cr);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void video_draw_image (VideoFrame *vf) {
|
|
|
|
|
int pix_w;
|
|
|
|
@ -218,39 +235,10 @@ void video_draw_image (VideoFrame *vf) {
|
|
|
|
|
video_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, false, 8, vf->w, vf->h);
|
|
|
|
|
pix_w = vf->w;
|
|
|
|
|
pix_h = vf->h;
|
|
|
|
|
|
|
|
|
|
// int channels = gdk_pixbuf_get_n_channels (video_pixbuf);
|
|
|
|
|
// int rowstride = gdk_pixbuf_get_rowstride (video_pixbuf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
video_convert(vf, video_pixbuf);
|
|
|
|
|
|
|
|
|
|
GdkWindow* window = gtk_widget_get_window(video_da);
|
|
|
|
|
cairo_t *cr = gdk_cairo_create(window);
|
|
|
|
|
|
|
|
|
|
gdk_cairo_set_source_pixbuf(cr, video_pixbuf, 0, 0);
|
|
|
|
|
cairo_paint(cr);
|
|
|
|
|
cairo_fill (cr);
|
|
|
|
|
|
|
|
|
|
// cairo_move_to(cr, 30, 30);
|
|
|
|
|
// cairo_set_font_size(cr,15);
|
|
|
|
|
// cairo_show_text(cr, "hello world");
|
|
|
|
|
|
|
|
|
|
cairo_destroy (cr);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
//
|
|
|
|
|
// "convert" the G*t*kWidget to G*d*kWindow (no, it's not a GtkWindow!)
|
|
|
|
|
GdkWindow* window = gtk_widget_get_window(video_da);
|
|
|
|
|
cairo_region_t * cairoRegion = cairo_region_create();
|
|
|
|
|
GdkDrawingContext * drawingContext = gdk_window_begin_draw_frame (window,cairoRegion);
|
|
|
|
|
cairo_t * cr = gdk_drawing_context_get_cairo_context (drawingContext);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gdk_window_end_draw_frame(window,drawingContext);
|
|
|
|
|
cairo_region_destroy(cairoRegion);
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
gdk_window_invalidate_rect(gtk_widget_get_window(video_da), NULL, true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -328,9 +316,9 @@ gboolean cb_thread_video (gpointer data) {
|
|
|
|
|
gtk_widget_set_sensitive(btnstop, false);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// printf ("%s:%d %s got video data\n", __FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
vf = videodev.FrameGet();
|
|
|
|
|
if (vf != NULL) video_draw_image(vf);
|
|
|
|
|
else printf ("%s:%d %s could not get image data\n", __FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
videodev.FrameNext();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|