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 extern GstElementDetails flacenc_details;
25 extern GstElementDetails flacdec_details;
27 static GstCaps* flac_typefind (GstBuffer *buf, gpointer private);
29 GstPadTemplate *dec_src_template, *dec_sink_template;
30 GstPadTemplate *enc_src_template, *enc_sink_template;
33 flac_caps_factory (void)
43 raw_caps_factory (void)
50 "format", GST_PROPS_STRING ("int"),
51 "law", GST_PROPS_INT (0),
52 "endianness", GST_PROPS_INT (G_BYTE_ORDER),
53 "signed", GST_PROPS_BOOLEAN (TRUE),
54 "width", GST_PROPS_INT (16),
55 "depth", GST_PROPS_INT (16),
56 "rate", GST_PROPS_INT_RANGE (11025, 48000),
57 "channels", GST_PROPS_INT_RANGE (1, 2),
61 static GstTypeDefinition flacdefinition = {
69 flac_typefind (GstBuffer *buf, gpointer private)
71 gulong head = GULONG_FROM_BE (*((gulong *)GST_BUFFER_DATA (buf)));
73 if (head != 0x664C6143)
76 return gst_caps_new ("flac_typefind", "audio/x-flac", NULL);
81 plugin_init (GModule *module, GstPlugin *plugin)
83 GstElementFactory *enc, *dec;
85 GstCaps *raw_caps, *flac_caps;
87 gst_plugin_set_longname (plugin, "The FLAC Lossless compressor Codec");
89 /* create an elementfactory for the flacenc element */
90 enc = gst_elementfactory_new ("flacenc", GST_TYPE_FLACENC,
92 g_return_val_if_fail (enc != NULL, FALSE);
94 raw_caps = raw_caps_factory ();
95 flac_caps = flac_caps_factory ();
97 /* register sink pads */
98 enc_sink_template = gst_padtemplate_new ("sink", GST_PAD_SINK,
101 gst_elementfactory_add_padtemplate (enc, enc_sink_template);
103 /* register src pads */
104 enc_src_template = gst_padtemplate_new ("src", GST_PAD_SRC,
107 gst_elementfactory_add_padtemplate (enc, enc_src_template);
109 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (enc));
111 /* create an elementfactory for the flacdec element */
112 dec = gst_elementfactory_new("flacdec",GST_TYPE_FLACDEC,
114 g_return_val_if_fail(dec != NULL, FALSE);
116 /* register sink pads */
117 dec_sink_template = gst_padtemplate_new ("sink", GST_PAD_SINK,
120 gst_elementfactory_add_padtemplate (dec, dec_sink_template);
122 /* register src pads */
123 dec_src_template = gst_padtemplate_new ("src", GST_PAD_SRC,
126 gst_elementfactory_add_padtemplate (dec, dec_src_template);
128 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (dec));
130 type = gst_typefactory_new (&flacdefinition);
131 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
136 GstPluginDesc plugin_desc = {