[gst-devel] Questions about GstBuffer in handoff fakesrc function

Riccardo Corona coronariccardo at gmail.com
Mon Jun 4 17:22:13 CEST 2007


Thank's for the first answer...
For the usage of fakesrc simply I've done this:

static void cb_handoff (GstElement *fakesrc,
        GstBuffer  *buffer,
        GstPad     *pad,
        gpointer    user_data)
{

     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);



     //Calling a function that give me an mpeg4 packet ("myMP4packet")  with
timestamp its ("myTS")

     buffer->timestamp=myTS;

    GST_BUFFER_MALLOCDATA(buffer) =    (unsigned
char*)g_memdup(myMP4packet->pixel_ptr,  myMP4packet->dimension);

     GST_BUFFER_DATA(buffer) = GST_BUFFER_MALLOCDATA(buffer);
     GST_BUFFER_SIZE(buffer) = myMP4packet->dimension;
     buffer->offset=(unsigned int)(buffer->malloc_data);
     buffer->offset_end=(unsigned int)(buffer->malloc_data+buffer->size);

}


Since it works well only for the first frame, it receive the mpeg4 packet
and print it on the directdraw sink, my greater problem is on the
buffer->duration (now is set to GST_CLOCK_TIME_NONE).
Moreover I can't understand if I need to interact in some way with the
"GstElement *fakesrc".


2007/6/4, René Stadler <mail at renestadler.de>:
>
> 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
>
>


-- 
Riccardo Corona
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20070604/f2e12f6e/attachment.htm>


More information about the gstreamer-devel mailing list