diff options
author | Thiago Santos <thiagoss@osg.samsung.com> | 2015-05-28 09:31:22 -0300 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2015-06-08 11:10:20 -0300 |
commit | d1f490fe2ab94f756985c2db55a73308d126e2da (patch) | |
tree | 0ac6a06fa9bc16fc2bdcef2571a5d71e37d3173b | |
parent | cd84163529bbdaadb932623089a858824c35fbeb (diff) |
Port elements to basemixerbasemixer
-rw-r--r-- | ext/gl/gstglmixer.c | 13 | ||||
-rw-r--r-- | gst-libs/gst/video/gstvideoaggregator.c | 34 | ||||
-rw-r--r-- | gst-libs/gst/video/gstvideoaggregatorpad.h | 1 | ||||
-rw-r--r-- | gst/compositor/compositor.c | 8 |
4 files changed, 34 insertions, 22 deletions
diff --git a/ext/gl/gstglmixer.c b/ext/gl/gstglmixer.c index 119ab5a35..c56fbe536 100644 --- a/ext/gl/gstglmixer.c +++ b/ext/gl/gstglmixer.c @@ -622,6 +622,7 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf) mix->frames->pdata[i] = g_slice_new0 (GstGLMixerFrameData); while (walk) { GstGLMixerPad *pad = GST_GL_MIXER_PAD (walk->data); + GstBaseMixerPad *mixerpad = GST_BASE_MIXER_PAD (pad); GstVideoAggregatorPad *vaggpad = walk->data; GstGLMixerFrameData *frame; @@ -631,7 +632,7 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf) walk = g_list_next (walk); - if (vaggpad->buffer != NULL) { + if (mixerpad->buffer != NULL) { GstVideoInfo gl_info; GstVideoFrame gl_frame; GstGLSyncMeta *sync_meta; @@ -641,11 +642,11 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf) GST_VIDEO_INFO_WIDTH (&vaggpad->info), GST_VIDEO_INFO_HEIGHT (&vaggpad->info)); - sync_meta = gst_buffer_get_gl_sync_meta (vaggpad->buffer); + sync_meta = gst_buffer_get_gl_sync_meta (mixerpad->buffer); if (sync_meta) gst_gl_sync_meta_wait (sync_meta, GST_GL_BASE_MIXER (mix)->context); - if (gst_video_frame_map (&gl_frame, &gl_info, vaggpad->buffer, + if (gst_video_frame_map (&gl_frame, &gl_info, mixerpad->buffer, GST_MAP_READ | GST_MAP_GL)) { frame->texture = *(guint *) gl_frame.data[0]; gst_video_frame_unmap (&gl_frame); @@ -694,13 +695,13 @@ gst_gl_mixer_process_buffers (GstGLMixer * mix, GstBuffer * outbuf) for (; i < element->numsinkpads; i++) mix->frames->pdata[i] = g_slice_new0 (GstGLMixerFrameData); while (walk) { /* We walk with this list because it's ordered */ - GstVideoAggregatorPad *vaggpad = walk->data; + GstBaseMixerPad *mixerpad = walk->data; walk = g_list_next (walk); - if (vaggpad->buffer != NULL) { + if (mixerpad->buffer != NULL) { /* put buffer into array */ - mix->array_buffers->pdata[array_index] = vaggpad->buffer; + mix->array_buffers->pdata[array_index] = mixerpad->buffer; } ++array_index; } diff --git a/gst-libs/gst/video/gstvideoaggregator.c b/gst-libs/gst/video/gstvideoaggregator.c index e8f747715..62c3abebd 100644 --- a/gst-libs/gst/video/gstvideoaggregator.c +++ b/gst-libs/gst/video/gstvideoaggregator.c @@ -131,7 +131,6 @@ _flush_pad (GstAggregatorPad * aggpad, GstAggregator * aggregator) GstVideoAggregatorPad *pad = GST_VIDEO_AGGREGATOR_PAD (aggpad); gst_videoaggregator_reset_qos (vagg); - gst_buffer_replace (&pad->buffer, NULL); pad->priv->start_time = -1; pad->priv->end_time = -1; @@ -224,17 +223,20 @@ gst_video_aggregator_pad_prepare_frame (GstVideoAggregatorPad * pad, GstVideoAggregator * vagg) { guint outsize; + GstBaseMixerPad *mixerpad = GST_BASE_MIXER_PAD_CAST (pad); GstVideoFrame *converted_frame; GstBuffer *converted_buf = NULL; GstVideoFrame *frame; static GstAllocationParams params = { 0, 15, 0, 0, }; - if (!pad->buffer) + if (!mixerpad->buffer) return TRUE; frame = g_slice_new0 (GstVideoFrame); - if (!gst_video_frame_map (frame, &pad->buffer_vinfo, pad->buffer, + pad->buffer_vinfo = pad->info; + + if (!gst_video_frame_map (frame, &pad->buffer_vinfo, mixerpad->buffer, GST_MAP_READ)) { GST_WARNING_OBJECT (vagg, "Could not map input buffer"); return FALSE; @@ -816,6 +818,7 @@ gst_videoaggregator_pad_sink_setcaps (GstPad * pad, GstObject * parent, } vaggpad->info = info; + vaggpad->buffer_vinfo = info; gst_pad_mark_reconfigure (GST_AGGREGATOR_SRC_PAD (vagg)); ret = TRUE; @@ -940,7 +943,6 @@ gst_videoaggregator_reset (GstVideoAggregator * vagg) for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) { GstVideoAggregatorPad *p = l->data; - gst_buffer_replace (&p->buffer, NULL); p->priv->start_time = -1; p->priv->end_time = -1; @@ -1143,13 +1145,14 @@ static gboolean sync_pad_values (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad) { GstAggregatorPad *bpad = GST_AGGREGATOR_PAD (pad); + GstBaseMixerPad *mixerpad = GST_BASE_MIXER_PAD_CAST (pad); GstClockTime timestamp; gint64 stream_time; - if (pad->buffer == NULL) + if (mixerpad->buffer == NULL) return TRUE; - timestamp = GST_BUFFER_TIMESTAMP (pad->buffer); + timestamp = GST_BUFFER_TIMESTAMP (mixerpad->buffer); GST_OBJECT_LOCK (bpad); stream_time = gst_segment_to_stream_time (&bpad->segment, GST_FORMAT_TIME, timestamp); @@ -1167,8 +1170,9 @@ prepare_frames (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad) { GstVideoAggregatorPadClass *vaggpad_class = GST_VIDEO_AGGREGATOR_PAD_GET_CLASS (pad); + GstBaseMixerPad *mixerpad = GST_BASE_MIXER_PAD_CAST (pad); - if (pad->buffer == NULL || !vaggpad_class->prepare_frame) + if (mixerpad->buffer == NULL || !vaggpad_class->prepare_frame) return TRUE; return vaggpad_class->prepare_frame (pad, vagg); @@ -1406,6 +1410,12 @@ gst_videoaggregator_mix (GstBaseMixer * bmixer, GstClockTime output_start_time, GST_VIDEO_AGGREGATOR_LOCK (vagg); + if (gst_base_mixer_check_eos (bmixer)) { + GST_INFO_OBJECT (bmixer, "no data available, must be EOS"); + GST_VIDEO_AGGREGATOR_UNLOCK (vagg); + gst_pad_push_event (GST_AGGREGATOR (bmixer)->srcpad, gst_event_new_eos ()); + return GST_FLOW_EOS; + } #if 0 if (res == GST_FLOW_NEEDS_DATA && !timeout) { GST_DEBUG_OBJECT (vagg, "Need more data for decisions"); @@ -1424,7 +1434,7 @@ gst_videoaggregator_mix (GstBaseMixer * bmixer, GstClockTime output_start_time, if (jitter <= 0) { res = gst_videoaggregator_do_mix (bmixer, output_start_time, output_end_time, &outbuf); - if (ret != GST_FLOW_OK) + if (res != GST_FLOW_OK) goto done; vagg->priv->qos_processed++; } else { @@ -1464,6 +1474,7 @@ gst_videoaggregator_mix (GstBaseMixer * bmixer, GstClockTime output_start_time, done: if (outbuf) gst_buffer_unref (outbuf); + return res; #if 0 unlock_and_return: GST_VIDEO_AGGREGATOR_UNLOCK (vagg); @@ -1699,14 +1710,15 @@ gst_videoaggregator_flush (GstAggregator * agg) abs_rate = ABS (agg->segment.rate); for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) { GstVideoAggregatorPad *p = l->data; + GstBaseMixerPad *mixerpad = GST_BASE_MIXER_PAD_CAST (p); /* Convert to the output segment rate */ if (ABS (agg->segment.rate) != abs_rate) { - if (ABS (agg->segment.rate) != 1.0 && p->buffer) { + if (ABS (agg->segment.rate) != 1.0 && mixerpad->buffer) { p->priv->start_time /= ABS (agg->segment.rate); p->priv->end_time /= ABS (agg->segment.rate); } - if (abs_rate != 1.0 && p->buffer) { + if (abs_rate != 1.0 && mixerpad->buffer) { p->priv->start_time *= abs_rate; p->priv->end_time *= abs_rate; } @@ -1835,8 +1847,6 @@ gst_videoaggregator_release_pad (GstElement * element, GstPad * pad) if (last_pad) gst_videoaggregator_reset (vagg); - gst_buffer_replace (&vaggpad->buffer, NULL); - gst_child_proxy_child_removed (GST_CHILD_PROXY (vagg), G_OBJECT (vaggpad), GST_OBJECT_NAME (vaggpad)); diff --git a/gst-libs/gst/video/gstvideoaggregatorpad.h b/gst-libs/gst/video/gstvideoaggregatorpad.h index 253734b86..6b20d981b 100644 --- a/gst-libs/gst/video/gstvideoaggregatorpad.h +++ b/gst-libs/gst/video/gstvideoaggregatorpad.h @@ -61,7 +61,6 @@ struct _GstVideoAggregatorPad GstVideoInfo info; - GstBuffer *buffer; /* The caps on the pad may not match the buffer above because of two reasons: * 1) When caps change, the info above will get updated, but the buffer might * not since it might be pending on the GstAggregatorPad diff --git a/gst/compositor/compositor.c b/gst/compositor/compositor.c index dfeb379fb..df9a3ee2f 100644 --- a/gst/compositor/compositor.c +++ b/gst/compositor/compositor.c @@ -356,6 +356,7 @@ gst_compositor_pad_prepare_frame (GstVideoAggregatorPad * pad, { GstCompositor *comp = GST_COMPOSITOR (vagg); GstCompositorPad *cpad = GST_COMPOSITOR_PAD (pad); + GstBaseMixerPad *mixerpad = GST_BASE_MIXER_PAD_CAST (pad); guint outsize; GstVideoFrame *converted_frame; GstBuffer *converted_buf = NULL; @@ -368,7 +369,7 @@ gst_compositor_pad_prepare_frame (GstVideoAggregatorPad * pad, * Due to the clamping, this is different from the frame width/height above. */ GstVideoRectangle frame_rect; - if (!pad->buffer) + if (!mixerpad->buffer) return TRUE; /* There's three types of width/height here: @@ -471,6 +472,7 @@ gst_compositor_pad_prepare_frame (GstVideoAggregatorPad * pad, GstVideoAggregatorPad *pad2 = l->data; GstCompositorPad *cpad2 = GST_COMPOSITOR_PAD (pad2); gint pad2_width, pad2_height; + GstBaseMixerPad *mixerpad2 = GST_BASE_MIXER_PAD_CAST (cpad2); _mixer_pad_get_output_size (comp, cpad2, &pad2_width, &pad2_height); @@ -484,7 +486,7 @@ gst_compositor_pad_prepare_frame (GstVideoAggregatorPad * pad, /* Check if there's a buffer to be aggregated, ensure it can't have an alpha * channel, then check opacity and frame boundaries */ - if (pad2->buffer && cpad2->alpha == 1.0 && + if (mixerpad2->buffer && cpad2->alpha == 1.0 && !GST_VIDEO_INFO_HAS_ALPHA (&pad2->info) && is_rectangle_contained (frame_rect, frame2_rect)) { frame_obscured = TRUE; @@ -508,7 +510,7 @@ gst_compositor_pad_prepare_frame (GstVideoAggregatorPad * pad, frame = g_slice_new0 (GstVideoFrame); - if (!gst_video_frame_map (frame, &pad->buffer_vinfo, pad->buffer, + if (!gst_video_frame_map (frame, &pad->buffer_vinfo, mixerpad->buffer, GST_MAP_READ)) { GST_WARNING_OBJECT (vagg, "Could not map input buffer"); return FALSE; |