//Add customized log function to GStreamer log system.
void gst_debug_add_log_function (GstLogFunction func,
gpointer user_data,
GDestroyNotify notify);
// Function prototype for a logging function that can be registered with
// gst_debug_add_log_function()
// Use G_GNUC_NO_INSTRUMENT on that function.
typedef void (*GstLogFunction) (GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line,
GObject * object,
GstDebugMessage * message,
gpointer user_data);
// Enable log if set to true.
void gst_debug_set_active (gboolean active);
// Set the default log level.
void gst_debug_set_default_threshold (GstDebugLevel level);
示例代码如下:
#include
#include
/* declare log function with the required attribute */
void my_log_func(GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line,
GObject * object,
GstDebugMessage * message,
gpointer user_data) G_GNUC_NO_INSTRUMENT;
void my_log_func(GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line,
GObject * object,
GstDebugMessage * message,
gpointer user_data) {
printf("MyLogFunc: [Level:%d] %s:%s:%d %s\n",
level, file, function, line,
gst_debug_message_get(message));
}
int main(int argc, char *argv[]) {
GstPipeline *pipeline = NULL;
GMainLoop *main_loop = NULL;
/* set log function and remove the default one */
gst_debug_add_log_function(my_log_func, NULL, NULL);
gst_debug_set_active(TRUE);
gst_debug_set_default_threshold(GST_LEVEL_INFO);
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* default log function is added by gst_init, so we need remove it after that. */
gst_debug_remove_log_function(gst_debug_log_default);
pipeline = (GstPipeline *)gst_parse_launch("audiotestsrc ! autoaudiosink", NULL);
/* Start playing */
gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_PLAYING);
main_loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (main_loop);
/* Free resources */
g_main_loop_unref (main_loop);
gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
原文地址:http://www.open-open.com/lib/view/open1346857871615.html
使用Java Mail API来发送邮件也很容易实现,但是最近公司一个同事封装的邮件API实在让我无法接受,于是便打算改用Spring Mail API来发送邮件,顺便记录下这篇文章。 【Spring Mail API】
Spring Mail API都在org.spri