How to write a simple mux element?

mariannasb mariannasb at yahoo.com.br
Mon Feb 15 09:21:31 UTC 2016


> There is also GstVideoAggregator, specialized for video.
>
> >
> > I only want to output frames when I have data from both inputs and I
> > would
> > like to check that the timestamps from both inputs are equal.
> 
> That's exactly what aggregator do, synchronize multiple streams. If
> it's live, there is a change that you only have 1 frame in the
> aggregate call. As you are implementing your one element, it should be
> easy to just drop this frame for your needs. 

Yeah, I have actually tried to copy the compositor element (which uses the
GstVideoAggregator) and modify it to my needs, but I wasn't sure if it was
the right or simplest way to go.

I have my own aggregate_frames() where I copy the buffer from the first sink
and the metadata from the second and that works fine.
I also have my own prepare_frame() for the sink pads, so I'm "obfuscating"
(like in the compositor) the second buffer because since I only want the
metadata I dont need to bother about converting it to the right format.

However I don't know how I can make sure that the timestamps from both
buffers match: they both come from the same v4l2src, but the second one has
some image processing done to it which generates the metadata I want to
append back to the "original" frame (so the second frame will arrive with a
delay corresponding to the processing time).
Or how to make sure I only output a frame when both sinks have the right
buffers.
Is returning FALSE from the prepare_frame() in case there is no buffer the
way to make it "wait" until it has data in both sink pads?
Can I return something like GST_BASE_TRANSFORM_FLOW_DROPPED from the
aggregate_frames()?
In case the "processing delay" in my pipeline is too big I might risk
getting a new buffer in the first sink pad before getting the processed
frame (with metadata) on the second sink pad. It seems that the buffer on
the first sink pad gets overwritten, is there any way I can prevent that?

Moreover there is also the "issue" I posted here
(http://gstreamer-devel.966125.n4.nabble.com/Compositor-valve-issues-td4675817.html#a4675851)
which I dont know if it is something I can fix in my own element or if it is
something to be done in the base classes...

Thanks for the help
Marianna S. Buschle



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-write-a-simple-mux-element-tp4675816p4675852.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list