Commit 235f2a96 authored by Wim Taymans's avatar Wim Taymans

midiparse: add basic midi parser

Parses midi files and outputs buffers with midi events.
parent 3af6effc
......@@ -366,6 +366,7 @@ AG_GST_CHECK_PLUGIN(jp2kdecimator)
AG_GST_CHECK_PLUGIN(jpegformat)
AG_GST_CHECK_PLUGIN(librfb)
AG_GST_CHECK_PLUGIN(liveadder)
AG_GST_CHECK_PLUGIN(midi)
AG_GST_CHECK_PLUGIN(mpegdemux)
AG_GST_CHECK_PLUGIN(mpegtsdemux)
AG_GST_CHECK_PLUGIN(mpegtsmux)
......@@ -2319,6 +2320,7 @@ gst/jp2kdecimator/Makefile
gst/jpegformat/Makefile
gst/librfb/Makefile
gst/liveadder/Makefile
gst/midi/Makefile
gst/mpegdemux/Makefile
gst/mpegtsdemux/Makefile
gst/mpegtsmux/Makefile
......
plugin_LTLIBRARIES = libgstmidi.la
libgstmidi_la_SOURCES = midi.c midiparse.c
libgstmidi_la_CFLAGS = \
$(GST_PLUGINS_BAD_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS)
libgstmidi_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) -lgsttag-$(GST_API_VERSION) \
$(GST_BASE_LIBS) \
$(LIBM)
libgstmidi_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstmidi_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = midiparse.h
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \
-:PROJECT libgstmidi -:SHARED libgstmidi \
-:TAGS eng debug \
-:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-:SOURCES $(libgstmidi_la_SOURCES) \
-:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmidi_la_CFLAGS) \
-:LDFLAGS $(libgstmidi_la_LDFLAGS) \
$(libgstmidi_la_LIBADD) \
-ldl \
-:PASSTHROUGH LOCAL_ARM_MODE:=arm \
LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-1.0' \
> $@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* GStreamer MIDI plugin initialisation
* Copyright (C) <2013> Wim Taymans <wim.taymans@gmail.com>
*
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/tag/tag.h>
#include <gst/gst-i18n-plugin.h>
#include "midiparse.h"
GST_DEBUG_CATEGORY_STATIC (midi_debug);
#define GST_CAT_DEFAULT (midi_debug)
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean ret;
GST_DEBUG_CATEGORY_INIT (midi_debug, "midi", 0, "MIDI plugin");
#ifdef ENABLE_NLS
GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
LOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif
ret = gst_element_register (plugin, "midiparse", GST_RANK_PRIMARY,
GST_TYPE_MIDI_PARSE);
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
midi,
"Parse MIDI files",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
This diff is collapsed.
/*
* gstmidiparse - midiparse plugin for gstreamer
*
* Copyright 2007 Wouter Paesen <wouter@blue-gate.be>
* Copyright 2013 Wim Taymans <wim.taymans@gmail.be>
*
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_MIDIPARSE_H__
#define __GST_MIDIPARSE_H__
#include <gst/gst.h>
#include <gst/base/gstadapter.h>
#include <midiparse.h>
G_BEGIN_DECLS
#define GST_TYPE_MIDI_PARSE \
(gst_midi_parse_get_type())
#define GST_MIDI_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MIDI_PARSE,GstMidiParse))
#define GST_MIDI_PARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MIDI_PARSE,GstMidiParseClass))
#define GST_IS_MIDI_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MIDI_PARSE))
#define GST_IS_MIDI_PARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MIDI_PARSE))
typedef struct _GstMidiParse GstMidiParse;
typedef struct _GstMidiParseClass GstMidiParseClass;
typedef enum {
GST_MIDI_PARSE_STATE_LOAD,
GST_MIDI_PARSE_STATE_PARSE,
GST_MIDI_PARSE_STATE_PLAY
} GstMidiParseState;
struct _GstMidiParse
{
GstElement element;
GstPad *sinkpad, *srcpad;
/* input stream properties */
GstMidiParseState state;
guint tempo;
guint16 ntracks;
guint16 division;
GList *tracks;
guint64 offset;
GstAdapter *adapter;
/* output data */
gboolean discont;
GstSegment segment;
};
struct _GstMidiParseClass
{
GstElementClass parent_class;
};
GType gst_midi_parse_get_type (void);
G_END_DECLS
#endif /* __GST_MIDI_PARSE_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment