[gst-devel] Questions about GstBuffer in handoff fakesrc function
René Stadler
mail at renestadler.de
Mon Jun 4 13:43:02 CEST 2007
Am Montag, den 04.06.2007, 12:46 +0200 schrieb Riccardo Corona:
> Hi,
> I've a fakesrc handoff function like this in which I get mpeg4 packet
> from the net:
>
> static void cb_handoff (GstElement *fakesrc,
> GstBuffer *buffer,
> GstPad *pad,
> gpointer user_data)
> {
> ......
> }
>
>
> And here's my doubts:
>
> 1)The buffer->caps is null, even if i set a capsfilter between my
> fakesrc and the next element in the pipeline, I think that it must be
> set but if I try something like this:
>
> ..........
> pad->caps= gst_caps_new_simple ("video/mpeg",
> "width", G_TYPE_INT, 720,
> "height", G_TYPE_INT, 288,
> "framerate",GST_TYPE_FRACTION,1,1,
> "mpegversion",G_TYPE_INT,4,
> "systemstream",G_TYPE_BOOLEAN,false);
> gst_buffer_set_caps(buffer,pad->caps);
> .........
>
You shouldn't set pad->caps.
>
> or like this:
>
>
> .........
> GstPad *myPad;
> myPad->caps= gst_caps_new_simple ("video/mpeg",
> "width", G_TYPE_INT, 720,
> "height", G_TYPE_INT, 288,
> "framerate",GST_TYPE_FRACTION,1,1,
> "mpegversion",G_TYPE_INT,4,
> "systemstream",G_TYPE_BOOLEAN,false);
> gst_buffer_set_caps(buffer,myPad->caps);
> ............
>
> My app crash at the gst_caps_new_simple execution.It's hard for me to
> say why it crash but my first problem is to understand if is necessary
> to set the cap (I think yes) and moreover what can be the utility of
> the pads into the handoff function.
You seem to ignore an important compiler warning which tells you that
you are missing the sentinel. Append NULL to the argument list.
> 2)In my handoff I've compressed data since I get mpeg4 packets so the
> buffer->offset would be the byte offset of the first byte in
> buffer->malloc, is it right?Is it necessary to set manually the offset
> and offset_end or is it done automatically?Offset have strange values
> since it starts from 1 but after a few cycle it increments to much
> greater values (1,2,3,4,8456,12345...) and offset_end isn't set.
> I really can't understand these two vars.
>
> Any help will be very appreciate.
> Thank's and best regards.
>
> --
> Riccardo Corona
Figuring out how you are supposed to interact with fakesrc is so hard
because you are not supposed to do it -- have a look at the new appsrc
element (found in gst-plugins-bad) or write your own GstBaseSrc or
GstPushSrc derived element.
--
Regards,
René Stadler
More information about the gstreamer-devel
mailing list