summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-01-23 10:11:44 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-01-23 10:11:44 +0000
commit960b1c5b08839e6e2727ae5fcad3c00be1916583 (patch)
tree14585b09b5a1c1e007fd0b9aa2ef846ecd8c52ec /gst
parent457fd5e1afef7b6e81471da2fb51deab85092659 (diff)
downloadgst-plugins-bad-960b1c5b08839e6e2727ae5fcad3c00be1916583.tar.gz
gst-plugins-bad-960b1c5b08839e6e2727ae5fcad3c00be1916583.tar.bz2
gst-plugins-bad-960b1c5b08839e6e2727ae5fcad3c00be1916583.zip
tests/check/: Add simple unit test for the xingmux element.
Original commit message from CVS: * tests/check/Makefile.am: * tests/check/elements/.cvsignore: * tests/check/elements/xingmux.c: (setup_xingmux), (cleanup_xingmux), (GST_START_TEST), (xingmux_suite), (main): * tests/check/elements/xingmux_testdata.h: Add simple unit test for the xingmux element. * gst/xingheader/gstxingmux.c: (generate_xing_header), (gst_xing_mux_finalize), (xing_reset): Fix a memleak and invalid seek tables with less than 100 MP3 frames.
Diffstat (limited to 'gst')
-rw-r--r--gst/xingheader/gstxingmux.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gst/xingheader/gstxingmux.c b/gst/xingheader/gstxingmux.c
index 76f11ec8..d10006cc 100644
--- a/gst/xingheader/gstxingmux.c
+++ b/gst/xingheader/gstxingmux.c
@@ -319,7 +319,7 @@ generate_xing_header (GstXingMux * xing)
GstXingSeekEntry *entry = (GstXingSeekEntry *) it->data;
gint64 byte;
- if ((entry->timestamp * 100) / duration >= percent) {
+ while ((entry->timestamp * 100) / duration >= percent) {
byte = (entry->byte * 256) / byte_count;
GST_DEBUG (" %d %% -- %d 1/256", percent, byte);
*data = byte;
@@ -327,6 +327,17 @@ generate_xing_header (GstXingMux * xing)
percent++;
}
}
+
+ if (percent < 100) {
+ guchar b = *(data - 1);
+ gint i;
+
+ for (i = percent; i < 100; i++) {
+ GST_DEBUG (" %d %% -- %d 1/256", i, b);
+ *data = b;
+ data++;
+ }
+ }
}
GST_DEBUG ("Setting Xing flags to 0x%x\n", *xing_flags);
@@ -376,6 +387,12 @@ gst_xing_mux_finalize (GObject * obj)
xing->adapter = NULL;
}
+ if (xing->seek_table) {
+ g_list_foreach (xing->seek_table, (GFunc) g_free, NULL);
+ g_list_free (xing->seek_table);
+ xing->seek_table = NULL;
+ }
+
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
@@ -389,6 +406,7 @@ xing_reset (GstXingMux * xing)
if (xing->seek_table) {
g_list_foreach (xing->seek_table, (GFunc) g_free, NULL);
+ g_list_free (xing->seek_table);
xing->seek_table = NULL;
}