[Swfdec-commits] 2 commits - swfdec-gtk/swfdec_playback_alsa.c swfdec/swfdec_init.c
Benjamin Otte
company at kemper.freedesktop.org
Wed Jun 11 11:54:48 PDT 2008
swfdec-gtk/swfdec_playback_alsa.c | 28 +++++++++++++++++++++++++++-
swfdec/swfdec_init.c | 1 +
2 files changed, 28 insertions(+), 1 deletion(-)
New commits:
commit b2d01995219f21e33dd43d69ab7d15e94fd0f1a5
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Jun 11 20:53:34 2008 +0200
strtoul needs stdlib.h
I'm surprised this wasn't caught earlier
diff --git a/swfdec/swfdec_init.c b/swfdec/swfdec_init.c
index 9fae716..12aef51 100644
--- a/swfdec/swfdec_init.c
+++ b/swfdec/swfdec_init.c
@@ -22,6 +22,7 @@
#endif
#include <errno.h>
+#include <stdlib.h>
#ifdef HAVE_GST
#include <gst/gst.h>
#include <gst/pbutils/pbutils.h>
commit 7b436b0a01ba58a7b85f597a5dd0c9827a02bc64
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Jun 11 20:51:19 2008 +0200
implement (and comment out, because surprisingly it's broken) rewinding
diff --git a/swfdec-gtk/swfdec_playback_alsa.c b/swfdec-gtk/swfdec_playback_alsa.c
index be9f4f9..84cf7e1 100644
--- a/swfdec-gtk/swfdec_playback_alsa.c
+++ b/swfdec-gtk/swfdec_playback_alsa.c
@@ -54,7 +54,7 @@ struct _Stream {
snd_pcm_t * pcm; /* the pcm we play back to */
GSource ** sources; /* sources for writing data */
guint n_sources; /* number of sources */
- guint offset; /* offset into sound */
+ gsize offset; /* offset into sound */
gboolean (* write) (Stream *);
};
@@ -237,6 +237,28 @@ swfdec_playback_stream_start (Stream *stream)
}
static void
+swfdec_playback_stream_changed (SwfdecAudio *audio, Stream *stream)
+{
+#if 0
+ snd_pcm_sframes_t back;
+
+ /* doesn't exist in Hardy yet and is broken on dmix */
+ back = snd_pcm_rewindable (stream->pcm);
+ if (back <= 0)
+ return;
+ if ((gsize) back > stream->offset)
+ back = stream->offset;
+
+ back = snd_pcm_rewind (stream->pcm, back);
+ if (back <= 0)
+ return;
+
+ stream->offset -= back;
+ try_write (stream);
+#endif
+}
+
+static void
swfdec_playback_stream_open (SwfdecPlayback *sound, SwfdecAudio *audio)
{
Stream *stream;
@@ -301,6 +323,8 @@ swfdec_playback_stream_open (SwfdecPlayback *sound, SwfdecAudio *audio)
if (stream->n_sources > 0)
stream->sources = g_new0 (GSource *, stream->n_sources);
sound->streams = g_list_prepend (sound->streams, stream);
+ g_signal_connect (stream->audio, "changed",
+ G_CALLBACK (swfdec_playback_stream_changed), stream);
swfdec_playback_stream_start (stream);
return;
@@ -315,6 +339,8 @@ swfdec_playback_stream_close (Stream *stream)
swfdec_playback_stream_remove_handlers (stream);
g_free (stream->sources);
stream->sound->streams = g_list_remove (stream->sound->streams, stream);
+ g_signal_handlers_disconnect_by_func (stream->audio,
+ swfdec_playback_stream_changed, stream);
g_object_unref (stream->audio);
g_free (stream);
}
More information about the Swfdec-commits
mailing list