Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-03-10 11:46:32 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-03-10 11:46:32 (GMT)
commit0c6085d1539707f5a49f1d5ea3226f97c5c153ca (patch)
treea5e599e546dd29ae6565c806d51c1fe4f7fee4ba
parent86a935ee40f0ef15e0f7b6711628207a53b8862f (diff)
Throw gio away
-rw-r--r--configure.ac1
-rw-r--r--src/Makefile.am4
-rw-r--r--src/espeak.c30
3 files changed, 13 insertions, 22 deletions
diff --git a/configure.ac b/configure.ac
index 185e16b..df2b213 100644
--- a/configure.ac
+++ b/configure.ac
@@ -129,7 +129,6 @@ AC_SUBST(GST_PLUGIN_LDFLAGS)
dnl check espeak dependencies
AC_CHECK_LIB(espeak, espeak_Initialize,, AC_MSG_ERROR())
-PKG_CHECK_MODULES(GIO, gio-2.0)
PKG_CHECK_MODULES(GST_AUDIO, gstreamer-audio-0.10)
AC_OUTPUT(Makefile m4/Makefile src/Makefile)
diff --git a/src/Makefile.am b/src/Makefile.am
index 2313a30..c1d1f49 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,8 +2,8 @@ plugin_LTLIBRARIES = libgstespeak.la
libgstespeak_la_SOURCES = espeak.c gstespeak.c
-libgstespeak_la_CFLAGS = $(GST_CFLAGS) $(GIO_CFLAGS) $(GST_AUDIO_CFLAGS)
-libgstespeak_la_LIBADD = $(GST_LIBS) $(GIO_LIBS) $(GST_AUDIO_LIBS)
+libgstespeak_la_CFLAGS = $(GST_CFLAGS) $(GST_AUDIO_CFLAGS)
+libgstespeak_la_LIBADD = $(GST_LIBS) $(GST_AUDIO_LIBS)
libgstespeak_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstespeak_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/src/espeak.c b/src/espeak.c
index 4db1f7b..9b128aa 100644
--- a/src/espeak.c
+++ b/src/espeak.c
@@ -18,7 +18,6 @@
#include <stdlib.h>
#include <string.h>
#include <glib.h>
-#include <gio/gio.h>
#include <gst/gst.h>
#include <espeak/speak_lib.h>
@@ -47,7 +46,7 @@ typedef struct
volatile SpinState state;
- GMemoryOutputStream *sound;
+ GByteArray *sound;
goffset sound_offset;
GArray *events;
@@ -144,8 +143,7 @@ espeak_new(GstElement *emitter)
spin->context = self;
spin->state = IN;
- spin->sound = G_MEMORY_OUTPUT_STREAM(g_memory_output_stream_new(
- NULL, 0, realloc, free));
+ spin->sound = g_byte_array_new();
spin->events = g_array_new(FALSE, FALSE, sizeof(espeak_EVENT));
}
@@ -181,9 +179,7 @@ espeak_unref(Econtext *self)
for (i = SPIN_QUEUE_SIZE; i--;)
{
- g_output_stream_close(G_OUTPUT_STREAM(self->queue[i].sound),
- NULL, NULL);
- g_object_unref(self->queue[i].sound);
+ g_byte_array_free(self->queue[i].sound, TRUE);
g_array_free(self->queue[i].events, TRUE);
}
@@ -218,13 +214,13 @@ play(Econtext *self, Espin *spin, gsize size_to_play)
{
inline gsize whole(Espin *spin, gsize size_to_play)
{
- gsize spin_size = g_memory_output_stream_get_data_size(spin->sound);
+ gsize spin_size = spin->sound->len;
return MIN(size_to_play, spin_size - spin->sound_offset);
}
inline gsize word(Econtext *self, Espin *spin, gsize size_to_play)
{
- gsize spin_size = g_memory_output_stream_get_data_size(spin->sound);
+ gsize spin_size = spin->sound->len;
size_to_play = MIN(size_to_play, spin_size);
goffset event;
@@ -287,7 +283,7 @@ play(Econtext *self, Espin *spin, gsize size_to_play)
spin->mark_name = NULL;
}
- gsize spin_size = g_memory_output_stream_get_data_size(spin->sound);
+ gsize spin_size = spin->sound->len;
size_to_play = MIN(size_to_play, spin_size);
goffset event;
@@ -353,9 +349,7 @@ play(Econtext *self, Espin *spin, gsize size_to_play)
}
GstBuffer *out = gst_buffer_new();
- GST_BUFFER_DATA(out) =
- (guchar*)g_memory_output_stream_get_data(spin->sound) +
- spin->sound_offset;
+ GST_BUFFER_DATA(out) = spin->sound->data + spin->sound_offset;
GST_BUFFER_SIZE(out) = size_to_play;
spin->sound_offset += size_to_play;
@@ -388,7 +382,7 @@ espeak_out(Econtext *self, gsize size_to_play)
g_mutex_unlock(process_lock);
Espin *spin = self->out;
- gsize spin_size = g_memory_output_stream_get_data_size(spin->sound);
+ gsize spin_size = spin->sound->len;
GST_DEBUG("[%p] spin->sound_offset=%ld spin_size=%ld",
self, spin->sound_offset, spin_size);
@@ -441,8 +435,7 @@ synth_cb(short *data, int numsamples, espeak_EVENT *events)
if (numsamples > 0)
{
- g_output_stream_write(G_OUTPUT_STREAM(spin->sound), data, numsamples*2,
- NULL, NULL);
+ g_byte_array_append(spin->sound, (const guint8*)data, numsamples*2);
espeak_EVENT *i;
@@ -497,8 +490,7 @@ synth_cb(short *data, int numsamples, espeak_EVENT *events)
static void
synth(Econtext *self, Espin *spin)
{
- g_seekable_seek(G_SEEKABLE(spin->sound), 0, G_SEEK_SET,
- NULL, NULL);
+ g_byte_array_set_size(spin->sound, 0);
g_array_set_size(spin->events, 0);
spin->sound_offset = 0;
spin->events_pos = 0;
@@ -530,7 +522,7 @@ synth(Econtext *self, Espin *spin)
}
espeak_EVENT last_event = { espeakEVENT_LIST_TERMINATED };
- last_event.sample = g_memory_output_stream_get_data_size(spin->sound) / 2;
+ last_event.sample = spin->sound->len / 2;
g_array_append_val(spin->events, last_event);
}