static PyObject * pygst_debug_log (PyObject * pyobject, PyObject * string, GstDebugLevel level, gboolean isgstobject) { #ifndef GST_DISABLE_GST_DEBUG gchar *str; gchar *function; gchar *filename; int lineno; PyFrameObject *frame; GObject *object = NULL; if (!PyArg_ParseTuple (string, "s:gst.debug_log", &str)) { PyErr_SetString (PyExc_TypeError, "Need a string!"); return NULL; } frame = PyEval_GetFrame (); function = PyString_AsString (frame->f_code->co_name); filename = g_path_get_basename (PyString_AsString (frame->f_code->co_filename)); lineno = PyCode_Addr2Line (frame->f_code, frame->f_lasti); /* gst_debug_log : category, level, file, function, line, object, format, va_list */ if (isgstobject) object = G_OBJECT (pygobject_get (pyobject)); gst_debug_log (python_debug, level, filename, function, lineno, object, "%s", str); if (filename) g_free (filename); #endif Py_INCREF (Py_None); return Py_None; }
void apply_wb_by8_c ( GstTisWhiteBalance* self, GstBuffer* buf, byte wb_r, byte wb_g, byte wb_b) { gst_debug_log (gst_tiswhitebalance_debug_category, GST_LEVEL_INFO, "tiswhitebalance", "", 850, NULL, "Applying white balance with values: R:%d G:%d B:%d", wb_r, wb_g, wb_b); wb_image_c( self, buf, wb_r, wb_g, wb_b); }
static gboolean gst_tiswhitebalance_device_set_whiteblance (GstTisWhiteBalance* self) { gst_debug_log (gst_tiswhitebalance_debug_category, GST_LEVEL_INFO, "tiswhitebalance", "", __LINE__, NULL, "Applying white balance to device with values: R:%d G:%d B:%d", self->res.color.rgb.R, self->res.color.rgb.G, self->res.color.rgb.B); return device_set_rgb(&self->res); }
/** * gst_gl_async_debug_output_log_msg: * @ad: the #GstGLAsyncDebug to store the message in * * Outputs a previously stored debug message. */ void gst_gl_async_debug_output_log_msg (GstGLAsyncDebug * ad) { if ((ad->state_flags & ASYNC_DEBUG_FILLED) != 0 && (ad->state_flags & ASYNC_DEBUG_FROZEN) == 0) { gchar *msg = NULL; if (ad->callback) msg = ad->callback (ad->user_data); gst_debug_log (ad->cat, ad->level, ad->file, ad->function, ad->line, ad->object, "%s %s", GST_STR_NULL (ad->debug_msg), msg ? msg : ""); g_free (msg); _free_async_debug_data (ad); } }
/* *INDENT-ON* */ static void gst_alsa_error_wrapper (const char *file, int line, const char *function, int err, const char *fmt, ...) { #ifndef GST_DISABLE_GST_DEBUG va_list args; gchar *str; va_start (args, fmt); str = g_strdup_vprintf (fmt, args); va_end (args); /* FIXME: use GST_LEVEL_ERROR here? Currently warning is used because we're * able to catch enough of the errors that would be printed otherwise */ gst_debug_log (alsa_debug, GST_LEVEL_WARNING, file, function, line, NULL, "alsalib error: %s%s%s", str, err ? ": " : "", err ? snd_strerror (err) : ""); g_free (str); #endif }
gboolean auto_whitebalance_cam (const auto_sample_points* data, rgb_tripel* wb ) { rgb_tripel old_wb = *wb; if (wb->R < WB_IDENTITY) wb->R = WB_IDENTITY; if (wb->G < WB_IDENTITY) wb->G = WB_IDENTITY; if (wb->B < WB_IDENTITY) wb->B = WB_IDENTITY; if (old_wb.R != wb->R || old_wb.G != wb->G || old_wb.B != wb->B) return FALSE; while ((wb->R > WB_IDENTITY) && (wb->G > WB_IDENTITY) && (wb->B > WB_IDENTITY)) { wb->R -= 1; wb->G -= 1; wb->B -= 1; } rgb_tripel averageColor = average_color_cam( data); if(wb_auto_step(&averageColor, wb ) ) { return TRUE; } wb->R = clip( wb->R, WB_MAX ); wb->G = clip( wb->G, WB_MAX ); wb->B = clip( wb->B, WB_MAX ); gst_debug_log (gst_tiswhitebalance_debug_category, GST_LEVEL_INFO, "tiswhitebalance", "", __LINE__, NULL, "Calculated white balance R:%d G:%d B:%d", wb->R, wb->G, wb->B); return FALSE; }
/* Entry point */ static GstFlowReturn gst_tiswhitebalance_transform_ip (GstBaseTransform* trans, GstBuffer* buf) { GstTisWhiteBalance* self = GST_TISWHITEBALANCE (trans); if (self->res.source_element == NULL) { gst_debug_log (gst_tiswhitebalance_debug_category, GST_LEVEL_INFO, "gst_tiswhitebalance", "gst_tiswhitebalance_fixate_caps", __LINE__, NULL, "Searching for source"); self->res = find_source(GST_ELEMENT(self)); if (self->force_hardware_wb) { self->res.color.has_whitebalance = TRUE; } if (self->res.color.has_whitebalance) { WB_MAX = self->res.color.max; WB_IDENTITY = self->res.color.default_value; init_wb_values(self); } } /* auto is completely disabled */ if (!self->auto_enabled) { return GST_FLOW_OK; } whitebalance_buffer(self, buf); return GST_FLOW_OK; }
static void gst_tiswhitebalance_fixate_caps (GstBaseTransform* base, GstPadDirection direction, GstCaps* incoming, GstCaps* outgoing) { GstTisWhiteBalance* self = GST_TISWHITEBALANCE(base); GstStructure* ins; GstStructure* outs; gint width, height; g_return_if_fail (gst_caps_is_fixed (incoming)); GST_DEBUG_OBJECT (base, "trying to fixate outgoing caps %" GST_PTR_FORMAT " based on caps %" GST_PTR_FORMAT, outgoing, incoming); ins = gst_caps_get_structure (incoming, 0); outs = gst_caps_get_structure (outgoing, 0); if (gst_structure_get_int (ins, "width", &width)) { if (gst_structure_has_field (outs, "width")) { gst_structure_fixate_field_nearest_int (outs, "width", width); } self->width = width; } if (gst_structure_get_int (ins, "height", &height)) { if (gst_structure_has_field (outs, "height")) { gst_structure_fixate_field_nearest_int (outs, "height", height); } self->height = height; } const char* p = gst_structure_get_name (ins); guint fourcc; if (g_strcmp0(p, "video/x-raw-bayer") == 0) { if (gst_structure_get_field_type (ins, "format") == G_TYPE_STRING) { const char *string; string = gst_structure_get_string (ins, "format"); fourcc = GST_STR_FOURCC (string); } else if (gst_structure_get_field_type (ins, "format") == GST_TYPE_FOURCC) { gst_structure_get_fourcc (ins, "format", &fourcc); } else fourcc = 0; if (fourcc == 0) { gst_debug_log (gst_tiswhitebalance_debug_category, GST_LEVEL_ERROR, "gst_tiswhitebalance", "gst_tiswhitebalance_fixate_caps", 0, NULL, "Unable to determine video format."); return; } if (fourcc == MAKE_FOURCC ('g','r','b','g')) { self->pattern = GR; } else if (fourcc == MAKE_FOURCC ('r', 'g', 'g', 'b')) { self->pattern = RG; } else if (fourcc == MAKE_FOURCC ('g', 'b', 'r', 'g')) { self->pattern = GB; } else if (fourcc == MAKE_FOURCC ('b', 'g', 'g', 'r')) { self->pattern = BG; } else { gst_debug_log (gst_tiswhitebalance_debug_category, GST_LEVEL_ERROR, "gst_tiswhitebalance", "gst_tiswhitebalance_fixate_caps", 0, NULL, "Unable to determine bayer pattern."); return; } gst_debug_log (gst_tiswhitebalance_debug_category, GST_LEVEL_INFO, "gst_tiswhitebalance", "gst_tiswhitebalance_fixate_caps", 0, NULL, "Using bayer format %s for whitebalancing.", bayer_to_string(self->pattern)); } else { gst_debug_log (gst_tiswhitebalance_debug_category, GST_LEVEL_INFO, "gst_tiswhitebalance", "gst_tiswhitebalance_fixate_caps", 0, NULL, "Not a bayer format. White balance will be disabled."); } }