gst/mpegaudioparse/: Use GSlice for allocating the seek table entries if we compile with

Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mpeg_audio_seek_entry_new), (mpeg_audio_seek_entry_free),
(gst_mp3parse_reset), (gst_mp3parse_emit_frame):
* gst/mpegaudioparse/gstxingmux.c: (gst_xing_seek_entry_new),
(gst_xing_seek_entry_free), (gst_xing_mux_finalize), (xing_reset),
(gst_xing_mux_chain):
Use GSlice for allocating the seek table entries if we compile with
GLib 2.10 or newer.
This commit is contained in:
Sebastian Dröge 2008-04-03 15:21:50 +00:00
parent 2336c35df2
commit e6107e7b39
4 changed files with 72 additions and 6 deletions

View file

@ -1,3 +1,14 @@
2008-04-03 Sebastian Dröge <slomo@circular-chaos.org>
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mpeg_audio_seek_entry_new), (mpeg_audio_seek_entry_free),
(gst_mp3parse_reset), (gst_mp3parse_emit_frame):
* gst/mpegaudioparse/gstxingmux.c: (gst_xing_seek_entry_new),
(gst_xing_seek_entry_free), (gst_xing_mux_finalize), (xing_reset),
(gst_xing_mux_chain):
Use GSlice for allocating the seek table entries if we compile with
GLib 2.10 or newer.
2008-04-01 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/asfdemux/gstasfdemux.c:

2
common

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

View file

@ -41,6 +41,33 @@ GST_DEBUG_CATEGORY_STATIC (mp3parse_debug);
#define GST_READ_UINT24_BE(p) (p[2] | (p[1] << 8) | (p[0] << 16))
/* FIXME: unconditionally use GSlice after we depend on GLib >= 2.10 */
#if GLIB_CHECK_VERSION (2, 10, 0)
static inline MPEGAudioSeekEntry *
mpeg_audio_seek_entry_new ()
{
return g_slice_new (MPEGAudioSeekEntry);
}
static inline void
mpeg_audio_seek_entry_free (MPEGAudioSeekEntry * entry)
{
g_slice_free (MPEGAudioSeekEntry, entry);
}
#else
static inline MPEGAudioSeekEntry *
mpeg_audio_seek_entry_new ()
{
return g_new (MPEGAudioSeekEntry, 1);
}
static inline void
mpeg_audio_seek_entry_free (MPEGAudioSeekEntry * entry)
{
g_free (entry);
}
#endif
/* elementfactory information */
static GstElementDetails mp3parse_details = {
"MPEG1 Audio Parser",
@ -341,7 +368,8 @@ gst_mp3parse_reset (GstMPEGAudioParse * mp3parse)
mp3parse->vbri_seek_table = NULL;
if (mp3parse->seek_table) {
g_list_foreach (mp3parse->seek_table, (GFunc) g_free, NULL);
g_list_foreach (mp3parse->seek_table, (GFunc) mpeg_audio_seek_entry_free,
NULL);
g_list_free (mp3parse->seek_table);
mp3parse->seek_table = NULL;
}
@ -638,7 +666,7 @@ gst_mp3parse_emit_frame (GstMPEGAudioParse * mp3parse, guint size,
(!mp3parse->seek_table ||
(mp3parse_seek_table_last_entry (mp3parse))->byte <
GST_BUFFER_OFFSET (outbuf))) {
MPEGAudioSeekEntry *entry = g_new0 (MPEGAudioSeekEntry, 1);
MPEGAudioSeekEntry *entry = mpeg_audio_seek_entry_new ();
entry->byte = mp3parse->cur_offset;
entry->timestamp = GST_BUFFER_TIMESTAMP (outbuf);

View file

@ -69,6 +69,33 @@ typedef struct _GstXingSeekEntry
gint byte;
} GstXingSeekEntry;
/* FIXME: unconditionally use GSlice after we depend on GLib >= 2.10 */
#if GLIB_CHECK_VERSION (2, 10, 0)
static inline GstXingSeekEntry *
gst_xing_seek_entry_new ()
{
return g_slice_new (GstXingSeekEntry);
}
static inline void
gst_xing_seek_entry_free (GstXingSeekEntry * entry)
{
g_slice_free (GstXingSeekEntry, entry);
}
#else
static inline GstXingSeekEntry *
gst_xing_seek_entry_new ()
{
return g_new (GstXingSeekEntry, 1);
}
static inline void
gst_xing_seek_entry_free (GstXingSeekEntry * entry)
{
g_free (entry);
}
#endif
static void gst_xing_mux_finalize (GObject * obj);
static GstStateChangeReturn
gst_xing_mux_change_state (GstElement * element, GstStateChange transition);
@ -429,7 +456,7 @@ gst_xing_mux_finalize (GObject * obj)
}
if (xing->seek_table) {
g_list_foreach (xing->seek_table, (GFunc) g_free, NULL);
g_list_foreach (xing->seek_table, (GFunc) gst_xing_seek_entry_free, NULL);
g_list_free (xing->seek_table);
xing->seek_table = NULL;
}
@ -446,7 +473,7 @@ xing_reset (GstXingMux * xing)
gst_adapter_clear (xing->adapter);
if (xing->seek_table) {
g_list_foreach (xing->seek_table, (GFunc) g_free, NULL);
g_list_foreach (xing->seek_table, (GFunc) gst_xing_seek_entry_free, NULL);
g_list_free (xing->seek_table);
xing->seek_table = NULL;
}
@ -548,7 +575,7 @@ gst_xing_mux_chain (GstPad * pad, GstBuffer * buffer)
}
}
seek_entry = g_new (GstXingSeekEntry, 1);
seek_entry = gst_xing_seek_entry_new ();
seek_entry->timestamp =
(xing->duration == GST_CLOCK_TIME_NONE) ? 0 : xing->duration;
/* Workaround for parsers checking that the first seek table entry is 0 */