[gst-devel] Linking elements in running state
Matthias Hardt
mhardt at diskohq.com
Thu Jan 6 17:43:41 CET 2011
Hello,
I'm trying to link elements to streams in an already running pipeline. Now the problem is, that these elements don't have the segments start/stop... times as they didn't receive the NEW_SEGMENT event, which was sent earlier.
Is it possible to have this event sent again?
For now I tried querying the segment from the pads parent element I'm linking to, but unfortunately I don't get the correct times. And the format is GST_FORMAT_BYTES although I requested GST_FORMAT_TIME.
Maybe I'm completely wrong and it can be done another way. Any help would be appreciated.
Here is the code I am using:
/* get segment times from stream pads parent element */
GstElement *el = gst_pad_get_parent_element(pad);
GstQuery* query = gst_query_new_segment(GST_FORMAT_TIME);
gboolean ret = gst_element_query(el, query);
if(ret) {
GstFormat format;
gdouble rate;
gint64 start, stop;
gst_query_parse_segment(query, &rate, &format, &start, &stop);
gst_query_unref(query);
gint64 position;
if(!gst_element_query_position(el, &format, &position))
position = 0;
gst_pad_push_event (pad, gst_event_new_new_segment (FALSE,
rate, format, start, stop, position));
printf("configured NEWSEGMENT rate %lf, format %d, %"
GST_TIME_FORMAT " -- %" GST_TIME_FORMAT ", pos %"
GST_TIME_FORMAT "\n", rate, format, GST_TIME_ARGS(start),
GST_TIME_ARGS(stop), GST_TIME_ARGS(position));
}
gst_object_unref(el);
Best regards,
Matthias
More information about the gstreamer-devel
mailing list