diff options
author | Sreerenj Balachandran <sreerenj.balachandran@intel.com> | 2012-07-04 10:14:35 +0300 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2012-07-10 12:19:17 +0200 |
commit | 68fadbb92aa13c9a571dfd7ceb6e518c362afed2 (patch) | |
tree | 0410328acd1c95b5c3eed71c8fa8d4fa2c1b5d2d | |
parent | c8e16bc1b76d2e8d4552458d65e4d16c8b3cc58b (diff) | |
download | gstreamer-plugins-bad-68fadbb92aa13c9a571dfd7ceb6e518c362afed2.tar.gz |
port festival to 0.11
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=679373
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | gst/festival/Makefile.am | 4 | ||||
-rw-r--r-- | gst/festival/gstfestival.c | 94 |
3 files changed, 31 insertions, 69 deletions
diff --git a/configure.ac b/configure.ac index 685708c1c..aaa7cd684 100644 --- a/configure.ac +++ b/configure.ac @@ -312,7 +312,7 @@ dnl Non ported plugins (non-dependant, then dependant) dnl Make sure you have a space before and after all plugins GST_PLUGINS_NONPORTED=" aiff \ cdxaparse \ - dccp faceoverlay festival \ + dccp faceoverlay \ fieldanalysis freeverb freeze frei0r \ hdvparse id3tag inter ivfparse jpegformat jp2kdecimator \ kate liveadder librfb \ diff --git a/gst/festival/Makefile.am b/gst/festival/Makefile.am index cb8959dc4..e61835923 100644 --- a/gst/festival/Makefile.am +++ b/gst/festival/Makefile.am @@ -6,7 +6,7 @@ libgstfestival_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) # we use net connection now... perhaps use the lib later # libgstfestival_la_LIBADD = $(FESTIVAL_LIBS) libgstfestival_la_LIBADD = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS) \ - -lgstaudio-0.10 $(WINSOCK2_LIBS) + -lgstaudio-1.0 $(WINSOCK2_LIBS) libgstfestival_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstfestival_la_LIBTOOLFLAGS = --tag=disable-static @@ -23,5 +23,5 @@ Android.mk: Makefile.am $(BUILT_SOURCES) $(libgstfestival_la_LIBADD) \ -ldl \ -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ - LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-1.0' \ > $@ diff --git a/gst/festival/gstfestival.c b/gst/festival/gstfestival.c index cb962ef09..075df746a 100644 --- a/gst/festival/gstfestival.c +++ b/gst/festival/gstfestival.c @@ -110,11 +110,8 @@ GST_DEBUG_CATEGORY_STATIC (festival_debug); static void gst_festival_finalize (GObject * object); -static void gst_festival_base_init (gpointer g_class); -static void gst_festival_class_init (GstFestivalClass * klass); -static void gst_festival_init (GstFestival * festival); - -static GstFlowReturn gst_festival_chain (GstPad * pad, GstBuffer * buf); +static GstFlowReturn gst_festival_chain (GstPad * pad, GstObject * parent, + GstBuffer * buf); static GstStateChangeReturn gst_festival_change_state (GstElement * element, GstStateChange transition); @@ -149,54 +146,11 @@ enum /* FILL ME */ }; -static GstElementClass *parent_class = NULL; - /*static guint gst_festival_signals[LAST_SIGNAL] = { 0 }; */ -GType -gst_festival_get_type (void) -{ - static GType festival_type = 0; - - if (!festival_type) { - static const GTypeInfo festival_info = { - sizeof (GstFestivalClass), - gst_festival_base_init, - NULL, - (GClassInitFunc) gst_festival_class_init, - NULL, - NULL, - sizeof (GstFestival), - 0, - (GInstanceInitFunc) gst_festival_init, - }; - - festival_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstFestival", &festival_info, - 0); - } - return festival_type; -} +G_DEFINE_TYPE (GstFestival, gst_festival, GST_TYPE_ELEMENT) -static void -gst_festival_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - /* register pads */ - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template_factory)); - - gst_element_class_set_details_simple (element_class, - "Festival Text-to-Speech synthesizer", "Filter/Effect/Audio", - "Synthesizes plain text into audio", - "Wim Taymans <wim.taymans@chello.be>"); -} - -static void -gst_festival_class_init (GstFestivalClass * klass) + static void gst_festival_class_init (GstFestivalClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; @@ -204,11 +158,20 @@ gst_festival_class_init (GstFestivalClass * klass) gobject_class = G_OBJECT_CLASS (klass); gstelement_class = GST_ELEMENT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_festival_finalize); gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_festival_change_state); + + /* register pads */ + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sink_template_factory)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&src_template_factory)); + + gst_element_class_set_details_simple (gstelement_class, + "Festival Text-to-Speech synthesizer", "Filter/Effect/Audio", + "Synthesizes plain text into audio", + "Wim Taymans <wim.taymans@chello.be>"); } static void @@ -233,7 +196,7 @@ gst_festival_finalize (GObject * object) g_free (festival->info); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gst_festival_parent_class)->finalize (object); } static gboolean @@ -252,7 +215,6 @@ read_response (GstFestival * festival) n += read (fd, ack + n, 3 - n); ack[3] = '\0'; GST_DEBUG_OBJECT (festival, "got response %s", ack); - if (strcmp (ack, "WV\n") == 0) { GstBuffer *buffer; @@ -262,12 +224,8 @@ read_response (GstFestival * festival) filesize); /* push contents as a buffer */ - buffer = gst_buffer_new (); - GST_BUFFER_SIZE (buffer) = (filesize); - GST_BUFFER_DATA (buffer) = (guint8 *) data; - GST_BUFFER_MALLOCDATA (buffer) = (guint8 *) data; + buffer = gst_buffer_new_wrapped (data, filesize); GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE; - gst_pad_push (festival->srcpad, buffer); } else if (strcmp (ack, "LP\n") == 0) { @@ -292,17 +250,19 @@ read_response (GstFestival * festival) } static GstFlowReturn -gst_festival_chain (GstPad * pad, GstBuffer * buf) +gst_festival_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstFlowReturn ret = GST_FLOW_OK; GstFestival *festival; + GstMapInfo info; guint8 *p, *ep; gint f; FILE *fd; - festival = GST_FESTIVAL (GST_PAD_PARENT (pad)); + festival = GST_FESTIVAL (parent); - GST_LOG_OBJECT (festival, "Got text buffer, %u bytes", GST_BUFFER_SIZE (buf)); + GST_LOG_OBJECT (festival, "Got text buffer, %u bytes", + gst_buffer_get_size (buf)); f = dup (festival->info->server_fd); if (f < 0) @@ -323,8 +283,9 @@ gst_festival_chain (GstPad * pad, GstBuffer * buf) } fprintf (fd, "(tts_textall \""); - p = GST_BUFFER_DATA (buf); - ep = p + GST_BUFFER_SIZE (buf); + gst_buffer_map (buf, &info, GST_MAP_WRITE); + p = info.data; + ep = p + gst_buffer_get_size (buf); for (; p < ep && (*p != '\0'); p++) { if ((*p == '"') || (*p == '\\')) { putc ('\\', fd); @@ -524,8 +485,9 @@ gst_festival_change_state (GstElement * element, GstStateChange transition) } } - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + if (GST_ELEMENT_CLASS (gst_festival_parent_class)->change_state) + return GST_ELEMENT_CLASS (gst_festival_parent_class)->change_state (element, + transition); return GST_STATE_CHANGE_SUCCESS; } |