# \[patch\] Implement each\_pad using a GstIterator

**URL:** <https://www.ruby-forum.com/t/patch-implement-each-pad-using-a-gstiterator/133285>\
**Category:** Ruby-Gnome 2\
**Created:** [March 29, 2008, 7:14pm UTC](https://www.ruby-forum.com/t/patch-implement-each-pad-using-a-gstiterator/133285 "2008-03-29T19:14:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sschunselaar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@sschunselaar](https://www.ruby-forum.com/u/sschunselaar)\
**Post date:** [March 29, 2008, 7:14pm UTC](https://www.ruby-forum.com/t/patch-implement-each-pad-using-a-gstiterator/133285/1 "2008-03-29T19:14:08Z")

</div>

Hi,

See patch for details. What might need some thought is the behaviour  
when we  
have to resync. This patch just calls gst\_iterator\_resync, which might  
cause  
some elements to be yielded twice. The only good option i can think of  
to  
prevent this is throw an error when a resync is needed, so the ruby  
code can  
choose how to handle it… But for most code this is probably a bit too  
much

Sjoerd

---

<div class="post-metadata">

**Author:** ![sschunselaar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@sschunselaar](https://www.ruby-forum.com/u/sschunselaar)\
**Post date:** [March 30, 2008, 12:52am UTC](https://www.ruby-forum.com/t/patch-implement-each-pad-using-a-gstiterator/133285/2 "2008-03-30T00:52:57Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] [patch] Implement each\_pad using a  
GstIterator” on Sat, 29 Mar 2008 19:13:49 +0100,  
Sjoerd S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> See patch for details.

It was very happy for us if you considered to follow our  
coding-style.

> ```
> * src/rbgst-element.c: Implement Gst::Element.each_pad using a GstIterator to
> ensure thread safety. Remove the get_pads function as it can't be
> implemented safely.
> 
> ```

Can we use gst\_iterator\_fold for get\_pads?

> ```
> What might need some thought is the behaviour when we
> 
> ```
> 
> have to resync. This patch just calls gst\_iterator\_resync, which might cause  
> some elements to be yielded twice. The only good option i can think of to  
> prevent this is throw an error when a resync is needed, so the ruby code can  
> choose how to handle it… But for most code this is probably a bit too much

We will export other method (#pads\_iterator ???) for the  
case. #each\_pad should keep being convenience.

## Thanks,

kou
