From 7ae7791da2efb6bf3faf5cbde18395acd5808d57 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 26 Mar 2008 11:54:59 +0100 Subject: [PATCH] src/: remove some comments, update license headers, split files into plugin/gstaubiotempo --- src/Makefile.am | 4 +- src/gstaubiotempo.c | 145 ++++++++-------------------------------------------- src/gstaubiotempo.h | 63 ++++++++--------------- src/plugin.c | 43 ++++++++++++++++ 4 files changed, 88 insertions(+), 167 deletions(-) create mode 100644 src/plugin.c diff --git a/src/Makefile.am b/src/Makefile.am index 25d9538..c1b3248 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,7 +14,9 @@ plugin_LTLIBRARIES = libgstaubio.la ############################################################################## # sources used to compile this plug-in -libgstaubio_la_SOURCES = gstaubiotempo.c +libgstaubio_la_SOURCES = \ + gstaubiotempo.c \ + plugin.c # flags used to compile the aubio gst plugin # add other _CFLAGS and _LIBS as needed diff --git a/src/gstaubiotempo.c b/src/gstaubiotempo.c index 7577d0d..d2ca0d0 100644 --- a/src/gstaubiotempo.c +++ b/src/gstaubiotempo.c @@ -1,46 +1,22 @@ /* - * GStreamer - * Copyright 2005 Thomas Vander Stichele - * Copyright 2005 Ronald S. Bultje - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Alternatively, the contents of this file may be used under the - * GNU Lesser General Public License Version 2.1 (the "LGPL"), in - * which case the following provisions apply instead of the ones - * mentioned above: - * - * 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. - */ + Copyright (C) 2008 Paul Brossier + + This file is part of gst-aubio. + + gst-aubio is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + gst-aubio 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with gst-aubio. If not, see . + +*/ /** * SECTION:element-aubiotempo @@ -60,16 +36,11 @@ # include #endif -#include - #include #include #include "gstaubiotempo.h" -#define GST_CAT_DEFAULT gst_aubiotempo_debug -GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); - static const GstElementDetails element_details = GST_ELEMENT_DETAILS ("Aubio Tempo Analysis", "Filter/Analyzer/Audio", @@ -96,20 +67,6 @@ enum " rate=(int)44100," \ " channels=(int)[1,MAX]" -/* -static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("ANY") - ); - -static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("ANY") - ); -*/ - GST_BOILERPLATE (GstAubioTempo, gst_aubiotempo, GstAudioFilter, GST_TYPE_AUDIO_FILTER); @@ -118,7 +75,6 @@ static void gst_aubiotempo_set_property (GObject * object, guint prop_id, static void gst_aubiotempo_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -//static gboolean gst_aubiotempo_set_caps (GstPad * pad, GstCaps * caps); static GstFlowReturn gst_aubiotempo_transform_ip (GstBaseTransform * trans, GstBuffer * buf); /* GObject vmethod implementations */ @@ -136,13 +92,6 @@ gst_aubiotempo_base_init (gpointer gclass) gst_caps_unref (caps); - /* - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory)); - */ - gst_element_class_set_details (element_class, &element_details); } @@ -168,11 +117,6 @@ gst_aubiotempo_class_init (GstAubioTempoClass * klass) FALSE, G_PARAM_READWRITE)); } -/* initialize the new element - * instantiate pads and add them to element - * set functions - * initialize structure - */ static void gst_aubiotempo_init (GstAubioTempo * filter, GstAubioTempoClass * gclass) @@ -180,7 +124,7 @@ gst_aubiotempo_init (GstAubioTempo * filter, filter->silent = TRUE; - filter->type_onset = aubio_onset_kl; + filter->type_onset = aubio_onset_hfc; filter->buf_size = 1024; filter->hop_size = 512; @@ -224,27 +168,6 @@ gst_aubiotempo_get_property (GObject * object, guint prop_id, } } -/* GstElement vmethod implementations */ - -/* this function handles the link with other elements */ -/* -static gboolean -gst_aubiotempo_set_caps (GstPad * pad, GstCaps * caps) -{ - GstAubioTempo *filter; - GstPad *otherpad; - - filter = GST_AUBIOTEMPO (gst_pad_get_parent (pad)); - otherpad = (pad == filter->srcpad) ? filter->sinkpad : filter->srcpad; - - return gst_pad_set_caps (pad, caps); -} -*/ - -/* chain function - * this function does the actual processing - */ - static GstFlowReturn gst_aubiotempo_transform_ip (GstBaseTransform * trans, GstBuffer * buf) { @@ -265,9 +188,9 @@ gst_aubiotempo_transform_ip (GstBaseTransform * trans, GstBuffer * buf) if (filter->out->data[0][0]==1) { gint64 now = GST_BUFFER_TIMESTAMP (buf); // correction of inside buffer time - //now += GST_FRAMES_TO_CLOCK_TIME(j, audiofilter->format.rate); + now += GST_FRAMES_TO_CLOCK_TIME(j, audiofilter->format.rate); if (filter->silent == FALSE) { - g_print ("beat: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS(now)); + g_print ("beat: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS(now)); } } @@ -279,29 +202,3 @@ gst_aubiotempo_transform_ip (GstBaseTransform * trans, GstBuffer * buf) return GST_FLOW_OK; } - -/* entry point to initialize the plug-in - * initialize the plug-in itself - * register the element factories and pad templates - * register the features - */ -static gboolean -plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_aubiotempo_debug, "aubiotempo", - 0, "Aubiotempo plugin"); - - return gst_element_register (plugin, "aubiotempo", - GST_RANK_NONE, GST_TYPE_AUBIOTEMPO); -} - -/* this is the structure that gstreamer looks for to register plugins - * - * exchange the strings 'plugin' and 'Template plugin' with you plugin name and - * description - */ -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "aubiotempo", - "Aubiotempo plugin", - plugin_init, VERSION, "GPL", "GStreamer-aubio", "http://aubio.org/") diff --git a/src/gstaubiotempo.h b/src/gstaubiotempo.h index 903c03d..0b1bbd4 100644 --- a/src/gstaubiotempo.h +++ b/src/gstaubiotempo.h @@ -1,46 +1,23 @@ /* - * GStreamer - * Copyright 2005 Thomas Vander Stichele - * Copyright 2005 Ronald S. Bultje - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Alternatively, the contents of this file may be used under the - * GNU Lesser General Public License Version 2.1 (the "LGPL"), in - * which case the following provisions apply instead of the ones - * mentioned above: - * - * 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. - */ + + Copyright (C) 2008 Paul Brossier + + This file is part of gst-aubio. + + gst-aubio is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + gst-aubio 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with gst-aubio. If not, see . + +*/ #ifndef __GST_AUBIOTEMPO_H__ #define __GST_AUBIOTEMPO_H__ @@ -49,6 +26,8 @@ #include #include +#include + G_BEGIN_DECLS /* #defines don't like whitespacey bits */ diff --git a/src/plugin.c b/src/plugin.c new file mode 100644 index 0000000..d767e07 --- /dev/null +++ b/src/plugin.c @@ -0,0 +1,43 @@ +/* + + Copyright (C) 2008 Paul Brossier + + This file is part of gst-aubio. + + gst-aubio is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + gst-aubio 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with gst-aubio. If not, see . + +*/ + +#include +#include "gstaubiotempo.h" + +#define GST_CAT_DEFAULT gst_aubiotempo_debug +GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); + +static gboolean +plugin_init (GstPlugin * plugin) +{ + GST_DEBUG_CATEGORY_INIT (gst_aubiotempo_debug, "aubiotempo", + 0, "Aubiotempo plugin"); + + return gst_element_register (plugin, "aubiotempo", + GST_RANK_NONE, GST_TYPE_AUBIOTEMPO); +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "aubio", + "Aubio plugin", + plugin_init, VERSION, "GPL", "GStreamer-aubio", "http://aubio.org/") + -- 2.11.0