summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Crete <olivier.crete@collabora.co.uk>2008-05-01 18:25:54 +0000
committerEdward Hervey <bilboed@bilboed.com>2009-02-17 19:29:05 +0100
commit312b4156c1248db554bbe7b3be9311f458059d62 (patch)
tree57d4f519e7608d5824b95033741d3b6dbb475052
parentc6df5201b08a1feee1b2a2e1e57c9adc1aee8fe0 (diff)
downloadgst-plugins-bad-312b4156c1248db554bbe7b3be9311f458059d62.tar.gz
gst-plugins-bad-312b4156c1248db554bbe7b3be9311f458059d62.tar.bz2
gst-plugins-bad-312b4156c1248db554bbe7b3be9311f458059d62.zip
[MOVED FROM GST-P-FARSIGHT] Create generic segment is none received and refuse non-time segments
20080501182554-3e2dc-ace5ca000414428d6d94478adc5927c9f91975df.gz
-rw-r--r--gst/liveadder/liveadder.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gst/liveadder/liveadder.c b/gst/liveadder/liveadder.c
index a91fe9a4..412cb605 100644
--- a/gst/liveadder/liveadder.c
+++ b/gst/liveadder/liveadder.c
@@ -806,6 +806,18 @@ gst_live_live_adder_chain (GstPad *pad, GstBuffer *buffer)
if (!GST_BUFFER_TIMESTAMP_IS_VALID(buffer))
goto invalid_timestamp;
+ if (padprivate->segment.format == GST_FORMAT_UNDEFINED)
+ {
+ GST_WARNING_OBJECT (adder, "No new-segment received,"
+ " initializing segment with time 0..-1");
+ gst_segment_init (&padprivate->segment, GST_FORMAT_TIME);
+ gst_segment_set_newsegment (&padprivate->segment,
+ FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0);
+ }
+
+ if (padprivate->segment.format == GST_FORMAT_TIME)
+ goto invalid_segment;
+
/* Just see if we receive invalid timestamp/durations */
if (GST_CLOCK_TIME_IS_VALID (padprivate->expected_timestamp) &&
!GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DISCONT) &&
@@ -983,6 +995,19 @@ gst_live_live_adder_chain (GstPad *pad, GstBuffer *buffer)
("Invalid timestamp received on buffer"));
return GST_FLOW_ERROR;
+
+ invalid_segment:
+ {
+ const gchar *format = gst_format_get_name (padprivate->segment.format);
+ GST_OBJECT_UNLOCK (adder);
+ gst_buffer_unref (buffer);
+ GST_ELEMENT_ERROR (adder, STREAM, FAILED,
+ ("This element only supports TIME segments, received other type"),
+ ("Received a segment of type %s, only support time segment", format));
+
+ return GST_FLOW_ERROR;
+ }
+
}
/*