diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/audiofile/Makefile.am | 17 | ||||
-rw-r--r-- | ext/audiofile/gstaf.c | 40 | ||||
-rw-r--r-- | ext/audiofile/gstafparse.c | 27 | ||||
-rw-r--r-- | ext/audiofile/gstafparse.h | 2 | ||||
-rw-r--r-- | ext/audiofile/gstafsink.c | 12 | ||||
-rw-r--r-- | ext/audiofile/gstafsink.h | 7 | ||||
-rw-r--r-- | ext/audiofile/gstafsrc.c | 11 | ||||
-rw-r--r-- | ext/audiofile/gstafsrc.h | 6 | ||||
-rw-r--r-- | ext/sdl/sdlvideosink.c | 33 |
9 files changed, 95 insertions, 60 deletions
diff --git a/ext/audiofile/Makefile.am b/ext/audiofile/Makefile.am index 8be5846d..31fab02d 100644 --- a/ext/audiofile/Makefile.am +++ b/ext/audiofile/Makefile.am @@ -1,15 +1,10 @@ plugindir = $(libdir)/gst -plugin_LTLIBRARIES = libgstafsink.la libgstafsrc.la +plugin_LTLIBRARIES = libgstaf.la -libgstafsink_la_SOURCES = gstafsink.c -libgstafsink_la_CFLAGS = $(GST_CFLAGS) $(AUDIOFILE_CFLAGS) -libgstafsink_la_LIBADD = $(AUDIOFILE_LIBS) -libgstafsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstaf_la_SOURCES = gstaf.c gstafsink.c gstafsrc.c gstafparse.c +libgstaf_la_CFLAGS = $(GST_CFLAGS) $(AUDIOFILE_CFLAGS) +libgstaf_la_LIBADD = $(AUDIOFILE_LIBS) +libgstaf_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstafsrc_la_SOURCES = gstafsrc.c -libgstafsrc_la_CFLAGS = $(GST_CFLAGS) $(AUDIOFILE_CFLAGS) -libgstafsrc_la_LIBADD = $(AUDIOFILE_LIBS) -libgstafsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) - -noinst_HEADERS = gstafsink.h gstafsrc.h +noinst_HEADERS = gstafsink.h gstafsrc.h diff --git a/ext/audiofile/gstaf.c b/ext/audiofile/gstaf.c new file mode 100644 index 00000000..4e2b3e9a --- /dev/null +++ b/ext/audiofile/gstaf.c @@ -0,0 +1,40 @@ +/* GStreamer + * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +#include "gstafsrc.h" +#include "gstafsink.h" +#include "gstafparse.h" + +static gboolean +plugin_init (GModule *module, GstPlugin *plugin) +{ + gst_afsink_plugin_init (module, plugin); + gst_afsrc_plugin_init (module, plugin); + gst_afparse_plugin_init (module, plugin); + + return TRUE; +} + +GstPluginDesc plugin_desc = { + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "gstaf", + plugin_init +}; diff --git a/ext/audiofile/gstafparse.c b/ext/audiofile/gstafparse.c index 32a12dce..5067ea1f 100644 --- a/ext/audiofile/gstafparse.c +++ b/ext/audiofile/gstafparse.c @@ -180,7 +180,7 @@ gst_afparse_loop(GstElement *element) GstAFParse *afparse; GstBuffer *buf; GstBufferPool *bufpool; - gint numframes, frames_to_bytes, frames_per_read, bytes_per_read; + gint numframes = 0, frames_to_bytes, frames_per_read, bytes_per_read; guint8 *data; gboolean bypass_afread = TRUE; GstByteStream *bs; @@ -315,8 +315,8 @@ gst_afparse_get_property (GObject *object, guint prop_id, GValue *value, GParamS } } -static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +gboolean +gst_afparse_plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; @@ -343,14 +343,6 @@ plugin_init (GModule *module, GstPlugin *plugin) return TRUE; } - -GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "afparse", - plugin_init -}; - /* this is where we open the audiofile */ static gboolean gst_afparse_open_file (GstAFParse *afparse) @@ -483,7 +475,7 @@ static long gst_afparse_vf_seek (AFvirtualfile *vfile, long offset, int is_relative) { GstByteStream *bs = (GstByteStream*)vfile->closure; - GstSeekType type; + GstSeekType method; guint64 current_offset = gst_bytestream_tell(bs); if (!is_relative){ @@ -492,16 +484,15 @@ gst_afparse_vf_seek (AFvirtualfile *vfile, long offset, int is_relative) return offset; } - type = GST_SEEK_BYTEOFFSET_SET; + method = GST_SEEK_METHOD_SET; } else { if (offset == 0) return current_offset; - type = GST_SEEK_BYTEOFFSET_CUR; + method = GST_SEEK_METHOD_CUR; } - - g_print("doing seek to %d, current offset %lld\n", (gint)offset, current_offset); - if (gst_bytestream_seek(bs, type, (gint64)offset)){ - + + if (gst_bytestream_seek(bs, (gint64)offset, method)){ + g_print("doing seek to %d\n", (gint)offset); return offset; } return 0; diff --git a/ext/audiofile/gstafparse.h b/ext/audiofile/gstafparse.h index 72a40bb6..9483f248 100644 --- a/ext/audiofile/gstafparse.h +++ b/ext/audiofile/gstafparse.h @@ -95,6 +95,8 @@ struct _GstAFParseClass { void (*handoff) (GstElement *element,GstPad *pad); }; +gboolean gst_afparse_plugin_init (GModule *module, GstPlugin *plugin); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ext/audiofile/gstafsink.c b/ext/audiofile/gstafsink.c index 77e1637d..7ea8d3c8 100644 --- a/ext/audiofile/gstafsink.c +++ b/ext/audiofile/gstafsink.c @@ -260,8 +260,8 @@ gst_afsink_get_property (GObject *object, guint prop_id, GValue *value, GParamSp } } -static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +gboolean +gst_afsink_plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; @@ -276,14 +276,6 @@ plugin_init (GModule *module, GstPlugin *plugin) return TRUE; } - -GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "afsink", - plugin_init -}; - /* this is where we open the audiofile */ static gboolean gst_afsink_open_file (GstAFSink *sink) diff --git a/ext/audiofile/gstafsink.h b/ext/audiofile/gstafsink.h index d61951b6..7dc0d73d 100644 --- a/ext/audiofile/gstafsink.h +++ b/ext/audiofile/gstafsink.h @@ -53,7 +53,7 @@ typedef struct _GstAFSink GstAFSink; typedef struct _GstAFSinkClass GstAFSinkClass; typedef enum { - GST_AFSINK_OPEN = GST_ELEMENT_FLAG_LAST, + GST_AFSINK_OPEN = GST_ELEMENT_FLAG_LAST, GST_AFSINK_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2, } GstAFSinkFlags; @@ -88,8 +88,9 @@ struct _GstAFSinkClass { void (*handoff) (GstElement *element,GstPad *pad); }; -GType gst_afsink_get_type(void); -/*gboolean gst_afsink_factory_init (GstElementFactory *factory); */ +GType gst_afsink_get_type (void); +gboolean gst_afsink_plugin_init (GModule *module, GstPlugin *plugin); + #ifdef __cplusplus diff --git a/ext/audiofile/gstafsrc.c b/ext/audiofile/gstafsrc.c index 751b3cec..d42c6ebc 100644 --- a/ext/audiofile/gstafsrc.c +++ b/ext/audiofile/gstafsrc.c @@ -271,8 +271,8 @@ gst_afsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe } } -static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +gboolean +gst_afsrc_plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; @@ -295,13 +295,6 @@ plugin_init (GModule *module, GstPlugin *plugin) } -GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "afsrc", - plugin_init -}; - /* this is where we open the audiofile */ static gboolean gst_afsrc_open_file (GstAFSrc *src) diff --git a/ext/audiofile/gstafsrc.h b/ext/audiofile/gstafsrc.h index 2544678b..61cb5095 100644 --- a/ext/audiofile/gstafsrc.h +++ b/ext/audiofile/gstafsrc.h @@ -94,8 +94,10 @@ struct _GstAFSrcClass { void (*handoff) (GstElement *element,GstPad *pad); }; -GType gst_afsrc_get_type(void); -/*gboolean gst_afsrc_factory_init (GstElementFactory *factory);*/ +GType gst_afsrc_get_type (void); +gboolean gst_afsrc_plugin_init (GModule *module, GstPlugin *plugin); + + #ifdef __cplusplus diff --git a/ext/sdl/sdlvideosink.c b/ext/sdl/sdlvideosink.c index 065a0c0b..244d9a7a 100644 --- a/ext/sdl/sdlvideosink.c +++ b/ext/sdl/sdlvideosink.c @@ -190,6 +190,7 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink) GST_ELEMENT (sdlvideosink)->setclockfunc = gst_sdlvideosink_set_clock; GST_FLAG_SET(sdlvideosink, GST_ELEMENT_THREAD_SUGGESTED); + GST_FLAG_SET(sdlvideosink, GST_ELEMENT_EVENT_AWARE); } @@ -399,7 +400,7 @@ static void gst_sdlvideosink_chain (GstPad *pad, GstBuffer *buf) { GstSDLVideoSink *sdlvideosink; - SDL_Event event; + SDL_Event sdl_event; g_return_if_fail (pad != NULL); g_return_if_fail (GST_IS_PAD (pad)); @@ -407,24 +408,42 @@ gst_sdlvideosink_chain (GstPad *pad, GstBuffer *buf) sdlvideosink = GST_SDLVIDEOSINK (gst_pad_get_parent (pad)); - GST_DEBUG (0,"videosink: clock wait: %llu", GST_BUFFER_TIMESTAMP(buf)); - while (SDL_PollEvent(&event)) + while (SDL_PollEvent(&sdl_event)) { - switch(event.type) + switch(sdl_event.type) { case SDL_VIDEORESIZE: /* create a SDL window of the size requested by the user */ - sdlvideosink->window_width = event.resize.w; - sdlvideosink->window_height = event.resize.h; + sdlvideosink->window_width = sdl_event.resize.w; + sdlvideosink->window_height = sdl_event.resize.h; gst_sdlvideosink_create(sdlvideosink, FALSE); break; } } + if (GST_IS_EVENT (buf)) { + GstEvent *event = GST_EVENT (buf); + gint64 offset; + + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_DISCONTINUOUS: + offset = GST_EVENT_DISCONT_OFFSET (event, 0).value; + g_print ("sdl discont %lld\n", offset); + gst_clock_handle_discont (sdlvideosink->clock, (guint64) GST_EVENT_DISCONT_OFFSET (event, 0).value); + break; + default: + gst_pad_event_default (pad, event); + break; + } + gst_event_free (event); + return; + } + + GST_DEBUG (0,"videosink: clock wait: %llu", GST_BUFFER_TIMESTAMP(buf)); if (sdlvideosink->clock) { gst_element_clock_wait (GST_ELEMENT (sdlvideosink), - sdlvideosink->clock, GST_BUFFER_TIMESTAMP (buf)); + sdlvideosink->clock, GST_BUFFER_TIMESTAMP (buf), NULL); } if (!gst_sdlvideosink_lock(sdlvideosink)) |