+2008-04-03 Sebastian Dröge <slomo@circular-chaos.org>
+
+ * ext/wavpack/gstwavpackdec.c: (gst_wavpack_dec_base_init):
+ * ext/wavpack/gstwavpackenc.c: (gst_wavpack_enc_base_init):
+ * ext/wavpack/gstwavpackparse.c:
+ (gst_wavpack_parse_index_entry_new),
+ (gst_wavpack_parse_index_entry_free),
+ (gst_wavpack_parse_base_init),
+ (gst_wavpack_parse_index_append_entry), (gst_wavpack_parse_reset):
+ Use GSlice for allocating index entries and use
+ gst_element_class_set_details_simple().
+
2008-04-02 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Brian Cameron <brian.cameron at sun dot com>
static void
gst_wavpack_dec_base_init (gpointer klass)
{
- static const GstElementDetails plugin_details =
- GST_ELEMENT_DETAILS ("Wavpack audio decoder",
- "Codec/Decoder/Audio",
- "Decodes Wavpack audio data",
- "Arwed v. Merkatz <v.merkatz@gmx.net>, "
- "Sebastian Dröge <slomo@circular-chaos.org>");
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
- gst_element_class_set_details (element_class, &plugin_details);
+ gst_element_class_set_details_simple (element_class, "Wavpack audio decoder",
+ "Codec/Decoder/Audio",
+ "Decodes Wavpack audio data",
+ "Arwed v. Merkatz <v.merkatz@gmx.net>, "
+ "Sebastian Dröge <slomo@circular-chaos.org>");
}
static void
static void
gst_wavpack_enc_base_init (gpointer klass)
{
- static const GstElementDetails element_details = {
- "Wavpack audio encoder",
- "Codec/Encoder/Audio",
- "Encodes audio with the Wavpack lossless/lossy audio codec",
- "Sebastian Dröge <slomo@circular-chaos.org>"
- };
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
/* add pad templates */
gst_static_pad_template_get (&wvcsrc_factory));
/* set element details */
- gst_element_class_set_details (element_class, &element_details);
+ gst_element_class_set_details_simple (element_class, "Wavpack audio encoder",
+ "Codec/Encoder/Audio",
+ "Encodes audio with the Wavpack lossless/lossy audio codec",
+ "Sebastian Dröge <slomo@circular-chaos.org>");
}
GST_DEBUG_CATEGORY_STATIC (gst_wavpack_parse_debug);
#define GST_CAT_DEFAULT gst_wavpack_parse_debug
+/* FIXME: unconditionally use GSlice after we depend on GLib >= 2.10 */
+#if GLIB_CHECK_VERSION (2, 10, 0)
+static inline GstWavpackParseIndexEntry *
+gst_wavpack_parse_index_entry_new ()
+{
+ return g_slice_new (GstWavpackParseIndexEntry);
+}
+
+static inline void
+gst_wavpack_parse_index_entry_free (GstWavpackParseIndexEntry * entry)
+{
+ g_slice_free (GstWavpackParseIndexEntry, entry);
+}
+#else
+static inline GstWavpackParseIndexEntry *
+gst_wavpack_parse_index_entry_new ()
+{
+ return g_new (GstWavpackParseIndexEntry, 1);
+}
+
+static inline void
+gst_wavpack_parse_index_entry_free (GstWavpackParseIndexEntry * entry)
+{
+ g_free (entry);
+}
+#endif
+
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
static void
gst_wavpack_parse_base_init (gpointer klass)
{
- static const GstElementDetails plugin_details =
- GST_ELEMENT_DETAILS ("Wavpack parser",
- "Codec/Demuxer/Audio",
- "Parses Wavpack files",
- "Arwed v. Merkatz <v.merkatz@gmx.net>, "
- "Sebastian Dröge <slomo@circular-chaos.org>");
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&wvc_src_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
- gst_element_class_set_details (element_class, &plugin_details);
+
+ gst_element_class_set_details_simple (element_class, "Wavpack parser",
+ "Codec/Demuxer/Audio",
+ "Parses Wavpack files",
+ "Arwed v. Merkatz <v.merkatz@gmx.net>, "
+ "Sebastian Dröge <slomo@circular-chaos.org>");
}
static void
GST_TIME_ARGS (gst_util_uint64_scale_int (sample_offset,
GST_SECOND, wvparse->samplerate)), byte_offset);
- entry = g_new0 (GstWavpackParseIndexEntry, 1);
+ entry = gst_wavpack_parse_index_entry_new ();
entry->byte_offset = byte_offset;
entry->sample_offset = sample_offset;
entry->sample_offset_end = sample_offset + num_samples;
parse->upstream_length = -1;
if (parse->entries) {
- g_slist_foreach (parse->entries, (GFunc) g_free, NULL);
+ g_slist_foreach (parse->entries, (GFunc) gst_wavpack_parse_index_entry_free,
+ NULL);
g_slist_free (parse->entries);
parse->entries = NULL;
}