+2008-05-19 Tim-Philipp Müller <tim.muller at collabora co uk>
+
+ * gst/typefind/gsttypefindfunctions.c: (data_scan_ctx_ensure_data),
+ (mpeg_sys_is_valid_pack):
+ Don't modify scan context when we return FALSE in ensure_data, so
+ it's possible to continue scanning, and we don't end up with a NULL
+ data pointer and a positive size, which might bite us the next time
+ we're called. Small constification.
+
2008-05-16 Sebastian Dröge <slomo@circular-chaos.org>
* gst/adder/gstadder.c:
typedef struct
{
guint64 offset;
- guint8 *data;
+ const guint8 *data;
gint size;
} DataScanCtx;
static inline gboolean
data_scan_ctx_ensure_data (GstTypeFind * tf, DataScanCtx * c, gint min_len)
{
+ const guint8 *data;
guint64 len;
if (G_LIKELY (c->size >= min_len))
return TRUE;
- c->data = gst_type_find_peek (tf, c->offset, DATA_SCAN_CTX_CHUNK_SIZE);
- if (G_LIKELY (c->data != NULL)) {
+ data = gst_type_find_peek (tf, c->offset, DATA_SCAN_CTX_CHUNK_SIZE);
+ if (G_LIKELY (data != NULL)) {
+ c->data = data;
c->size = DATA_SCAN_CTX_CHUNK_SIZE;
return TRUE;
}
len = min_len;
}
- c->data = gst_type_find_peek (tf, c->offset, len);
- if (c->data != NULL) {
+ data = gst_type_find_peek (tf, c->offset, len);
+ if (data != NULL) {
+ c->data = data;
c->size = len;
return TRUE;
}
#define MPEG2_MAX_SYS_HEADERS 5
static gboolean
-mpeg_sys_is_valid_pack (GstTypeFind * tf, guint8 * data, guint len,
+mpeg_sys_is_valid_pack (GstTypeFind * tf, const guint8 * data, guint len,
guint * pack_size)
{
/* Check the pack header @ offset for validity, assuming that the 4 byte header