diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2008-06-10 16:25:24 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2008-06-10 16:25:24 +0000 |
commit | 515b32d5aa66dd6e2cfc0b49e7d249bc614ca4b8 (patch) | |
tree | f40918f342ffb84db5c1db243e23e6528cc8a9b3 /gst/videomixer | |
parent | b28a5162afdd1c47c7cf8ee20dd2c2d235f88ebd (diff) |
gst/videomixer/videomixer.c: Use stream_time to synchronize the object properties.
Original commit message from CVS:
* gst/videomixer/videomixer.c: (gst_videomixer_fill_queues),
(gst_videomixer_blend_buffers):
Use stream_time to synchronize the object properties.
Use running_time of the master pad to timestamp outgoing buffers.
Fix the initial segment event to extend an unknown amount of time.
Fixes #537361.
Diffstat (limited to 'gst/videomixer')
-rw-r--r-- | gst/videomixer/videomixer.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/gst/videomixer/videomixer.c b/gst/videomixer/videomixer.c index eadbe5ad..ea03f269 100644 --- a/gst/videomixer/videomixer.c +++ b/gst/videomixer/videomixer.c @@ -1294,8 +1294,8 @@ gst_videomixer_fill_queues (GstVideoMixer * mix) * match. */ GST_INFO ("_sending play segment"); - event = gst_event_new_new_segment (FALSE, segment->rate, segment->format, - segment->start, segment->stop, mix->segment_position); + event = gst_event_new_new_segment_full (FALSE, segment->rate, 1.0, + segment->format, 0, -1, mix->segment_position); gst_pad_push_event (mix->srcpad, event); mix->sendseg = FALSE; } @@ -1324,17 +1324,36 @@ gst_videomixer_blend_buffers (GstVideoMixer * mix, GstBuffer * outbuf) walk = g_slist_next (walk); if (mixcol->buffer != NULL) { - if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (mixcol->buffer))) - gst_object_sync_values (G_OBJECT (pad), - GST_BUFFER_TIMESTAMP (mixcol->buffer)); + GstClockTime timestamp; + gint64 stream_time; + GstSegment *seg; + + seg = &mixcol->collect.segment; + + timestamp = GST_BUFFER_TIMESTAMP (mixcol->buffer); + + stream_time = + gst_segment_to_stream_time (seg, GST_FORMAT_TIME, timestamp); + + /* sync object properties on stream time */ + if (GST_CLOCK_TIME_IS_VALID (stream_time)) + gst_object_sync_values (G_OBJECT (pad), stream_time); + gst_videomixer_blend_ayuv_ayuv (GST_BUFFER_DATA (mixcol->buffer), pad->xpos, pad->ypos, pad->in_width, pad->in_height, pad->alpha, GST_BUFFER_DATA (outbuf), mix->out_width, mix->out_height); + if (pad == mix->master) { - GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (mixcol->buffer); + gint64 running_time; + + running_time = + gst_segment_to_running_time (seg, GST_FORMAT_TIME, timestamp); + + /* outgoing buffers need the running_time */ + GST_BUFFER_TIMESTAMP (outbuf) = running_time; GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (mixcol->buffer); - mix->last_ts = GST_BUFFER_TIMESTAMP (outbuf); + mix->last_ts = running_time; if (GST_BUFFER_DURATION_IS_VALID (outbuf)) mix->last_ts += GST_BUFFER_DURATION (outbuf); } |