GstCaps filter issue

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

GstCaps filter issue

doon
This post was updated on .
I trying to create filter using caps:
                GMainLoop *loop;
                GstElement *pipeline, *source, *demuxer, *decoder,  *typefind, *conv, *sink;;
                GstBus *bus;
                guint bus_watch_id;


                loop = g_main_loop_new(NULL, FALSE);

                pipeline = gst_pipeline_new ("audio-player");
                source   = gst_element_factory_make ("filesrc",       "file-source");
                typefind = gst_element_factory_make ("typefind", "typefinder");
                demuxer  = gst_element_factory_make ("oggdemux",      "ogg-demuxer");
                decoder  = gst_element_factory_make ("vorbisdec",     "vorbis-decoder");
                conv     = gst_element_factory_make ("audioconvert",  "converter");
                sink     = gst_element_factory_make ("autoaudiosink", "audio-output");

                if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) {
                        g_printerr ("Не удалось создать один из элементов конвейера. Работа приложения завершена.\n");
                        return -1;
                }
                g_signal_connect (typefind, "have-type", G_CALLBACK (cb_typefound), loop);
                g_object_set(G_OBJECT(source), "location", name_of_file, NULL);

                bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
                bus_watch_id = gst_bus_add_watch(bus, bus_call, loop);
                gst_object_unref(bus);

                gst_bin_add_many(GST_BIN(pipeline), source, typefind, demuxer, decoder, conv, sink, NULL);

                GstCaps *my_caps = gst_caps_new_simple ("audio/x-raw","rate", G_TYPE_INT, 384,NULL);


                gboolean test=false;
                test = gst_element_link_filtered(source,typefind, my_caps);
                test = gst_element_link(typefind, demuxer);
                test = gst_element_link_many(decoder, conv,sink, NULL);


                g_signal_connect(demuxer, "pad-added", G_CALLBACK(on_pad_added), decoder);
............


But get error:
Debug: gsttypefindelement.c(1169): gst_type_find_element_loop (): /GstPipeline:a
udio-player/GstTypeFindElement:typefinder:
stream stopped, reason not-linked


Var test == 1 after gst_element_link_filtered(source,typefind, my_caps);
      test == 0 after gst_element_link(typefind, demuxer);
      test == 1 after gst_element_link_many(decoder, conv,sink, NULL);
If I just change gst_element_link_filtered on gst_element_link all going ok and file plays.
What am I doing wrong?
Reply | Threaded
Open this post in threaded view
|

Re: GstCaps filter issue

Sérgio Agostinho
Hi, 

You're setting a caps filter of type audio/x-raw between the filesource and the typefind element, but the demuxer you selected (oggdemux) does not support that on its sink pad.

What are you trying to do?

Cheers

2015-07-23 2:57 GMT+02:00 doon <[hidden email]>:
I trying to create filter using caps:
*               GMainLoop *loop;
                GstElement *pipeline, *source, *demuxer, *decoder,  *typefind, *conv,
*sink;;
                GstBus *bus;
                guint bus_watch_id;


                loop = g_main_loop_new(NULL, FALSE);

                pipeline = gst_pipeline_new ("audio-player");
                source   = gst_element_factory_make ("filesrc",       "file-source");
                typefind = gst_element_factory_make ("typefind", "typefinder");
                demuxer  = gst_element_factory_make ("oggdemux",      "ogg-demuxer");
                decoder  = gst_element_factory_make ("vorbisdec",     "vorbis-decoder");
                conv     = gst_element_factory_make ("audioconvert",  "converter");
                sink     = gst_element_factory_make ("autoaudiosink", "audio-output");

                if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) {
                        g_printerr ("Не удалось создать один из элементов конвейера. Работа
приложения завершена.\n");
                        return -1;
                }
                g_signal_connect (typefind, "have-type", G_CALLBACK (cb_typefound), loop);
                g_object_set(G_OBJECT(source), "location", name_of_file, NULL);

                bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
                bus_watch_id = gst_bus_add_watch(bus, bus_call, loop);
                gst_object_unref(bus);

                gst_bin_add_many(GST_BIN(pipeline), source, typefind, demuxer, decoder,
conv, sink, NULL);

                GstCaps *my_caps = gst_caps_new_simple ("audio/x-raw","rate", G_TYPE_INT,
384,NULL);


                gboolean test=false;
                test = gst_element_link_filtered(source,typefind, my_caps);
                test = gst_element_link(typefind, demuxer);
                test = gst_element_link_many(decoder, conv,sink, NULL);


                g_signal_connect(demuxer, "pad-added", G_CALLBACK(on_pad_added),
decoder);*

But get error:
*Debug: gsttypefindelement.c(1169): gst_type_find_element_loop ():
/GstPipeline:a
udio-player/GstTypeFindElement:typefinder:
stream stopped, reason not-linked*

Var test == 1 after gst_element_link_filtered(source,typefind, my_caps);
      test == 0 after gst_element_link(typefind, demuxer);
      test == 1 after gst_element_link_many(decoder, conv,sink, NULL);
If I just change gst_element_link_filtered on gst_element_link all going ok
and file plays.
What am I doing wrong?



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/GstCaps-filter-issue-tp4672796.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GstCaps filter issue

doon
Thanks for the response!
Yes, oggdemux really need audio/ogg on sink pad. Now I trying to link audioconvert to autoaudiosink with the same caps and with caps with "audio/ogg" type but still have same error.
I think I don't quite understand something, can you explain?
I trying to change rate of my audio.
Sérgio Agostinho wrote
Hi,

You're setting a caps filter of type audio/x-raw between the filesource and
the typefind element, but the demuxer you selected (oggdemux) does not
support that on its sink pad.

What are you trying to do?

Cheers

2015-07-23 2:57 GMT+02:00 doon <[hidden email]>:

> I trying to create filter using caps:
> *               GMainLoop *loop;
>                 GstElement *pipeline, *source, *demuxer, *decoder,
> *typefind, *conv,
> *sink;;
>                 GstBus *bus;
>                 guint bus_watch_id;
>
>
>                 loop = g_main_loop_new(NULL, FALSE);
>
>                 pipeline = gst_pipeline_new ("audio-player");
>                 source   = gst_element_factory_make ("filesrc",
>  "file-source");
>                 typefind = gst_element_factory_make ("typefind",
> "typefinder");
>                 demuxer  = gst_element_factory_make ("oggdemux",
> "ogg-demuxer");
>                 decoder  = gst_element_factory_make ("vorbisdec",
>  "vorbis-decoder");
>                 conv     = gst_element_factory_make ("audioconvert",
> "converter");
>                 sink     = gst_element_factory_make ("autoaudiosink",
> "audio-output");
>
>                 if (!pipeline || !source || !demuxer || !decoder || !conv
> || !sink) {
>                         g_printerr ("Не удалось создать один из элементов
> конвейера. Работа
> приложения завершена.\n");
>                         return -1;
>                 }
>                 g_signal_connect (typefind, "have-type", G_CALLBACK
> (cb_typefound), loop);
>                 g_object_set(G_OBJECT(source), "location", name_of_file,
> NULL);
>
>                 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
>                 bus_watch_id = gst_bus_add_watch(bus, bus_call, loop);
>                 gst_object_unref(bus);
>
>                 gst_bin_add_many(GST_BIN(pipeline), source, typefind,
> demuxer, decoder,
> conv, sink, NULL);
>
>                 GstCaps *my_caps = gst_caps_new_simple
> ("audio/x-raw","rate", G_TYPE_INT,
> 384,NULL);
>
>
>                 gboolean test=false;
>                 test = gst_element_link_filtered(source,typefind, my_caps);
>                 test = gst_element_link(typefind, demuxer);
>                 test = gst_element_link_many(decoder, conv,sink, NULL);
>
>
>                 g_signal_connect(demuxer, "pad-added",
> G_CALLBACK(on_pad_added),
> decoder);*
>
> But get error:
> *Debug: gsttypefindelement.c(1169): gst_type_find_element_loop ():
> /GstPipeline:a
> udio-player/GstTypeFindElement:typefinder:
> stream stopped, reason not-linked*
>
> Var test == 1 after gst_element_link_filtered(source,typefind, my_caps);
>       test == 0 after gst_element_link(typefind, demuxer);
>       test == 1 after gst_element_link_many(decoder, conv,sink, NULL);
> If I just change gst_element_link_filtered on gst_element_link all going ok
> and file plays.
> What am I doing wrong?
>
>
>
> --
> View this message in context:
> http://gstreamer-devel.966125.n4.nabble.com/GstCaps-filter-issue-tp4672796.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GstCaps filter issue

Sérgio Agostinho
Hey 

If your objective is to have control over the audiorate, I would suggest modifying your code to implement a pipeline like this

filesrc ! oggmux ! vorbisdec ! audioconvert ! audiorate (or audioresample) ! audio/x-raw, rate=<desired_rate> ! autoaudiosink

and then set the desired rate on the audiorate/audioresample element. 

Cheers

2015-07-23 15:42 GMT+02:00 doon <[hidden email]>:
Thanks for the response!
Yes, oggdemux really need audio/ogg on sink pad. Now I trying to link
audioconvert to autoaudiosink with the same caps and with caps with
"audio/ogg" type but still have same error.
I think I don't quite understand something, can you explain?
I trying to change rate of my audio.
Sérgio Agostinho wrote
> Hi,
>
> You're setting a caps filter of type audio/x-raw between the filesource
> and
> the typefind element, but the demuxer you selected (oggdemux) does not
> support that on its sink pad.
>
> What are you trying to do?
>
> Cheers
>
> 2015-07-23 2:57 GMT+02:00 doon &lt;

> don-prog@

> &gt;:
>
>> I trying to create filter using caps:
>> *               GMainLoop *loop;
>>                 GstElement *pipeline, *source, *demuxer, *decoder,
>> *typefind, *conv,
>> *sink;;
>>                 GstBus *bus;
>>                 guint bus_watch_id;
>>
>>
>>                 loop = g_main_loop_new(NULL, FALSE);
>>
>>                 pipeline = gst_pipeline_new ("audio-player");
>>                 source   = gst_element_factory_make ("filesrc",
>>  "file-source");
>>                 typefind = gst_element_factory_make ("typefind",
>> "typefinder");
>>                 demuxer  = gst_element_factory_make ("oggdemux",
>> "ogg-demuxer");
>>                 decoder  = gst_element_factory_make ("vorbisdec",
>>  "vorbis-decoder");
>>                 conv     = gst_element_factory_make ("audioconvert",
>> "converter");
>>                 sink     = gst_element_factory_make ("autoaudiosink",
>> "audio-output");
>>
>>                 if (!pipeline || !source || !demuxer || !decoder || !conv
>> || !sink) {
>>                         g_printerr ("Не удалось создать один из элементов
>> конвейера. Работа
>> приложения завершена.\n");
>>                         return -1;
>>                 }
>>                 g_signal_connect (typefind, "have-type", G_CALLBACK
>> (cb_typefound), loop);
>>                 g_object_set(G_OBJECT(source), "location", name_of_file,
>> NULL);
>>
>>                 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
>>                 bus_watch_id = gst_bus_add_watch(bus, bus_call, loop);
>>                 gst_object_unref(bus);
>>
>>                 gst_bin_add_many(GST_BIN(pipeline), source, typefind,
>> demuxer, decoder,
>> conv, sink, NULL);
>>
>>                 GstCaps *my_caps = gst_caps_new_simple
>> ("audio/x-raw","rate", G_TYPE_INT,
>> 384,NULL);
>>
>>
>>                 gboolean test=false;
>>                 test = gst_element_link_filtered(source,typefind,
>> my_caps);
>>                 test = gst_element_link(typefind, demuxer);
>>                 test = gst_element_link_many(decoder, conv,sink, NULL);
>>
>>
>>                 g_signal_connect(demuxer, "pad-added",
>> G_CALLBACK(on_pad_added),
>> decoder);*
>>
>> But get error:
>> *Debug: gsttypefindelement.c(1169): gst_type_find_element_loop ():
>> /GstPipeline:a
>> udio-player/GstTypeFindElement:typefinder:
>> stream stopped, reason not-linked*
>>
>> Var test == 1 after gst_element_link_filtered(source,typefind, my_caps);
>>       test == 0 after gst_element_link(typefind, demuxer);
>>       test == 1 after gst_element_link_many(decoder, conv,sink, NULL);
>> If I just change gst_element_link_filtered on gst_element_link all going
>> ok
>> and file plays.
>> What am I doing wrong?
>>
>>
>>
>> --
>> View this message in context:
>> http://gstreamer-devel.966125.n4.nabble.com/GstCaps-filter-issue-tp4672796.html
>> Sent from the GStreamer-devel mailing list archive at Nabble.com.
>> _______________________________________________
>> gstreamer-devel mailing list
>>

> gstreamer-devel@.freedesktop

>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>
> _______________________________________________
> gstreamer-devel mailing list

> gstreamer-devel@.freedesktop

> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel





--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/GstCaps-filter-issue-tp4672796p4672814.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GstCaps filter issue

doon
Thanks! But my preferred objective is to understand why I have this error and how I can correctly use caps in this case.
Sérgio Agostinho wrote
Hey

If your objective is to have control over the audiorate, I would suggest
modifying your code to implement a pipeline like this

filesrc ! oggmux ! vorbisdec ! audioconvert ! audiorate (or audioresample)
! audio/x-raw, rate=<desired_rate> ! autoaudiosink

and then set the desired rate on the audiorate/audioresample element.

Cheers

2015-07-23 15:42 GMT+02:00 doon <[hidden email]>:

> Thanks for the response!
> Yes, oggdemux really need audio/ogg on sink pad. Now I trying to link
> audioconvert to autoaudiosink with the same caps and with caps with
> "audio/ogg" type but still have same error.
> I think I don't quite understand something, can you explain?
> I trying to change rate of my audio.
> Sérgio Agostinho wrote
> > Hi,
> >
> > You're setting a caps filter of type audio/x-raw between the filesource
> > and
> > the typefind element, but the demuxer you selected (oggdemux) does not
> > support that on its sink pad.
> >
> > What are you trying to do?
> >
> > Cheers
> >
> > 2015-07-23 2:57 GMT+02:00 doon <
>
> > don-prog@
>
> > >:
> >
> >> I trying to create filter using caps:
> >> *               GMainLoop *loop;
> >>                 GstElement *pipeline, *source, *demuxer, *decoder,
> >> *typefind, *conv,
> >> *sink;;
> >>                 GstBus *bus;
> >>                 guint bus_watch_id;
> >>
> >>
> >>                 loop = g_main_loop_new(NULL, FALSE);
> >>
> >>                 pipeline = gst_pipeline_new ("audio-player");
> >>                 source   = gst_element_factory_make ("filesrc",
> >>  "file-source");
> >>                 typefind = gst_element_factory_make ("typefind",
> >> "typefinder");
> >>                 demuxer  = gst_element_factory_make ("oggdemux",
> >> "ogg-demuxer");
> >>                 decoder  = gst_element_factory_make ("vorbisdec",
> >>  "vorbis-decoder");
> >>                 conv     = gst_element_factory_make ("audioconvert",
> >> "converter");
> >>                 sink     = gst_element_factory_make ("autoaudiosink",
> >> "audio-output");
> >>
> >>                 if (!pipeline || !source || !demuxer || !decoder ||
> !conv
> >> || !sink) {
> >>                         g_printerr ("Не удалось создать один из
> элементов
> >> конвейера. Работа
> >> приложения завершена.\n");
> >>                         return -1;
> >>                 }
> >>                 g_signal_connect (typefind, "have-type", G_CALLBACK
> >> (cb_typefound), loop);
> >>                 g_object_set(G_OBJECT(source), "location", name_of_file,
> >> NULL);
> >>
> >>                 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
> >>                 bus_watch_id = gst_bus_add_watch(bus, bus_call, loop);
> >>                 gst_object_unref(bus);
> >>
> >>                 gst_bin_add_many(GST_BIN(pipeline), source, typefind,
> >> demuxer, decoder,
> >> conv, sink, NULL);
> >>
> >>                 GstCaps *my_caps = gst_caps_new_simple
> >> ("audio/x-raw","rate", G_TYPE_INT,
> >> 384,NULL);
> >>
> >>
> >>                 gboolean test=false;
> >>                 test = gst_element_link_filtered(source,typefind,
> >> my_caps);
> >>                 test = gst_element_link(typefind, demuxer);
> >>                 test = gst_element_link_many(decoder, conv,sink, NULL);
> >>
> >>
> >>                 g_signal_connect(demuxer, "pad-added",
> >> G_CALLBACK(on_pad_added),
> >> decoder);*
> >>
> >> But get error:
> >> *Debug: gsttypefindelement.c(1169): gst_type_find_element_loop ():
> >> /GstPipeline:a
> >> udio-player/GstTypeFindElement:typefinder:
> >> stream stopped, reason not-linked*
> >>
> >> Var test == 1 after gst_element_link_filtered(source,typefind, my_caps);
> >>       test == 0 after gst_element_link(typefind, demuxer);
> >>       test == 1 after gst_element_link_many(decoder, conv,sink, NULL);
> >> If I just change gst_element_link_filtered on gst_element_link all going
> >> ok
> >> and file plays.
> >> What am I doing wrong?
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://gstreamer-devel.966125.n4.nabble.com/GstCaps-filter-issue-tp4672796.html
> >> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> >> _______________________________________________
> >> gstreamer-devel mailing list
> >>
>
> > gstreamer-devel@.freedesktop
>
> >> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >>
> >
> > _______________________________________________
> > gstreamer-devel mailing list
>
> > gstreamer-devel@.freedesktop
>
> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
>
>
> --
> View this message in context:
> http://gstreamer-devel.966125.n4.nabble.com/GstCaps-filter-issue-tp4672796p4672814.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GstCaps filter issue

RK29
This post was updated on .
Hey guys,
can you please answer my question.

http://gstreamer-devel.966125.n4.nabble.com/Waiting-for-the-reply-Unable-to-get-the-sample-from-Appsink-using-C-td4695139.html



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel