gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse): gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_reset) (gst_mpeg_...

Original commit message from CVS:
2006-01-19  Martin Soto  <martinsoto@users.sourceforge.net>

* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_reset)
(gst_mpeg_parse_process_event, gst_mpeg_parse_parse_packhead)
(gst_mpeg_parse_change_state):
Make timestamp adjustment somewhat milder. Actual timestamps are
now sent unmodified unless an actual gap is found in the
stream. This should fix time display when playing most MPEG
files.
This commit is contained in:
Martin Soto 2006-01-19 21:32:05 +00:00
parent 82e24850a2
commit b34e7d995b
3 changed files with 34 additions and 12 deletions

View file

@ -1,3 +1,14 @@
2006-01-19 Martin Soto <martinsoto@users.sourceforge.net>
* gst/mpegstream/gstmpegparse.h (struct _GstMPEGParse):
* gst/mpegstream/gstmpegparse.c (gst_mpeg_parse_reset)
(gst_mpeg_parse_process_event, gst_mpeg_parse_parse_packhead)
(gst_mpeg_parse_change_state):
Make timestamp adjustment somewhat milder. Actual timestamps are
now sent unmodified unless an actual gap is found in the
stream. This should fix time display when playing most MPEG
files.
2006-01-18 Edward Hervey <edward@fluendo.com>
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_subbuffer):

View file

@ -273,6 +273,7 @@ gst_mpeg_parse_reset (GstMPEGParse * mpeg_parse)
mpeg_parse->current_ts = 0;
mpeg_parse->do_adjust = TRUE;
mpeg_parse->pending_newsegment = TRUE;
mpeg_parse->adjust = 0;
/* Initialize the current segment. */
@ -374,6 +375,8 @@ gst_mpeg_parse_process_event (GstMPEGParse * mpeg_parse, GstEvent * event)
"Updating current segment with newsegment");
gst_segment_set_newsegment (&mpeg_parse->current_segment,
update, rate, format, start, stop, time);
gst_segment_set_newsegment (&mpeg_parse->current_segment,
update, rate, format, start, stop, time);
if (!update) {
/* Send a newsegment event for the new current segment. */
@ -399,12 +402,6 @@ gst_mpeg_parse_process_event (GstMPEGParse * mpeg_parse, GstEvent * event)
gst_event_unref (event);
}
/* Send a newsegment event to restart counting from 0. */
if (CLASS (mpeg_parse)->send_event) {
CLASS (mpeg_parse)->send_event (mpeg_parse,
gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
}
/* Reset the internal fields. */
gst_mpeg_parse_reset (mpeg_parse);
@ -532,6 +529,22 @@ gst_mpeg_parse_parse_packhead (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
prev_scr = mpeg_parse->current_scr;
mpeg_parse->current_scr = scr;
if (mpeg_parse->do_adjust && mpeg_parse->pending_newsegment) {
/* Open a new segment. */
gst_segment_set_newsegment (&mpeg_parse->current_segment,
FALSE, 1.0, GST_FORMAT_TIME, MPEGTIME_TO_GSTTIME (scr), -1,
MPEGTIME_TO_GSTTIME (scr));
CLASS (mpeg_parse)->send_event (mpeg_parse,
gst_event_new_new_segment (FALSE, mpeg_parse->current_segment.rate,
GST_FORMAT_TIME, mpeg_parse->current_segment.start, -1,
mpeg_parse->current_segment.time));
mpeg_parse->pending_newsegment = FALSE;
/* The first SCR seen should not lead to timestamp adjustment. */
mpeg_parse->next_scr = scr;
}
if (mpeg_parse->next_scr == MP_INVALID_SCR) {
mpeg_parse->next_scr = mpeg_parse->current_scr;
}
@ -1216,12 +1229,6 @@ gst_mpeg_parse_change_state (GstElement * element, GstStateChange transition)
/* Initialize parser state */
gst_mpeg_parse_reset (mpeg_parse);
/* Send a newsegment event to start counting from 0. */
if (CLASS (mpeg_parse)->send_event) {
CLASS (mpeg_parse)->send_event (mpeg_parse,
gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
}
break;
default:
break;

View file

@ -83,6 +83,10 @@ struct _GstMPEGParse
the 'adjust' attribute. */
gint64 adjust; /* Value added to SCR values to
produce buffer timestamps */
gboolean pending_newsegment; /* The element should send a
newsegment event as soon as it sees
the next SCR. This option is only
meaningful in do_adjust mode. */
gint max_scr_gap; /* The maximum allowed SCR gap without
making a timestamp adjustment */
GstSegment current_segment; /* Segment currently being played. */