- Changed plugins for new APIs

Original commit message from CVS:
- Changed plugins for new APIs
- modularized audiofile.
- added seeking, query and convert functions for mad, mpeg2dec,
avidemux, mpegdemux, mpegparse
- sync updates to oss. removed the ossclock for now
This commit is contained in:
Wim Taymans 2002-05-26 21:59:21 +00:00
parent cff445b737
commit d18d4fd5a1
9 changed files with 95 additions and 60 deletions

View file

@ -1,15 +1,10 @@
plugindir = $(libdir)/gst plugindir = $(libdir)/gst
plugin_LTLIBRARIES = libgstafsink.la libgstafsrc.la plugin_LTLIBRARIES = libgstaf.la
libgstafsink_la_SOURCES = gstafsink.c libgstaf_la_SOURCES = gstaf.c gstafsink.c gstafsrc.c gstafparse.c
libgstafsink_la_CFLAGS = $(GST_CFLAGS) $(AUDIOFILE_CFLAGS) libgstaf_la_CFLAGS = $(GST_CFLAGS) $(AUDIOFILE_CFLAGS)
libgstafsink_la_LIBADD = $(AUDIOFILE_LIBS) libgstaf_la_LIBADD = $(AUDIOFILE_LIBS)
libgstafsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) 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

40
ext/audiofile/gstaf.c Normal file
View file

@ -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
};

View file

@ -180,7 +180,7 @@ gst_afparse_loop(GstElement *element)
GstAFParse *afparse; GstAFParse *afparse;
GstBuffer *buf; GstBuffer *buf;
GstBufferPool *bufpool; 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; guint8 *data;
gboolean bypass_afread = TRUE; gboolean bypass_afread = TRUE;
GstByteStream *bs; GstByteStream *bs;
@ -315,8 +315,8 @@ gst_afparse_get_property (GObject *object, guint prop_id, GValue *value, GParamS
} }
} }
static gboolean gboolean
plugin_init (GModule *module, GstPlugin *plugin) gst_afparse_plugin_init (GModule *module, GstPlugin *plugin)
{ {
GstElementFactory *factory; GstElementFactory *factory;
@ -343,14 +343,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = {
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"afparse",
plugin_init
};
/* this is where we open the audiofile */ /* this is where we open the audiofile */
static gboolean static gboolean
gst_afparse_open_file (GstAFParse *afparse) gst_afparse_open_file (GstAFParse *afparse)
@ -483,7 +475,7 @@ static long
gst_afparse_vf_seek (AFvirtualfile *vfile, long offset, int is_relative) gst_afparse_vf_seek (AFvirtualfile *vfile, long offset, int is_relative)
{ {
GstByteStream *bs = (GstByteStream*)vfile->closure; GstByteStream *bs = (GstByteStream*)vfile->closure;
GstSeekType type; GstSeekType method;
guint64 current_offset = gst_bytestream_tell(bs); guint64 current_offset = gst_bytestream_tell(bs);
if (!is_relative){ if (!is_relative){
@ -492,16 +484,15 @@ gst_afparse_vf_seek (AFvirtualfile *vfile, long offset, int is_relative)
return offset; return offset;
} }
type = GST_SEEK_BYTEOFFSET_SET; method = GST_SEEK_METHOD_SET;
} }
else { else {
if (offset == 0) return current_offset; 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, (gint64)offset, method)){
if (gst_bytestream_seek(bs, type, (gint64)offset)){ g_print("doing seek to %d\n", (gint)offset);
return offset; return offset;
} }
return 0; return 0;

View file

@ -95,6 +95,8 @@ struct _GstAFParseClass {
void (*handoff) (GstElement *element,GstPad *pad); void (*handoff) (GstElement *element,GstPad *pad);
}; };
gboolean gst_afparse_plugin_init (GModule *module, GstPlugin *plugin);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View file

@ -260,8 +260,8 @@ gst_afsink_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
} }
} }
static gboolean gboolean
plugin_init (GModule *module, GstPlugin *plugin) gst_afsink_plugin_init (GModule *module, GstPlugin *plugin)
{ {
GstElementFactory *factory; GstElementFactory *factory;
@ -276,14 +276,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = {
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"afsink",
plugin_init
};
/* this is where we open the audiofile */ /* this is where we open the audiofile */
static gboolean static gboolean
gst_afsink_open_file (GstAFSink *sink) gst_afsink_open_file (GstAFSink *sink)

View file

@ -53,7 +53,7 @@ typedef struct _GstAFSink GstAFSink;
typedef struct _GstAFSinkClass GstAFSinkClass; typedef struct _GstAFSinkClass GstAFSinkClass;
typedef enum { 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, GST_AFSINK_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2,
} GstAFSinkFlags; } GstAFSinkFlags;
@ -88,8 +88,9 @@ struct _GstAFSinkClass {
void (*handoff) (GstElement *element,GstPad *pad); void (*handoff) (GstElement *element,GstPad *pad);
}; };
GType gst_afsink_get_type(void); GType gst_afsink_get_type (void);
/*gboolean gst_afsink_factory_init (GstElementFactory *factory); */ gboolean gst_afsink_plugin_init (GModule *module, GstPlugin *plugin);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -271,8 +271,8 @@ gst_afsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe
} }
} }
static gboolean gboolean
plugin_init (GModule *module, GstPlugin *plugin) gst_afsrc_plugin_init (GModule *module, GstPlugin *plugin)
{ {
GstElementFactory *factory; 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 */ /* this is where we open the audiofile */
static gboolean static gboolean
gst_afsrc_open_file (GstAFSrc *src) gst_afsrc_open_file (GstAFSrc *src)

View file

@ -94,8 +94,10 @@ struct _GstAFSrcClass {
void (*handoff) (GstElement *element,GstPad *pad); void (*handoff) (GstElement *element,GstPad *pad);
}; };
GType gst_afsrc_get_type(void); GType gst_afsrc_get_type (void);
/*gboolean gst_afsrc_factory_init (GstElementFactory *factory);*/ gboolean gst_afsrc_plugin_init (GModule *module, GstPlugin *plugin);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -190,6 +190,7 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
GST_ELEMENT (sdlvideosink)->setclockfunc = gst_sdlvideosink_set_clock; GST_ELEMENT (sdlvideosink)->setclockfunc = gst_sdlvideosink_set_clock;
GST_FLAG_SET(sdlvideosink, GST_ELEMENT_THREAD_SUGGESTED); 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) gst_sdlvideosink_chain (GstPad *pad, GstBuffer *buf)
{ {
GstSDLVideoSink *sdlvideosink; GstSDLVideoSink *sdlvideosink;
SDL_Event event; SDL_Event sdl_event;
g_return_if_fail (pad != NULL); g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad)); 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)); 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: case SDL_VIDEORESIZE:
/* create a SDL window of the size requested by the user */ /* create a SDL window of the size requested by the user */
sdlvideosink->window_width = event.resize.w; sdlvideosink->window_width = sdl_event.resize.w;
sdlvideosink->window_height = event.resize.h; sdlvideosink->window_height = sdl_event.resize.h;
gst_sdlvideosink_create(sdlvideosink, FALSE); gst_sdlvideosink_create(sdlvideosink, FALSE);
break; 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) { if (sdlvideosink->clock) {
gst_element_clock_wait (GST_ELEMENT (sdlvideosink), 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)) if (!gst_sdlvideosink_lock(sdlvideosink))