<div dir="ltr">


        
        
        
        


<p class="" style="margin-bottom:0cm;line-height:100%"> I
have a C/GTK program that creates the following pipeline:-</p>

<p class="" style="margin-bottom:0cm;line-height:100%">  |
Camera  |      | Video |     | Caps  |      | Queue |      | Video      |      |
Video |</p>|
v4l2src   |->| Rate     |->| Filter  |->| (blk)       |->|
convert |->| sink       |-> Screen

<p class="" style="margin-bottom:0cm;line-height:100%">which
gets changed dynamically, adding 2 elements, when a menu option is
selected (there is also a reversing option) into this:-</p>

<p class="" style="margin-bottom:0cm;line-height:100%">  |
Camera  |     | Video |  | Caps   |       | Queue |      | Video     |      |
Cairo    |     | Video     |      | Video |</p>|
v4l2src   |->| Rat     |->| Filter  |-> | (blk)       |->|
convert |->| overlay |->| convert |->| sink     |-> Screen

<p class="" style="margin-bottom:0cm;line-height:100%">It
works anywhere from 0 to n times before the stream will freeze
sometimes with the following error (GST_DEBUG=1).
</p>
<p class="" style="margin-bottom:0cm;line-height:100%">libv4l2:
error turning on stream: Invalid argument</p>0:00:07.395996377
 3849  0x8856150 ERROR                   v4l2
gstv4l2bufferpool.c:566:gst_v4l2_buffer_pool_streamon:<v4l2:pool:src>
error with STREAMON 22 (Invalid argument)

<p class="" style="margin-bottom:0cm;line-height:100%">The
approach I take when the menu option is selected is:-</p>

<p class="" style="margin-bottom:0cm;line-height:100%">probe_id
= gst_pad_add_probe (blockpad,  GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, 
</p>                                              OnPadProbe, user_data pointer , NULL); 


<p class="" style="margin-bottom:0cm;line-height:100%">and
the OnPadProbe routine:-</p>  unlinks
the elements in the pipeline<br>  creates
the 'cairooverlay' element and the second 'videoconvert' adapter<br>  sets
up callbacks<br>  adds
the new elements to the pipeline, links them and sets their state to
Playing<br>  return
GST_PAD_PROBE_REMOVE;

<p class="" style="margin-bottom:0cm;line-height:100%">The
cairooverlay Callbacks for 'caps-changed' and 'draw' are pretty
straightforward.</p>

<p class="" style="margin-bottom:0cm;line-height:100%">Is
this a valid approach for changing a pipeline on the fly? I've used
debug code and found that the pad is still blocked and that the
pipeline is still in playing state after the video freezes, but I'm
unsure what to try next.</p>
<p class="" style="margin-bottom:0cm;line-height:100%">I've
found that there is no problem when I switch video sinks from
'xvimagesink' to 'ximagesink', but no idea why.</p>
<p class="" style="margin-bottom:0cm;line-height:100%">I've
also wondered if there is much penalty in just including the 2
additional elements anyway and connecting / disconnecting the
Callbacks as required.</p>

<p class="" style="margin-bottom:0cm;line-height:100%">Any
advice or pointers would be gladly received.</p>

<p class="" style="margin-bottom:0cm;line-height:100%">Regards.</p>

<p class="" style="margin-bottom:0cm;line-height:100%">Tony</p>

</div>