diff options
-rw-r--r-- | Android.mk | 3 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | docs/libs/gstreamer-libs-docs.sgml | 5 | ||||
-rw-r--r-- | docs/libs/gstreamer-libs-sections.txt | 37 | ||||
-rw-r--r-- | gstreamer.spec.in | 4 | ||||
-rw-r--r-- | libs/gst/Makefile.am | 2 | ||||
-rw-r--r-- | libs/gst/dataprotocol/.gitignore | 8 | ||||
-rw-r--r-- | libs/gst/dataprotocol/Makefile.am | 81 | ||||
-rw-r--r-- | libs/gst/dataprotocol/dataprotocol.c | 768 | ||||
-rw-r--r-- | libs/gst/dataprotocol/dataprotocol.h | 175 | ||||
-rw-r--r-- | libs/gst/dataprotocol/dp-private.h | 52 | ||||
-rw-r--r-- | pkgconfig/Makefile.am | 4 | ||||
-rw-r--r-- | pkgconfig/gstreamer-dataprotocol-uninstalled.pc.in | 15 | ||||
-rw-r--r-- | pkgconfig/gstreamer-dataprotocol.pc.in | 15 | ||||
-rwxr-xr-x | scripts/gst-uninstalled | 2 | ||||
-rw-r--r-- | tests/check/Makefile.am | 8 | ||||
-rw-r--r-- | tests/check/gst/.gitignore | 1 | ||||
-rw-r--r-- | tests/check/libs/gdp.c | 105 | ||||
-rw-r--r-- | tests/check/libs/gstlibscpp.cc | 2 | ||||
-rw-r--r-- | tests/check/libs/libsabi.c | 1 | ||||
-rw-r--r-- | win32/MANIFEST | 4 | ||||
-rw-r--r-- | win32/vs6/gstreamer.dsw | 15 | ||||
-rw-r--r-- | win32/vs6/libgstdataprotocol.dsp | 127 |
23 files changed, 4 insertions, 1433 deletions
diff --git a/Android.mk b/Android.mk index 8f20a4d09..a6982562f 100644 --- a/Android.mk +++ b/Android.mk @@ -17,12 +17,10 @@ GST_BUILT_SOURCES := \ pkgconfig/gstreamer-0.10.pc \ pkgconfig/gstreamer-base-0.10.pc \ pkgconfig/gstreamer-controller-0.10.pc \ - pkgconfig/gstreamer-dataprotocol-0.10.pc \ pkgconfig/gstreamer-net-0.10.pc \ pkgconfig/gstreamer-0.10-uninstalled.pc \ pkgconfig/gstreamer-base-0.10-uninstalled.pc \ pkgconfig/gstreamer-controller-0.10-uninstalled.pc \ - pkgconfig/gstreamer-dataprotocol-0.10-uninstalled.pc \ pkgconfig/gstreamer-net-0.10-uninstalled.pc \ gst/Android.mk \ gst/parse/Android.mk \ @@ -30,7 +28,6 @@ GST_BUILT_SOURCES := \ libs/gst/Android.mk \ libs/gst/base/Android.mk \ libs/gst/controller/Android.mk \ - libs/gst/dataprotocol/Android.mk \ libs/gst/net/Android.mk \ libs/gst/helpers/Android.mk \ plugins/Android.mk \ diff --git a/configure.ac b/configure.ac index e2cf99b21..83e14c788 100644 --- a/configure.ac +++ b/configure.ac @@ -729,7 +729,6 @@ libs/gst/check/Makefile libs/gst/check/libcheck/Makefile libs/gst/check/libcheck/check.h libs/gst/controller/Makefile -libs/gst/dataprotocol/Makefile libs/gst/helpers/Makefile libs/gst/net/Makefile plugins/Makefile @@ -777,8 +776,6 @@ pkgconfig/gstreamer-check.pc pkgconfig/gstreamer-check-uninstalled.pc pkgconfig/gstreamer-controller.pc pkgconfig/gstreamer-controller-uninstalled.pc -pkgconfig/gstreamer-dataprotocol.pc -pkgconfig/gstreamer-dataprotocol-uninstalled.pc pkgconfig/gstreamer-net.pc pkgconfig/gstreamer-net-uninstalled.pc gst-element-check.m4 diff --git a/docs/libs/gstreamer-libs-docs.sgml b/docs/libs/gstreamer-libs-docs.sgml index 788c3d836..97387d29d 100644 --- a/docs/libs/gstreamer-libs-docs.sgml +++ b/docs/libs/gstreamer-libs-docs.sgml @@ -61,11 +61,6 @@ <xi:include href="xml/gsttriggercontrolsource.xml" /> </chapter> - <chapter id="gstreamer-dataprotocol"> - <title>GStreamer Data Protocol</title> - <xi:include href="xml/gstdataprotocol.xml" /> - </chapter> - <chapter id="gstreamer-net"> <title>GStreamer Network Classes</title> <para> diff --git a/docs/libs/gstreamer-libs-sections.txt b/docs/libs/gstreamer-libs-sections.txt index 21efb35e6..631137292 100644 --- a/docs/libs/gstreamer-libs-sections.txt +++ b/docs/libs/gstreamer-libs-sections.txt @@ -13,43 +13,6 @@ # <SUBSECTION Private> # </SECTION> -<SECTION> -<FILE>gstdataprotocol</FILE> -<INCLUDE>gst/dataprotocol/dataprotocol.h</INCLUDE> -GstDPHeaderFlag -GstDPPayloadType - -GST_DP_HEADER_LENGTH -GstDPVersion -GST_DP_VERSION_MAJOR -GST_DP_VERSION_MINOR - -gst_dp_init - -GstDPHeaderFromBufferFunction -GstDPPacketFromCapsFunction -GstDPPacketFromEventFunction -GstDPPacketizer -gst_dp_packetizer_new -gst_dp_packetizer_free - -gst_dp_crc - -gst_dp_header_payload_length -gst_dp_header_payload_type - -gst_dp_buffer_from_header -gst_dp_caps_from_packet -gst_dp_event_from_packet - -gst_dp_validate_header -gst_dp_validate_payload -gst_dp_validate_packet -<SUBSECTION Standard> -GST_TYPE_DP_VERSION -gst_dp_version_get_type -</SECTION> - # control source classes <SECTION> diff --git a/gstreamer.spec.in b/gstreamer.spec.in index 70c4d3b05..7fad20001 100644 --- a/gstreamer.spec.in +++ b/gstreamer.spec.in @@ -114,7 +114,6 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/libgstreamer-%{majorminor}.so.* %{_libdir}/libgstbase-%{majorminor}.so.* %{_libdir}/libgstcontroller-%{majorminor}.so.* -%{_libdir}/libgstdataprotocol-%{majorminor}.so.* %{_libdir}/libgstnet-%{majorminor}.so.* %dir %{_libdir}/gstreamer-%{majorminor} @@ -151,11 +150,9 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/gstreamer-%{majorminor}/gst/base %{_includedir}/gstreamer-%{majorminor}/gst/check %{_includedir}/gstreamer-%{majorminor}/gst/controller -%{_includedir}/gstreamer-%{majorminor}/gst/dataprotocol %{_includedir}/gstreamer-%{majorminor}/gst/net %{_libdir}/libgstreamer-%{majorminor}.so -%{_libdir}/libgstdataprotocol-%{majorminor}.so %{_libdir}/libgstbase-%{majorminor}.so %{_libdir}/libgstcheck-%{majorminor}.so* %{_libdir}/libgstcontroller-%{majorminor}.so @@ -166,7 +163,6 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/pkgconfig/gstreamer-base-%{majorminor}.pc %{_libdir}/pkgconfig/gstreamer-controller-%{majorminor}.pc %{_libdir}/pkgconfig/gstreamer-check-%{majorminor}.pc -%{_libdir}/pkgconfig/gstreamer-dataprotocol-%{majorminor}.pc %{_libdir}/pkgconfig/gstreamer-net-%{majorminor}.pc %doc %{_datadir}/gtk-doc/html/gstreamer-%{majorminor}/* diff --git a/libs/gst/Makefile.am b/libs/gst/Makefile.am index 65a4499da..f638e616f 100644 --- a/libs/gst/Makefile.am +++ b/libs/gst/Makefile.am @@ -24,7 +24,7 @@ else SUBDIRS_HELPERS = helpers endif -SUBDIRS_ALWAYS = base controller dataprotocol +SUBDIRS_ALWAYS = base controller SUBDIRS = $(SUBDIRS_ALWAYS) $(SUBDIRS_CHECK) $(SUBDIRS_NET) $(SUBDIRS_HELPERS) DIST_SUBDIRS = $(SUBDIRS_ALWAYS) check net helpers diff --git a/libs/gst/dataprotocol/.gitignore b/libs/gst/dataprotocol/.gitignore deleted file mode 100644 index 39b627566..000000000 --- a/libs/gst/dataprotocol/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -libgstdataprotocol.def -dataprotocol-test -*.gcno -*.c.gcov.out -*.c.gcov.out -*.o -*.lo -*.la diff --git a/libs/gst/dataprotocol/Makefile.am b/libs/gst/dataprotocol/Makefile.am deleted file mode 100644 index 59bd3878b..000000000 --- a/libs/gst/dataprotocol/Makefile.am +++ /dev/null @@ -1,81 +0,0 @@ -lib_LTLIBRARIES = libgstdataprotocol-@GST_MAJORMINOR@.la - -libgstdataprotocol_@GST_MAJORMINOR@_includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/dataprotocol -libgstdataprotocol_@GST_MAJORMINOR@_include_HEADERS = \ - dataprotocol.h -noinst_HEADERS = dp-private.h - -libgstdataprotocol_@GST_MAJORMINOR@_la_SOURCES = \ - dataprotocol.c - -libgstdataprotocol_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS) -libgstdataprotocol_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS) -libgstdataprotocol_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) - -CLEANFILES = *.gcno *.gcda *.gcov *.gcov.out - -%.c.gcov: .libs/libgstdataprotocol_@GST_MAJORMINOR@_la-%.gcda %.c - $(GCOV) -b -f -o $^ > $@.out - -gcov: $(libgstdataprotocol_@GST_MAJORMINOR@_la_SOURCES:=.gcov) - -Android.mk: Makefile.am - androgenizer -:PROJECT gstreamer -:SHARED libgstdataprotocol-@GST_MAJORMINOR@ -:TAGS eng debug \ - -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ - -:SOURCES $(libgstdataprotocol_@GST_MAJORMINOR@_la_SOURCES) \ - -:CFLAGS $(libgstdataprotocol_@GST_MAJORMINOR@_la_CFLAGS) \ - -:LDFLAGS $(libgstdataprotocol_@GST_MAJORMINOR@_la_LDFLAGS) \ - $(libgstdataprotocol_@GST_MAJORMINOR@_la_LIBADD) \ - -:HEADER_TARGET gstreamer-@GST_MAJORMINOR@/gst/dataprotocol \ - -:HEADERS $(libgstdataprotocol_@GST_MAJORMINOR@_include_HEADERS) \ - -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ - > $@ - -# Disabled until this is fixed: -# http://bugzilla.gnome.org/show_bug.cgi?id=594202 -if FALSE -if HAVE_INTROSPECTION -BUILT_GIRSOURCES = GstDataprotocol-@GST_MAJORMINOR@.gir - -gir_headers=$(patsubst %,$(srcdir)/%, $(libgstdataprotocol_@GST_MAJORMINOR@_include_HEADERS)) -gir_sources=$(patsubst %,$(srcdir)/%, $(libgstdataprotocol_@GST_MAJORMINOR@_la_SOURCES)) -gir_cincludes=$(patsubst %,--c-include='gst/dataprotocol/%',$(libgstdataprotocol_@GST_MAJORMINOR@_include_HEADERS)) - -GstDataprotocol-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstdataprotocol-@GST_MAJORMINOR@.la - $(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \ - GST_PLUGIN_SYSTEM_PATH="" GST_PLUGIN_PATH="" GST_REGISTRY_UPDATE=no \ - $(INTROSPECTION_SCANNER) -v --namespace GstDataprotocol \ - --strip-prefix=Gst \ - --nsversion=@GST_MAJORMINOR@ \ - -DGST_USE_UNSTABLE_API \ - -I$(top_srcdir) \ - -I$(top_builddir) \ - $(gir_cincludes) \ - --add-include-path=$(top_builddir)/gst \ - --library-path=$(top_builddir)/gst \ - --library=$(top_builddir)/gst/libgstreamer-@GST_MAJORMINOR@.la \ - --library=libgstdataprotocol-@GST_MAJORMINOR@.la \ - --include=Gst-@GST_MAJORMINOR@ \ - --libtool="$(top_builddir)/libtool" \ - --pkg gstreamer-@GST_MAJORMINOR@ \ - --pkg-export=gstreamer-dataprotocol-@GST_MAJORMINOR@ \ - --add-init-section="gst_init(NULL,NULL);" \ - --output $@ \ - $(gir_headers) \ - $(gir_sources) - -# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to -# install anything - we need to install inside our prefix. -girdir = $(datadir)/gir-1.0 -gir_DATA = $(BUILT_GIRSOURCES) - -typelibsdir = $(libdir)/girepository-1.0/ - -typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) - -%.typelib: %.gir $(INTROSPECTION_COMPILER) - $(AM_V_GEN)$(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=$(builddir) --includedir=$(top_builddir)/gst $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F) - -CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA) -endif -endif diff --git a/libs/gst/dataprotocol/dataprotocol.c b/libs/gst/dataprotocol/dataprotocol.c deleted file mode 100644 index 3b2e18220..000000000 --- a/libs/gst/dataprotocol/dataprotocol.c +++ /dev/null @@ -1,768 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * Copyright (C) 2004,2006 Thomas Vander Stichele <thomas at apestaart dot org> - * - * dataprotocol.c: Functions implementing the GStreamer Data Protocol - * - * 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. - */ - -/** - * SECTION:gstdataprotocol - * @short_description: Serialization of caps, buffers and events. - * @see_also: #GstCaps, #GstEvent, #GstBuffer - * - * This helper library provides serialization of GstBuffer, GstCaps and - * GstEvent structures. - * - * This serialization is useful when GStreamer needs to interface with - * the outside world to transport data between distinct GStreamer pipelines. - * The connections with the outside world generally don't have mechanisms - * to transport properties of these structures. - * - * For example, transporting buffers across named pipes or network connections - * doesn't maintain the buffer size and separation. - * - * This data protocol assumes a reliable connection-oriented transport, such as - * TCP, a pipe, or a file. The protocol does not serialize the caps for - * each buffer; instead, it transport the caps only when they change in the - * stream. This implies that there will always be a caps packet before any - * buffer packets. - * - * The versioning of the protocol is independent of GStreamer's version. - * The major number gets incremented, and the minor reset, for incompatible - * changes. The minor number gets incremented for compatible changes that - * allow clients who do not completely understand the newer protocol version - * to still decode what they do understand. - * - * Version 0.2 serializes only a small subset of all events, with a custom - * payload for each type. Also, all GDP streams start with the initial caps - * packet. - * - * Version 1.0 serializes all events by taking the string representation of - * the event as the payload. In addition, GDP streams can now start with - * events as well, as required by the new data stream model in GStreamer 0.10. - * - * Converting buffers, caps and events to GDP buffers is done using a - * #GstDPPacketizer object and invoking its packetizer functions. - * For backwards-compatibility reasons, the old 0.2 methods are still - * available but deprecated. - * - * For reference, this image shows the byte layout of the GDP header: - * - * <inlinegraphic format="PNG" fileref="gdp-header.png"></inlinegraphic> - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include <gst/dataprotocol/dataprotocol.h> -#include <glib/gprintf.h> /* g_sprintf */ -#include <string.h> /* strlen */ -#include "dp-private.h" - -/* debug category */ -GST_DEBUG_CATEGORY_STATIC (data_protocol_debug); -#define GST_CAT_DEFAULT data_protocol_debug - -/* helper macros */ - -/* write first 6 bytes of header */ -#define GST_DP_INIT_HEADER(h, version, flags, type) \ -G_STMT_START { \ - gint maj = 0, min = 0; \ - switch (version) { \ - case GST_DP_VERSION_0_2: maj = 0; min = 2; break; \ - case GST_DP_VERSION_1_0: maj = 1; min = 0; break; \ - } \ - h[0] = (guint8) maj; \ - h[1] = (guint8) min; \ - h[2] = (guint8) flags; \ - h[3] = 0; /* padding byte */ \ - GST_WRITE_UINT16_BE (h + 4, type); \ -} G_STMT_END - -#define GST_DP_SET_CRC(h, flags, payload, length); \ -G_STMT_START { \ - guint16 crc = 0; \ - if (flags & GST_DP_HEADER_FLAG_CRC_HEADER) \ - /* we don't crc the last four bytes since they are crc's */ \ - crc = gst_dp_crc (h, 58); \ - GST_WRITE_UINT16_BE (h + 58, crc); \ - \ - crc = 0; \ - if (length && (flags & GST_DP_HEADER_FLAG_CRC_PAYLOAD)) \ - crc = gst_dp_crc (payload, length); \ - GST_WRITE_UINT16_BE (h + 60, crc); \ -} G_STMT_END - -/* calculate a CCITT 16 bit CRC check value for a given byte array */ -/* - * this code snippet is adapted from a web page I found - * it is identical except for cleanups, and a final XOR with 0xffff - * as outlined in the uecp spec - * - * XMODEM x^16 + x^12 + x^5 + 1 - */ - -#define POLY 0x1021 -#define CRC_INIT 0xFFFF - -/*** HELPER FUNCTIONS ***/ - -static gboolean -gst_dp_header_from_buffer_any (const GstBuffer * buffer, GstDPHeaderFlag flags, - guint * length, guint8 ** header, GstDPVersion version) -{ - guint8 *h; - guint16 flags_mask; - guint8 *data; - gsize size; - - g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE); - g_return_val_if_fail (length, FALSE); - g_return_val_if_fail (header, FALSE); - - *length = GST_DP_HEADER_LENGTH; - h = g_malloc0 (GST_DP_HEADER_LENGTH); - - /* version, flags, type */ - GST_DP_INIT_HEADER (h, version, flags, GST_DP_PAYLOAD_BUFFER); - - data = gst_buffer_map ((GstBuffer *) buffer, &size, NULL, GST_MAP_READ); - - /* buffer properties */ - GST_WRITE_UINT32_BE (h + 6, size); - GST_WRITE_UINT64_BE (h + 10, GST_BUFFER_TIMESTAMP (buffer)); - GST_WRITE_UINT64_BE (h + 18, GST_BUFFER_DURATION (buffer)); - GST_WRITE_UINT64_BE (h + 26, GST_BUFFER_OFFSET (buffer)); - GST_WRITE_UINT64_BE (h + 34, GST_BUFFER_OFFSET_END (buffer)); - - /* data flags; eats two bytes from the ABI area */ - /* we copy everything but the read-only flags */ - flags_mask = GST_BUFFER_FLAG_LIVE | GST_BUFFER_FLAG_DISCONT | - GST_BUFFER_FLAG_IN_CAPS | GST_BUFFER_FLAG_GAP | - GST_BUFFER_FLAG_DELTA_UNIT; - - GST_WRITE_UINT16_BE (h + 42, GST_BUFFER_FLAGS (buffer) & flags_mask); - - GST_DP_SET_CRC (h, flags, data, size); - - gst_buffer_unmap ((GstBuffer *) buffer, data, size); - - GST_LOG ("created header from buffer:"); - gst_dp_dump_byte_array (h, GST_DP_HEADER_LENGTH); - *header = h; - return TRUE; -} - -static gboolean -gst_dp_packet_from_caps_any (const GstCaps * caps, GstDPHeaderFlag flags, - guint * length, guint8 ** header, guint8 ** payload, GstDPVersion version) -{ - guint8 *h; - guchar *string; - guint payload_length; - - g_return_val_if_fail (GST_IS_CAPS (caps), FALSE); - g_return_val_if_fail (length, FALSE); - g_return_val_if_fail (header, FALSE); - g_return_val_if_fail (payload, FALSE); - - *length = GST_DP_HEADER_LENGTH; - h = g_malloc0 (GST_DP_HEADER_LENGTH); - - string = (guchar *) gst_caps_to_string (caps); - payload_length = strlen ((gchar *) string) + 1; /* include trailing 0 */ - - /* version, flags, type */ - GST_DP_INIT_HEADER (h, version, flags, GST_DP_PAYLOAD_CAPS); - - /* buffer properties */ - GST_WRITE_UINT32_BE (h + 6, payload_length); - GST_WRITE_UINT64_BE (h + 10, (guint64) 0); - GST_WRITE_UINT64_BE (h + 18, (guint64) 0); - GST_WRITE_UINT64_BE (h + 26, (guint64) 0); - GST_WRITE_UINT64_BE (h + 34, (guint64) 0); - - GST_DP_SET_CRC (h, flags, string, payload_length); - - GST_LOG ("created header from caps:"); - gst_dp_dump_byte_array (h, GST_DP_HEADER_LENGTH); - *header = h; - *payload = string; - return TRUE; -} - - -/*** PUBLIC FUNCTIONS ***/ - -static const guint16 gst_dp_crc_table[256] = { - 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, - 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, - 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, - 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, - 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, - 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, - 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, - 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, - 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, - 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, - 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, - 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, - 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, - 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, - 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, - 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, - 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, - 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, - 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, - 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, - 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, - 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, - 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, - 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, - 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, - 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, - 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, - 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, - 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, - 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, - 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, - 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 -}; - -/** - * gst_dp_crc: - * @buffer: array of bytes - * @length: the length of @buffer - * - * Calculate a CRC for the given buffer over the given number of bytes. - * This is only provided for verification purposes; typical GDP users - * will not need this function. - * - * Returns: a two-byte CRC checksum. - */ -guint16 -gst_dp_crc (const guint8 * buffer, guint length) -{ - guint16 crc_register = CRC_INIT; - - g_return_val_if_fail (buffer != NULL || length == 0, 0); - - /* calc CRC */ - for (; length--;) { - crc_register = (guint16) ((crc_register << 8) ^ - gst_dp_crc_table[((crc_register >> 8) & 0x00ff) ^ *buffer++]); - } - return (0xffff ^ crc_register); -} - -/* debugging function; dumps byte array values per 8 bytes */ -/* FIXME: would be nice to merge this with gst_util_dump_mem () */ -void -gst_dp_dump_byte_array (guint8 * array, guint length) -{ - int i; - int n = 8; /* number of bytes per line */ - gchar *line = g_malloc0 (3 * n + 1); - - GST_LOG ("dumping byte array of length %d", length); - for (i = 0; i < length; ++i) { - g_sprintf (line + 3 * (i % n), "%02x ", array[i]); - if (i % n == (n - 1)) { - GST_LOG ("%03d: %s", i - (n - 1), line); - } - } - if (i % n != 0) { - GST_LOG ("%03d: %s", (i / n) * n, line); - } - g_free (line); -} - -GType -gst_dp_version_get_type (void) -{ - static gsize gst_dp_version_type = 0; - static const GEnumValue gst_dp_version[] = { - {GST_DP_VERSION_0_2, "GST_DP_VERSION_0_2", "0.2"}, - {GST_DP_VERSION_1_0, "GST_DP_VERSION_1_0", "1.0"}, - {0, NULL, NULL}, - }; - - if (g_once_init_enter (&gst_dp_version_type)) { - GType tmp = g_enum_register_static ("GstDPVersion", gst_dp_version); - g_once_init_leave (&gst_dp_version_type, tmp); - } - - return (GType) gst_dp_version_type; -}; - -/** - * gst_dp_init: - * - * Initialize GStreamer Data Protocol library. - * - * Should be called before using these functions from source linking - * to this source file. - */ -void -gst_dp_init (void) -{ - static gboolean _gst_dp_initialized = FALSE; - - if (_gst_dp_initialized) - return; - - _gst_dp_initialized = TRUE; - - g_type_class_ref (gst_dp_version_get_type ()); - - GST_DEBUG_CATEGORY_INIT (data_protocol_debug, "gdp", 0, - "GStreamer Data Protocol"); -} - -/** - * gst_dp_header_payload_length: - * @header: the byte header of the packet array - * - * Get the length of the payload described by @header. - * - * Returns: the length of the payload this header describes. - */ -guint32 -gst_dp_header_payload_length (const guint8 * header) -{ - g_return_val_if_fail (header != NULL, 0); - - return GST_DP_HEADER_PAYLOAD_LENGTH (header); -} - -/** - * gst_dp_header_payload_type: - * @header: the byte header of the packet array - * - * Get the type of the payload described by @header. - * - * Returns: the #GstDPPayloadType the payload this header describes. - */ -GstDPPayloadType -gst_dp_header_payload_type (const guint8 * header) -{ - g_return_val_if_fail (header != NULL, GST_DP_PAYLOAD_NONE); - - return GST_DP_HEADER_PAYLOAD_TYPE (header); -} - -/*** PACKETIZER FUNCTIONS ***/ - -static gboolean -gst_dp_header_from_buffer_1_0 (const GstBuffer * buffer, GstDPHeaderFlag flags, - guint * length, guint8 ** header) -{ - return gst_dp_header_from_buffer_any (buffer, flags, length, header, - GST_DP_VERSION_1_0); -} - -static gboolean -gst_dp_packet_from_caps_1_0 (const GstCaps * caps, GstDPHeaderFlag flags, - guint * length, guint8 ** header, guint8 ** payload) -{ - return gst_dp_packet_from_caps_any (caps, flags, length, header, payload, - GST_DP_VERSION_1_0); -} - -static gboolean -gst_dp_packet_from_event_1_0 (const GstEvent * event, GstDPHeaderFlag flags, - guint * length, guint8 ** header, guint8 ** payload) -{ - guint8 *h; - guint32 pl_length; /* length of payload */ - guchar *string = NULL; - const GstStructure *structure; - - g_return_val_if_fail (GST_IS_EVENT (event), FALSE); - g_return_val_if_fail (length, FALSE); - g_return_val_if_fail (header, FALSE); - g_return_val_if_fail (payload, FALSE); - - *length = GST_DP_HEADER_LENGTH; - h = g_malloc0 (GST_DP_HEADER_LENGTH); - - structure = gst_event_get_structure ((GstEvent *) event); - if (structure) { - string = (guchar *) gst_structure_to_string (structure); - GST_LOG ("event %p has structure, string %s", event, string); - pl_length = strlen ((gchar *) string) + 1; /* include trailing 0 */ - } else { - GST_LOG ("event %p has no structure", event); - pl_length = 0; - } - - /* version, flags, type */ - GST_DP_INIT_HEADER (h, GST_DP_VERSION_1_0, flags, - GST_DP_PAYLOAD_EVENT_NONE + GST_EVENT_TYPE (event)); - - /* length */ - GST_WRITE_UINT32_BE (h + 6, pl_length); - /* timestamp */ - GST_WRITE_UINT64_BE (h + 10, GST_EVENT_TIMESTAMP (event)); - - GST_DP_SET_CRC (h, flags, string, pl_length); - - GST_LOG ("created header from event:"); - gst_dp_dump_byte_array (h, GST_DP_HEADER_LENGTH); - *header = h; - *payload = string; - return TRUE; -} - -/*** DEPACKETIZING FUNCTIONS ***/ - -/** - * gst_dp_buffer_from_header: - * @header_length: the length of the packet header - * @header: the byte array of the packet header - * - * Creates a newly allocated #GstBuffer from the given header. - * The buffer data needs to be copied into it before validating. - * - * Use this function if you want to pre-allocate a buffer based on the - * packet header to read the packet payload in to. - * - * This function does not check the header passed to it, use - * gst_dp_validate_header() first if the header data is unchecked. - * - * Returns: A #GstBuffer if the buffer was successfully created, or NULL. - */ -GstBuffer * -gst_dp_buffer_from_header (guint header_length, const guint8 * header) -{ - GstBuffer *buffer; - - g_return_val_if_fail (header != NULL, NULL); - g_return_val_if_fail (header_length >= GST_DP_HEADER_LENGTH, NULL); - g_return_val_if_fail (GST_DP_HEADER_PAYLOAD_TYPE (header) == - GST_DP_PAYLOAD_BUFFER, NULL); - - buffer = - gst_buffer_new_allocate (NULL, - (guint) GST_DP_HEADER_PAYLOAD_LENGTH (header), 0); - - GST_BUFFER_TIMESTAMP (buffer) = GST_DP_HEADER_TIMESTAMP (header); - GST_BUFFER_DURATION (buffer) = GST_DP_HEADER_DURATION (header); - GST_BUFFER_OFFSET (buffer) = GST_DP_HEADER_OFFSET (header); - GST_BUFFER_OFFSET_END (buffer) = GST_DP_HEADER_OFFSET_END (header); - GST_BUFFER_FLAGS (buffer) = GST_DP_HEADER_BUFFER_FLAGS (header); - - return buffer; -} - -/** - * gst_dp_caps_from_packet: - * @header_length: the length of the packet header - * @header: the byte array of the packet header - * @payload: the byte array of the packet payload - * - * Creates a newly allocated #GstCaps from the given packet. - * - * This function does not check the arguments passed to it, use - * gst_dp_validate_packet() first if the header and payload data are - * unchecked. - * - * Returns: A #GstCaps containing the caps represented in the packet, - * or NULL if the packet could not be converted. - */ -GstCaps * -gst_dp_caps_from_packet (guint header_length, const guint8 * header, - const guint8 * payload) -{ - GstCaps *caps; - gchar *string; - - g_return_val_if_fail (header, NULL); - g_return_val_if_fail (header_length >= GST_DP_HEADER_LENGTH, NULL); - g_return_val_if_fail (GST_DP_HEADER_PAYLOAD_TYPE (header) == - GST_DP_PAYLOAD_CAPS, NULL); - g_return_val_if_fail (payload, NULL); - - /* 0 sized payload length will work create NULL string */ - string = g_strndup ((gchar *) payload, GST_DP_HEADER_PAYLOAD_LENGTH (header)); - caps = gst_caps_from_string (string); - g_free (string); - - return caps; -} - -static GstEvent * -gst_dp_event_from_packet_0_2 (guint header_length, const guint8 * header, - const guint8 * payload) -{ - GstEvent *event = NULL; - GstEventType type; - - type = GST_DP_HEADER_PAYLOAD_TYPE (header) - GST_DP_PAYLOAD_EVENT_NONE; - switch (type) { - case GST_EVENT_UNKNOWN: - GST_WARNING ("Unknown event, ignoring"); - return NULL; - case GST_EVENT_EOS: - case GST_EVENT_FLUSH_START: - case GST_EVENT_FLUSH_STOP: - case GST_EVENT_SEGMENT: - event = gst_event_new_custom (type, NULL); - GST_EVENT_TIMESTAMP (event) = GST_DP_HEADER_TIMESTAMP (header); - break; - case GST_EVENT_SEEK: - { - gdouble rate; - GstFormat format; - GstSeekFlags flags; - GstSeekType cur_type, stop_type; - gint64 cur, stop; - - g_return_val_if_fail (payload != NULL, NULL); - - /* FIXME, read rate */ - rate = 1.0; - format = (GstFormat) GST_READ_UINT32_BE (payload); - flags = (GstSeekFlags) GST_READ_UINT32_BE (payload + 4); - cur_type = (GstSeekType) GST_READ_UINT32_BE (payload + 8); - cur = (gint64) GST_READ_UINT64_BE (payload + 12); - stop_type = (GstSeekType) GST_READ_UINT32_BE (payload + 20); - stop = (gint64) GST_READ_UINT64_BE (payload + 24); - - event = gst_event_new_seek (rate, format, flags, cur_type, cur, - stop_type, stop); - GST_EVENT_TIMESTAMP (event) = GST_DP_HEADER_TIMESTAMP (header); - break; - } - case GST_EVENT_QOS: - case GST_EVENT_NAVIGATION: - case GST_EVENT_TAG: - GST_WARNING ("Unhandled event type %d, ignoring", type); - return NULL; - default: - GST_WARNING ("Unknown event type %d, ignoring", type); - return NULL; - } - - return event; -} - -static GstEvent * -gst_dp_event_from_packet_1_0 (guint header_length, const guint8 * header, - const guint8 * payload) -{ - GstEvent *event = NULL; - GstEventType type; - gchar *string = NULL; - GstStructure *s = NULL; - - type = GST_DP_HEADER_PAYLOAD_TYPE (header) - GST_DP_PAYLOAD_EVENT_NONE; - if (payload) { - string = - g_strndup ((gchar *) payload, GST_DP_HEADER_PAYLOAD_LENGTH (header)); - s = gst_structure_from_string (string, NULL); - g_free (string); - } - event = gst_event_new_custom (type, s); - return event; -} - - -/** - * gst_dp_event_from_packet: - * @header_length: the length of the packet header - * @header: the byte array of the packet header - * @payload: the byte array of the packet payload - * - * Creates a newly allocated #GstEvent from the given packet. - * - * This function does not check the arguments passed to it, use - * gst_dp_validate_packet() first if the header and payload data are - * unchecked. - * - * Returns: A #GstEvent if the event was successfully created, - * or NULL if an event could not be read from the payload. - */ -GstEvent * -gst_dp_event_from_packet (guint header_length, const guint8 * header, - const guint8 * payload) -{ - guint8 major, minor; - - g_return_val_if_fail (header, NULL); - g_return_val_if_fail (header_length >= GST_DP_HEADER_LENGTH, NULL); - - major = GST_DP_HEADER_MAJOR_VERSION (header); - minor = GST_DP_HEADER_MINOR_VERSION (header); - - if (major == 0 && minor == 2) - return gst_dp_event_from_packet_0_2 (header_length, header, payload); - else if (major == 1 && minor == 0) - return gst_dp_event_from_packet_1_0 (header_length, header, payload); - else { - GST_ERROR ("Unknown GDP version %d.%d", major, minor); - return NULL; - } -} - -/** - * gst_dp_validate_header: - * @header_length: the length of the packet header - * @header: the byte array of the packet header - * - * Validates the given packet header by checking the CRC checksum. - * - * Returns: %TRUE if the CRC matches, or no CRC checksum is present. - */ -gboolean -gst_dp_validate_header (guint header_length, const guint8 * header) -{ - guint16 crc_read, crc_calculated; - - g_return_val_if_fail (header != NULL, FALSE); - g_return_val_if_fail (header_length >= GST_DP_HEADER_LENGTH, FALSE); - - if (!(GST_DP_HEADER_FLAGS (header) & GST_DP_HEADER_FLAG_CRC_HEADER)) - return TRUE; - - crc_read = GST_DP_HEADER_CRC_HEADER (header); - - /* don't include the last two crc fields for the crc check */ - crc_calculated = gst_dp_crc (header, header_length - 4); - if (crc_read != crc_calculated) - goto crc_error; - - GST_LOG ("header crc validation: %02x", crc_read); - return TRUE; - - /* ERRORS */ -crc_error: - { - GST_WARNING ("header crc mismatch: read %02x, calculated %02x", crc_read, - crc_calculated); - return FALSE; - } -} - -/** - * gst_dp_validate_payload: - * @header_length: the length of the packet header - * @header: the byte array of the packet header - * @payload: the byte array of the packet payload - * - * Validates the given packet payload using the given packet header - * by checking the CRC checksum. - * - * Returns: %TRUE if the CRC matches, or no CRC checksum is present. - */ -gboolean -gst_dp_validate_payload (guint header_length, const guint8 * header, - const guint8 * payload) -{ - guint16 crc_read, crc_calculated; - - g_return_val_if_fail (header != NULL, FALSE); - g_return_val_if_fail (header_length >= GST_DP_HEADER_LENGTH, FALSE); - - if (!(GST_DP_HEADER_FLAGS (header) & GST_DP_HEADER_FLAG_CRC_PAYLOAD)) - return TRUE; - - crc_read = GST_DP_HEADER_CRC_PAYLOAD (header); - crc_calculated = gst_dp_crc (payload, GST_DP_HEADER_PAYLOAD_LENGTH (header)); - if (crc_read != crc_calculated) - goto crc_error; - - GST_LOG ("payload crc validation: %02x", crc_read); - return TRUE; - - /* ERRORS */ -crc_error: - { - GST_WARNING ("payload crc mismatch: read %02x, calculated %02x", crc_read, - crc_calculated); - return FALSE; - } -} - -/** - * gst_dp_validate_packet: - * @header_length: the length of the packet header - * @header: the byte array of the packet header - * @payload: the byte array of the packet payload - * - * Validates the given packet by checking version information and checksums. - * - * Returns: %TRUE if the packet validates. - */ -gboolean -gst_dp_validate_packet (guint header_length, const guint8 * header, - const guint8 * payload) -{ - if (!gst_dp_validate_header (header_length, header)) - return FALSE; - if (!gst_dp_validate_payload (header_length, header, payload)) - return FALSE; - - return TRUE; -} - -/** - * gst_dp_packetizer_new: - * @version: the #GstDPVersion of the protocol to packetize for. - * - * Creates a new packetizer. - * - * Returns: a newly allocated #GstDPPacketizer - */ -GstDPPacketizer * -gst_dp_packetizer_new (GstDPVersion version) -{ - GstDPPacketizer *ret; - - ret = g_malloc0 (sizeof (GstDPPacketizer)); - ret->version = version; - - switch (version) { - case GST_DP_VERSION_1_0: - ret->header_from_buffer = gst_dp_header_from_buffer_1_0; - ret->packet_from_caps = gst_dp_packet_from_caps_1_0; - ret->packet_from_event = gst_dp_packet_from_event_1_0; - break; - default: - g_free (ret); - ret = NULL; - break; - } - - return ret; -} - -/** - * gst_dp_packetizer_free: - * @packetizer: the #GstDPPacketizer to free. - * - * Free the given packetizer. - */ -void -gst_dp_packetizer_free (GstDPPacketizer * packetizer) -{ - g_free (packetizer); -} diff --git a/libs/gst/dataprotocol/dataprotocol.h b/libs/gst/dataprotocol/dataprotocol.h deleted file mode 100644 index d2b211466..000000000 --- a/libs/gst/dataprotocol/dataprotocol.h +++ /dev/null @@ -1,175 +0,0 @@ -/* GStreamer - * Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu> - * Copyright (C) 2004,2006 Thomas Vander Stichele <thomas at apestaart dot org> - * - * dataprotocol.h: Functions implementing the GStreamer Data Protocol - * - * 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_DATA_PROTOCOL_H__ -#define __GST_DATA_PROTOCOL_H__ - -#include <gst/gstbuffer.h> -#include <gst/gstevent.h> -#include <gst/gstcaps.h> - -G_BEGIN_DECLS - -/** - * GstDPVersion: - * @GST_DP_VERSION_0_2: protocol version 0.2 - * @GST_DP_VERSION_1_0: protocol version 1.0 - * - * The version of the GDP protocol being used. - */ -typedef enum { - GST_DP_VERSION_0_2 = 1, - GST_DP_VERSION_1_0, -} GstDPVersion; - -GType gst_dp_version_get_type (void); -#define GST_TYPE_DP_VERSION (gst_dp_version_get_type ()) - -/** - * GST_DP_VERSION_MAJOR: - * - * The major version number of the GStreamer Data Protocol. - */ -#define GST_DP_VERSION_MAJOR 0 -/** - * GST_DP_VERSION_MINOR: - * - * The minor version number of the GStreamer Data Protocol. - */ -#define GST_DP_VERSION_MINOR 2 - -/** - * GST_DP_HEADER_LENGTH: - * - * The header size in bytes. - */ -#define GST_DP_HEADER_LENGTH 62 - -/** - * GstDPHeaderFlag: - * @GST_DP_HEADER_FLAG_NONE: No flag present. - * @GST_DP_HEADER_FLAG_CRC_HEADER: a header CRC field is present. - * @GST_DP_HEADER_FLAG_CRC_PAYLOAD: a payload CRC field is present. - * @GST_DP_HEADER_FLAG_CRC: a CRC for header and payload is present. - * - * header flags for the dataprotocol. - */ -typedef enum { - GST_DP_HEADER_FLAG_NONE = 0, - GST_DP_HEADER_FLAG_CRC_HEADER = (1 << 0), - GST_DP_HEADER_FLAG_CRC_PAYLOAD = (1 << 1), - GST_DP_HEADER_FLAG_CRC = (1 << 1) | (1 << 0), -} GstDPHeaderFlag; - -/** - * GstDPPayloadType: - * @GST_DP_PAYLOAD_NONE: Invalid payload type. - * @GST_DP_PAYLOAD_BUFFER: #GstBuffer payload packet. - * @GST_DP_PAYLOAD_CAPS: #GstCaps payload packet. - * @GST_DP_PAYLOAD_EVENT_NONE: First value of #GstEvent payload packets. - * - * The GDP payload types. a #GstEvent payload type is encoded with the - * event type number starting from @GST_DP_PAYLOAD_EVENT_NONE. - */ -typedef enum { - GST_DP_PAYLOAD_NONE = 0, - GST_DP_PAYLOAD_BUFFER, - GST_DP_PAYLOAD_CAPS, - GST_DP_PAYLOAD_EVENT_NONE = 64, -} GstDPPayloadType; - -typedef gboolean (*GstDPHeaderFromBufferFunction) (const GstBuffer * buffer, - GstDPHeaderFlag flags, - guint * length, - guint8 ** header); -typedef gboolean (*GstDPPacketFromCapsFunction) (const GstCaps * caps, - GstDPHeaderFlag flags, - guint * length, - guint8 ** header, - guint8 ** payload); -typedef gboolean (*GstDPPacketFromEventFunction) (const GstEvent * event, - GstDPHeaderFlag flags, - guint * length, - guint8 ** header, - guint8 ** payload); - -/** - * GstDPPacketizer: - * @version: the #GstDPVersion of the protocol to be used - * @header_from_buffer: buffer serializer function - * @packet_from_caps: caps serializer function - * @packet_from_event: event serializer function - * - * Data protocol packetizer handle. - */ -typedef struct { - GstDPVersion version; - - GstDPHeaderFromBufferFunction header_from_buffer; - GstDPPacketFromCapsFunction packet_from_caps; - GstDPPacketFromEventFunction packet_from_event; - - /*< private >*/ - gpointer _gst_reserved[GST_PADDING]; -} GstDPPacketizer; - - -void gst_dp_init (void); - -/* packetizer */ -GstDPPacketizer * - gst_dp_packetizer_new (GstDPVersion version); -void gst_dp_packetizer_free (GstDPPacketizer *packetizer); - -/* crc checksum */ -guint16 gst_dp_crc (const guint8 * buffer, - guint length); - -/* payload information from header */ -guint32 gst_dp_header_payload_length (const guint8 * header); -GstDPPayloadType - gst_dp_header_payload_type (const guint8 * header); - -/* converting to GstBuffer/GstEvent/GstCaps */ -GstBuffer * gst_dp_buffer_from_header (guint header_length, - const guint8 * header); -GstCaps * gst_dp_caps_from_packet (guint header_length, - const guint8 * header, - const guint8 * payload); -GstEvent * gst_dp_event_from_packet (guint header_length, - const guint8 * header, - const guint8 * payload); - -/* validation */ -gboolean gst_dp_validate_header (guint header_length, - const guint8 * header); -gboolean gst_dp_validate_payload (guint header_length, - const guint8 * header, - const guint8 * payload); -gboolean gst_dp_validate_packet (guint header_length, - const guint8 * header, - const guint8 * payload); - -G_END_DECLS - -#endif /* __GST_DATA_PROTOCOL_H__ */ - diff --git a/libs/gst/dataprotocol/dp-private.h b/libs/gst/dataprotocol/dp-private.h deleted file mode 100644 index 5e54045cf..000000000 --- a/libs/gst/dataprotocol/dp-private.h +++ /dev/null @@ -1,52 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org> - * - * dp-private.h: private defines/macros for dataprotocol implementation - * - * 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_DP_PRIVATE_H__ -#define __GST_DP_PRIVATE_H__ - -#include <gst/gstbuffer.h> -#include <gst/gstevent.h> -#include <gst/gstcaps.h> - -G_BEGIN_DECLS - -/* accessor defines */ -#define GST_DP_HEADER_MAJOR_VERSION(x) ((x)[0]) -#define GST_DP_HEADER_MINOR_VERSION(x) ((x)[1]) -#define GST_DP_HEADER_FLAGS(x) ((x)[2]) -/* free byte here to align */ -#define GST_DP_HEADER_PAYLOAD_TYPE(x) GST_READ_UINT16_BE (x + 4) -#define GST_DP_HEADER_PAYLOAD_LENGTH(x) GST_READ_UINT32_BE (x + 6) -#define GST_DP_HEADER_TIMESTAMP(x) GST_READ_UINT64_BE (x + 10) -#define GST_DP_HEADER_DURATION(x) GST_READ_UINT64_BE (x + 18) -#define GST_DP_HEADER_OFFSET(x) GST_READ_UINT64_BE (x + 26) -#define GST_DP_HEADER_OFFSET_END(x) GST_READ_UINT64_BE (x + 34) -#define GST_DP_HEADER_BUFFER_FLAGS(x) GST_READ_UINT16_BE (x + 42) -#define GST_DP_HEADER_CRC_HEADER(x) GST_READ_UINT16_BE (x + 58) -#define GST_DP_HEADER_CRC_PAYLOAD(x) GST_READ_UINT16_BE (x + 60) - -void gst_dp_dump_byte_array (guint8 *array, guint length); - -G_END_DECLS - -#endif /* __GST_DP_PRIVATE_H__ */ - diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am index c928f25ec..e4b3831b4 100644 --- a/pkgconfig/Makefile.am +++ b/pkgconfig/Makefile.am @@ -12,7 +12,6 @@ pcfiles = \ gstreamer-base-@GST_MAJORMINOR@.pc \ $(CHECK_PC_I) \ gstreamer-controller-@GST_MAJORMINOR@.pc \ - gstreamer-dataprotocol-@GST_MAJORMINOR@.pc \ gstreamer-net-@GST_MAJORMINOR@.pc pcfiles_uninstalled = \ @@ -20,7 +19,6 @@ pcfiles_uninstalled = \ gstreamer-base-@GST_MAJORMINOR@-uninstalled.pc \ $(CHECK_PC_U) \ gstreamer-controller-@GST_MAJORMINOR@-uninstalled.pc \ - gstreamer-dataprotocol-@GST_MAJORMINOR@-uninstalled.pc \ gstreamer-net-@GST_MAJORMINOR@-uninstalled.pc all-local: $(pcfiles) $(pcfiles_uninstalled) @@ -47,8 +45,6 @@ EXTRA_DIST = \ gstreamer-check-uninstalled.pc.in \ gstreamer-controller.pc.in \ gstreamer-controller-uninstalled.pc.in \ - gstreamer-dataprotocol.pc.in \ - gstreamer-dataprotocol-uninstalled.pc.in \ gstreamer-net.pc.in \ gstreamer-net-uninstalled.pc.in diff --git a/pkgconfig/gstreamer-dataprotocol-uninstalled.pc.in b/pkgconfig/gstreamer-dataprotocol-uninstalled.pc.in deleted file mode 100644 index fff856aab..000000000 --- a/pkgconfig/gstreamer-dataprotocol-uninstalled.pc.in +++ /dev/null @@ -1,15 +0,0 @@ -# the standard variables don't make sense for an uninstalled copy -prefix= -exec_prefix= -libdir=@abs_top_builddir@/libs/gst/dataprotocol -includedir= -girdir=@abs_top_builddir@/libs/gst/dataprotocol -typelibdir=@abs_top_builddir@/libs/gst/dataprotocol - -Name: GStreamer data protocol library, uninstalled -Description: Data protocol for plug-ins, Not Installed -Requires: gstreamer-@GST_MAJORMINOR@ = @VERSION@ -Version: @VERSION@ - -Libs: @abs_top_builddir@/libs/gst/dataprotocol/libgstdataprotocol-@GST_MAJORMINOR@.la -Cflags: -I@abs_top_srcdir@/libs -I@abs_top_builddir@/libs diff --git a/pkgconfig/gstreamer-dataprotocol.pc.in b/pkgconfig/gstreamer-dataprotocol.pc.in deleted file mode 100644 index e06b7e9f7..000000000 --- a/pkgconfig/gstreamer-dataprotocol.pc.in +++ /dev/null @@ -1,15 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@/gstreamer-@GST_MAJORMINOR@ -datarootdir=${prefix}/share -datadir=${datarootdir} -girdir=${datadir}/gir-1.0 -typelibdir=${libdir}/girepository-1.0 - -Name: GStreamer data protocol library -Description: Data protocol for plug-ins -Requires: gstreamer-@GST_MAJORMINOR@ -Version: @VERSION@ -Libs: -L${libdir} -lgstdataprotocol-@GST_MAJORMINOR@ -Cflags: -I${includedir} diff --git a/scripts/gst-uninstalled b/scripts/gst-uninstalled index 485a1c16a..fa51658b7 100755 --- a/scripts/gst-uninstalled +++ b/scripts/gst-uninstalled @@ -79,7 +79,7 @@ do done # GStreamer core libraries -for path in base net check controller dataprotocol +for path in base net check controller do LD_LIBRARY_PATH=$GST/gstreamer/libs/gst/$path/.libs:$LD_LIBRARY_PATH DYLD_LIBRARY_PATH=$GST/gstreamer/libs/gst/$path/.libs:$DYLD_LIBRARY_PATH diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 689632c1d..0bbe12a01 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -127,7 +127,6 @@ check_PROGRAMS = \ $(PARSE_CHECKS) \ $(REGISTRY_CHECKS) \ $(LIBSABI_CHECKS) \ - libs/gdp \ libs/adapter \ libs/bitreader \ libs/bytereader \ @@ -178,12 +177,6 @@ libs_gstlibscpp_SOURCES = libs/gstlibscpp.cc gst_gstutils_LDADD = $(LDADD) $(GSL_LIBS) $(GMP_LIBS) -libs_gdp_SOURCES = \ - libs/gdp.c -libs_gdp_LDADD = \ - $(top_builddir)/libs/gst/dataprotocol/libgstdataprotocol-@GST_MAJORMINOR@.la \ - $(LDADD) - elements_fdsrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \ -DTESTFILE=\"$(top_srcdir)/configure.ac\" elements_filesrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \ @@ -225,7 +218,6 @@ COVERAGE_DIRS = \ libs/gst/base \ libs/gst/controller \ libs/gst/check \ - libs/gst/dataprotocol \ libs/gst/net \ plugins/elements COVERAGE_FILES = $(foreach dir,$(COVERAGE_DIRS),$(wildcard $(top_builddir)/$(dir)/*.gcov)) diff --git a/tests/check/gst/.gitignore b/tests/check/gst/.gitignore index 5ee0bcf40..6a83ce121 100644 --- a/tests/check/gst/.gitignore +++ b/tests/check/gst/.gitignore @@ -9,6 +9,7 @@ gstbus gstcaps gstchildproxy gstclock +gstcontroller gstcpp gstdata gstdatetime diff --git a/tests/check/libs/gdp.c b/tests/check/libs/gdp.c deleted file mode 100644 index fff4ed43f..000000000 --- a/tests/check/libs/gdp.c +++ /dev/null @@ -1,105 +0,0 @@ -/* GStreamer - * - * unit test for data protocol - * - * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org> - * - * 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 "config.h" - -#include <gst/check/gstcheck.h> - -#ifndef GST_REMOVE_DEPRECATED -#undef GST_DISABLE_DEPRECATED -#endif - -#include <gst/dataprotocol/dataprotocol.h> -#include "libs/gst/dataprotocol/dp-private.h" /* private header */ - -/* test our method of reading and writing headers using TO/FROM_BE */ -GST_START_TEST (test_conversion) -{ - guint8 array[9]; - guint8 write_array[9]; - guint16 read_two, expect_two; - guint32 read_four, expect_four; - guint64 read_eight, expect_eight; - int i; - - for (i = 0; i < 9; ++i) { - array[i] = i * 0x10; - } - - /* read 8 16 bits */ - for (i = 0; i < 8; ++i) { - read_two = GST_READ_UINT16_BE (array + i); - expect_two = array[i] * (1 << 8) + array[i + 1]; - fail_unless (read_two == expect_two, - "GST_READ_UINT16_BE %d: read %d != %d", i, read_two, expect_two); - } - - /* write 8 16 bits */ - for (i = 0; i < 8; ++i) { - GST_WRITE_UINT16_BE (&write_array[i], read_two); - fail_unless (memcmp (array + 7, write_array + i, 2) == 0, - "GST_WRITE_UINT16_BE %d: memcmp failed", i); - } - - /* read 5 32 bits */ - for (i = 0; i < 5; ++i) { - read_four = GST_READ_UINT32_BE (array + i); - expect_four = array[i] * (1 << 24) + array[i + 1] * (1 << 16) - + array[i + 2] * (1 << 8) + array[i + 3]; - fail_unless (read_four == expect_four, - "GST_READ_UINT32_BE %d: read %d != %d", i, read_four, expect_four); - } - - /* read 2 64 bits */ - for (i = 0; i < 2; ++i) { - read_eight = GST_READ_UINT64_BE (array + i); - expect_eight = array[i] * (1LL << 56) + array[i + 1] * (1LL << 48) - + array[i + 2] * (1LL << 40) + array[i + 3] * (1LL << 32) - + array[i + 4] * (1 << 24) + array[i + 5] * (1 << 16) - + array[i + 6] * (1 << 8) + array[i + 7]; - fail_unless (read_eight == expect_eight, - "GST_READ_UINT64_BE %d: read %" G_GUINT64_FORMAT - " != %" G_GUINT64_FORMAT, i, read_eight, expect_eight); - } - - /* write 1 64 bit */ - GST_WRITE_UINT64_BE (&write_array[0], read_eight); - fail_unless (memcmp (array + 1, write_array, 8) == 0, - "GST_WRITE_UINT64_BE: memcmp failed"); -} - -GST_END_TEST; - -static Suite * -gst_dp_suite (void) -{ - Suite *s = suite_create ("data protocol"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_checked_fixture (tc_chain, gst_dp_init, NULL); - tcase_add_test (tc_chain, test_conversion); - - return s; -} - -GST_CHECK_MAIN (gst_dp); diff --git a/tests/check/libs/gstlibscpp.cc b/tests/check/libs/gstlibscpp.cc index 6ea6de5fe..0009ec3f4 100644 --- a/tests/check/libs/gstlibscpp.cc +++ b/tests/check/libs/gstlibscpp.cc @@ -39,8 +39,6 @@ #include <gst/controller/gstlfocontrolsource.h> #include <gst/controller/gsttriggercontrolsource.h> -#include <gst/dataprotocol/dataprotocol.h> - #include <gst/net/gstnetclientclock.h> #include <gst/net/gstnet.h> #include <gst/net/gstnettimepacket.h> diff --git a/tests/check/libs/libsabi.c b/tests/check/libs/libsabi.c index f302bc6d9..117df17ed 100644 --- a/tests/check/libs/libsabi.c +++ b/tests/check/libs/libsabi.c @@ -36,7 +36,6 @@ #include <gst/controller/gstcontrolsource.h> #include <gst/controller/gstinterpolationcontrolsource.h> #include <gst/controller/gstlfocontrolsource.h> -#include <gst/dataprotocol/dataprotocol.h> #include <gst/net/gstnet.h> #include <gst/net/gstnetclientclock.h> #include <gst/net/gstnettimepacket.h> diff --git a/win32/MANIFEST b/win32/MANIFEST index baf886e8c..f5d7fb9e7 100644 --- a/win32/MANIFEST +++ b/win32/MANIFEST @@ -10,7 +10,6 @@ win32/common/gstversion.h win32/common/gtchar.h win32/common/libgstbase.def win32/common/libgstcontroller.def -win32/common/libgstdataprotocol.def win32/common/libgstnet.def win32/common/libgstreamer.def win32/vs6/gstreamer.dsw @@ -20,7 +19,6 @@ win32/vs6/gst_launch.dsp win32/vs6/libgstbase.dsp win32/vs6/libgstcontroller.dsp win32/vs6/libgstcoreelements.dsp -win32/vs6/libgstdataprotocol.dsp win32/vs6/libgstnet.dsp win32/vs6/libgstreamer.dsp win32/vs7/gstreamer.sln @@ -38,4 +36,4 @@ win32/vs8/gst-launch.vcproj win32/vs8/libgstbase.vcproj win32/vs8/libgstcontroller.vcproj win32/vs8/libgstcoreelements.vcproj -win32/vs8/libgstreamer.vcproj
\ No newline at end of file +win32/vs8/libgstreamer.vcproj diff --git a/win32/vs6/gstreamer.dsw b/win32/vs6/gstreamer.dsw index a0bbd74a9..ae40f73a4 100644 --- a/win32/vs6/gstreamer.dsw +++ b/win32/vs6/gstreamer.dsw @@ -93,21 +93,6 @@ Package=<4> ###############################################################################
-Project: "libgstdataprotocol"=".\libgstdataprotocol.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name libgstreamer
- End Project Dependency
-}}}
-
-###############################################################################
-
Project: "libgstnet"=".\libgstnet.dsp" - Package Owner=<4>
Package=<5>
diff --git a/win32/vs6/libgstdataprotocol.dsp b/win32/vs6/libgstdataprotocol.dsp deleted file mode 100644 index 445849ae3..000000000 --- a/win32/vs6/libgstdataprotocol.dsp +++ /dev/null @@ -1,127 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libgstdataprotocol" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libgstdataprotocol - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libgstdataprotocol.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libgstdataprotocol.mak" CFG="libgstdataprotocol - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libgstdataprotocol - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libgstdataprotocol - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libgstdataprotocol - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDATAPROTOCOL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../.." /I "../../libs" /I "../common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDATAPROTOCOL_EXPORTS" /D "HAVE_CONFIG_H" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 glib-2.0.lib gobject-2.0.lib gthread-2.0.lib gmodule-2.0.lib /nologo /dll /machine:I386 /out:"Release/libgstdataprotocol-0.10.dll"
-# Begin Special Build Tool
-TargetPath=.\Release\libgstdataprotocol-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\bin
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "libgstdataprotocol - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDATAPROTOCOL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../.." /I "../../libs" /I "../common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBGSTDATAPROTOCOL_EXPORTS" /D "HAVE_CONFIG_H" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 glib-2.0D.lib gobject-2.0D.lib gthread-2.0D.lib gmodule-2.0D.lib /nologo /dll /debug /machine:I386 /out:"Debug/libgstdataprotocol-0.10.dll" /pdbtype:sept
-# Begin Special Build Tool
-TargetPath=.\Debug\libgstdataprotocol-0.10.dll
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy /Y $(TargetPath) c:\gstreamer\debug\bin
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libgstdataprotocol - Win32 Release"
-# Name "libgstdataprotocol - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\libs\gst\dataprotocol\dataprotocol.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\common\libgstdataprotocol.def
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\libs\gst\dataprotocol\dataprotocol.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\libs\gst\dataprotocol\dp-private.h"
-# End Source File
-# End Group
-# End Target
-# End Project
|