summaryrefslogtreecommitdiff
path: root/gst/mpegtsdemux
diff options
context:
space:
mode:
authorEdward Hervey <edward.hervey@collabora.co.uk>2011-07-15 12:08:40 +0200
committerEdward Hervey <bilboed@bilboed.com>2011-07-16 12:27:50 +0200
commitb73679e13d23d39c9e34bb01909bf42649ea6dda (patch)
tree1bdc4b48de94dbb2b297dbaa2ddfe62b47969b9f /gst/mpegtsdemux
parentf054eab77e24051fd9ff733c873e62f236a1dc11 (diff)
mpegtsbase: Store incoming newsegments
Diffstat (limited to 'gst/mpegtsdemux')
-rw-r--r--gst/mpegtsdemux/mpegtsbase.c26
-rw-r--r--gst/mpegtsdemux/mpegtsbase.h5
2 files changed, 27 insertions, 4 deletions
diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c
index 463090a29..e5bf6834d 100644
--- a/gst/mpegtsdemux/mpegtsbase.c
+++ b/gst/mpegtsdemux/mpegtsbase.c
@@ -210,6 +210,8 @@ mpegts_base_reset (MpegTSBase * base)
/* base->pat = NULL; */
/* pmt pids will be added and removed dynamically */
+ gst_segment_init (&base->segment, GST_FORMAT_UNDEFINED);
+
if (klass->reset)
klass->reset (base);
}
@@ -241,6 +243,8 @@ mpegts_base_init (MpegTSBase * base, MpegTSBaseClass * klass)
base->mode = BASE_MODE_STREAMING;
base->seen_pat = FALSE;
base->first_pat_offset = -1;
+
+ gst_segment_init (&base->segment, GST_FORMAT_UNDEFINED);
}
static void
@@ -1008,7 +1012,7 @@ mpegts_base_get_tags_from_eit (MpegTSBase * base, GstStructure * eit_info)
static gboolean
mpegts_base_sink_event (GstPad * pad, GstEvent * event)
{
- gboolean res;
+ gboolean res = TRUE;
MpegTSBase *base = GST_MPEGTS_BASE (gst_object_get_parent (GST_OBJECT (pad)));
GST_WARNING_OBJECT (base, "Got event %s",
@@ -1016,11 +1020,27 @@ mpegts_base_sink_event (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:
- /* FIXME : STORE NEW SEGMENT ! */
+ {
+ gboolean update;
+ gdouble rate, applied_rate;
+ GstFormat format;
+ gint64 start, stop, position;
+
+ gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
+ &format, &start, &stop, &position);
+ GST_DEBUG_OBJECT (base,
+ "Segment update:%d, rate:%f, applied_rate:%f, format:%s", update,
+ rate, applied_rate, gst_format_get_name (format));
+ GST_DEBUG_OBJECT (base,
+ " start:%" G_GINT64_FORMAT ", stop:%" G_GINT64_FORMAT
+ ", position:%" G_GINT64_FORMAT, start, stop, position);
+ gst_segment_set_newsegment_full (&base->segment, update, rate,
+ applied_rate, format, start, stop, position);
gst_event_unref (event);
- res = FALSE;
+ }
break;
case GST_EVENT_FLUSH_START:
+ gst_segment_init (&base->segment, GST_FORMAT_UNDEFINED);
mpegts_packetizer_flush (base->packetizer);
/* Passthrough */
default:
diff --git a/gst/mpegtsdemux/mpegtsbase.h b/gst/mpegtsdemux/mpegtsbase.h
index 44ea90a11..719af7bfd 100644
--- a/gst/mpegtsdemux/mpegtsbase.h
+++ b/gst/mpegtsdemux/mpegtsbase.h
@@ -120,8 +120,11 @@ struct _MpegTSBase {
/* Whether we saw a PAT yet */
gboolean seen_pat;
- /*Offset from the origin to the first PAT (pullmode) */
+ /* Offset from the origin to the first PAT (pullmode) */
guint64 first_pat_offset;
+
+ /* Upstream segment */
+ GstSegment segment;
};
struct _MpegTSBaseClass {