Commit dd75c216 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

annodex: remove annodex plugin and CMML elements

This never really took off and is most likely completely
unused. If there is still a need for this, it should
probably be done differently, perhaps inside oggdemux/mux.
parent 3f833f75
......@@ -686,12 +686,6 @@ AG_GST_CHECK_FEATURE(AALIB, [aalib ASCII Art library], aasink, [
AS_SCRUB_INCLUDE(AALIB_CFLAGS)
])
dnl *** annodex ***
translit(dnm, m, l) AM_CONDITIONAL(USE_ANNODEX, true)
AG_GST_CHECK_FEATURE(ANNODEX, [XML library], annodex, [
AG_GST_PKG_CHECK_MODULES(ANNODEX, libxml-2.0 >= 2.4.9)
])
dnl *** cairo ***
translit(dnm, m, l) AM_CONDITIONAL(USE_CAIRO, true)
AG_GST_CHECK_FEATURE(CAIRO, [Cairo graphics rendering], cairo, [
......@@ -954,7 +948,6 @@ else
dnl not building plugins with external dependencies,
dnl but we still need to set the conditionals
AM_CONDITIONAL(USE_AALIB, false)
AM_CONDITIONAL(USE_ANNODEX, false)
AM_CONDITIONAL(USE_BZ2, false)
AM_CONDITIONAL(USE_CAIRO, false)
AM_CONDITIONAL(USE_CAIRO_GOBJECT, false)
......@@ -1093,7 +1086,6 @@ gst/flx/Makefile
gst/y4m/Makefile
ext/Makefile
ext/aalib/Makefile
ext/annodex/Makefile
ext/cairo/Makefile
ext/dv/Makefile
ext/flac/Makefile
......
......@@ -53,8 +53,6 @@ IGNORE_CFILES =
EXTRA_HFILES = \
$(top_srcdir)/ext/aalib/gstaasink.h \
$(top_srcdir)/ext/annodex/gstcmmldec.h \
$(top_srcdir)/ext/annodex/gstcmmlenc.h \
$(top_srcdir)/ext/cairo/gsttextoverlay.h \
$(top_srcdir)/ext/cairo/gsttimeoverlay.h \
$(top_srcdir)/ext/cairo/gstcairorender.h \
......
......@@ -57,8 +57,6 @@
<xi:include href="xml/element-cairorender.xml" />
<xi:include href="xml/element-cairooverlay.xml" />
<xi:include href="xml/element-capssetter.xml" />
<xi:include href="xml/element-cmmldec.xml" />
<xi:include href="xml/element-cmmlenc.xml" />
<xi:include href="xml/element-cutter.xml" />
<xi:include href="xml/element-dcaparse.xml" />
<xi:include href="xml/element-deinterlace.xml" />
......@@ -187,7 +185,6 @@
<xi:include href="xml/plugin-alaw.xml" />
<xi:include href="xml/plugin-alpha.xml" />
<xi:include href="xml/plugin-alphacolor.xml" />
<xi:include href="xml/plugin-annodex.xml" />
<xi:include href="xml/plugin-apetag.xml" />
<xi:include href="xml/plugin-audiofx.xml" />
<xi:include href="xml/plugin-auparse.xml" />
......
......@@ -540,38 +540,6 @@ GST_IS_CAPS_SETTER_CLASS
gst_caps_setter_get_type
</SECTION>
<SECTION>
<FILE>element-cmmldec</FILE>
<TITLE>cmmldec</TITLE>
GstCmmlDec
<SUBSECTION Standard>
GstCmmlDecClass
GST_TYPE_CMML_DEC
GST_CMML_DEC
GST_CMML_DEC_CLASS
GST_CMML_DEC_GET_CLASS
GST_IS_CMML_DEC
GST_IS_CMML_DEC_CLASS
gst_cmml_dec_plugin_init
gst_cmml_dec_get_type
</SECTION>
<SECTION>
<FILE>element-cmmlenc</FILE>
<TITLE>cmmlenc</TITLE>
GstCmmlEnc
<SUBSECTION Standard>
GstCmmlEncClass
GST_TYPE_CMML_ENC
GST_CMML_ENC
GST_CMML_ENC_CLASS
GST_CMML_ENC_GET_CLASS
GST_IS_CMML_ENC
GST_IS_CMML_ENC_CLASS
gst_cmml_enc_plugin_init
gst_cmml_enc_get_type
</SECTION>
<SECTION>
<FILE>element-cutter</FILE>
<TITLE>cutter</TITLE>
......
<plugin>
<name>annodex</name>
<description>annodex stream manipulation (info about annodex: http://www.annodex.net)</description>
<filename>../../ext/annodex/.libs/libgstannodex.so</filename>
<basename>libgstannodex.so</basename>
<version>0.11.90</version>
<license>LGPL</license>
<source>gst-plugins-good</source>
<package>GStreamer Good Plug-ins source release</package>
<origin>Unknown package origin</origin>
<elements>
<element>
<name>cmmldec</name>
<longname>CMML stream decoder</longname>
<class>Codec/Decoder</class>
<description>Decodes CMML streams</description>
<author>Alessandro Decina &lt;alessandro@nnva.org&gt;</author>
<pads>
<caps>
<name>sink</name>
<direction>sink</direction>
<presence>always</presence>
<details>text/x-cmml, encoded=(boolean)true</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>text/x-cmml, encoded=(boolean)false</details>
</caps>
</pads>
</element>
<element>
<name>cmmlenc</name>
<longname>CMML streams encoder</longname>
<class>Codec/Encoder</class>
<description>Encodes CMML streams</description>
<author>Alessandro Decina &lt;alessandro@nnva.org&gt;</author>
<pads>
<caps>
<name>sink</name>
<direction>sink</direction>
<presence>always</presence>
<details>text/x-cmml, encoded=(boolean)false</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>text/x-cmml, encoded=(boolean)true</details>
</caps>
</pads>
</element>
</elements>
</plugin>
\ No newline at end of file
......@@ -4,12 +4,6 @@ else
AALIB_DIR =
endif
if USE_ANNODEX
ANNODEX_DIR = annodex
else
ANNODEX_DIR =
endif
if USE_CAIRO
CAIRO_DIR = cairo
else
......@@ -115,7 +109,6 @@ endif
SUBDIRS = \
$(AALIB_DIR) \
$(ANNODEX_DIR) \
$(CAIRO_DIR) \
$(DV1394_DIR) \
$(FLAC_DIR) \
......@@ -136,7 +129,6 @@ SUBDIRS = \
DIST_SUBDIRS = \
aalib \
annodex \
cairo \
dv \
flac \
......
plugin_LTLIBRARIES = libgstannodex.la
# FIXME 0.11: ignore GValueArray warnings for now until this is sorted
ERROR_CFLAGS=
libgstannodex_la_SOURCES = \
gstannodex.c \
gstcmmlutils.c \
gstcmmldec.c \
gstcmmlenc.c \
gstcmmltag.c \
gstcmmlparser.c
libgstannodex_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
$(GST_CFLAGS) $(ANNODEX_CFLAGS)
libgstannodex_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
$(GST_LIBS) $(ANNODEX_LIBS) $(LIBM)
libgstannodex_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstannodex_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = gstannodex.h gstcmmlutils.h gstcmmltag.h gstcmmlparser.h \
gstcmmldec.h gstcmmlenc.h
/*
* gstannodex.c - GStreamer annodex plugin
* Copyright (C) 2005 Alessandro Decina
*
* Authors:
* Alessandro Decina <alessandro@nnva.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.
*/
/* FIXME 0.11: suppress warnings for deprecated API such as GValueArray
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <math.h>
#include <string.h>
#include <gst/tag/tag.h>
#include "gstannodex.h"
#include "gstcmmlparser.h"
#include "gstcmmlenc.h"
#include "gstcmmldec.h"
GstClockTime
gst_annodex_granule_to_time (gint64 granulepos, gint64 granulerate_n,
gint64 granulerate_d, guint8 granuleshift)
{
gint64 keyindex, keyoffset;
gint64 granulerate;
GstClockTime res;
g_return_val_if_fail (granuleshift <= 64, GST_CLOCK_TIME_NONE);
if (granulepos == -1)
return GST_CLOCK_TIME_NONE;
if (granulepos == 0 || granulerate_n == 0 || granulerate_d == 0)
return 0;
if (granuleshift != 0 && granuleshift != 64) {
keyindex = granulepos >> granuleshift;
keyoffset = granulepos - (keyindex << granuleshift);
granulepos = keyindex + keyoffset;
}
/* GST_SECOND / (granulerate_n / granulerate_d) */
granulerate = gst_util_uint64_scale (GST_SECOND,
granulerate_d, granulerate_n);
/* granulepos * granulerate */
res = gst_util_uint64_scale (granulepos, granulerate, 1);
return res;
}
GValueArray *
gst_annodex_parse_headers (const gchar * headers)
{
GValueArray *array;
GValue val = { 0 };
gchar *header_name = NULL;
gchar *header_value = NULL;
gchar *line, *column, *space, *tmp;
gchar **lines;
gint i = 0;
array = g_value_array_new (0);
g_value_init (&val, G_TYPE_STRING);
lines = g_strsplit (headers, "\r\n", 0);
line = lines[i];
while (line != NULL && *line != '\0') {
if (line[0] == '\t' || line[0] == ' ') {
/* WSP: continuation line */
if (header_value == NULL)
/* continuation line without a previous value */
goto fail;
tmp = g_strjoin (" ", header_value, g_strstrip (line), NULL);
g_free (header_value);
header_value = tmp;
} else {
if (header_name) {
g_value_take_string (&val, header_name);
g_value_array_append (array, &val);
g_value_take_string (&val, header_value);
g_value_array_append (array, &val);
}
/* search the column starting from line[1] as an header name can't be
* empty */
column = g_strstr_len (line + 1, strlen (line) - 1, ":");
if (column == NULL)
/* bad syntax */
goto fail;
if (*(space = column + 1) != ' ')
/* bad syntax */
goto fail;
header_name = g_strndup (line, column - line);
header_value = g_strdup (space + 1);
}
line = lines[++i];
}
if (header_name) {
g_value_take_string (&val, header_name);
g_value_array_append (array, &val);
g_value_take_string (&val, header_value);
g_value_array_append (array, &val);
}
g_value_unset (&val);
g_strfreev (lines);
return array;
fail:
GST_WARNING ("could not parse annodex headers");
g_free (header_name);
g_free (header_value);
g_strfreev (lines);
g_value_array_free (array);
g_value_unset (&val);
return NULL;
}
static gboolean
plugin_init (GstPlugin * plugin)
{
gst_tag_register (GST_TAG_CMML_STREAM, GST_TAG_FLAG_META,
GST_TYPE_CMML_TAG_STREAM, "cmml-stream", "annodex CMML stream tag", NULL);
gst_tag_register (GST_TAG_CMML_HEAD, GST_TAG_FLAG_META,
GST_TYPE_CMML_TAG_HEAD, "cmml-head", "annodex CMML head tag", NULL);
gst_tag_register (GST_TAG_CMML_CLIP, GST_TAG_FLAG_META,
GST_TYPE_CMML_TAG_CLIP, "cmml-clip", "annodex CMML clip tag", NULL);
gst_cmml_parser_init ();
if (!gst_cmml_enc_plugin_init (plugin))
return FALSE;
if (!gst_cmml_dec_plugin_init (plugin))
return FALSE;
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
annodex,
"annodex stream manipulation (info about annodex: http://www.annodex.net)",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
/*
* gstannodex.h - GStreamer annodex utility functions
* Copyright (C) 2005 Alessandro Decina
*
* Authors:
* Alessandro Decina <alessandro@nnva.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.
*/
#ifndef __GST_ANNODEX_H__
#define __GST_ANNODEX_H__
#include <gst/gst.h>
GstClockTime gst_annodex_granule_to_time (gint64 granulepos,
gint64 granulerate_n, gint64 granulerate_d, guint8 granuleshift);
gchar *gst_annodex_time_to_npt (GstClockTime time);
GValueArray *gst_annodex_parse_headers (const gchar * headers);
#endif /* __GST_ANNODEX_H__ */
/*
* gstcmmldec.c - GStreamer annodex CMML decoder
* Copyright (C) 2005 Alessandro Decina
*
* Authors:
* Alessandro Decina <alessandro@nnva.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.
*/
/**
* SECTION:element-cmmldec
* @see_also: cmmlenc, oggdemux
*
* Cmmldec extracts a CMML document from a CMML bitstream.<ulink
* url="http://www.annodex.net/TR/draft-pfeiffer-cmml-02.html">CMML</ulink> is
* an XML markup language for time-continuous data maintained by the <ulink
* url="http:/www.annodex.org/">Annodex Foundation</ulink>.
*
* <refsect2>
* <title>Example pipeline</title>
* |[
* gst-launch -v filesrc location=annotated.ogg ! oggdemux ! cmmldec ! filesink location=annotations.cmml
* ]|
* </refsect2>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <glib.h>
#include <gst/tag/tag.h>
#include "gstannodex.h"
#include "gstcmmltag.h"
#include "gstcmmldec.h"
#include "gstcmmlutils.h"
GST_DEBUG_CATEGORY_STATIC (cmmldec);
#define GST_CAT_DEFAULT cmmldec
#define CMML_IDENT_HEADER_SIZE 29
enum
{
ARG_0,
GST_CMML_DEC_WAIT_CLIP_END
};
enum
{
LAST_SIGNAL
};
static GstStaticPadTemplate gst_cmml_dec_src_factory =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("text/x-cmml, encoded = (boolean) false")
);
static GstStaticPadTemplate gst_cmml_dec_sink_factory =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("text/x-cmml, encoded = (boolean) true")
);
/* GstCmmlDec */
#define gst_cmml_dec_parent_class parent_class
G_DEFINE_TYPE (GstCmmlDec, gst_cmml_dec, GST_TYPE_ELEMENT);
static void gst_cmml_dec_get_property (GObject * dec, guint property_id,
GValue * value, GParamSpec * pspec);
static void gst_cmml_dec_set_property (GObject * dec, guint property_id,
const GValue * value, GParamSpec * pspec);
static gboolean gst_cmml_dec_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_cmml_dec_sink_event (GstPad * pad, GstObject * parent,
GstEvent * event);
static gboolean gst_cmml_dec_convert (GstPad * pad, GstFormat src_fmt,
gint64 src_val, GstFormat * dest_fmt, gint64 * dest_val);
static GstStateChangeReturn gst_cmml_dec_change_state (GstElement * element,
GstStateChange transition);
static GstFlowReturn gst_cmml_dec_chain (GstPad * pad, GstObject * parent,
GstBuffer * buffer);
static GstCmmlPacketType gst_cmml_dec_parse_packet_type (GstCmmlDec * dec,
gchar * data, gsize size);
static void gst_cmml_dec_parse_ident_header (GstCmmlDec * dec, guint8 * data,
gsize size);
static void gst_cmml_dec_parse_first_header (GstCmmlDec * dec, guint8 * data,
gsize size);
static void gst_cmml_dec_parse_preamble (GstCmmlDec * dec, guchar * preamble,
guchar * cmml_root_element);
static void gst_cmml_dec_parse_xml (GstCmmlDec * dec, guchar * data,
guint size);
static void gst_cmml_dec_parse_head (GstCmmlDec * dec, GstCmmlTagHead * head);
static void gst_cmml_dec_parse_clip (GstCmmlDec * dec, GstCmmlTagClip * clip);
static GstFlowReturn gst_cmml_dec_new_buffer (GstCmmlDec * dec,
guchar * data, gint size, GstBuffer ** buffer);
static void gst_cmml_dec_push_clip (GstCmmlDec * dec, GstCmmlTagClip * clip);
static void gst_cmml_dec_send_clip_tag (GstCmmlDec * dec,
GstCmmlTagClip * clip);
static void gst_cmml_dec_finalize (GObject * object);
static void
gst_cmml_dec_class_init (GstCmmlDecClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
object_class->set_property = gst_cmml_dec_set_property;
object_class->get_property = gst_cmml_dec_get_property;
object_class->finalize = gst_cmml_dec_finalize;
g_object_class_install_property (object_class, GST_CMML_DEC_WAIT_CLIP_END,
g_param_spec_boolean ("wait-clip-end-time",
"Wait clip end time",
"Send a tag for a clip when the clip ends, setting its end-time. "
"Use when you need to know both clip's start-time and end-time.",
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
element_class->change_state = gst_cmml_dec_change_state;
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_cmml_dec_sink_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_cmml_dec_src_factory));
gst_element_class_set_static_metadata (element_class, "CMML stream decoder",
"Codec/Decoder",
"Decodes CMML streams", "Alessandro Decina <alessandro@nnva.org>");
}
static void
gst_cmml_dec_init (GstCmmlDec * dec)
{
dec->sinkpad =
gst_pad_new_from_static_template (&gst_cmml_dec_sink_factory, "sink");
gst_pad_set_chain_function (dec->sinkpad, gst_cmml_dec_chain);
gst_pad_set_query_function (dec->sinkpad, gst_cmml_dec_sink_query);
gst_pad_set_event_function (dec->sinkpad, gst_cmml_dec_sink_event);
gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
dec->srcpad =
gst_pad_new_from_static_template (&gst_cmml_dec_src_factory, "src");
gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad);
dec->wait_clip_end = FALSE;
}
static void
gst_cmml_dec_get_property (GObject * object, guint property_id,
GValue * value, GParamSpec * pspec)
{
GstCmmlDec *dec = GST_CMML_DEC (object);
switch (property_id) {
case GST_CMML_DEC_WAIT_CLIP_END:
g_value_set_boolean (value, dec->wait_clip_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
gst_cmml_dec_set_property (GObject * object, guint property_id,
const GValue * value, GParamSpec * pspec)
{
GstCmmlDec *dec = GST_CMML_DEC (object);
switch (property_id) {
case GST_CMML_DEC_WAIT_CLIP_END:
dec->wait_clip_end = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (dec, property_id, pspec);
}
}
static void
gst_cmml_dec_finalize (GObject * object)
{
GstCmmlDec *dec = GST_CMML_DEC (object);
if (dec->tracks) {
gst_cmml_track_list_destroy (dec->tracks);
dec->tracks = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GstStateChangeReturn
gst_cmml_dec_change_state (GstElement * element, GstStateChange transition)
{
GstCmmlDec *dec = GST_CMML_DEC (element);
GstStateChangeReturn res;
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
dec->parser = gst_cmml_parser_new (GST_CMML_PARSER_DECODE);
dec->parser->user_data = dec;
dec->parser->preamble_callback =
(GstCmmlParserPreambleCallback) gst_cmml_dec_parse_preamble;
dec->parser->head_callback =
(GstCmmlParserHeadCallback) gst_cmml_dec_parse_head;
dec->parser->clip_callback =
(GstCmmlParserClipCallback) gst_cmml_dec_parse_clip;
dec->major = -1;
dec->minor = -1;
dec->granulerate_n = -1;
dec->granulerate_d = -1;
dec->granuleshift = 0;
dec->granulepos = 0;
dec->flow_return = GST_FLOW_OK;
dec->sent_root = FALSE;
dec->tracks = gst_cmml_track_list_new ();
break;
default:
break;
}