2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
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.
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.
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., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 #include "gstflacenc.h"
22 #include "gstflacdec.h"
24 #include "flac_compat.h"
26 extern GstElementDetails flacenc_details;
27 extern GstElementDetails flacdec_details;
29 GstPadTemplate *gst_flacdec_src_template, *gst_flacdec_sink_template;
30 GstPadTemplate *gst_flacenc_src_template, *gst_flacenc_sink_template;
33 flac_caps_factory (void)
40 "rate", GST_PROPS_INT_RANGE (11025, 48000),
41 "channels", GST_PROPS_INT_RANGE (1, 2),
46 raw_caps_factory (void)
53 "endianness", GST_PROPS_INT (G_BYTE_ORDER),
54 "signed", GST_PROPS_BOOLEAN (TRUE),
55 "width", GST_PROPS_INT (16),
56 "depth", GST_PROPS_INT (16),
57 "rate", GST_PROPS_INT_RANGE (11025, 48000),
58 "channels", GST_PROPS_INT_RANGE (1, 2),
63 plugin_init (GModule *module, GstPlugin *plugin)
65 GstElementFactory *enc, *dec;
66 GstCaps *raw_caps, *flac_caps;
68 if (!gst_library_load ("gstbytestream"))
71 gst_plugin_set_longname (plugin, "The FLAC Lossless compressor Codec");
73 /* create an elementfactory for the flacenc element */
74 enc = gst_element_factory_new ("flacenc", GST_TYPE_FLACENC,
76 g_return_val_if_fail (enc != NULL, FALSE);
78 raw_caps = raw_caps_factory ();
79 flac_caps = flac_caps_factory ();
81 /* register sink pads */
82 gst_flacenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
85 gst_element_factory_add_pad_template (enc, gst_flacenc_sink_template);
87 /* register src pads */
88 gst_flacenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
91 gst_element_factory_add_pad_template (enc, gst_flacenc_src_template);
93 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (enc));
95 /* create an elementfactory for the flacdec element */
96 dec = gst_element_factory_new("flacdec",GST_TYPE_FLACDEC,
98 g_return_val_if_fail(dec != NULL, FALSE);
99 gst_element_factory_set_rank (dec, GST_ELEMENT_RANK_PRIMARY);
101 /* register sink pads */
102 gst_flacdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
105 gst_element_factory_add_pad_template (dec, gst_flacdec_sink_template);
107 /* register src pads */
108 gst_flacdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
111 gst_element_factory_add_pad_template (dec, gst_flacdec_src_template);
113 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (dec));
118 GstPluginDesc plugin_desc = {