ext/wavpack/: Use GSlice for allocating index entries and use gst_element_class_set_details_simple().

Original commit message from CVS:
* 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().
This commit is contained in:
Sebastian Dröge 2008-04-03 18:28:28 +00:00
parent 23b9485530
commit 8cb180066d
5 changed files with 58 additions and 24 deletions

View file

@ -1,3 +1,15 @@
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> 2008-04-02 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Brian Cameron <brian.cameron at sun dot com> Patch by: Brian Cameron <brian.cameron at sun dot com>

2
common

@ -1 +1 @@
Subproject commit 5421815aeed8b2d73a4d4d4a4b8eb2c93f1b7d02 Subproject commit fda6da5f2b9b000f7e1df8ffb44a6185ffd9799b

View file

@ -96,19 +96,17 @@ GST_BOILERPLATE (GstWavpackDec, gst_wavpack_dec, GstElement, GST_TYPE_ELEMENT);
static void static void
gst_wavpack_dec_base_init (gpointer klass) 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); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory)); gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory)); 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

View file

@ -210,12 +210,6 @@ GST_BOILERPLATE (GstWavpackEnc, gst_wavpack_enc, GstElement, GST_TYPE_ELEMENT);
static void static void
gst_wavpack_enc_base_init (gpointer klass) 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); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
/* add pad templates */ /* add pad templates */
@ -227,7 +221,10 @@ gst_wavpack_enc_base_init (gpointer klass)
gst_static_pad_template_get (&wvcsrc_factory)); gst_static_pad_template_get (&wvcsrc_factory));
/* set element details */ /* 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>");
} }

View file

@ -57,6 +57,33 @@
GST_DEBUG_CATEGORY_STATIC (gst_wavpack_parse_debug); GST_DEBUG_CATEGORY_STATIC (gst_wavpack_parse_debug);
#define GST_CAT_DEFAULT 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", static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
@ -99,12 +126,6 @@ GST_BOILERPLATE (GstWavpackParse, gst_wavpack_parse, GstElement,
static void static void
gst_wavpack_parse_base_init (gpointer klass) 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); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
@ -113,7 +134,12 @@ gst_wavpack_parse_base_init (gpointer klass)
gst_static_pad_template_get (&wvc_src_factory)); gst_static_pad_template_get (&wvc_src_factory));
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory)); 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 static void
@ -199,7 +225,7 @@ gst_wavpack_parse_index_append_entry (GstWavpackParse * wvparse,
GST_TIME_ARGS (gst_util_uint64_scale_int (sample_offset, GST_TIME_ARGS (gst_util_uint64_scale_int (sample_offset,
GST_SECOND, wvparse->samplerate)), byte_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->byte_offset = byte_offset;
entry->sample_offset = sample_offset; entry->sample_offset = sample_offset;
entry->sample_offset_end = sample_offset + num_samples; entry->sample_offset_end = sample_offset + num_samples;
@ -222,7 +248,8 @@ gst_wavpack_parse_reset (GstWavpackParse * parse)
parse->upstream_length = -1; parse->upstream_length = -1;
if (parse->entries) { 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); g_slist_free (parse->entries);
parse->entries = NULL; parse->entries = NULL;
} }