[gst-devel] Gdb - help with debbug
Guilherme
grlongo.ireland at gmail.com
Thu May 7 11:47:10 CEST 2009
Wim, tks for your advice.
I been through this manual a couple of times, I understood how things
works (at least) the basic of the gstreamer functionality.
I have others applications running here that I developed using
gstreamer, this script was just a small one to test the fft element.
Those two problem is exactly where I'm stuck with it.
This function require 3 parameters:
gst_fft_s16_fft (fft, in, freq);
fft is the instance, alread created using:
fft = gst_fft_s16_new (128, FALSE);
The in is a gint buffer of a size specified in the function above
that must be the number of samples I want that will be processed or
generated. i chose a arbitrary number of 128. And the last parameter is
from a specific data type called GstFFTS16Complex that is a struct of 2
gint16:
typedef struct {
gint16 r;
gint16 i;
} GstFFTS16Complex;
What I have in mind is that a should create a space in memory to those
2 variable with the specifics sizes above and that's all.
That is the prototype of the function:
void gst_fft_s16_inverse_fft (GstFFTS16 <http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstffts16.html#GstFFTS16> *self,
const GstFFTS16Complex <http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstffts16.html#GstFFTS16Complex> *freqdata,
gint16 <http://gstreamer.freedesktop.org/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint16> *timedata);
Plz, what kind of initialization I should realize to use that function. My lack
of experience doesn't let me see the problem
At the moment I have this:
fft = gst_fft_s16_new(128, FALSE);
GstFFTS16Complex *freqdata;
gint16 *timedata
Other thing is if this fft is a element and than should be added in the pipeline. 'cause in the gstreamer
website it says that the fft is a lib not a plug-ins, so Im confused about it.
Those are the problems I cant understand and is not quite clear in the manual!
Tks!
-------------------
Guilherme Longo
Dept. Eng. da Computação
Unaerp
Linux User - #484927
*Before Asking
http://www.istf.com.br/?page=perguntas
!- I'd rather die on my feet than live on my knees -!
Wim Taymans wrote:
> On Thu, 2009-05-07 at 00:09 -0300, Guilherme wrote:
>
> Guilherme,
>
> Your code does not make sense, you pass unitialized data to a library
> function that is usually not used from an application.
>
> You also seem to construct a pipeline that is not doing very much. What
> is it that you are trying to do?
>
> I would suggest to read the documentation here and get back to us with
> what is not clear enough about it:
>
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html
>
> Wim
>
>
>> Antoine, I have the whole profile of the problem now.
>> Plz, if you could give me a help with that.
>>
>> (gdb) run
>> Starting program: /home/guilherme/EBA
>> [Thread debugging using libthread_db enabled]
>> [New Thread 0xb7ad09b0 (LWP 3585)]
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 0xb7ad09b0 (LWP 3585)]
>> 0xb7e9e582 in g_type_check_instance_cast () from
>> /usr/lib/libgobject-2.0.so.0
>> (gdb) backtrace
>> #0 0xb7e9e582 in g_type_check_instance_cast () from
>> /usr/lib/libgobject-2.0.so.0
>> #1 0x08048a5b in main ()
>> (gdb) valgrind
>> Undefined command: "valgrind". Try "help".
>> (gdb) bt
>> #0 0xb7e9e582 in g_type_check_instance_cast () from
>> /usr/lib/libgobject-2.0.so.0
>> #1 0x08048a5b in main ()
>> (gdb)
>>
>>
>> And my code:
>>
>> #include<gst/gst.h>
>> #include<glib.h>
>> #include<gst/fft/gstffts16.h>
>>
>> static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data);
>>
>> int main(int argc, char *argv[])
>> {
>> GMainLoop *loop;
>>
>> GstElement *pipeline, *source, *filesink;
>> GstBus *bus;
>> GstFFTS16 *fft;
>>
>> gint16 td;
>> gint16 *timedata = &td;
>>
>> gint16 bufferin;
>> gint16 *in = &bufferin;
>>
>> GstFFTS16Complex fq;
>> GstFFTS16Complex *freq = &fq;
>>
>>
>> /*const gint16 *in;*/
>> /*GstFFTS16Complex *freq;*/
>>
>>
>> gst_init(&argc, &argv);
>>
>> loop = g_main_loop_new (NULL, FALSE);
>>
>> /*creating elements*/
>> pipeline = gst_pipeline_new ("audio-player");
>> source = gst_element_factory_make ("audiotestsrc",
>> "file-source");
>> fft = gst_fft_s16_new (128, FALSE);
>> filesink = gst_element_factory_make ("alsasink",
>> "audio-output");
>>
>>
>>
>> if (!pipeline || !source || !fft || !filesink) {
>> g_printerr ("One element could not be created. Exiting.\n");
>> return -1;
>> }
>>
>> /*set-up the pipeline*/
>>
>> /*set up fft transform*/
>> /*gst_fft_s16_window(fft, timedata, GST_FFT_WINDOW_RECTANGULAR);*/
>> gst_fft_s16_fft (fft, in, freq);
>>
>>
>> /*message handler*/
>> bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>> gst_bus_add_watch (bus, bus_call, loop);
>> gst_object_unref (bus);
>>
>> /*colocar todos elementos na pipeline*/
>> gst_bin_add_many (GST_BIN (pipeline), source, filesink, NULL);
>>
>> /*Linkar elementos*/
>> /*Cria o link entre os pads dos elementos*/
>> gst_element_link_many (source, filesink, NULL);
>>
>>
>> /* set pipeline playing status */
>> gst_element_set_state (pipeline, GST_STATE_PLAYING);
>> g_print ("Running...\n");
>>
>> /*iterate*/
>> g_main_loop_run (loop);
>> g_print ("Recording\n");
>>
>> /* Out of the main loop, clean up nicely */
>> g_print ("Returned, stopping playback\n");
>> gst_element_set_state (pipeline, GST_STATE_NULL);
>>
>> g_print ("Deleting pipeline\n");
>> gst_object_unref (GST_OBJECT (pipeline));
>>
>> return 0;
>> }
>>
>> static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data) {
>>
>> return TRUE;
>> }
>>
>>
>>
>>
>>
>> Can't really figure out what is gong on!
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Tks!
>>
>> -------------------
>>
>> Guilherme Longo
>> Dept. Eng. da Computação
>> Unaerp
>>
>> Linux User - #484927
>>
>> *Before Asking
>> http://www.istf.com.br/?page=perguntas
>>
>> !- I'd rather die on my feet than live on my knees -!
>>
>>
>>
>> Antoine Tremblay wrote:
>>
>>> Did you try a backtrace ?
>>>
>>> Type bt <enter> in gdb ..
>>>
>>> It will show you the backtrace of the sigsegv and thus the line that
>>> failed...
>>>
>>> If not you can always try valgrind ...
>>>
>>>
>>> On Wed, May 6, 2009 at 7:59 PM, Guilherme <grlongo.ireland at gmail.com
>>> <mailto:grlongo.ireland at gmail.com>> wrote:
>>>
>>> Hi all.
>>>
>>> I finished building my code and it's compiled without any error, but
>>> when I run it I get the beautiful segmentation fault.
>>>
>>> No good.
>>>
>>> Running gdb I can't get the line of the problem, instead I have this:
>>>
>>> (gdb) run
>>> Starting program: /home/guilherme/EBA
>>> [Thread debugging using libthread_db enabled]
>>> [New Thread 0xb7a479b0 (LWP 5565)]
>>>
>>> Program received signal SIGSEGV, Segmentation fault.
>>> [Switching to Thread 0xb7a479b0 (LWP 5565)]
>>> 0xb7bf2234 in ?? () from /usr/lib/libgstfft-0.10.so.0
>>>
>>> Is this a normal debug or I'm doing smth wrong?
>>> It seen a problem with my fft implementation. That is the code:
>>>
>>>
>>> #include<gst/gst.h>
>>>
>>>
>>> #include<glib.h>
>>>
>>>
>>> #include<gst/fft/gstffts16.h>
>>>
>>>
>>>
>>> static gboolean bus_call(GstBus *bus, GstMessage *msg,
>>> gpointer data);
>>>
>>>
>>>
>>> int main(int argc, char *argv[])
>>>
>>>
>>> {
>>>
>>>
>>> GMainLoop *loop;
>>>
>>>
>>>
>>>
>>>
>>> GstElement *pipeline, *source, *filesink;
>>>
>>>
>>> GstBus *bus;
>>>
>>>
>>> GstBuffer *buffer;
>>>
>>>
>>> GstFFTS16 *fft;
>>>
>>>
>>>
>>>
>>>
>>> const gint16 *in;
>>>
>>>
>>> GstFFTS16Complex *freq;
>>>
>>>
>>>
>>>
>>>
>>> gst_init(&argc, &argv);
>>>
>>>
>>>
>>>
>>>
>>> loop = g_main_loop_new (NULL, FALSE);
>>>
>>>
>>>
>>>
>>>
>>> /*creating elements*/
>>>
>>>
>>> pipeline = gst_pipeline_new
>>> ("audio-player");
>>>
>>>
>>> source = gst_element_factory_make
>>> ("audiotestsrc",
>>> "file-source");
>>>
>>>
>>> filesink = gst_element_factory_make ("alsasink",
>>> "audio-output");
>>>
>>>
>>> fft = gst_fft_s16_new (128, FALSE);
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> if (!pipeline || !source || !filesink) {
>>>
>>>
>>> g_printerr ("One element could not be created.
>>> Exiting.\n");
>>>
>>>
>>> return -1;
>>>
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>> /*set-up the pipeline*/
>>>
>>>
>>>
>>>
>>>
>>> /*create and set up buffer*/
>>>
>>>
>>> g_print ("\n\nCreating Buffer\n");
>>>
>>>
>>> buffer = gst_buffer_new();
>>>
>>>
>>> if(!buffer)
>>>
>>>
>>> g_printerr ("buffer could not be created\n");
>>>
>>>
>>> else
>>>
>>>
>>> g_print ("Buffer Created\n\n");
>>>
>>>
>>>
>>>
>>>
>>> /*set up fft transform*/
>>>
>>>
>>> gst_fft_s16_fft (fft, in, freq);
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> /*message handler*/
>>>
>>>
>>> bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>>>
>>>
>>> gst_bus_add_watch (bus, bus_call, loop);
>>>
>>>
>>> gst_object_unref (bus);
>>>
>>>
>>>
>>>
>>>
>>> /*colocar todos elementos na pipeline*/
>>>
>>>
>>> gst_bin_add_many (GST_BIN (pipeline), source,
>>> filesink, NULL);
>>>
>>>
>>>
>>>
>>>
>>> /*Linkar elementos*/
>>>
>>>
>>> /*Cria o link entre os pads dos elementos*/
>>>
>>>
>>> gst_element_link_many (source, filesink, NULL);
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> /* set pipeline playing status */
>>>
>>>
>>> gst_element_set_state (pipeline, GST_STATE_PLAYING);
>>>
>>>
>>> g_print ("Running...\n");
>>>
>>>
>>>
>>>
>>>
>>> /*iterate*/
>>>
>>>
>>> g_main_loop_run (loop);
>>>
>>>
>>> g_print ("Recording\n");
>>>
>>>
>>>
>>>
>>>
>>> /* Out of the main loop, clean up nicely */
>>>
>>>
>>> g_print ("Returned, stopping playback\n");
>>>
>>>
>>> gst_element_set_state (pipeline, GST_STATE_NULL);
>>>
>>>
>>>
>>> g_print ("Deleting pipeline\n");
>>>
>>>
>>> gst_object_unref (GST_OBJECT (pipeline));
>>>
>>>
>>>
>>> return 0;
>>>
>>>
>>> }
>>>
>>>
>>>
>>> static gboolean bus_call(GstBus *bus, GstMessage *msg,
>>> gpointer data) {
>>>
>>>
>>>
>>> return TRUE;
>>>
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> The NEW KODAK i700 Series Scanners deliver under ANY
>>> circumstances! Your
>>> production scanning environment may not be a perfect world - but
>>> thanks to
>>> Kodak, there's a perfect scanner to get the job done! With the NEW
>>> KODAK i700
>>> Series Scanner you'll get full speed at 300 dpi even with all image
>>> processing features enabled. http://p.sf.net/sfu/kodak-com
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.sourceforge.net
>>> <mailto:gstreamer-devel at lists.sourceforge.net>
>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------------
>>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>>> production scanning environment may not be a perfect world - but thanks to
>>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
>>> Series Scanner you'll get full speed at 300 dpi even with all image
>>> processing features enabled. http://p.sf.net/sfu/kodak-com
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>>
>>>
>> ------------------------------------------------------------------------------
>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>> production scanning environment may not be a perfect world - but thanks to
>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
>> Series Scanner you'll get full speed at 300 dpi even with all image
>> processing features enabled. http://p.sf.net/sfu/kodak-com
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
More information about the gstreamer-devel
mailing list