From: <kak...@us...> - 2008-12-16 02:22:25
|
Revision: 10798 http://amsn.svn.sourceforge.net/amsn/?rev=10798&view=rev Author: kakaroto Date: 2008-12-16 01:56:25 +0000 (Tue, 16 Dec 2008) Log Message: ----------- a bit of refactoring.. not much Modified Paths: -------------- trunk/amsn/guicontactlist.tcl trunk/amsn/utils/farsight/src/tcl_farsight.c Modified: trunk/amsn/guicontactlist.tcl =================================================================== --- trunk/amsn/guicontactlist.tcl 2008-12-15 20:35:27 UTC (rev 10797) +++ trunk/amsn/guicontactlist.tcl 2008-12-16 01:56:25 UTC (rev 10798) @@ -1620,8 +1620,8 @@ set noupdate_img [::skin::loadPixmap space_noupdate] # Check if we need an icon to show an updated space/blog, and draw one if we do - # We must create the icon and hide after else, the status icon will stick the border \ - # it's surely due to anchor parameter + # We must create the icon and hide after else, the status icon will stick the border + # it's surely due to anchor parameter if { [::MSNSPACES::hasSpace $email] } { lappend stylestring [list "tag" "$space_icon"] if { $space_update } { @@ -1818,7 +1818,6 @@ lappend stylestring [list "newline" "\n"] if {[::config::getKey spacesinfo "inline"] == "both" } { #image to show the ccard - lappend stylestring [list "space" 15] lappend stylestring [list "tag" "icon"] lappend stylestring [list "tag" "$undock_space"] lappend stylestring [list "image" [::skin::loadPixmap spaces_undock] "w"] Modified: trunk/amsn/utils/farsight/src/tcl_farsight.c =================================================================== --- trunk/amsn/utils/farsight/src/tcl_farsight.c 2008-12-15 20:35:27 UTC (rev 10797) +++ trunk/amsn/utils/farsight/src/tcl_farsight.c 2008-12-16 01:56:25 UTC (rev 10798) @@ -418,19 +418,59 @@ g_object_set (sink, "sync", FALSE, NULL); } +static GstElement * _create_source () +{ + GstElement *src = NULL; -static void -_src_pad_added (FsStream *self, GstPad *pad, FsCodec *codec, gpointer user_data) + if (source_pipeline) { + GstPad *pad = NULL; + GstBin *bin; + gchar *desc; + GError *error; + + /* parse the pipeline to a bin */ + desc = g_strdup_printf ("bin.( %s ! queue )", source_pipeline); + bin = (GstBin *) gst_parse_launch (desc, &error); + g_free (desc); + + if (bin) { + /* find pads and ghost them if necessary */ + if ((pad = gst_bin_find_unlinked_pad (bin, GST_PAD_SRC))) { + gst_element_add_pad (GST_ELEMENT (bin), gst_ghost_pad_new ("src", pad)); + gst_object_unref (pad); + } + src = GST_ELEMENT (bin); + } + if (error) { + _notify_debug ("Error while creating source pipeline (%d): %s", + error->code, error->message); + } + } else if (source) { + src = gst_element_factory_make (source, NULL); + if (src && source_device) + g_object_set(src, "device", source_device, NULL); + } + if (src == NULL) + src = gst_element_factory_make ("dshowaudiosrc", NULL); + if (src == NULL) + src = gst_element_factory_make ("directsoundsrc", NULL); + else + g_object_set(src, "buffer-time", G_GINT64_CONSTANT(20000), NULL); + if (src == NULL) + src = gst_element_factory_make ("osxaudiosrc", NULL); + if (src == NULL) + src = gst_element_factory_make ("gconfaudiosrc", NULL); + if (src == NULL) + src = gst_element_factory_make ("alsasrc", NULL); + if (src == NULL) + src = gst_element_factory_make ("osssrc", NULL); + + return src; +} + +static GstElement * _create_sink () { - GstElement *pipeline = user_data; GstElement *snk = NULL; - GstElement *convert = gst_element_factory_make ("audioconvert", NULL); - GstElement *resample = gst_element_factory_make ("audioresample", NULL); - GstElement *convert2 = gst_element_factory_make ("audioconvert", NULL); - GstPad *sink_pad = NULL; - GstPadLinkReturn ret; - - if (sink_pipeline) { GstPad *pad = NULL; GstBin *bin; @@ -462,6 +502,21 @@ if (snk == NULL) snk = gst_element_factory_make ("autoaudiosink", NULL); + return snk; +} + +static void +_src_pad_added (FsStream *self, GstPad *pad, FsCodec *codec, gpointer user_data) +{ + GstElement *pipeline = user_data; + GstElement *snk = NULL; + GstElement *convert = gst_element_factory_make ("audioconvert", NULL); + GstElement *resample = gst_element_factory_make ("audioresample", NULL); + GstElement *convert2 = gst_element_factory_make ("audioconvert", NULL); + GstPad *sink_pad = NULL; + GstPadLinkReturn ret; + + snk = _create_sink (); if (snk == NULL) { _notify_error_post ("Could not create sink"); if (convert) gst_object_unref (convert); @@ -1030,47 +1085,7 @@ goto error; } - if (source_pipeline) { - GstPad *pad = NULL; - GstBin *bin; - gchar *desc; - - /* parse the pipeline to a bin */ - desc = g_strdup_printf ("bin.( %s ! queue )", source_pipeline); - bin = (GstBin *) gst_parse_launch (desc, &error); - g_free (desc); - - if (bin) { - /* find pads and ghost them if necessary */ - if ((pad = gst_bin_find_unlinked_pad (bin, GST_PAD_SRC))) { - gst_element_add_pad (GST_ELEMENT (bin), gst_ghost_pad_new ("src", pad)); - gst_object_unref (pad); - } - src = GST_ELEMENT (bin); - } - if (error) { - _notify_debug ("Error while creating source pipeline (%d): %s", - error->code, error->message); - } - } else if (source) { - src = gst_element_factory_make (source, NULL); - if (src && source_device) - g_object_set(src, "device", source_device, NULL); - } - if (src == NULL) - src = gst_element_factory_make ("dshowaudiosrc", NULL); - if (src == NULL) - src = gst_element_factory_make ("directsoundsrc", NULL); - else - g_object_set(src, "buffer-time", G_GINT64_CONSTANT(20000), NULL); - if (src == NULL) - src = gst_element_factory_make ("osxaudiosrc", NULL); - if (src == NULL) - src = gst_element_factory_make ("gconfaudiosrc", NULL); - if (src == NULL) - src = gst_element_factory_make ("alsasrc", NULL); - if (src == NULL) - src = gst_element_factory_make ("osssrc", NULL); + src = _create_source (); if (src == NULL) { Tcl_AppendResult (interp, "Couldn't create audio source" , (char *) NULL); goto error; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |