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 static class EncoderFactory {
22 public static Gst.Bin? get_encoder_bin(string name, string encoder, string quality, string? taglist) {
25 return get_encoder_vorbisenc(name, quality, taglist);
27 return get_encoder_nokiaaacenc(name, quality, taglist);
29 return get_encoder_wavenc(name, quality, taglist);
35 public static Gst.Bin get_encoder_wavenc(string name, string quality, string? taglist) {
36 // Quality ignored for now
37 Gst.Bin enc_bin = new Gst.Bin(name);
38 Gst.Element taginject = Gst.ElementFactory.make("taginject", "injector");
39 Gst.ElementFactory.make("wavenc", "encoder");
40 enc_bin.add(taginject);
42 if (null != taglist) {
43 taginject.set_property("tags", taglist);
45 taginject.link(enc_bin);
46 Gst.GhostPad sink_pad = new Gst.GhostPad("sink", taginject.get_static_pad("sink"));
47 enc_bin.add_pad(sink_pad);
48 Gst.GhostPad src_pad = new Gst.GhostPad("src", enc_bin.get_static_pad("src"));
49 enc_bin.add_pad(src_pad);
53 public static Gst.Bin get_encoder_vorbisenc(string name, string quality, string? taglist) {
69 Gst.Bin enc_bin = new Gst.Bin(name);
70 Gst.Element taginject = Gst.ElementFactory.make("taginject", "injector");
71 Gst.Element encoder = Gst.ElementFactory.make("vorbisenc", "encoder");
72 Gst.Element muxer = Gst.ElementFactory.make("oggmux", "muxer");
73 enc_bin.add(taginject);
76 encoder.set_property("quality", q);
77 if (null != taglist) {
78 taginject.set_property("tags", taglist);
80 taginject.link(encoder);
82 Gst.GhostPad sink_pad = new Gst.GhostPad("sink", taginject.get_static_pad("sink"));
83 enc_bin.add_pad(sink_pad);
84 Gst.GhostPad src_pad = new Gst.GhostPad("src", muxer.get_static_pad("src"));
85 enc_bin.add_pad(src_pad);
89 public static Gst.Bin get_encoder_nokiaaacenc(string name, string quality, string? taglist) {
90 uint bitrate = 128000;
91 int output_format = 1;
106 Gst.Bin enc_bin = new Gst.Bin(name);
107 Gst.Element taginject = Gst.ElementFactory.make("taginject", "injector");
108 Gst.Element encoder = Gst.ElementFactory.make("nokiaaacenc", "encoder");
109 enc_bin.add(taginject);
110 enc_bin.add(encoder);
111 encoder.set_property("bitrate", bitrate);
112 encoder.set_property("output-format", output_format);
113 if (null != taglist) {
114 taginject.set_property("tags", taglist);
116 taginject.link(encoder);
117 Gst.GhostPad sink_pad = new Gst.GhostPad("sink", taginject.get_static_pad("sink"));
118 enc_bin.add_pad(sink_pad);
119 Gst.GhostPad src_pad = new Gst.GhostPad("src", encoder.get_static_pad("src"));
120 enc_bin.add_pad(src_pad);