summaryrefslogtreecommitdiffstats
path: root/gst/matroska/ebml-write.c
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-06-04 07:36:07 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-06-04 07:36:07 +0000
commit636372f384aa97213c588ddfe0be05b92a83e2f6 (patch)
tree8b93a9e91d4996cf2ee2e30b5b3ee2f9486f8624 /gst/matroska/ebml-write.c
parent1169ebe7890801ef140c80ca147da6272ff5a8a5 (diff)
gst/matroska/ebml-write.c: Unref the write cache in finalize if it was set and add add "FIXME" to a comment that need...
Original commit message from CVS: * gst/matroska/ebml-write.c: (gst_ebml_write_finalize), (gst_ebml_write_set_cache): Unref the write cache in finalize if it was set and add add "FIXME" to a comment that needs it.
Diffstat (limited to 'gst/matroska/ebml-write.c')
-rw-r--r--gst/matroska/ebml-write.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gst/matroska/ebml-write.c b/gst/matroska/ebml-write.c
index ca08613b..7bc5a75d 100644
--- a/gst/matroska/ebml-write.c
+++ b/gst/matroska/ebml-write.c
@@ -71,6 +71,11 @@ gst_ebml_write_finalize (GObject * object)
gst_object_unref (ebml->srcpad);
+ if (ebml->cache) {
+ gst_buffer_unref (ebml->cache);
+ ebml->cache = NULL;
+ }
+
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
@@ -153,7 +158,7 @@ gst_ebml_last_write_result (GstEbmlWrite * ebml)
void
gst_ebml_write_set_cache (GstEbmlWrite * ebml, guint size)
{
- /* This is currently broken. I don't know why yet. */
+ /* FIXME: This is currently broken. I don't know why yet. */
return;
g_return_if_fail (ebml->cache == NULL);
@@ -250,6 +255,7 @@ static void
gst_ebml_write_element_id (GstBuffer * buf, guint32 id)
{
guint8 *data = GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf);
+
guint bytes = 4, mask = 0x10;
/* get ID length */
@@ -285,6 +291,7 @@ static void
gst_ebml_write_element_size (GstBuffer * buf, guint64 size)
{
guint8 *data = GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf);
+
guint bytes = 1, mask = 0x80;
if (size != GST_EBML_SIZE_UNKNOWN) {
@@ -474,6 +481,7 @@ void
gst_ebml_write_uint (GstEbmlWrite * ebml, guint32 id, guint64 num)
{
GstBuffer *buf = gst_ebml_write_element_new (ebml, sizeof (num));
+
guint size = gst_ebml_write_get_uint_size (num);
/* write */
@@ -502,6 +510,7 @@ gst_ebml_write_sint (GstEbmlWrite * ebml, guint32 id, gint64 num)
* have a number (-)0x8000 (G_MINSHORT), then my abs()<<1
* will be 0x10000; this is G_MAXUSHORT+1! So: if (<0) -1. */
guint64 unum = (num < 0 ? (-num - 1) << 1 : num << 1);
+
guint size = gst_ebml_write_get_uint_size (unum);
/* make unsigned */
@@ -563,6 +572,7 @@ void
gst_ebml_write_ascii (GstEbmlWrite * ebml, guint32 id, const gchar * str)
{
gint len = strlen (str) + 1; /* add trailing '\0' */
+
GstBuffer *buf = gst_ebml_write_element_new (ebml, len);
gst_ebml_write_element_id (buf, id);
@@ -618,6 +628,7 @@ guint64
gst_ebml_write_master_start (GstEbmlWrite * ebml, guint32 id)
{
guint64 pos = ebml->pos, t;
+
GstBuffer *buf = gst_ebml_write_element_new (ebml, 0);
t = GST_BUFFER_SIZE (buf);
@@ -641,6 +652,7 @@ void
gst_ebml_write_master_finish (GstEbmlWrite * ebml, guint64 startpos)
{
guint64 pos = ebml->pos;
+
GstBuffer *buf;
gst_ebml_write_seek (ebml, startpos);
@@ -734,6 +746,7 @@ void
gst_ebml_replace_uint (GstEbmlWrite * ebml, guint64 pos, guint64 num)
{
guint64 oldpos = ebml->pos;
+
GstBuffer *buf = gst_buffer_new_and_alloc (8);
gst_ebml_write_seek (ebml, pos);