typedef struct _note_pipeline note_pipeline;
struct _note_pipeline {
- GstElement *pipeline,
- GstElement *src,
- GstElement *sink,
- GstElement *filter,
+ GstElement *pipeline;
+ GstElement *src;
+ GstElement *sink;
+ GstElement *filter;
};
static note_pipeline note_play;
static note_pipeline note_record;
static gboolean
audio_create_pipeline(note_pipeline *np, gboolean rec)
{
-p->pipeline=gst_pipeline_new("pipeline");
+np->pipeline=gst_pipeline_new("pipeline");
if (rec==TRUE) {
- p->src=gst_element_factory_make(AUDIO_SRC, "source");
- p->filter=gst_element_factory_make("wavenc", "filter");
- p->sink=gst_element_factory_make("filesink", "sink");
+ np->src=gst_element_factory_make(AUDIO_SRC, "source");
+ np->filter=gst_element_factory_make("wavenc", "filter");
+ np->sink=gst_element_factory_make("filesink", "sink");
} else {
- p->src=gst_element_factory_make("filesrc", "source");
- p->filter=gst_element_factory_make("wavenc", "filter");
- p->sink=gst_element_factory_make(AUDIO_SINK, "sink");
+ np->src=gst_element_factory_make("filesrc", "source");
+ np->filter=gst_element_factory_make("wavenc", "filter");
+ np->sink=gst_element_factory_make(AUDIO_SINK, "sink");
}
return TRUE;
}
/**
* Set the given elements (filesrc or filesink) file location
+ */
static void
audio_set_filename(GstElement *e, gchar *file)
{
g_object_set(G_OBJECT(e), "location", file, NULL);
}
+/**
+ * Play given audio note file
+ */
gboolean
audio_note_play(gchar *file)
{
audio_set_filename(note_play.src, file);
}
+/**
+ * Record to given file
+ */
gboolean
audio_note_record(gchar *file)
{
audio_set_filename(note_play.sink, file);
}
+/**
+ * Init gst pipelines for note play and record
+ */
gboolean
-audio_init(void)
+audio_note_init(void)
{
-audio_create_pipeline(note_play, FALSE);
-audio_create_pipeline(note_record, TRUE);
+audio_create_pipeline(¬e_play, FALSE);
+audio_create_pipeline(¬e_record, TRUE);
return TRUE;
}
+
+void
+audio_note_deinit(void)
+{
+
+}