From e4bba88ae906fa60370ef19f4f31467d1ecc6f11 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 12 Dec 2001 06:08:44 +0000 Subject: [PATCH] minor typographical change to autogen added --with-html-dir option to configure more robust docbook checks convert to... Original commit message from CVS: * minor typographical change to autogen * added --with-html-dir option to configure * more robust docbook checks * convert to standard docbook makefiles, at least for the gst/ directory * added filesrc.h so that docbook can know about filesrc * updated -sections.txt because docbook is incredibly stupid and requires that at least one of the lines between
and
is not an entity * first pass at possible getting the docs to build on glib2, untested --- autogen.sh | 2 +- configure.ac | 45 ++++++-- docs/gst/Makefile.am | 238 +++++++++++++++++++++++++--------------- docs/gst/gstreamer-docs.sgml | 4 +- docs/gst/gstreamer-sections.txt | 8 ++ docs/plugins/Makefile.am | 1 - gst/elements/Makefile.am | 3 +- gst/elements/gstfilesrc.c | 52 +-------- gst/elements/gstfilesrc.h | 90 +++++++++++++++ plugins/elements/Makefile.am | 3 +- plugins/elements/gstfilesrc.c | 52 +-------- plugins/elements/gstfilesrc.h | 90 +++++++++++++++ 12 files changed, 385 insertions(+), 203 deletions(-) create mode 100644 gst/elements/gstfilesrc.h create mode 100644 plugins/elements/gstfilesrc.h diff --git a/autogen.sh b/autogen.sh index 5db2e98..1e6cc0d 100755 --- a/autogen.sh +++ b/autogen.sh @@ -35,7 +35,7 @@ version_check () if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi debug "major $MAJOR minor $MINOR micro $MICRO" - echo -n "+ checking for $1 > $VERSION ... " + echo -n "+ checking for $1 >= $VERSION ... " ($PACKAGE --version) < /dev/null > /dev/null 2>&1 || { echo diff --git a/configure.ac b/configure.ac index 6c0e083..c2519f3 100644 --- a/configure.ac +++ b/configure.ac @@ -90,14 +90,36 @@ export PKG_CONFIG_PATH dnl Check for pkgconfig AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, true, false) -dnl check for gtkdoc +dnl check for gtk-doc +AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ]) + +if test "x$with_html_dir" = "x" ; then + HTML_DIR='${datadir}/gst/html' +else + HTML_DIR=$with_html_dir +fi + +AC_SUBST(HTML_DIR) + AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-mkdb, true, false) -AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-scanobj, :, false) -AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-scan, :, false) -AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-mktmpl, :, false) -AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-mkdb, :, false) -AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-mkhtml, :, false) -AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-fixxref, :, false) +gtk_doc_min_version=0.6 +if $HAVE_GTK_DOC ; then + gtk_doc_version=`gtkdoc-mkdb --version` + AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version]) + if perl <= "$gtk_doc_min_version") ? 0 : 1); +EOF + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + HAVE_GTK_DOC=false + fi +fi +GTK_DOC_SCANOBJ=gtkdoc-scanobj + +AC_SUBST(HAVE_GTK_DOC) +AC_SUBST(GTK_DOC_SCANOBJ) dnl check for docbook tools AC_CHECK_PROG(HAVE_DB2HTML, db2html, true, false) @@ -238,6 +260,13 @@ else GTK_FLAGS=$GTK2_CFLAGS GTK_LIBS=$GTK2_LIBS + + if $HAVE_GTK_DOC; then + AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-scangobj, true, false) + if $HAVE_GTK_DOC; then + GTK_DOC_SCANOBJ=gtkdoc-scangobj + fi; + fi dnl FIXME: check for gnome2 - this conditional is currently dnl always false. @@ -825,7 +854,7 @@ esac], AC_ARG_ENABLE(docs-build, [ --enable-docs-build enable building of documentation], [case "${enableval}" in - yes) BUILD_DOCS=yes ;; + yes) if $HAVE_GTK_DOC; then BUILD_DOCS=yes; else AC_MSG_ERROR([you don't have gtk-doc, so don't use --docs-build]); fi; ;; no) BUILD_DOCS=no ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-docs-build) ;; esac], diff --git a/docs/gst/Makefile.am b/docs/gst/Makefile.am index de16f26..8d55a2c 100644 --- a/docs/gst/Makefile.am +++ b/docs/gst/Makefile.am @@ -1,110 +1,151 @@ ## Process this file with automake to produce Makefile.in -# The name of the module. +# The name of the module, e.g. 'glib'. DOC_MODULE=gstreamer -# The top-level SGML file. +# The top-level SGML file. Change it if you want. DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml -# The directory containing the source code (if it contains documentation). +# The directory containing the source code. Relative to $(top_srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting functions and macros. DOC_SOURCE_DIR=$(top_srcdir)/gst +# Extra options to supply to gtkdoc-scan. +SCAN_OPTIONS= + # FIXME : # there's something wrong with gstreamer-sections.txt not being in the dist # maybe it doesn't resolve; we're adding it below for now -EXTRA_DIST = gstreamer.types.in gstreamer.hierarchy $(DOC_MODULE)-sections.txt gstreamer-sections.txt $(DOC_MAIN_SGML_FILE) +#EXTRA_DIST = gstreamer.types.in gstreamer.hierarchy $(DOC_MODULE)-sections.txt gstreamer-sections.txt $(DOC_MAIN_SGML_FILE) + +# Extra options to supply to gtkdoc-mkdb. +MKDB_OPTIONS= + +# Extra options to supply to gtkdoc-fixref. +FIXXREF_OPTIONS= + +# Used for dependencies. +# FIXME deal with the subdirs too... +HFILE_GLOB=$(DOC_SOURCE_DIR)/*.h +CFILE_GLOB=$(DOC_SOURCE_DIR)/*.c + +# this is a wingo addition +SCANOBJ_DEPS = $(top_builddir)/gst/elements/libgstelements.la \ + $(top_builddir)/gst/schedulers/libgstbasicscheduler.la + +# Header files to ignore when scanning. +IGNORE_HFILES= + +# Images to copy into HTML directory. +HTML_IMAGES = + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +content_files = + +# Other files to distribute. +extra_files = + +# CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib +# contains GtkObjects/GObjects and you want to document signals and properties. +GTKDOC_CFLAGS = $(GST_CFLAGS) $(GLIB_CFLAGS) $(XML_CFLAGS) +GTKDOC_LIBS = $(GST_LIBS) $(GLIB_LIBS) $(XML_LIBS) $(SCANOBJ_DEPS) + +# $(shell echo $(top_builddir)/gst/autoplug/*.la) \ +# $(top_builddir)/gst/types/libgsttypes.la \ + +GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC) +GTKDOC_LD=$(LIBTOOL) --mode=link $(CC) + +# If you need to override some of the declarations, place them in this file +# and uncomment this line. +#DOC_OVERRIDES = $(DOC_MODULE)-overrides.txt -HTML_DIR=$(datadir)/gstreamer/html -GST_LIBS += $(top_builddir)/gst/elements/libgstelements.la \ - $(top_builddir)/gst/autoplug/libgststaticautoplug.la \ - $(top_builddir)/gst/autoplug/libgststaticautoplugrender.la +########################################################################### +# Everything below here is generic and you shouldn't need to change it. +########################################################################### TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) -tmpl_sources = \ - tmpl/cothreads.sgml \ - tmpl/gst.sgml \ - tmpl/gstinfo.sgml \ - tmpl/gstautoplug.sgml \ - tmpl/gstscheduler.sgml \ - tmpl/gstprops.sgml \ - tmpl/gstcaps.sgml \ - tmpl/gstbin.sgml \ - tmpl/gstbuffer.sgml \ - tmpl/gstbufferpool.sgml \ - tmpl/gstdisksrc.sgml \ - tmpl/gstelement.sgml \ - tmpl/gstfakesink.sgml \ - tmpl/gstfakesrc.sgml \ - tmpl/gstfdsink.sgml \ - tmpl/gstfdsrc.sgml \ - tmpl/gsthttpsrc.sgml \ - tmpl/gstidentity.sgml \ - tmpl/gstlog.sgml \ - tmpl/gstobject.sgml \ - tmpl/gstpad.sgml \ - tmpl/gstpipeline.sgml \ - tmpl/gstplugin.sgml \ - tmpl/gstqueue.sgml \ - tmpl/gstreamer-unused.sgml \ - tmpl/gstsinesrc.sgml \ - tmpl/gsttee.sgml \ - tmpl/gstthread.sgml \ - tmpl/gsttrace.sgml \ - tmpl/gsttype.sgml \ - tmpl/gstutils.sgml \ - tmpl/gstxml.sgml \ - tmpl/spectrum.sgml - -gstreamer_docdir = $(HTML_DIR) -gstreamer_doc_DATA = \ - gstreamer.types \ - gstreamer.hierarchy \ - gstreamer-sections.txt - -SCANOBJS_FILES = \ - $(DOC_MODULE).signals \ - $(DOC_MODULE).hierarchy \ - $(DOC_MODULE).args - -# FIXME: the dependencies here are rather broken. Really, html/book1.html -# should be rebuilt if any file in $(top_srcdir)/gst is updated. -if HAVE_GTK_DOC -html/book1.html: - $(MAKE) html -else -html/book1.html: -endif +EXTRA_DIST = \ + $(content_files) \ + $(extra_files) \ + $(HTML_IMAGES) \ + $(DOC_MAIN_SGML_FILE) \ + $(DOC_MODULE).types \ + $(DOC_MODULE)-sections.txt -gstreamer-decl.txt: - gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="" +DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ + $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp -# The LD env-var below is a nasty hack to make this work on versions of -# gtkdoc-scanobj which don't understand libtool -scanobj: $(srcdir)/$(DOC_MODULE).types - cd $(top_builddir)/gst/;$(MAKE) libgst.la - cd $(top_builddir)/gst/elements/;$(MAKE) libgstelements.la - rm gstreamer-scan.o; ln -s gstreamer-scan.lo gstreamer-scan.o - env CC="$(LIBTOOL) $(CC)" LD="cp gstreamer-scan.lo gstreamer-scan.o;$(LIBTOOL) $(CC)" CFLAGS="$(LIBGST_CFLAGS) $(GLIB_CFLAGS) $(XML_CFLAGS) -I../../" LDFLAGS="$(GST_LIBS)"\ - gtkdoc-scanobj --module=$(DOC_MODULE) - gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) +SCANOBJ_FILES = \ + $(DOC_MODULE).args \ + $(DOC_MODULE).hierarchy \ + $(DOC_MODULE).signals -# FIXME: this is nasty, we shouldn't have to do this, HELP -tmpl: scanobj gstreamer-decl.txt - if test ! -e gstreamer-sections.txt; then cp $(top_srcdir)/docs/gst/gstreamer-sections.txt .; fi - gtkdoc-mktmpl --module=$(DOC_MODULE) +if HAVE_GTK_DOC +all-local: html-build.stamp -sgml: tmpl - gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) +#### scan #### -html: sgml - if ! test -d html ; then mkdir html ; fi - -cd html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) +# wingo addition +scan-build.stamp: $(HFILE_GLOB) $(SCANOBJ_DEPS) + @echo '*** Scanning header files ***' + if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \ + CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" $(GTK_DOC_SCANOBJ) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ + else \ + cd $(srcdir) ; \ + for i in $(SCANOBJ_FILES) ; do \ + test -f $$i || touch $$i ; \ + done \ + fi + cd $(srcdir) && \ + gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) + touch scan-build.stamp + +$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp + @true + +#### templates #### + +tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES) + @echo '*** Rebuilding template files ***' + cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) + touch tmpl-build.stamp + +tmpl.stamp: tmpl-build.stamp + @true + +#### sgml #### + +sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml + @echo '*** Building SGML ***' + cd $(srcdir) && \ + gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS) + touch sgml-build.stamp + +sgml.stamp: sgml-build.stamp + @true + +#### html #### + +html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) + @echo '*** Building HTML ***' + test -d $(srcdir)/html || mkdir $(srcdir)/html + cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) + test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) + @echo '-- Fixing Crossreferences' + cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) + touch html-build.stamp +endif clean-local: - rm -rf *~ *.bak *.signals *-unused.txt *.args *.o *.lo .libs sgml html + rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS) + +maintainer-clean-local: clean + cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt # FIXME : thomas added all sgml files and some other things to make # make distcheck work @@ -115,7 +156,7 @@ distclean-local: clean rm gstreamer.hierarchy rm *.stamp -install-data-local: html/book1.html +install-data-local: $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) (installfiles=`echo $(srcdir)/html/*.html`; \ if test "$$installfiles" = '$(srcdir)/html/*.html'; \ @@ -127,12 +168,31 @@ install-data-local: html/book1.html done; \ echo '-- Installing $(srcdir)/html/index.sgml' ; \ $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \ - echo '-- Fixing Crossreferences' ; \ - gtkdoc-fixxref --module=$(DOC_MODULE) --html-dir=$(HTML_DIR)|| true; \ fi) -dist-hook: html/book1.html - if ! test -d $(distdir)/tmpl ; then mkdir $(distdir)/tmpl ; fi +# +# Require gtk-doc when making dist +# +if HAVE_GTK_DOC +dist-check-gtkdoc: +else +dist-check-gtkdoc: + @echo "*** gtk-doc must be installed and enabled in order to make dist" + @false +endif + +dist-hook: dist-check-gtkdoc dist-hook-local + mkdir $(distdir)/tmpl + mkdir $(distdir)/sgml + mkdir $(distdir)/html -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl + -cp $(srcdir)/sgml/*.sgml $(distdir)/sgml + -cp $(srcdir)/html/index.sgml $(distdir)/html + -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html + + images=$(HTML_IMAGES) ; \ + for i in $$images ; do \ + cp $(srcdir)/$$i $(distdir)/html ; \ + done -.PHONY : html sgml tmpl +.PHONY : dist-hook-local diff --git a/docs/gst/gstreamer-docs.sgml b/docs/gst/gstreamer-docs.sgml index a89d623..44c6946 100644 --- a/docs/gst/gstreamer-docs.sgml +++ b/docs/gst/gstreamer-docs.sgml @@ -118,7 +118,7 @@ with some more specialized elements. &GstFakeSrc; &GstFakeSink; - + &GstFileSrc; &GstDiskSrc; &GstDiskSink; @@ -136,7 +136,7 @@ with some more specialized elements. - GStreamer Autoppluggers + GStreamer Autopluggers the autopluggers provide a way to automatically construct elements based on sink and src capabilities diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 0828583..63ef0a7 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -1180,6 +1180,14 @@ GST_IS_AGGREGATOR_CLASS gstfilesrc GstFileSrc +GstFileSrc +GstFileSrcClass +gst_filesrc_get_type +GST_TYPE_FILESRC +GST_FILESRC +GST_FILESRC_CLASS +GST_IS_FILESRC +GST_IS_FILESRC_CLASS
diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am index 93fed5c..3f9d57d 100644 --- a/docs/plugins/Makefile.am +++ b/docs/plugins/Makefile.am @@ -49,7 +49,6 @@ sgml/$(DOC_MODULE)-doc.bottom: $(tmpl_sources) scanobj: env CC="$(LIBTOOL) $(CC)" CFLAGS="$(LIBGST_CFLAGS) $(GLIB_CFLAGS) $(XML_CFLAGS) -I../../" LDFLAGS="$(GST_LIBS)"\ ./gstdoc-scanobj --module=$(DOC_MODULE) - tmpl: scanobj ./gstdoc-mktmpl --module=$(DOC_MODULE) diff --git a/gst/elements/Makefile.am b/gst/elements/Makefile.am index faff202..5238aac 100644 --- a/gst/elements/Makefile.am +++ b/gst/elements/Makefile.am @@ -39,7 +39,8 @@ noinst_HEADERS = \ gstpipefilter.h \ gsttee.h \ gstaggregator.h \ - gststatistics.h + gststatistics.h \ + gstfilesrc.h libgstelements_la_CFLAGS = $(GHTTP_CFLAGS) $(GLIB_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS) libgstelements_la_LIBADD = $(GHTTP_LIBS) $(GLIB_LIBS) $(XML_LIBS) diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index 9159a46..cfcc250 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -22,7 +22,8 @@ #include -#include +#include "gstfilesrc.h" + #include #include #include @@ -78,55 +79,6 @@ GstElementDetails gst_filesrc_details = { //#define fs_print(format,args...) g_print(format, ## args) #define fs_print(format,args...) - -#define GST_TYPE_FILESRC \ - (gst_filesrc_get_type()) -#define GST_FILESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FILESRC,GstFileSrc)) -#define GST_FILESRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FILESRC,GstFileSrcClass)) -#define GST_IS_FILESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FILESRC)) -#define GST_IS_FILESRC_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FILESRC)) - -typedef enum { - GST_FILESRC_OPEN = GST_ELEMENT_FLAG_LAST, - - GST_FILESRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2, -} GstFileSrcFlags; - -typedef struct _GstFileSrc GstFileSrc; -typedef struct _GstFileSrcClass GstFileSrcClass; - -struct _GstFileSrc { - GstElement element; - GstPad *srcpad; - - guint pagesize; // system page size - - gchar *filename; // filename - gint fd; // open file descriptor - off_t filelen; // what's the file length? - - off_t curoffset; // current offset in file - off_t block_size; // bytes per read - gboolean touch; // whether to touch every page - - GstBuffer *mapbuf; - size_t mapsize; - - GTree *map_regions; - GMutex *map_regions_lock; - - gboolean seek_happened; -}; - -struct _GstFileSrcClass { - GstElementClass parent_class; -}; - - /* FileSrc signals and args */ enum { /* FILL ME */ diff --git a/gst/elements/gstfilesrc.h b/gst/elements/gstfilesrc.h new file mode 100644 index 0000000..983edb1 --- /dev/null +++ b/gst/elements/gstfilesrc.h @@ -0,0 +1,90 @@ +/* GStreamer + * Copyright (C) 1999,2000 Erik Walthinsen + * 2000 Wim Taymans + * + * gstfilesrc.h: + * + * 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. + */ + + +#ifndef __GST_FILESRC_H__ +#define __GST_FILESRC_H__ + + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define GST_TYPE_FILESRC \ + (gst_filesrc_get_type()) +#define GST_FILESRC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FILESRC,GstFileSrc)) +#define GST_FILESRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FILESRC,GstFileSrcClass)) +#define GST_IS_FILESRC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FILESRC)) +#define GST_IS_FILESRC_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FILESRC)) + +typedef enum { + GST_FILESRC_OPEN = GST_ELEMENT_FLAG_LAST, + + GST_FILESRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2, +} GstFileSrcFlags; + +typedef struct _GstFileSrc GstFileSrc; +typedef struct _GstFileSrcClass GstFileSrcClass; + +struct _GstFileSrc { + GstElement element; + GstPad *srcpad; + + guint pagesize; // system page size + + gchar *filename; // filename + gint fd; // open file descriptor + off_t filelen; // what's the file length? + + off_t curoffset; // current offset in file + off_t block_size; // bytes per read + gboolean touch; // whether to touch every page + + GstBuffer *mapbuf; + size_t mapsize; + + GTree *map_regions; + GMutex *map_regions_lock; + + gboolean seek_happened; +}; + +struct _GstFileSrcClass { + GstElementClass parent_class; +}; + +GType gst_filesrc_get_type(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GST_FILESRC_H__ */ diff --git a/plugins/elements/Makefile.am b/plugins/elements/Makefile.am index faff202..5238aac 100644 --- a/plugins/elements/Makefile.am +++ b/plugins/elements/Makefile.am @@ -39,7 +39,8 @@ noinst_HEADERS = \ gstpipefilter.h \ gsttee.h \ gstaggregator.h \ - gststatistics.h + gststatistics.h \ + gstfilesrc.h libgstelements_la_CFLAGS = $(GHTTP_CFLAGS) $(GLIB_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS) libgstelements_la_LIBADD = $(GHTTP_LIBS) $(GLIB_LIBS) $(XML_LIBS) diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 9159a46..cfcc250 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -22,7 +22,8 @@ #include -#include +#include "gstfilesrc.h" + #include #include #include @@ -78,55 +79,6 @@ GstElementDetails gst_filesrc_details = { //#define fs_print(format,args...) g_print(format, ## args) #define fs_print(format,args...) - -#define GST_TYPE_FILESRC \ - (gst_filesrc_get_type()) -#define GST_FILESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FILESRC,GstFileSrc)) -#define GST_FILESRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FILESRC,GstFileSrcClass)) -#define GST_IS_FILESRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FILESRC)) -#define GST_IS_FILESRC_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FILESRC)) - -typedef enum { - GST_FILESRC_OPEN = GST_ELEMENT_FLAG_LAST, - - GST_FILESRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2, -} GstFileSrcFlags; - -typedef struct _GstFileSrc GstFileSrc; -typedef struct _GstFileSrcClass GstFileSrcClass; - -struct _GstFileSrc { - GstElement element; - GstPad *srcpad; - - guint pagesize; // system page size - - gchar *filename; // filename - gint fd; // open file descriptor - off_t filelen; // what's the file length? - - off_t curoffset; // current offset in file - off_t block_size; // bytes per read - gboolean touch; // whether to touch every page - - GstBuffer *mapbuf; - size_t mapsize; - - GTree *map_regions; - GMutex *map_regions_lock; - - gboolean seek_happened; -}; - -struct _GstFileSrcClass { - GstElementClass parent_class; -}; - - /* FileSrc signals and args */ enum { /* FILL ME */ diff --git a/plugins/elements/gstfilesrc.h b/plugins/elements/gstfilesrc.h new file mode 100644 index 0000000..983edb1 --- /dev/null +++ b/plugins/elements/gstfilesrc.h @@ -0,0 +1,90 @@ +/* GStreamer + * Copyright (C) 1999,2000 Erik Walthinsen + * 2000 Wim Taymans + * + * gstfilesrc.h: + * + * 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. + */ + + +#ifndef __GST_FILESRC_H__ +#define __GST_FILESRC_H__ + + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define GST_TYPE_FILESRC \ + (gst_filesrc_get_type()) +#define GST_FILESRC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FILESRC,GstFileSrc)) +#define GST_FILESRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FILESRC,GstFileSrcClass)) +#define GST_IS_FILESRC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FILESRC)) +#define GST_IS_FILESRC_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FILESRC)) + +typedef enum { + GST_FILESRC_OPEN = GST_ELEMENT_FLAG_LAST, + + GST_FILESRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2, +} GstFileSrcFlags; + +typedef struct _GstFileSrc GstFileSrc; +typedef struct _GstFileSrcClass GstFileSrcClass; + +struct _GstFileSrc { + GstElement element; + GstPad *srcpad; + + guint pagesize; // system page size + + gchar *filename; // filename + gint fd; // open file descriptor + off_t filelen; // what's the file length? + + off_t curoffset; // current offset in file + off_t block_size; // bytes per read + gboolean touch; // whether to touch every page + + GstBuffer *mapbuf; + size_t mapsize; + + GTree *map_regions; + GMutex *map_regions_lock; + + gboolean seek_happened; +}; + +struct _GstFileSrcClass { + GstElementClass parent_class; +}; + +GType gst_filesrc_get_type(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GST_FILESRC_H__ */ -- 2.7.4