From: <sl...@ke...> - 2008-01-06 16:36:43
|
CVS Root: /cvs/gstreamer Module: gst-plugins-bad Changes by: slomo Date: Sun Jan 06 2008 16:36:46 UTC Log message: * configure.ac: * ext/gio/gstgiobasesrc.c: (gst_gio_base_src_get_size): * tests/check/pipelines/gio.c: (free_input), (GST_START_TEST): Update to GMemoryInputStream API changes in GLib SVN and require gio-2.0 >= 2.15.1 for this. Fixes bug #507584. We can also report the duration for every GSeekable, not only GFileInputStream and GMemoryInputStream. Modified files: . : ChangeLog configure.ac ext/gio : gstgiobasesrc.c tests/check/pipelines: gio.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.2988&r2=1.2989 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/configure.ac.diff?r1=1.800&r2=1.801 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/gio/gstgiobasesrc.c.diff?r1=1.2&r2=1.3 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/tests/check/pipelines/gio.c.diff?r1=1.3&r2=1.4 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v retrieving revision 1.2988 retrieving revision 1.2989 diff -u -d -r1.2988 -r1.2989 --- ChangeLog 6 Jan 2008 03:01:38 -0000 1.2988 +++ ChangeLog 6 Jan 2008 16:36:30 -0000 1.2989 @@ -1,3 +1,13 @@ +2008-01-06 Sebastian Dröge <sl...@ci...> + + * configure.ac: + * ext/gio/gstgiobasesrc.c: (gst_gio_base_src_get_size): + * tests/check/pipelines/gio.c: (free_input), (GST_START_TEST): + Update to GMemoryInputStream API changes in GLib SVN and require + gio-2.0 >= 2.15.1 for this. Fixes bug #507584. + We can also report the duration for every GSeekable, not only + GFileInputStream and GMemoryInputStream. 2008-01-05 David Schleef <ds...@sc...> * sys/glsink/glimagesink.c: Index: configure.ac RCS file: /cvs/gstreamer/gst-plugins-bad/configure.ac,v retrieving revision 1.800 retrieving revision 1.801 diff -u -d -r1.800 -r1.801 --- configure.ac 31 Dec 2007 07:55:23 -0000 1.800 +++ configure.ac 6 Jan 2008 16:36:31 -0000 1.801 @@ -584,7 +584,7 @@ dnl *** libgio *** translit(dnm, m, l) AM_CONDITIONAL(USE_GIO, true) AG_GST_CHECK_FEATURE(GIO, [GIO library], gio, [ - PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.15.0, HAVE_GIO="yes", [ + PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.15.1, HAVE_GIO="yes", [ HAVE_GIO="no" AC_MSG_RESULT(no) ]) Index: gstgiobasesrc.c RCS file: /cvs/gstreamer/gst-plugins-bad/ext/gio/gstgiobasesrc.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gstgiobasesrc.c 29 Dec 2007 17:29:16 -0000 1.2 +++ gstgiobasesrc.c 6 Jan 2008 16:36:32 -0000 1.3 @@ -185,15 +185,52 @@ g_clear_error (&err); } - } else if (G_IS_MEMORY_INPUT_STREAM (src->stream)) { - gsize data_size; + } else if (GST_GIO_STREAM_IS_SEEKABLE (src->stream)) { + goffset old; + goffset stream_size; + gboolean ret; + GSeekable *seekable = G_SEEKABLE (src->stream); + GError *err = NULL; - data_size = - g_memory_input_stream_get_data_size (G_MEMORY_INPUT_STREAM (src-> - stream)); + old = g_seekable_tell (seekable); - if (data_size != -1) { - *size = data_size; + ret = g_seekable_seek (seekable, 0, G_SEEK_END, src->cancel, &err); + if (!ret) { + if (!gst_gio_error (src, "g_seekable_seek", &err, NULL)) { + if (GST_GIO_ERROR_MATCHES (err, NOT_SUPPORTED)) + GST_DEBUG_OBJECT (src, + "Seeking to the end of stream is not supported"); + else + GST_WARNING_OBJECT (src, "Seeking to end of stream failed: %s", + err->message); + g_clear_error (&err); + } else { + GST_WARNING_OBJECT (src, "Seeking to end of stream failed"); + } + return FALSE; + } + stream_size = g_seekable_tell (seekable); + ret = g_seekable_seek (seekable, old, G_SEEK_SET, src->cancel, &err); + GST_ERROR_OBJECT (src, "Seeking to the old position not supported"); + GST_ERROR_OBJECT (src, "Seeking to the old position failed: %s", + GST_ERROR_OBJECT (src, "Seeking to the old position faile"); + if (stream_size >= 0) { + *size = stream_size; return TRUE; } Index: gio.c RCS file: /cvs/gstreamer/gst-plugins-bad/tests/check/pipelines/gio.c,v retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- gio.c 29 Dec 2007 17:29:17 -0000 1.3 +++ gio.c 6 Jan 2008 16:36:32 -0000 1.4 @@ -57,6 +57,12 @@ return TRUE; } +static void +free_input (gpointer data) +{ + g_free (data); +} GST_START_TEST (test_memory_stream) { GMainLoop *loop; @@ -70,6 +76,8 @@ guint8 *in_data; GByteArray *out_data; gint i; + GstFormat fmt = GST_FORMAT_BYTES; + gint64 duration; got_eos = FALSE; @@ -78,8 +86,8 @@ in_data[i] = i % 256; input = - G_MEMORY_INPUT_STREAM (g_memory_input_stream_from_data (in_data, 512)); - g_memory_input_stream_set_free_data (input, TRUE); + G_MEMORY_INPUT_STREAM (g_memory_input_stream_new_from_data (in_data, 512, + free_input)); out_data = g_byte_array_new (); output = G_MEMORY_OUTPUT_STREAM (g_memory_output_stream_new (out_data)); @@ -105,6 +113,11 @@ gst_bus_add_watch (bus, message_handler, loop); gst_object_unref (bus); + gst_element_set_state (bin, GST_STATE_PAUSED); + fail_unless (gst_element_query_duration (bin, &fmt, &duration)); + fail_unless_equals_int (duration, 512); gst_element_set_state (bin, GST_STATE_PLAYING); g_main_loop_run (loop); |