}
static GstData*
-parse_packhead (GstMPEGPacketize * packetize)
+parse_packhead (GstMPEGPacketize *packetize)
{
gint length = 8 + 4;
guint8 *buf;
got_bytes = gst_bytestream_peek_bytes (packetize->bs, &buf, length);
if (got_bytes < length)
return NULL;
+
buf += 4;
GST_DEBUG (0, "code %02x", *buf);
return GST_DATA (outbuf);
}
+static GstData*
+parse_end (GstMPEGPacketize *packetize)
+{
+ guint32 got_bytes;
+ GstBuffer *outbuf;
+
+ got_bytes = gst_bytestream_read (packetize->bs, &outbuf, 4);
+ if (got_bytes < 4)
+ return NULL;
+
+ return GST_DATA (outbuf);
+}
+
static inline GstData*
parse_generic (GstMPEGPacketize *packetize)
{
got_bytes = gst_bytestream_peek_bytes (bs, (guint8**)&buf, length);
if (got_bytes < 6)
return NULL;
+
buf += 4;
length += GUINT16_FROM_BE (*(guint16 *) buf);
chunksize = gst_bytestream_peek_bytes (bs, (guint8**)&buf, 4096);
if (chunksize == 0)
- return FALSE;
+ return NULL;
+
offset = 4;
code = GUINT32_FROM_BE (*((guint32 *)(buf+offset)));
gint chunksize;
chunksize = gst_bytestream_peek_bytes (bs, (guint8**)&buf, 4096);
- if (chunksize == 0)
+ if (chunksize < 5)
return FALSE;
+
offset = 4;
code = GUINT32_FROM_BE (*((guint32 *)(buf)));
- GST_DEBUG (0, "code = %08x", code);
+ GST_DEBUG (0, "code = %08x %p %08x", code, buf, chunksize);
while ((code & 0xffffff00) != 0x100L) {
code = (code << 8) | buf[offset++];
- GST_DEBUG (0, " code = %08x", code);
+ GST_DEBUG (0, " code = %08x %p %08x", code, buf, chunksize);
if (offset == chunksize) {
gst_bytestream_flush_fast (bs, offset);
gboolean got_event = FALSE;
GstData *outbuf = NULL;
+ g_return_val_if_fail (packetize != NULL, NULL);
+
while (outbuf == NULL) {
if (!find_start_code (packetize))
got_event = TRUE;
if (!outbuf)
got_event = TRUE;
break;
+ case ISO11172_END_START_CODE:
+ outbuf = parse_end (packetize);
+ if (!outbuf)
+ got_event = TRUE;
+ break;
default:
if (packetize->MPEG2 && ((packetize->id < 0xBD) || (packetize->id > 0xFE))) {
g_warning ("packetize: ******** unknown id 0x%02X",packetize->id);