typedef struct
{
/* Offset Size Description Value
- * 0x00 4 Chunk ID "labl" (0x6C61626C)
- * 0x04 4 Chunk Data Size depends on contained text
* 0x08 4 Cue Point ID 0 - 0xFFFFFFFF
* 0x0c Text
*/
- guint32 chunk_id;
- guint32 chunk_data_size;
guint32 cue_point_id;
gchar *text;
} GstWavParseLabl;
GList *cues = NULL;
GstWavParseCue *cue;
- GST_OBJECT_LOCK (wav);
if (wav->cues) {
- GST_OBJECT_UNLOCK (wav);
GST_WARNING_OBJECT (wav, "found another cue's");
return TRUE;
}
ncues = GST_READ_UINT32_LE (data);
- if (size != 4 + ncues * 24) {
- GST_WARNING_OBJECT (wav, "broken file");
+ if (size < 4 + ncues * 24) {
+ GST_WARNING_OBJECT (wav, "broken file %d %d", size, ncues);
return FALSE;
}
}
wav->cues = cues;
- GST_OBJECT_UNLOCK (wav);
return TRUE;
}
{
GstWavParseLabl *labl;
+ if (size < 5)
+ return FALSE;
+
labl = g_new0 (GstWavParseLabl, 1);
/* parse data */
- labl->chunk_id = GST_READ_UINT32_LE (data);
- labl->chunk_data_size = GST_READ_UINT32_LE (data + 4);
- labl->cue_point_id = GST_READ_UINT32_LE (data + 8);
- labl->text = (gchar *) g_new (gchar *, labl->chunk_data_size + 1);
- memcpy (labl->text, data + 12, labl->chunk_data_size);
+ data += 8;
+ labl->cue_point_id = GST_READ_UINT32_LE (data);
+ labl->text = (gchar *) g_new0 (gchar *, size - 4 + 1);
+ memcpy (labl->text, data + 4, size - 4);
- GST_OBJECT_LOCK (wav);
wav->labls = g_list_append (wav->labls, labl);
- GST_OBJECT_UNLOCK (wav);
return TRUE;
}
GST_INFO_OBJECT (wav, "pos query at %" G_GINT64_FORMAT, curb);
switch (format) {
- case GST_FORMAT_TIME:
- res = gst_wavparse_pad_convert (pad, GST_FORMAT_BYTES, curb,
- &format, &cur);
- break;
- default:
+ case GST_FORMAT_BYTES:
format = GST_FORMAT_BYTES;
cur = curb;
break;
+ default:
+ res = gst_wavparse_pad_convert (pad, GST_FORMAT_BYTES, curb,
+ &format, &cur);
+ break;
}
if (res)
gst_query_set_position (query, format, cur);
gst_query_parse_duration (query, &format, NULL);
switch (format) {
- case GST_FORMAT_TIME:{
+ case GST_FORMAT_BYTES:{
+ format = GST_FORMAT_BYTES;
+ duration = wav->datasize;
+ break;
+ }
+ case GST_FORMAT_TIME:
if ((res = gst_wavparse_calculate_duration (wav))) {
duration = wav->duration;
}
break;
- }
default:
- format = GST_FORMAT_BYTES;
- duration = wav->datasize;
+ res = FALSE;
break;
}
- gst_query_set_duration (query, format, duration);
+ if (res)
+ gst_query_set_duration (query, format, duration);
break;
}
case GST_QUERY_CONVERT: