[gst-devel] Fwd: Fakesrc signal handoff question

Riccardo Corona coronariccardo at gmail.com
Thu May 31 16:27:33 CEST 2007


---------- Forwarded message ----------
From: Riccardo Corona <coronariccardo at gmail.com>
Date: 30-mag-2007 13.28
Subject: Re: [gst-devel] Fakesrc signal handoff question
To: Tim Muller <t.i.m at zen.co.uk>

This's my testing pipeline :

..............................
pipeline = gst_pipeline_new ("pipeline");
    fakesrc = gst_element_factory_make ("fakesrc", "source");
    decoder = gst_element_factory_make ("ffdec_mpeg4","mpeg4-decoder");
    videoscale = gst_element_factory_make ("videoscale", "scaling-video");
    par = gst_element_factory_make ("capsfilter", "dimens");
    videorate=gst_element_factory_make("videorate", "rateVideo");

    parFakesrc = gst_element_factory_make ("capsfilter", "fakeSrcType");

    parDDSink = gst_element_factory_make ("capsfilter", "ddSinkSetup");

    g_object_set (G_OBJECT(parFakesrc), "caps",
        gst_caps_new_simple ("video/mpeg",
        "width", G_TYPE_INT, 720,
        "height", G_TYPE_INT, 288,
        "framerate",GST_TYPE_FRACTION,25,1,
        "mpegversion",G_TYPE_INT,4,
        "systemstream",G_TYPE_BOOLEAN,false),
        NULL);

    g_object_set (G_OBJECT(par), "caps",
      gst_caps_new_simple( "video/x-raw-yuv",
        "width", G_TYPE_INT, 720,
        "height", G_TYPE_INT, 576,NULL),
      NULL );

    g_object_set (G_OBJECT (fakesrc),
        "blocksize",40000,
        "signal-handoffs", TRUE,
        "sizemin", 0,
        "sizemax", 30000,
        "sizetype", 3,
        "datarate", 2000,
        "filltype",2,
         NULL);

    g_object_set (G_OBJECT (videorate),
        "in", 0,
        "out", 25,
         NULL);

    g_object_set (G_OBJECT(parDDSink), "caps",
        gst_caps_new_simple ("video/x-raw-rgb",
        "width", G_TYPE_INT, 720,
        "height", G_TYPE_INT, 576,
        "framerate",GST_TYPE_FRACTION,25,1),
        NULL);

    conv = gst_element_factory_make ("ffmpegcolorspace", "converter");

    videosink = gst_element_factory_make ("directdrawsink", "directdraw");

    gst_bin_add_many (GST_BIN (pipeline),
            fakesrc, parFakesrc, decoder,videoscale ,par,videorate,
conv,parDDSink, videosink, NULL);

    gst_element_link_many (fakesrc,parFakesrc,decoder,videoscale,
par,videorate, conv, parDDSink, videosink, NULL);


........................


Some of the pads are unusefull but I've leaved it...
I can't find any pads or element properties to convert my time_t (the time
as seconds elapsed since midnight, January 1, 1970) to the TIME type that
you are talking about.
However I've tried the buffer allocation with  GST_BUFFER_MALLOCDATA but
nothing is changed.
I don't believe that is possible to run my MFC application with GST_DEBUG
output, or I was unable to find a way to do it.
I see that offset parameter of gst_buffer increments with the first packets
from 0 to X, it sounds good but the offset_end have a different value (the
ending byte of the offset, I assume), so I've tried to force this value to
the offset one but nothing to do.
I think that the problem is in timestamp value but I cannot find a way to
escape from this hell...





2007/5/30, Tim Muller <t.i.m at zen.co.uk >:
>
> Riccardo Corona <coronariccardo at gmail.com > wrote :
>
> Hi,
>
> > Hi,during my test with gstreamer app for win32 I've used a fakesrc with
> > an handoff function in which I obtain some mpeg4 fragment that is put
> into
> > a gstbuffer. I've also used the right plugin to visualize the mpeg4
> packet
> > on my directdraw sink.
>
> Some more details about the pipeline used would probably be helpful.
>
>
> > It works weel only for the first 2-3 packets received and then the
> refresh
> > of the images stops and, if I run in debug mode, I can see that some
> thread
> > stop its execution but there isn't gstreamer thread. This is main part
> of
> > may handoff:
>
> > static void
> > cb_handoff (GstElement *fakesrc, GstBuffer  *buffer, GstPad *pad,
> >     gpointer user_data)
> > {
> >   MyClass* dlg=(MyClass*)user_data;
> >
> >  //fg_image is the object that contains the correct (I've checked it...)
> >  //mpeg4 fragment
> >  //dt contains the time of the fragment
> >  //dlg->t is a struct tm that allows to obtain time_t
> >  ...
> >  buffer->timestamp = mktime(&dlg->t);//GST_CLOCK_TIME_NONE;
>
> The timestamps you're creating, are they 0-based? (there may also be
> problems
> due to fakesrc sending a newsegment event in BYTES format, but the
> videosink
> expecting a TIME format, so it depends on your pipeline setup if there's
> an
> element that converts it to TIME Format or not).
>
> > //fg_image->pixel_ptr contains the mpeg4 image buffer
> > gst_buffer_set_data(buffer,fg_image->pixel_ptr,fg_image->dimension);
>
> Have you tried memcpy()'ing the data first, to make sure the data you're
> passing is not invalidated while it makes its way through the pipeline?
> Maybe something like (this assumes you're getting passed empty buffers,
> which
> may not be the case if you've set certain fakesrc properties):
>
>   GST_BUFFER_MALLOCDATA(buffer) =
>       g_memdup (fg_image->pixel_ptr,fg_image->dimension);
>   GST_BUFFER_DATA(buffer) = GST_BUFFER_MALLOCDATA(buffer);
>   GST_BUFFER_SIZE(buffer) = fg_image->dimension;
>
>
> In case it's your handoff callback that stops being called, run your
> program with
>
>   GST_DEBUG=basesrc:5 yourapp
>
> (or whatever the way to set an environment variable is on win32) to see
> why it stops/pauses (see 'flow' or 'reason').
>
> Cheers
>   -Tim
>
>
>
>
>
>


-- 
Riccardo Corona

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


More information about the gstreamer-devel mailing list