$ git clone http://tcclient.ion.nu/tc_client.git
commit 2f818271ab606c7fb912b8e785b92d99f8ae6f02
Author: Alicia <...>
Date: Fri Feb 26 22:26:46 2016 +0100
tc_client-gtk: keep cam pixel buffers on the heap instead of the stack, fixes glitchyness when resizing.
diff --git a/ChangeLog b/ChangeLog
index aa47940..cc1d6c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@ tc_client-gtk: windows compat: do /mbs handling on a duplicated buffer to avoid
tc_client-gtk: added input history (up/down arrows)
tc_client-gtk: set a default position of the cam and nickname list pane handles.
tc_client-gtk: use --hexcolors to show the full range of colors.
+tc_client-gtk: keep cam pixel buffers on the heap instead of the stack, fixes glitchyness when resizing.
modbot: use youtube-dl's 'ytsearch:' instead of '--default-search auto', fixes issues with search terms that include slashes.
configure: check for multiple versions of ncurses.
0.37:
diff --git a/utilities/gtk/camviewer.c b/utilities/gtk/camviewer.c
index 3eb8f6d..46a6c43 100644
--- a/utilities/gtk/camviewer.c
+++ b/utilities/gtk/camviewer.c
@@ -119,7 +119,6 @@ void updatescaling(struct viddata* data, unsigned int width, unsigned int height
if(!pixbuf){continue;}
pixbuf=gdk_pixbuf_scale_simple(pixbuf, data->scalewidth, data->scaleheight, GDK_INTERP_BILINEAR);
gtk_image_set_from_pixbuf(GTK_IMAGE(cams[i].cam), pixbuf);
-// TODO: figure out/fix the "static" noise that seems to happen here
}
}
@@ -198,6 +197,8 @@ void printchat_color(const char* text, const char* color, unsigned int offset, c
if(bottom){autoscroll_after(scroll);}
}
+void freebuffer(guchar* pixels, gpointer data){free(pixels);}
+
char buf[1024];
gboolean handledata(GIOChannel* iochannel, GIOCondition condition, gpointer datap)
{
@@ -599,17 +600,15 @@ gboolean handledata(GIOChannel* iochannel, GIOCondition condition, gpointer data
// Scale and convert to RGB24 format
unsigned int bufsize=avpicture_get_size(PIX_FMT_RGB24, scalewidth, scaleheight);
- unsigned char buf[bufsize];
+ unsigned char* buf=malloc(bufsize);
cam->dstframe->data[0]=buf;
cam->dstframe->linesize[0]=scalewidth*3;
struct SwsContext* swsctx=sws_getContext(cam->frame->width, cam->frame->height, cam->frame->format, scalewidth, scaleheight, AV_PIX_FMT_RGB24, 0, 0, 0, 0);
sws_scale(swsctx, (const uint8_t*const*)cam->frame->data, cam->frame->linesize, 0, cam->frame->height, cam->dstframe->data, cam->dstframe->linesize);
sws_freeContext(swsctx);
- GdkPixbuf* gdkframe=gdk_pixbuf_new_from_data(cam->dstframe->data[0], GDK_COLORSPACE_RGB, 0, 8, scalewidth, scaleheight, cam->dstframe->linesize[0], 0, 0);
+ GdkPixbuf* gdkframe=gdk_pixbuf_new_from_data(cam->dstframe->data[0], GDK_COLORSPACE_RGB, 0, 8, scalewidth, scaleheight, cam->dstframe->linesize[0], freebuffer, 0);
gtk_image_set_from_pixbuf(GTK_IMAGE(cam->cam), gdkframe);
- // Make sure it gets redrawn in time
- gdk_window_process_updates(gtk_widget_get_window(cam->cam), 1);
return 1;
}