Callback from pipeline to notify about video picture size changing

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Callback from pipeline to notify about video picture size changing

Akon2
Hi all,

Please consider the following simple pipeline:

static const gchar PipelineCommand[] =
    "videotestsrc "
    "! capsfilter name=capsfilter caps=video/x-raw,width=320,height=240 "
    "! videocrop name=videocrop top=100 bottom=100 left=100 right=100"
    "! autovideosink";

Effectively, this produces 120 x 40 video picture size.

Then, when the pipeline is playing, the capsfilter changes to reduce video
picture size, e.g. caps=video/x-raw,width=100,height=100. This leads to
pipeline error (reported as data flow error in videotestsrc), because now
video picture size after cropping becomes negative (-100 x -100). videocrop
itself detects such conditions and simply sets an error return code that is
propagated further.

One way to prevent the error is to detect video picture size change *before
caps negotiation process reaches videocrop* and adjust videocrop's
properties accordingly. How?

I tried to set a (synchronous) callback that is invoked from pipeline worker
thread to monitor caps change:

g_signal_connect(video_crop_sink_pad, "notify::caps",
(GCallback)videoCropSinkCapsChanged, (__bridge void *)self);

but with no luck - the error I see on a sync bus handler occurs before. Caps
change occurs after caps negotiation completes, so it's not a surprise.

Do I need some playing with pad blocking feature (gst_pad_add_probe() method
with the GST_PAD_PROBE_TYPE_BLOCK) to get the goal?

Maybe, an alternative way - is to write a thin videocrop wrapper (as a
plugin) to handle such conditions woulb be easier?

Note: In real life video actually comes from network with H264 encoding over
RTP.

Thanks in advance!



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Callback from pipeline to notify about video picture size changing

Akon2
In context of my scenario what is most suitable place to start observe inband
(synchronously) caps negotiation process and find new video picture size,
then change videocrop properties accordingly?

Another option looking well logically is to fix video picture size after
videocrop (so it will negotiate bigger size on its sink) and put videoscale
before (so it will adjuct the resolution difference). But this option leads
to lower performance and looks roughly.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel