1 /* GStreamer
2  * Copyright (C) <2017> Carlos Rafael Giani <dv at pseudoterminal dot org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 
21 #ifndef __GST_OPENMPT_DEC_H__
22 #define __GST_OPENMPT_DEC_H__
23 
24 
25 #include <gst/gst.h>
26 #include "gst/audio/gstnonstreamaudiodecoder.h"
27 #include <libopenmpt/libopenmpt.h>
28 
29 
30 G_BEGIN_DECLS
31 
32 
33 typedef struct _GstOpenMptDec GstOpenMptDec;
34 typedef struct _GstOpenMptDecClass GstOpenMptDecClass;
35 
36 
37 #define GST_TYPE_OPENMPT_DEC             (gst_openmpt_dec_get_type())
38 #define GST_OPENMPT_DEC(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_OPENMPT_DEC, GstOpenMptDec))
39 #define GST_OPENMPT_DEC_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_OPENMPT_DEC, GstOpenMptDecClass))
40 #define GST_IS_OPENMPT_DEC(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_OPENMPT_DEC))
41 #define GST_IS_OPENMPT_DEC_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_OPENMPT_DEC))
42 
43 
44 struct _GstOpenMptDec
45 {
46   GstNonstreamAudioDecoder parent;
47   openmpt_module *mod;
48 
49   guint cur_subsong, num_subsongs;
50   double *subsong_durations;
51   /* NOTE: this is of type int, not guint, because the value
52    * is defined by OpenMPT, and can be -1 (= "all subsongs") */
53   int default_openmpt_subsong;
54   GstNonstreamAudioSubsongMode cur_subsong_mode;
55 
56   gint num_loops;
57 
58   gint master_gain, stereo_separation, filter_length, volume_ramping;
59 
60   GstAudioFormat sample_format;
61   gint sample_rate, num_channels;
62 
63   guint output_buffer_size;
64 
65   GstTagList *main_tags;
66 };
67 
68 
69 struct _GstOpenMptDecClass
70 {
71   GstNonstreamAudioDecoderClass parent_class;
72 };
73 
74 
75 GType gst_openmpt_dec_get_type (void);
76 
77 
78 G_END_DECLS
79 
80 
81 #endif /* __GST_OPENMPT_DEC_H__ */
82