summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2002-09-26 12:20:12 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2002-09-26 12:20:12 +0000
commit5a312ff117ffd73b44ae0a597afff5f152ac8a07 (patch)
treeef1d617988cd48fb60a952215eebce956cf8119f
parentd5e5c9ce3e40f0185210a4e45b1c922764831b5d (diff)
This adds a generic video functions library
Original commit message from CVS: This adds a generic video functions library
-rw-r--r--configure.ac1
-rw-r--r--gst-libs/gst/Makefile.am4
-rw-r--r--gst-libs/gst/video/Makefile.am12
-rw-r--r--gst-libs/gst/video/video.c64
-rw-r--r--gst-libs/gst/video/video.h28
-rw-r--r--gst-plugins-ugly.spec.in2
-rw-r--r--gstreamer-libs-uninstalled.pc.in4
7 files changed, 112 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index adfdcf35..84891395 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1040,6 +1040,7 @@ gst-libs/gst/gconf/Makefile
gst-libs/gst/idct/Makefile
gst-libs/gst/resample/Makefile
gst-libs/gst/riff/Makefile
+gst-libs/gst/video/Makefile
examples/dynparams/Makefile
examples/capsfilter/Makefile
examples/seeking/Makefile
diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am
index d519764f..d6eaa874 100644
--- a/gst-libs/gst/Makefile.am
+++ b/gst-libs/gst/Makefile.am
@@ -4,6 +4,6 @@ else
GCONF_DIR=
endif
-SUBDIRS = audio idct resample riff floatcast $(GCONF_DIR)
+SUBDIRS = audio idct resample riff floatcast $(GCONF_DIR) video
-DIST_SUBDIRS = audio idct resample riff floatcast gconf
+DIST_SUBDIRS = audio idct resample riff floatcast gconf video
diff --git a/gst-libs/gst/video/Makefile.am b/gst-libs/gst/video/Makefile.am
new file mode 100644
index 00000000..ef924fd7
--- /dev/null
+++ b/gst-libs/gst/video/Makefile.am
@@ -0,0 +1,12 @@
+librarydir = $(libdir)/gst
+
+library_LTLIBRARIES = libgstvideo.la
+
+libgstvideo_la_SOURCES = video.c
+
+libgstvideoincludedir = $(includedir)/@PACKAGE@-@VERSION@/gst/video
+libgstvideoinclude_HEADERS = video.h
+
+libgstvideo_la_LIBADD =
+libgstvideo_la_CFLAGS = $(GST_CFLAGS) -finline-functions -ffast-math
+libgstvideo_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c
new file mode 100644
index 00000000..da9f06ab
--- /dev/null
+++ b/gst-libs/gst/video/video.c
@@ -0,0 +1,64 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Library <2002> Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * 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 "video.h"
+
+#define NUM_UNITS 1000000000
+
+/* This is simply a convenience function, nothing more or less */
+
+gdouble
+gst_video_frame_rate (GstPad *pad)
+{
+ GstFormat dest_format = GST_FORMAT_UNITS;
+ gint64 dest_value = 0;
+ gdouble fps;
+
+ /* do a convert request on the source pad */
+ if (!gst_pad_convert(pad,
+ GST_FORMAT_TIME, GST_SECOND * NUM_UNITS,
+ &dest_format, &dest_value))
+ {
+ g_warning("gstvideo: pad %s:%s failed to convert time to unit!\n",
+ GST_ELEMENT_NAME(gst_pad_get_parent (pad)), GST_PAD_NAME(pad));
+ return 0.;
+ }
+
+ fps = ((gdouble) dest_value) / NUM_UNITS;
+
+ GST_DEBUG(GST_CAT_ELEMENT_PADS, "Framerate request on pad %s:%s - %lf fps",
+ GST_ELEMENT_NAME(gst_pad_get_parent (pad)), GST_PAD_NAME(pad), fps);
+
+ return fps;
+}
+
+static gboolean
+plugin_init (GModule *module, GstPlugin *plugin)
+{
+ gst_plugin_set_longname (plugin, "Convenience routines for video plugins");
+ return TRUE;
+}
+
+GstPluginDesc plugin_desc = {
+ GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gstvideo",
+ plugin_init
+};
diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h
new file mode 100644
index 00000000..ef11872e
--- /dev/null
+++ b/gst-libs/gst/video/video.h
@@ -0,0 +1,28 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Library <2002> Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * 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_VIDEO_CONVENIENCE_H__
+#define __GST_VIDEO_CONVENIENCE_H__
+
+#include <gst/gst.h>
+
+gdouble gst_video_frame_rate (GstPad *pad);
+
+#endif /* __GST_VIDEO_CONVENIENCE_H__ */
diff --git a/gst-plugins-ugly.spec.in b/gst-plugins-ugly.spec.in
index be33ed56..a0837ea4 100644
--- a/gst-plugins-ugly.spec.in
+++ b/gst-plugins-ugly.spec.in
@@ -97,6 +97,7 @@ unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
%{_libdir}/gst/libgstidct.so
%{_libdir}/gst/libgstresample.so
%{_libdir}/gst/libgstriff.so
+%{_libdir}/gst/libgstvideo.so
%package -n gstreamer-plugins-devel
Summary: GStreamer Plugin Library Headers.
@@ -114,6 +115,7 @@ GStreamer support libraries header files.
%{_includedir}/gst-plugins-%{version}/gst/idct/idct.h
%{_includedir}/gst-plugins-%{version}/gst/resample/resample.h
%{_includedir}/gst-plugins-%{version}/gst/riff/riff.h
+%{_includedir}/gst-plugins-%{version}/gst/video/video.h
%{_libdir}/pkgconfig/gstreamer-libs.pc
# Here are all the packages depending on external libs #
diff --git a/gstreamer-libs-uninstalled.pc.in b/gstreamer-libs-uninstalled.pc.in
index f294eb2d..8a2c6c9f 100644
--- a/gstreamer-libs-uninstalled.pc.in
+++ b/gstreamer-libs-uninstalled.pc.in
@@ -2,5 +2,7 @@ Name: GStreamer Uninstalled Media-Specific Libraries
Description: Streaming-media framework media-specific libraries, not installed
Version: @VERSION@
Requires: gstreamer = @VERSION@
-Libs: -L${pcfiledir}/gst-libs/gst/gconf
+Libs: -L${pcfiledir}/gst-libs/gst/gconf \
+ -L${pcfiledir}/gst-libs/gst/audio \
+ -L${pcfiledir}/gst-libs/gst/video
Cflags: -I${pcfiledir}/gst-libs