2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-22 23:26:48 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2003-11-07 12:46:51 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
/*#define GST_DEBUG_ENABLED */
|
2004-07-27 21:51:28 +00:00
|
|
|
#include "gstmpegpacketize.h"
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
GstMPEGPacketize *
|
|
|
|
gst_mpeg_packetize_new (GstPad * pad, GstMPEGPacketizeType type)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GstMPEGPacketize *new;
|
|
|
|
|
2001-12-23 22:37:07 +00:00
|
|
|
g_return_val_if_fail (pad != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
new = g_malloc (sizeof (GstMPEGPacketize));
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2001-12-23 22:37:07 +00:00
|
|
|
gst_object_ref (GST_OBJECT (pad));
|
2003-01-06 19:13:49 +00:00
|
|
|
new->resync = TRUE;
|
2001-12-22 23:26:48 +00:00
|
|
|
new->id = 0;
|
2001-12-23 22:37:07 +00:00
|
|
|
new->pad = pad;
|
|
|
|
new->bs = gst_bytestream_new (pad);
|
2001-12-22 23:26:48 +00:00
|
|
|
new->MPEG2 = FALSE;
|
2001-12-31 03:03:05 +00:00
|
|
|
new->type = type;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mpeg_packetize_destroy (GstMPEGPacketize * packetize)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (packetize != NULL);
|
|
|
|
|
2001-12-23 22:37:07 +00:00
|
|
|
gst_bytestream_destroy (packetize->bs);
|
|
|
|
gst_object_unref (GST_OBJECT (packetize->pad));
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
g_free (packetize);
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstData *
|
|
|
|
parse_packhead (GstMPEGPacketize * packetize)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
gint length = 8 + 4;
|
|
|
|
guint8 *buf;
|
|
|
|
GstBuffer *outbuf;
|
2002-05-15 19:08:16 +00:00
|
|
|
guint32 got_bytes;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("packetize: in parse_packhead");
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2002-05-15 19:08:16 +00:00
|
|
|
got_bytes = gst_bytestream_peek_bytes (packetize->bs, &buf, length);
|
2003-01-19 13:42:43 +00:00
|
|
|
if (got_bytes < length)
|
|
|
|
return NULL;
|
2003-03-28 17:33:20 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 4;
|
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("code %02x", *buf);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
/* start parsing the stream */
|
2003-08-13 21:15:03 +00:00
|
|
|
if ((*buf & 0xc0) == 0x40) {
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("packetize::parse_packhead setting mpeg2");
|
2001-12-22 23:26:48 +00:00
|
|
|
packetize->MPEG2 = TRUE;
|
|
|
|
length += 2;
|
2002-05-15 19:08:16 +00:00
|
|
|
got_bytes = gst_bytestream_peek_bytes (packetize->bs, &buf, length);
|
2003-01-19 13:42:43 +00:00
|
|
|
if (got_bytes < length)
|
|
|
|
return NULL;
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("packetize::parse_packhead setting mpeg1");
|
2001-12-22 23:26:48 +00:00
|
|
|
packetize->MPEG2 = FALSE;
|
|
|
|
}
|
|
|
|
|
2002-05-15 19:08:16 +00:00
|
|
|
got_bytes = gst_bytestream_read (packetize->bs, &outbuf, length);
|
2003-01-19 13:42:43 +00:00
|
|
|
if (got_bytes < length)
|
|
|
|
return NULL;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
return GST_DATA (outbuf);
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstData *
|
|
|
|
parse_end (GstMPEGPacketize * packetize)
|
2003-03-28 17:33:20 +00:00
|
|
|
{
|
|
|
|
guint32 got_bytes;
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
|
|
|
|
got_bytes = gst_bytestream_read (packetize->bs, &outbuf, 4);
|
|
|
|
if (got_bytes < 4)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return GST_DATA (outbuf);
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static inline GstData *
|
|
|
|
parse_generic (GstMPEGPacketize * packetize)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GstByteStream *bs = packetize->bs;
|
|
|
|
guchar *buf;
|
|
|
|
GstBuffer *outbuf;
|
2002-05-15 19:08:16 +00:00
|
|
|
guint32 got_bytes;
|
2003-01-19 13:42:43 +00:00
|
|
|
gint16 length = 6;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("packetize: in parse_generic");
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
got_bytes = gst_bytestream_peek_bytes (bs, (guint8 **) & buf, length);
|
|
|
|
if (got_bytes < 6)
|
2003-01-19 13:42:43 +00:00
|
|
|
return NULL;
|
2003-03-28 17:33:20 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
buf += 4;
|
|
|
|
|
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
|
|
|
length += GST_READ_UINT16_BE (buf);
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("packetize: header_length %d", length);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2003-01-19 13:42:43 +00:00
|
|
|
got_bytes = gst_bytestream_read (packetize->bs, &outbuf, length);
|
2004-03-14 22:34:30 +00:00
|
|
|
if (got_bytes < length)
|
2003-01-19 13:42:43 +00:00
|
|
|
return NULL;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
return GST_DATA (outbuf);
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static inline GstData *
|
|
|
|
parse_chunk (GstMPEGPacketize * packetize)
|
2001-12-31 03:03:05 +00:00
|
|
|
{
|
|
|
|
GstByteStream *bs = packetize->bs;
|
|
|
|
guchar *buf;
|
|
|
|
gint offset;
|
|
|
|
guint32 code;
|
2003-01-19 13:42:43 +00:00
|
|
|
gint chunksize;
|
2001-12-31 03:03:05 +00:00
|
|
|
GstBuffer *outbuf = NULL;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
chunksize = gst_bytestream_peek_bytes (bs, (guint8 **) & buf, 4096);
|
2003-01-19 13:42:43 +00:00
|
|
|
if (chunksize == 0)
|
2003-03-28 17:33:20 +00:00
|
|
|
return NULL;
|
|
|
|
|
2001-12-31 03:03:05 +00:00
|
|
|
offset = 4;
|
|
|
|
|
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
|
|
|
code = GST_READ_UINT32_BE (buf + offset);
|
2001-12-31 03:03:05 +00:00
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("code = %08x", code);
|
2001-12-31 03:03:05 +00:00
|
|
|
|
|
|
|
while ((code & 0xffffff00) != 0x100L) {
|
|
|
|
code = (code << 8) | buf[offset++];
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG (" code = %08x", code);
|
2001-12-31 03:03:05 +00:00
|
|
|
|
2003-01-19 13:42:43 +00:00
|
|
|
if (offset == chunksize) {
|
2004-03-14 22:34:30 +00:00
|
|
|
chunksize =
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_bytestream_peek_bytes (bs, (guint8 **) & buf, offset + 4096);
|
2003-01-19 13:42:43 +00:00
|
|
|
if (chunksize == 0)
|
2004-03-15 19:32:25 +00:00
|
|
|
return NULL;
|
2003-01-19 13:42:43 +00:00
|
|
|
chunksize += offset;
|
2001-12-31 03:03:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (offset > 4) {
|
2004-03-14 22:34:30 +00:00
|
|
|
chunksize = gst_bytestream_read (bs, &outbuf, offset - 4);
|
2003-01-19 13:42:43 +00:00
|
|
|
if (chunksize == 0)
|
|
|
|
return NULL;
|
2001-12-31 03:03:05 +00:00
|
|
|
}
|
|
|
|
return GST_DATA (outbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
/* FIXME mmx-ify me */
|
|
|
|
static inline gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
find_start_code (GstMPEGPacketize * packetize)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GstByteStream *bs = packetize->bs;
|
|
|
|
guchar *buf;
|
|
|
|
gint offset;
|
|
|
|
guint32 code;
|
2003-01-19 13:42:43 +00:00
|
|
|
gint chunksize;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
chunksize = gst_bytestream_peek_bytes (bs, (guint8 **) & buf, 4096);
|
2003-03-28 17:33:20 +00:00
|
|
|
if (chunksize < 5)
|
2001-12-22 23:26:48 +00:00
|
|
|
return FALSE;
|
2003-03-28 17:33:20 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
offset = 4;
|
|
|
|
|
configure.ac: bump required gstreamer version to 0.8.1.1 because of following changes [--ds]
Original commit message from CVS:
reviewed by David Schleef
* configure.ac: bump required gstreamer version to 0.8.1.1
because of following changes [--ds]
* gst-libs/gst/riff/riff-read.c: Include gst/gstutils.h.
(gst_riff_peek_head, gst_riff_peek_list, gst_riff_read_list)
(gst_riff_read_header): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/typefind/gsttypefindfunctions.c: Include gst/gstutils.h.
(mp3_type_find): Use GST_READ_UINT*
macros to access possibly unaligned memory.
(mp3_type_find, mpeg1_parse_header, qt_type_find)
(speex_type_find): Likewise
* gst/tags/gstvorbistag.c: (ADVANCE): Likewise
* gst/qtdemux/qtdemux.c: Include stdlib.h (needed by realloc).
(QTDEMUX_GUINT32_GET, QTDEMUX_GUINT16_GET, QTDEMUX_FP32_GET)
(QTDEMUX_FP16_GET, QTDEMUX_FOURCC_GET)
(gst_qtdemux_loop_header, gst_qtdemux_loop_header)
(qtdemux_node_dump_foreach, qtdemux_tree_get_child_by_type)
(qtdemux_tree_get_sibling_by_type): Use GST_READ_UINT*
macros to access possibly unaligned memory.
* gst/mpegstream/gstmpegpacketize.c: (parse_generic, parse_chunk):
Likewise.
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead)
(gst_mpeg_demux_parse_packet, gst_mpeg_demux_parse_pes): Likewise.
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain):
Likewise.
* gst/mpeg2sub/gstmpeg2subt.c: (GST_BUFFER_DATA)
(gst_mpeg2subt_chain_subtitle): Likewise.
* gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq)
(gst_mp1videoparse_time_code, gst_mp1videoparse_real_chain):
Likewise.
* gst/mpeg1sys/buffer.c: (mpeg1mux_buffer_update_audio_info):
Likewise.
* gst/cdxaparse/gstcdxaparse.c: (gst_bytestream_peek_bytes):
Likewise.
* gst/asfdemux/gstasfdemux.c: (_read_var_length, _read_uint):
Likewise.
2004-04-20 21:04:22 +00:00
|
|
|
code = GST_READ_UINT32_BE (buf);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("code = %08x %p %08x", code, buf, chunksize);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
while ((code & 0xffffff00) != 0x100L) {
|
|
|
|
code = (code << 8) | buf[offset++];
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG (" code = %08x %p %08x", code, buf, chunksize);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
if (offset == chunksize) {
|
2003-01-19 13:42:43 +00:00
|
|
|
gst_bytestream_flush_fast (bs, offset);
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
chunksize = gst_bytestream_peek_bytes (bs, (guint8 **) & buf, 4096);
|
2003-01-19 13:42:43 +00:00
|
|
|
if (chunksize == 0)
|
2004-03-15 19:32:25 +00:00
|
|
|
return FALSE;
|
2003-01-19 13:42:43 +00:00
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
offset = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
packetize->id = code & 0xff;
|
|
|
|
if (offset > 4) {
|
2003-01-19 13:42:43 +00:00
|
|
|
gst_bytestream_flush_fast (bs, offset - 4);
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
GstData *
|
|
|
|
gst_mpeg_packetize_read (GstMPEGPacketize * packetize)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
gboolean got_event = FALSE;
|
|
|
|
GstData *outbuf = NULL;
|
|
|
|
|
2003-03-28 17:33:20 +00:00
|
|
|
g_return_val_if_fail (packetize != NULL, NULL);
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
while (outbuf == NULL) {
|
|
|
|
if (!find_start_code (packetize))
|
|
|
|
got_event = TRUE;
|
|
|
|
else {
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("packetize: have chunk 0x%02X", packetize->id);
|
2001-12-31 03:03:05 +00:00
|
|
|
if (packetize->type == GST_MPEG_PACKETIZE_SYSTEM) {
|
2004-03-15 19:32:25 +00:00
|
|
|
if (packetize->resync) {
|
|
|
|
if (packetize->id != PACK_START_CODE) {
|
|
|
|
gst_bytestream_flush_fast (packetize->bs, 4);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
packetize->resync = FALSE;
|
|
|
|
}
|
|
|
|
switch (packetize->id) {
|
|
|
|
case PACK_START_CODE:
|
|
|
|
outbuf = parse_packhead (packetize);
|
|
|
|
if (!outbuf)
|
|
|
|
got_event = TRUE;
|
|
|
|
break;
|
|
|
|
case SYS_HEADER_START_CODE:
|
|
|
|
outbuf = parse_generic (packetize);
|
|
|
|
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))) {
|
|
|
|
gst_bytestream_flush (packetize->bs, 4);
|
|
|
|
g_warning ("packetize: ******** unknown id 0x%02X",
|
|
|
|
packetize->id);
|
|
|
|
} else {
|
|
|
|
outbuf = parse_generic (packetize);
|
|
|
|
if (!outbuf)
|
|
|
|
got_event = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
} else if (packetize->type == GST_MPEG_PACKETIZE_VIDEO) {
|
2004-03-15 19:32:25 +00:00
|
|
|
outbuf = parse_chunk (packetize);
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2004-03-15 19:32:25 +00:00
|
|
|
g_assert_not_reached ();
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (got_event) {
|
|
|
|
guint32 remaining;
|
|
|
|
GstEvent *event;
|
|
|
|
gint etype;
|
|
|
|
|
|
|
|
gst_bytestream_get_status (packetize->bs, &remaining, &event);
|
2004-03-14 22:34:30 +00:00
|
|
|
etype = event ? GST_EVENT_TYPE (event) : GST_EVENT_EOS;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
switch (etype) {
|
2004-03-15 19:32:25 +00:00
|
|
|
case GST_EVENT_DISCONTINUOUS:
|
|
|
|
GST_DEBUG ("packetize: discont\n");
|
|
|
|
gst_bytestream_flush_fast (packetize->bs, remaining);
|
|
|
|
break;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return GST_DATA (event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return outbuf;
|
|
|
|
}
|