[gst-devel] Caps problem when writing encoder/decoder

Hunterwood markus.jagerskogh at imentum.se
Tue May 18 12:31:53 CEST 2010


Hi,

I have tried several different non-existing types: audio/x-test, audio/xyz,
audio/x-xyz, audio/x-qwertyuiop, audio/x-test, ...

Since my encoder is passing data to my decoder, I thought that the only
imortant thing was that they have the same caps to make it work (when I'm
finished, I want them to use a currently non-existing type), but it doesn't
work.
gst-inspect shows the same type for the source of the encoder and the sink
of the decoder, but when trying with gst-launch, it doesn't work:

C:\gstreamer\bin>gst-launch-0.10.exe audiotestsrc ! gtestenc ! gtestdec !
audioresample ! autoaudiosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstAudioTestSrc:audiotestsrc0:
Internal data flow error.
Additional debug info:
..\Source\gstreamer\libs\gst\base\gstbasesrc.c(2378): gst_base_src_loop ():
/GstPipeline:pipeline0/GstAudioTestSrc:audiotestsrc0:
streaming task paused, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
C:\gstreamer\bin>

Since I couldn't make it work with non-existing types i tried several
different existing types, but the only types that work are ANY and 
audio/x-raw-int:

C:\gstreamer\bin>gst-launch-0.10.exe audiotestsrc ! gtestenc ! gtestdec !
audioresample ! autoaudiosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstAudioSinkClock
^C
C:\gstreamer\bin>

To isolate the problem with the caps, the code just passes on the incomming
buffer (just as the gst-template, which I used as base), and the
interresting parts of the encoder looks like this (I have omited
gst_gtestenc_class_init and parts of gst_gtestenc_base_init bellow):

static GstStaticPadTemplate gtest_enc_sink_factory = GST_STATIC_PAD_TEMPLATE
("sink",
    GST_PAD_SINK,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS ("audio/x-raw-int, "
        "rate = (int) { 48000 }, "
        "channels = (int) { 1 }, "
        "endianness = (int) BYTE_ORDER, "
        "width = (int) 16, " "depth = (int) 16, " "signed = (boolean) True")
    );

static GstStaticPadTemplate gtest_enc_src_factory = GST_STATIC_PAD_TEMPLATE
("src",
    GST_PAD_SRC,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS ("audio/x-test") 
    );

GST_BOILERPLATE (Gstgtestenc, gst_gtestenc, GstElement, GST_TYPE_ELEMENT);

static void gst_gtestenc_base_init (gpointer gclass)
{
  GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);

// ...

  gst_element_class_add_pad_template (element_class,
      gst_static_pad_template_get (&gtest_enc_src_factory));
  gst_element_class_add_pad_template (element_class,
      gst_static_pad_template_get (&gtest_enc_sink_factory));
}

static void gst_gtestenc_init (Gstgtestenc * filter,
    GstgtestencClass * gclass)
{
  filter->sinkpad = gst_pad_new_from_static_template
(&gtest_enc_sink_factory, "sink");
  gst_pad_set_chain_function (filter->sinkpad,
                              GST_DEBUG_FUNCPTR(gst_gtestenc_chain));

  filter->srcpad = gst_pad_new_from_static_template
(&gtest_enc_src_factory, "src");
  gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
  gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
  gst_pad_use_fixed_caps (filter->sinkpad);
  gst_pad_use_fixed_caps (filter->srcpad);
}

static GstFlowReturn gst_gtestenc_chain (GstPad * pad, GstBuffer * buf)
{
  Gstgtestenc *filter;

  filter = GST_GtestENC (GST_OBJECT_PARENT (pad));

  /* just push out the incoming buffer without touching it */
  return gst_pad_push (filter->srcpad, buf);
}


The code in the decoder is basicly the same - pass on the incomming data.
The main difference at the moment is the caps definitions:


static GstStaticPadTemplate gtest_dec_sink_factory = GST_STATIC_PAD_TEMPLATE
("sink",
    GST_PAD_SINK,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS ("audio/x-test")
    );

static GstStaticPadTemplate gtest_dec_src_factory = GST_STATIC_PAD_TEMPLATE
("src",
    GST_PAD_SRC,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS ("audio/x-raw-int, "
        "rate = (int) { 48000 }, "
		"channels = (int) { 1 }, "
        "endianness = (int) BYTE_ORDER, "
        "width = (int) 16, " "depth = (int) 16, " "signed = (boolean) True")
    );



What am I doing wrong?
Why is it working with audio/x-raw-int, but not with audio/x-test?

Regards,
 Markus
-- 
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Caps-problem-when-writing-encoder-decoder-tp2219436p2221067.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list