Decodebin pad linking and NOFORMAT error condition

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Decodebin pad linking and NOFORMAT error condition

F455
This post was updated on .
Hi everyone,

I'm using GStreamer 1.10.4 in order to perform raw video streaming playback in a Java application.

This this the command I'm using for the video playback outside my Java app: It works fine
gst-launch-1.0 -v udpsrc multicast-group=239.192.2.1 auto-multicast=true port="5000" caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:2, depth=(string)8, width=(string)1920, height=(string)1080, colorimetry=(string)BT709-2, payload=(int)96, a-framerate=(string)20" ! rtpvrawdepay ! decodebin ! videobox top=90 bottom=90  ! autovideosink sync=false

Now, I need to implement this pipeline in my Java app. So I'm using:
- the jna-4.4.0.jar
- the gst1-java-core-0.9-161201.jar GStreamer java wrapper
- the SimpleVideoComponent.java class, part of gstreamer-java, in order to embed the video sink in a JFrame UI object

I am able to construct simple pipelines in Java (like videotestsrc ! autovideosink) that are correctly displayed in my UI.

However, things get harder when I'm building my raw streaming decoding pipeline as described in command-line above.

The problem is that I can't link the decodebin's src0 pad to the videobox's sink pad : I get a NOFORMAT error

Here is the relevant code I'm using for the pipeline construction :
String[] gstreamerArgs = new String[1];
gstreamerArgs[0] = "-v";

Gst.init("Video", gstreamerArgs);

mPipeline = new Pipeline("pipeline");

// Create elements =================================================================
elmt_udpsrc = ElementFactory.make("udpsrc", "udpsrc");
elmt_udpsrc.set("multicast-group", "239.192.2.1");
elmt_udpsrc.set("auto-multicast", true);
elmt_udpsrc.set("port", 5000);
Caps caps = new Caps("application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:2, depth=(string)8, width=(string)1920, height=(string)1080, colorimetry=(string)BT709-2, payload=(int)96, a-framerate=(string)20");
elmt_udpsrc.set("caps", caps);
elmt_rtpvrawdepay = ElementFactory.make("rtpvrawdepay", "rtpvrawdepay");
elmt_decodebin = ElementFactory.make("decodebin", "decodebin"); // has a "Sometimes" pad
elmt_decodebin.connect(new PAD_ADDED() {

  @Override
  public void padAdded(final Element element, final Pad pad) {
    if (pad.isLinked()) {
      return;
    }

    // Prints "Linking Decodebin pad : src_0 to sink"
    System.out.println("VideoHandlerUI - Linking Decodebin pad : " + pad.getName() + " to " + elmt_autovideosink.getStaticPad("sink").getName());

    PadLinkReturn retour = pad.link(elmt_videobox.getStaticPad("sink"));  // NOFORMAT error !

    inspect(mPipeline);
    mPipeline.play();
  }
});
elmt_videobox = ElementFactory.make("videobox", "videobox");
elmt_autovideosink = videoUIComponent.getElement();
elmt_autovideosink.set("sync", false);

// Build Pipeline =================================================================
mPipeline.addMany(elmt_udpsrc, elmt_rtpvrawdepay, elmt_decodebin, elmt_videobox, elmt_autovideosink);
bStatus1 = Element.linkMany(elmt_udpsrc, elmt_rtpvrawdepay, elmt_decodebin);    // TRUE
bStatus2 = Element.linkMany(elmt_videobox, elmt_autovideosink);                 // TRUE


Here is the output of the inspect(pipeline) function in the padAdded callback, after the linking attempt:
GstVideoComponent
    Sink pad: sink connected to peer parent=BaseTransform: [videobox] / Pad: [src]
videobox
    Sink pad: sink DISCONNECTED
    Src pad: src connected to peer parent=AppSink: [GstVideoComponent] / Pad: [sink]
decodebin
    Sink pad: sink connected to peer parent=Element: [rtpvrawdepay] / Pad: [src]
    Sink pad: src_0 DISCONNECTED
rtpvrawdepay
    Sink pad: sink connected to peer parent=BaseSrc: [udpsrc] / Pad: [src]
    Src pad: src connected to peer parent=DecodeBin: [decodebin] / GhostPad: [sink]
udpsrc
    Src pad: src connected to peer parent=Element: [rtpvrawdepay] / Pad: [sink]

The way I'm programming this pipeline is very close to other examples I found on the web. I don't understand why I'm getting a NOFORMAT error between these two elements as the same pipeline works fine both:
- in command-line mode
- in java when passing the entire pipeline string to the GStreamer binding (but this is not a appropriate solution as I need to have control on the pipeline elements)

I also tried to link the decodebin directly to the videosink element (not using the videobox), but I get the same result.

I don't find any precise information about the NOFORMAT error condition on the web. Any idea about any tricky thing I may have forgotten in my code ? How could I go deeper and see what happens during the elements pads negociations ?

Thank you for your help
Loading...