1 /* Demo Recorder for MAEMO 5
2 * Copyright (C) 2010 Dru Moore <usr@dru-id.co.uk>
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2,
5 * or (at your option) any later version, as published by the Free
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 public class RecordPipeline_Old : Object {
22 Gst.Pipeline pipeline;
25 Gst.Element converter;
28 Gst.Element resampler;
34 Gst.Query duration_query;
35 Gst.Query position_query;
39 public signal void position_duration(int64 position, int64 duration);
40 public signal void tag_parsed(string tag, string val);
41 public signal void end_of_stream();
42 public signal void stream_error(string msg);
44 public RecordPipeline_Old(string name, string location, Gst.Caps caps) {
46 this.location = location;
48 //set the tag handling delegate
49 //this.handle_tags_delegate = this.handle_tags;
50 //set some default values
53 this.construct_pipeline(this.name, this.location, this.caps);
55 //duration_query = new Gst.Query.duration(Gst.Format.TIME);
56 //position_query = new Gst.Query.position(Gst.Format.TIME);
59 public string get_location() {
63 public void record() {
64 this.pipeline.set_state(Gst.State.PLAYING);
69 this.pipeline.set_state(Gst.State.READY);
72 private void construct_pipeline(string name, string location, Gst.Caps caps) {
73 pipeline = new Gst.Pipeline(name);
75 this.src = Gst.ElementFactory.make("pulsesrc", "input");
76 src.set_property("device", "source.hw0");
77 this.pipeline.add(this.src);
79 this.converter = Gst.ElementFactory.make("audioconvert", "converter");
80 this.pipeline.add(this.converter);
82 this.queue = Gst.ElementFactory.make("queue", "buffer");
83 this.pipeline.add(this.queue);
85 this.resampler = Gst.ElementFactory.make("audioresample", "resampler");
86 this.resampler.set_property("quality", 10);
87 this.pipeline.add(resampler);
88 this.encoder = Gst.ElementFactory.make("wavenc", "encoder");
89 this.pipeline.add(this.encoder);
90 if (null != this.encoder) {
91 stdout.printf("Encoder added!\n");
94 this.filesink = Gst.ElementFactory.make("filesink", "fileoutput");
95 if (null != this.filesink) {
96 this.filesink.set_property("location", location);
97 stdout.printf("Location set!\n");
99 this.pipeline.add(this.filesink);
100 stdout.printf("Filesink added!\n");
103 /*if (this.converter.link(this.resampler)) {
104 stdout.printf("Converter linked!\n");
107 if (this.src.link(this.queue)) {
108 stdout.printf("Source linked!\n");
111 if (this.queue.link(this.converter)) {
112 stdout.printf("Queue linked!\n");
115 if (this.converter.link(this.resampler)) {
116 stdout.printf("Converter linked!\n");
119 if (this.resampler.link_filtered(this.encoder, caps)) {
120 stdout.printf("Resampler linked!\n");
123 if (this.encoder.link(this.filesink)) {
124 stdout.printf("Encoder linked!\n");