1 /* GStreamer
2  * Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
3  * Copyright (C) 2005 Stefan Kost <ensonic@users.sf.net> (audiotestsrc)
4  * Copyright (C) 2013 Juan Manuel Borges Caño <juanmabcmail@gmail.com>
5  *
6  * gstladspasource.h: Header for LADSPA source
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef __GST_LADSPA_SOURCE_H__
25 #define __GST_LADSPA_SOURCE_H__
26 
27 #include <gst/gst.h>
28 #include <gst/base/gstbasesrc.h>
29 #include "gstladspautils.h"
30 
31 G_BEGIN_DECLS
32 
33 #define GST_TYPE_LADSPA_SOURCE              (gst_ladspa_source_get_type())
34 #define GST_LADSPA_SOURCE(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LADSPA_SOURCE,GstLADSPASource))
35 #define GST_LADSPA_SOURCE_CAST(obj)         ((GstLADSPASource *) (obj))
36 #define GST_LADSPA_SOURCE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LADSPA_SOURCE,GstLADSPASourceClass))
37 #define GST_LADSPA_SOURCE_CLASS_CAST(klass) ((GstLADSPASourceClass *) (klass))
38 #define GST_LADSPA_SOURCE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_LADSPA_SOURCE,GstLADSPASourceClass))
39 #define GST_IS_LADSPA_SOURCE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LADSPA_SOURCE))
40 #define GST_IS_LADSPA_SOURCE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LADSPA_SOURCE))
41 
42 typedef struct _GstLADSPASource GstLADSPASource;
43 
44 typedef struct _GstLADSPASourceClass GstLADSPASourceClass;
45 
46 struct _GstLADSPASource
47 {
48   GstBaseSrc parent;
49 
50   GstLADSPA ladspa;
51 
52   /* audio parameters */
53   GstAudioInfo info;
54   gint samples_per_buffer;
55 
56   /*< private > */
57   gboolean tags_pushed;              /* send tags just once ? */
58   GstClockTimeDiff timestamp_offset; /* base offset */
59   GstClockTime next_time;            /* next timestamp */
60   gint64 next_sample;                /* next sample to send */
61   gint64 next_byte;                  /* next byte to send */
62   gint64 sample_stop;
63   gboolean check_seek_stop;
64   gboolean eos_reached;
65   gint generate_samples_per_buffer;  /* used to generate a partial buffer */
66   gboolean can_activate_pull;
67   gboolean reverse;                  /* play backwards */
68 };
69 
70 struct _GstLADSPASourceClass
71 {
72   GstBaseSrcClass parent_class;
73 
74   GstLADSPAClass ladspa;
75 };
76 
77 GType
78 gst_ladspa_source_get_type (void);
79 
80 void
81 ladspa_register_source_element (GstPlugin * plugin, GstStructure *ladspa_meta);
82 
83 void
84 gst_my_base_source_class_add_pad_template (GstBaseSrcClass * base_class,
85     GstCaps * srccaps);
86 
87 G_END_DECLS
88 
89 #endif /* __GST_LADSPA_SOURCE_H__ */
90