// // Video is in YV12 Colorspace // // uint8_t DIA_getMPdelogo(MPDELOGO_PARAM *param,AVDMGenericVideoStream *in) { // Allocate space for green-ised video width=in->getInfo()->width; height=in->getInfo()->height; working=new uint8_t [width*height*4]; original=NULL; uint8_t ret=0; dialog=create_dialog1(); gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gtk_register_dialog(dialog); x=param->xoff; y=param->yoff; w=param->lw; h=param->lh; band=param->band; imgsrc=new ADMImage(width,height); incoming=in; rgbConv=new ColYuvRgb(width,height); rgbConv->reset(width,height); float zoom = UI_calcZoomToFitScreen(GTK_WINDOW(dialog), WID(drawingarea1), width, height); zoomW = width * zoom; zoomH = height * zoom; rgbBufferDisplay=new uint8_t[zoomW*zoomH*4]; gtk_widget_set_usize(WID(drawingarea1), zoomW, zoomH); if (zoom < 1) { UI_centreCanvasWindow((GtkWindow*)dialog, WID(drawingarea1), zoomW, zoomH); resizer = new ADMImageResizer(width, height, zoomW, zoomH, PIX_FMT_RGB32, PIX_FMT_RGB32); } prepare(0); gtk_widget_show(dialog); ui_upload(); ui_update(); #define CONNECT(x,y,z) gtk_signal_connect(GTK_OBJECT(WID(x)), #y,GTK_SIGNAL_FUNC(z), NULL); CONNECT(drawingarea1,expose_event,gui_draw); CONNECT(hscale1,value_changed,frame_changed); #define CONNECT_SPIN(x) CONNECT(spinbutton##x, value_changed,ui_changed) CONNECT_SPIN(X); CONNECT_SPIN(Y); CONNECT_SPIN(W); CONNECT_SPIN(H); CONNECT_SPIN(Band); draw(dialog,width,height); ret=0; int response; while( (response=gtk_dialog_run(GTK_DIALOG(dialog)))==GTK_RESPONSE_APPLY) { ui_changed(); } if(response==GTK_RESPONSE_OK) { ui_read( ); param->xoff=x; param->yoff=y; param->lw=w; param->lh=h; param->band=band; ret=1; } gtk_unregister_dialog(dialog); gtk_widget_destroy(dialog); delete working; delete imgsrc; delete rgbConv; if (resizer) { delete resizer; delete[] rgbBufferDisplay; resizer=NULL; rgbBufferDisplay=NULL; } working=NULL; dialog=NULL; original=NULL; imgsrc=NULL; return ret; }
void log_open(GSList *filenames, gboolean merge) { gchar *filename; gzFile gzfp; gint n, err; guchar buffer[READ_BUFFER_LEN]; const gchar *err_string; yajl_handle json; yajl_status status; read_ctx_t context; if(ui.changed && !ui_dialog_ask_unsaved()) return; context.merge = merge; context.changed = FALSE; if(!merge) ui_clear(); ui_view_lock(ui.treeview); while(filenames != NULL) { filename = (gchar*)filenames->data; gzfp = gzopen(filename, "r"); if(!gzfp) { ui_dialog(ui.window, GTK_MESSAGE_ERROR, "Error", "Failed to open a file:\n%s", filename); } else { context.key = KEY_UNKNOWN; context.level = LEVEL_ROOT; context.level_signals = FALSE; context.signal = NULL; network_init(&context.network); json = yajl_alloc(&json_callbacks, NULL, &context); do { n = gzread(gzfp, buffer, READ_BUFFER_LEN-1); status = yajl_parse(json, buffer, n); if(n < READ_BUFFER_LEN-1) { if(gzeof(gzfp)) break; err_string = gzerror(gzfp, &err); if(err) { ui_dialog(ui.window, GTK_MESSAGE_ERROR, "Error", "Failed to read a file:\n%s\n\n%s", filename, err_string); break; } } } while (status == yajl_status_ok); gzclose(gzfp); if(status == yajl_status_ok) status = yajl_complete_parse(json); yajl_free(json); if(status != yajl_status_ok) { network_free(&context.network); g_free(context.signal); ui_dialog(ui.window, GTK_MESSAGE_ERROR, "Error", "The selected file is corrupted or is not a valid MTscan log:\n%s", filename); } else if(!merge) { /* Take the allocated filename for the UI */ ui_set_title(filename); filenames->data = NULL; } } filenames = filenames->next; } ui_view_unlock(ui.treeview); if(context.changed) { ui_status_update_networks(); if(merge) { /* Set filename to NULL after merge */ ui_set_title(NULL); ui_changed(); } } }