gst/mpegstream/: Flush packetizer cache when we get a FLUSH_STOP event; remove unused source pad member from packetiz...

Original commit message from CVS:
* gst/mpegstream/gstmpegpacketize.c: (gst_mpeg_packetize_new),
(gst_mpeg_packetize_flush_cache), (gst_mpeg_packetize_destroy),
(gst_mpeg_packetize_read):
* gst/mpegstream/gstmpegpacketize.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_change_state):
Flush packetizer cache when we get a FLUSH_STOP event;
remove unused source pad member from packetizer; add debug
category for packetizer.
This commit is contained in:
Tim-Philipp Müller 2006-06-23 11:22:04 +00:00
parent d13b1e7003
commit 8daf179ca4
4 changed files with 41 additions and 38 deletions

View file

@ -1,3 +1,15 @@
2006-06-23 Tim-Philipp Müller <tim at centricular dot net>
* gst/mpegstream/gstmpegpacketize.c: (gst_mpeg_packetize_new),
(gst_mpeg_packetize_flush_cache), (gst_mpeg_packetize_destroy),
(gst_mpeg_packetize_read):
* gst/mpegstream/gstmpegpacketize.h:
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_process_event),
(gst_mpeg_parse_change_state):
Flush packetizer cache when we get a FLUSH_STOP event;
remove unused source pad member from packetizer; add debug
category for packetizer.
2006-06-23 Jan Schmidt <thaytan@mad.scientist.com> 2006-06-23 Jan Schmidt <thaytan@mad.scientist.com>
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (plugin_init): * ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (plugin_init):

View file

@ -25,21 +25,17 @@
#include "gstmpegpacketize.h" #include "gstmpegpacketize.h"
GST_DEBUG_CATEGORY_STATIC (gstmpegpacketize_debug);
#define GST_CAT_DEFAULT (gstmpegpacketize_debug)
GstMPEGPacketize * GstMPEGPacketize *
gst_mpeg_packetize_new (GstPad * srcpad, GstMPEGPacketizeType type) gst_mpeg_packetize_new (GstMPEGPacketizeType type)
{ {
GstMPEGPacketize *new; GstMPEGPacketize *new;
g_return_val_if_fail (srcpad != NULL, NULL); new = g_new0 (GstMPEGPacketize, 1);
g_return_val_if_fail (GST_IS_PAD (srcpad), NULL);
g_return_val_if_fail (GST_PAD_IS_SRC (srcpad), NULL);
gst_object_ref (GST_OBJECT (srcpad));
new = g_malloc (sizeof (GstMPEGPacketize));
new->resync = TRUE; new->resync = TRUE;
new->id = 0; new->id = 0;
new->srcpad = srcpad;
new->cache_head = 0; new->cache_head = 0;
new->cache_tail = 0; new->cache_tail = 0;
new->cache_size = 0x4000; new->cache_size = 0x4000;
@ -48,16 +44,31 @@ gst_mpeg_packetize_new (GstPad * srcpad, GstMPEGPacketizeType type)
new->MPEG2 = FALSE; new->MPEG2 = FALSE;
new->type = type; new->type = type;
if (gstmpegpacketize_debug == NULL) {
GST_DEBUG_CATEGORY_INIT (gstmpegpacketize_debug, "mpegpacketize", 0,
"MPEG parser element packetizer");
}
return new; return new;
} }
void
gst_mpeg_packetize_flush_cache (GstMPEGPacketize * packetize)
{
g_return_if_fail (packetize != NULL);
packetize->resync = TRUE;
packetize->cache_head = 0;
packetize->cache_tail = 0;
GST_DEBUG ("flushed packetize cache");
}
void void
gst_mpeg_packetize_destroy (GstMPEGPacketize * packetize) gst_mpeg_packetize_destroy (GstMPEGPacketize * packetize)
{ {
g_return_if_fail (packetize != NULL); g_return_if_fail (packetize != NULL);
gst_object_unref (GST_OBJECT (packetize->srcpad));
g_free (packetize->cache); g_free (packetize->cache);
g_free (packetize); g_free (packetize);
} }
@ -333,26 +344,5 @@ gst_mpeg_packetize_read (GstMPEGPacketize * packetize, GstBuffer ** outbuf)
} }
} }
#if 0
/* TODO: flush cache when newsegment is received */
if (got_event) {
guint32 remaining;
GstEvent *event;
gint etype;
gst_bytestream_get_status (packetize->bs, &remaining, &event);
etype = event ? GST_EVENT_TYPE (event) : GST_EVENT_EOS;
switch (etype) {
case GST_EVENT_NEWSEGMENT:
GST_DEBUG ("packetize: discont\n");
gst_bytestream_flush_fast (packetize->bs, remaining);
break;
}
return GST_MINI_OBJECT (event);
}
#endif
g_assert_not_reached (); g_assert_not_reached ();
} }

View file

@ -54,7 +54,6 @@ struct _GstMPEGPacketize {
/* current parse state */ /* current parse state */
guchar id; guchar id;
GstPad *srcpad;
GstMPEGPacketizeType type; GstMPEGPacketizeType type;
guint8 *cache; /* cache for incoming data */ guint8 *cache; /* cache for incoming data */
@ -67,9 +66,11 @@ struct _GstMPEGPacketize {
gboolean resync; gboolean resync;
}; };
GstMPEGPacketize* gst_mpeg_packetize_new (GstPad *pad, GstMPEGPacketizeType type); GstMPEGPacketize* gst_mpeg_packetize_new (GstMPEGPacketizeType type);
void gst_mpeg_packetize_destroy (GstMPEGPacketize *packetize); void gst_mpeg_packetize_destroy (GstMPEGPacketize *packetize);
void gst_mpeg_packetize_flush_cache (GstMPEGPacketize *packetize);
guint64 gst_mpeg_packetize_tell (GstMPEGPacketize *packetize); guint64 gst_mpeg_packetize_tell (GstMPEGPacketize *packetize);
void gst_mpeg_packetize_put (GstMPEGPacketize *packetize, GstBuffer * buf); void gst_mpeg_packetize_put (GstMPEGPacketize *packetize, GstBuffer * buf);
GstFlowReturn gst_mpeg_packetize_read (GstMPEGPacketize *packetize, GstBuffer ** outbuf); GstFlowReturn gst_mpeg_packetize_read (GstMPEGPacketize *packetize, GstBuffer ** outbuf);

View file

@ -394,7 +394,7 @@ gst_mpeg_parse_process_event (GstMPEGParse * mpeg_parse, GstEvent * event)
ret = TRUE; ret = TRUE;
break; break;
} }
case GST_EVENT_FLUSH_STOP: case GST_EVENT_FLUSH_STOP:{
/* Forward the event. */ /* Forward the event. */
if (CLASS (mpeg_parse)->send_event) { if (CLASS (mpeg_parse)->send_event) {
ret = CLASS (mpeg_parse)->send_event (mpeg_parse, event); ret = CLASS (mpeg_parse)->send_event (mpeg_parse, event);
@ -404,8 +404,9 @@ gst_mpeg_parse_process_event (GstMPEGParse * mpeg_parse, GstEvent * event)
/* Reset the internal fields. */ /* Reset the internal fields. */
gst_mpeg_parse_reset (mpeg_parse); gst_mpeg_parse_reset (mpeg_parse);
gst_mpeg_packetize_flush_cache (mpeg_parse->packetize);
break; break;
}
default: default:
if (CLASS (mpeg_parse)->send_event) { if (CLASS (mpeg_parse)->send_event) {
ret = CLASS (mpeg_parse)->send_event (mpeg_parse, event); ret = CLASS (mpeg_parse)->send_event (mpeg_parse, event);
@ -1232,8 +1233,7 @@ gst_mpeg_parse_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
if (!mpeg_parse->packetize) { if (!mpeg_parse->packetize) {
mpeg_parse->packetize = mpeg_parse->packetize =
gst_mpeg_packetize_new (mpeg_parse->srcpad, gst_mpeg_packetize_new (GST_MPEG_PACKETIZE_SYSTEM);
GST_MPEG_PACKETIZE_SYSTEM);
} }
/* Initialize parser state */ /* Initialize parser state */