1 /* 2 * gstmidiparse - midiparse plugin for gstreamer 3 * 4 * Copyright 2007 Wouter Paesen <wouter@blue-gate.be> 5 * Copyright 2013 Wim Taymans <wim.taymans@gmail.be> 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Library General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Library General Public License for more details. 16 * 17 * You should have received a copy of the GNU Library General Public 18 * License along with this library; if not, write to the 19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 20 * Boston, MA 02110-1301, USA. 21 */ 22 23 #ifndef __GST_MIDIPARSE_H__ 24 #define __GST_MIDIPARSE_H__ 25 26 #include <gst/gst.h> 27 #include <gst/base/gstadapter.h> 28 #include <midiparse.h> 29 30 G_BEGIN_DECLS 31 32 #define GST_TYPE_MIDI_PARSE \ 33 (gst_midi_parse_get_type()) 34 #define GST_MIDI_PARSE(obj) \ 35 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MIDI_PARSE,GstMidiParse)) 36 #define GST_MIDI_PARSE_CLASS(klass) \ 37 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MIDI_PARSE,GstMidiParseClass)) 38 #define GST_IS_MIDI_PARSE(obj) \ 39 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MIDI_PARSE)) 40 #define GST_IS_MIDI_PARSE_CLASS(klass) \ 41 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MIDI_PARSE)) 42 43 typedef struct _GstMidiParse GstMidiParse; 44 typedef struct _GstMidiParseClass GstMidiParseClass; 45 46 typedef enum { 47 GST_MIDI_PARSE_STATE_LOAD, 48 GST_MIDI_PARSE_STATE_PARSE, 49 GST_MIDI_PARSE_STATE_PLAY 50 } GstMidiParseState; 51 52 struct _GstMidiParse 53 { 54 GstElement element; 55 56 GstPad *sinkpad, *srcpad; 57 58 gboolean have_group_id; 59 guint group_id; 60 61 /* input stream properties */ 62 GstMidiParseState state; 63 64 guint tempo; 65 guint16 ntracks; 66 guint16 division; 67 68 GList *tracks; 69 guint track_count; 70 71 guint64 offset; 72 GstAdapter *adapter; 73 guint8 *data; 74 75 /* output data */ 76 gboolean discont; 77 GstSegment segment; 78 gboolean segment_pending; 79 guint32 seqnum; 80 81 guint64 pulse; 82 }; 83 84 struct _GstMidiParseClass 85 { 86 GstElementClass parent_class; 87 }; 88 89 GType gst_midi_parse_get_type (void); 90 GST_ELEMENT_REGISTER_DECLARE (midiparse); 91 92 G_END_DECLS 93 94 #endif /* __GST_MIDI_PARSE_H__ */ 95