From: <tp...@ke...> - 2006-10-30 16:18:39
|
CVS Root: /cvs/gstreamer Module: gst-plugins-good Changes by: tpm Date: Mon Oct 30 2006 16:18:30 UTC Log message: Patch by: Michal Benes <michal dot benes at itonis tv> * gst/matroska/matroska-demux.c: (gst_matroska_demux_encoding_cmp), (gst_matroska_demux_read_track_encodings), (gst_matroska_decode_buffer): Fix several issues with encoded/compressed/encrypted/signed tracks; also, remove superfluous newline characters from some debug statements. (#366155) Modified files: . : ChangeLog gst/matroska : matroska-demux.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ChangeLog.diff?r1=1.2601&r2=1.2602 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/gst/matroska/matroska-demux.c.diff?r1=1.87&r2=1.88 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-good/ChangeLog,v retrieving revision 1.2601 retrieving revision 1.2602 diff -u -d -r1.2601 -r1.2602 --- ChangeLog 30 Oct 2006 09:24:53 -0000 1.2601 +++ ChangeLog 30 Oct 2006 16:18:18 -0000 1.2602 @@ -1,3 +1,14 @@ +2006-10-30 Tim-Philipp Müller <tim at centricular dot net> + + Patch by: Michal Benes <michal dot benes at itonis tv> + * gst/matroska/matroska-demux.c: (gst_matroska_demux_encoding_cmp), + (gst_matroska_demux_read_track_encodings), + (gst_matroska_decode_buffer): + Fix several issues with encoded/compressed/encrypted/signed tracks; + also, remove superfluous newline characters from some debug + statements. (#366155) 2006-10-30 Wim Taymans <wi...@fl...> * ext/jpeg/gstjpegenc.c: (gst_jpegenc_getcaps): Index: matroska-demux.c RCS file: /cvs/gstreamer/gst-plugins-good/gst/matroska/matroska-demux.c,v retrieving revision 1.87 retrieving revision 1.88 diff -u -d -r1.87 -r1.88 --- matroska-demux.c 5 Oct 2006 16:37:33 -0000 1.87 +++ matroska-demux.c 30 Oct 2006 16:18:18 -0000 1.88 @@ -313,6 +313,18 @@ return -1; } +static gint +gst_matroska_demux_encoding_cmp (gconstpointer a, gconstpointer b) +{ + const GstMatroskaTrackEncoding *enc_a; + const GstMatroskaTrackEncoding *enc_b; + enc_a = (const GstMatroskaTrackEncoding *) a; + enc_b = (const GstMatroskaTrackEncoding *) b; + return (gint) enc_b->order - (gint) enc_a->order; +} static gboolean gst_matroska_demux_read_track_encodings (GstEbmlRead * ebml, GstMatroskaDemux * demux, GstMatroskaTrackContext * context) @@ -485,6 +497,9 @@ } } + /* Sort encodings according to their order */ + g_array_sort (context->encodings, gst_matroska_demux_encoding_cmp); return res; @@ -2476,17 +2491,21 @@ gst_matroska_decode_buffer (GstMatroskaTrackContext * context, GstBuffer * buf) { gint i; - guint8 *new_data = NULL; - guint new_size = 0; - GstBuffer *res; g_assert (context->encodings != NULL); for (i = 0; i < context->encodings->len; i++) { GstMatroskaTrackEncoding *enc; + guint8 *new_data = NULL; + guint new_size = 0; + GstBuffer *new_buf; enc = &g_array_index (context->encodings, GstMatroskaTrackEncoding, i); + /* Currently only compression is supported */ + if (enc->type != 0) + break; /* FIXME: use enc->scope ? */ if (enc->comp_algo == 0) { @@ -2501,8 +2520,8 @@ zstream.zfree = (free_func) 0; zstream.opaque = (voidpf) 0; if (inflateInit (&zstream) != Z_OK) { - GST_WARNING ("zlib initialization failed.\n"); - return buf; + GST_WARNING ("zlib initialization failed."); + break; } zstream.next_in = (Bytef *) GST_BUFFER_DATA (buf); zstream.avail_in = orig_size; @@ -2515,10 +2534,10 @@ zstream.next_out = (Bytef *) (new_data + zstream.total_out); result = inflate (&zstream, Z_NO_FLUSH); if (result != Z_OK && result != Z_STREAM_END) { - GST_WARNING ("zlib decompression failed.\n"); + GST_WARNING ("zlib decompression failed."); g_free (new_data); inflateEnd (&zstream); - return buf; + break; } zstream.avail_out += 4000; } while (zstream.avail_out == 4000 && @@ -2528,25 +2547,34 @@ inflateEnd (&zstream); #else GST_WARNING ("GZIP encoded tracks not supported."); - return buf; #endif } else if (enc->comp_algo == 1) { GST_WARNING ("BZIP encoded tracks not supported."); } else if (enc->comp_algo == 2) { GST_WARNING ("LZO encoded tracks not supported."); + } else if (enc->comp_algo == 3) { + GST_WARNING ("Header-stripped tracks not supported."); + } else { + g_assert_not_reached (); - } - res = gst_buffer_new (); - GST_BUFFER_MALLOCDATA (res) = (guint8 *) new_data; - GST_BUFFER_DATA (res) = (guint8 *) new_data; - GST_BUFFER_SIZE (res) = new_size; - gst_buffer_stamp (res, buf); + g_assert (new_data != NULL); - gst_buffer_unref (buf); - return res; + new_buf = gst_buffer_new (); + GST_BUFFER_MALLOCDATA (new_buf) = (guint8 *) new_data; + GST_BUFFER_DATA (new_buf) = (guint8 *) new_data; + GST_BUFFER_SIZE (new_buf) = new_size; + gst_buffer_stamp (new_buf, buf); + gst_buffer_unref (buf); + buf = new_buf; + } + return buf; |