Buyuk
Buyuk

Reputation: 1094

How to handle EOS in gstreamer's custom plugin?

I'm trying to develop my own, custom plugin with N request sink pads and M sometimes src pads. Sink pads are added to GstCollectPads object. I've managed to make plugin up & running, it receives buffers and process them the right way within gst_my_plugin_collected( GstCollectPads *pads ) callback, than i push the buffers to the peer of selected src pad.

These are the last lines in my *_collected(...) implementation.

281     GSList *it = pads->data;
282     for( it; it != NULL; it=it->next ) {
283         cdata = (GstCollectData*)(it->data);
284         outbuf = gst_collect_pads_peek( pads, cdata );
295         gst_pad_push( elem->srcpads[i++], outbuf );               
298 } 
299 return GST_FLOW_OK;

Sample pipeline: gst-ndl-launch filesrc location=in.log ! myplugin ! filesink location=out.log runs in the infinite loop processing all the time the same data from in.log file writing it to out.log file, just like it doesn't know when it reaches End-Of-File.

My guess is, I somehow need to tell my plugin that processing should stop, maybe by sending EOS message in some way, however I've got no idea how to do it. Thus my question is: What should i do within my plugin in order to stop processing when End of file occurs?

// UPDATE: It appears that my pipeline processes only first buffer in an infinite loop. So my previous idea about sending EOS message was invalid, instead i must somehow remove processed buffer in order to receive next one. Still don't know how to do it so any help will be appreciated.

What should i do after processing buffer from GstCollectData so that it won't process the same buffer again and again?

Upvotes: 0

Views: 1227

Answers (2)

Buyuk
Buyuk

Reputation: 1094

Turns out it was just what i suspected at the begining, not handling EOS event. In order to fix my issue i had to implement gst_collect_pads_event function, its strange though that there is not a single word about this in GstCollectPads reference page.

(problem solved)

Upvotes: 0

mpr
mpr

Reputation: 3378

Ok maybe simpler answer:

gst_collect_pads_pop () instead of gst_collect_pads_peek ()?

Make sure to check for null.

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstCollectPads.html#gst-collect-pads-pop

Upvotes: 1

Related Questions