[gst-devel] Fwd: no such element factory

Kapil Agrawal kapil.agl at gmail.com
Tue Nov 14 15:43:00 CET 2006


Hi,

can someone plz  copy the following program and compile and plz check
whether its working or not
since i am still getting the same error .


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <gst/gst.h>

GstElement *pipeline, *filesrc, *filter, *sink;
GstElement *decoder;
static gboolean
bus_call (GstBus *bus,
                GstMessage *msg,
                gpointer data)
{
        GMainLoop *loop = data;
        switch (GST_MESSAGE_TYPE (msg)) {
                case GST_MESSAGE_EOS:
                        g_print ("End-of-stream\n");
                        g_main_loop_quit (loop);
                        break;
                case GST_MESSAGE_ERROR: {
                                                gchar *debug;
                                                GError *err;
                                                gst_message_parse_error
(msg, &err, &debug);
                                                g_free (debug);
                                                g_print ("Error: %s\n",
err->message);
                                                g_error_free (err);
                                                g_main_loop_quit (loop);
                                                break;
                                        }
                default:
                                        break;
        }
        return TRUE;
}

gint
main (gint argc,
                gchar *argv[])
{
        GMainLoop *loop;
        /* initialization */
        gst_init (&argc, &argv);
        loop = g_main_loop_new (NULL, FALSE);
        if (argc != 2) {
                g_print ("Usage: %s <mp3 filename>\n", argv[0]);
                return 01;
        }
        /* create elements */
        pipeline = gst_pipeline_new ("my_pipeline");
        gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (pipeline)),
                        bus_call, loop);

          filesrc = gst_element_factory_make ("filesrc", "my_filesource");
          decoder = gst_element_factory_make ("mad", "my_decoder");
      sink = gst_element_factory_make ("alsasink", "audiosink");
        if (!decoder) {
                g_print ("Decoder or output could not be found - check your
install\n");
                return -1;
        }
        g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
        /* link everything together */
        gst_element_link_many (filesrc, decoder, filter, sink, NULL);
        gst_bin_add_many (GST_BIN (pipeline), filesrc, decoder, sink, NULL);
        /* run */
        gst_element_set_state (pipeline, GST_STATE_PLAYING);
        g_main_loop_run (loop);
        /* clean up */
        gst_element_set_state (pipeline, GST_STATE_NULL);
        gst_object_unref (GST_OBJECT (pipeline));
        return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

On 11/7/06, ensonic <ensonic at hora-obscura.de> wrote:
>
> Hi,
>
> from the path it looks like you use gstreamer-0.10 (because of
> gst-plugins-ugly-0.10.4). That means you don't need gst-register anymore.
> Can you please post the gstreamer versions that you use?
>
> If you still have a gstreamer-0.9 around, you should remove it (make
> uninstall).
>
> You definitely do not need to load plgins, if you use the gst-registry.
> You
> only need to manually load the plugins if you build gstreamer with
> --disable-gst-registry.
>
> In your sample you try to load the mad-plugin bt below it looks like its
> is
> your own filter that does not work. Try running your application as:
> GST_DEBUG="GST_REGISTRY:4,GST_PLUGIN_LOADING:4" ./my-app 2>debug.log
>
> and then search the debg.log file for your plugin name. The you'll see if
> your plgin gets loaded properly. If it get loaded, you should be able to
> instantiate it by its name ( via gst_element_factory_make() )
>
> Stefan
>
>
> On 8:10:30 am 07/11/2006 "Kapil Agrawal" <kapil.agl at gmail.com> wrote:
> >
> >
> >
> > ---------- Forwarded message ----------
> > From: Kapil Agrawal
> > Date: Nov 7, 2006 12:33 PM
> > Subject: Re: [gst-devel] no such element factory
> > To: Benoit Fouet
> >
> > i added the above mentioned code but still i am getting  the error.
> > if i use gst_plugin_load_file(&quot;../gstreamer/gst-plugins-ugly-0.10
> > .4/ext/mad/libgstmad.la&quot;,&amp;error); it give me error as &quot; ER
> > ROR loading plug-in: Opening module failed&quot;.
> >
> > and if use gst_plugin_load_file(&quot;../../../usr/local/lib/gstreamer
> > -0.10/libgst/libgstmad.so&quot;,&amp;error); it gives me error as &quot;
> > ERROR loading plug-in: Problem accessing file ../../../usr/local/lib/gst
> > reamer-0.10/libgst/libgstmad.so: No such file or directory&quot;.
> >
> > in both cases the path is correct and the files are present.
> > following is my code.
> >
> > /***************************************************/
> > #include
> >
> > GstElement *pipeline, *filesrc, *decoder, *filter, *sink;
> > static gboolean
> > bus_call (GstBus *bus,
> >                 GstMessage *msg,
> >                 gpointer data)
> > {
> >         GMainLoop *loop = data;
> >         switch (GST_MESSAGE_TYPE (msg)) {
> >                 case GST_MESSAGE_EOS:
> >                         g_print (&quot;End-of-stream\n&quot;);
> >                         g_main_loop_quit (loop);
> >                         break;
> >                 case GST_MESSAGE_ERROR: {
> >                                                 gchar *debug;
> >                                                 GError *err;
> >                                                 gst_message_parse_erro
> > r (msg, &amp;err, &amp;debug);
> >                                                 g_free (debug);
> >                                                 g_print (&quot;Error:
> > %s\n&quot;, err->message);
> > g_error_free (err);
> > g_main_loop_quit (loop);
> > break;                                         }
> >                 default:
> >                                         break;
> >         }
> >         return TRUE;}
> >
> > gint
> > main (gint argc,
> >                 gchar *argv[])
> > {
> >         GstPlugin* load_plugin;
> >         GError* error= NULL;
> >
> >         GMainLoop *loop;
> >         /* initialization */
> >         gst_init (&amp;argc, &amp;argv);
> >         loop = g_main_loop_new (NULL, FALSE);
> >         if (argc != 2) {
> >                 g_print (&quot;Usage: %s \n&quot;, argv[0]);
> >                 return 01;
> >         }
> >         /* create elements */
> >         pipeline = gst_pipeline_new (&quot;my_pipeline&quot;);
> >         gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE
> > (pipeline)),                         bus_call, loop);
> >
> >         //gst_plugin_load_file(&quot;../gstreamer/gst-plugins-ugly-0.1
> > 0.4/ext/mad/libgstmad.la&quot;,&amp;error);
> >         gst_plugin_load_file(&quot;../../../usr/local/lib/gstreamer-0.
> > 10/libgst/libgstmad.so&quot;,&amp;error);
> >         if (error)
> >         {
> >                  g_print (&quot;ERROR loading plug-in: %s\n&quot;,
> > error->message);                  g_free (error);
> >                  return -1;
> >         }
> >         filesrc = gst_element_factory_make (&quot;filesrc&quot;,
> > &quot;my_filesource&quot;);         decoder = gst_element_factory_make
> >  (&quot;mad&quot;, &quot;my_decoder&quot;);
> >         filter = gst_element_factory_make (&quot;myelement&quot;,
> > &quot;my_filter&quot;);         sink = gst_element_factory_make
> > (&quot;alsasink&quot;, &quot;audiosink&quot;);         if (!sink ||
> > !decoder) {                 g_print (&quot;Decoder or output could
> > not be found - check your install\n&quot;);                 return -1;
> >         } else if (!filter) {
> >                 g_print (&quot;Your self-written filter could not be
> > found. Make sure it &quot;                                 &quot;is
> > installed correctly in $(libdir)/gstreamer-0.9/ and that &quot;
> >                           &quot;you've ran gst-register-0.9 to register
> > it. Check availability &quot;
> > &quot;of the plugin afterwards using \&quot;gst-inspect-0.9
> > my_filter\&quot;&quot;);                 return -1;
> >         }
> >         g_object_set (G_OBJECT (filesrc), &quot;location&quot;,
> > argv[1], NULL);         /* link everything together */
> >         gst_element_link_many (filesrc, decoder, filter, sink, NULL);
> >         gst_bin_add_many (GST_BIN (pipeline), filesrc, decoder,
> > filter, sink, NULL);         /* run */
> >         gst_element_set_state (pipeline, GST_STATE_PLAYING);
> >         g_main_loop_run (loop);
> >         /* clean up */
> >         gst_element_set_state (pipeline, GST_STATE_NULL);
> >         gst_object_unref (GST_OBJECT (pipeline));
> >         return 0;
> > }
> >
> >
> > /***************************************************/
> >
> >
> > On 11/6/06, Benoit Fouet  wrote:Kapil Agrawal wrote:
> > >  thanks for your reply.
> > >  Actually i had installed the mad plugin , and i am getting the
> > >  above mentioned error using it. so do we need to use
> > >  gst_plugin_load_file api whenever we add a new plugin, and can u
> > >  plz brief on this api further, since no enough description is
> > > given abt it .
> > you have to load the library in which your plugin is...
> > for instance:
> > /* ........ */
> > GError *error;
> >
> > /* ....... */
> >
> > gst_plugin_load_file (&quot;lib_mylib.so&quot;, &amp;error);
> > if (error)
> > {
> >   g_print (&quot;ERROR loading plug-in: %s\n&quot;, error->message);
> >   g_free (error);
> >   return -1;
> > }
> >
> > /* here you can call gst_element_factory_make() */
> >
> > /* ...... */
> >
> > -- Ben
> >
> > >  -kapil
> > >
> > >  On 11/6/06, *Benoit Fouet*  > wrote:
> > >
> > >      Kapil Agrawal wrote:
> > >     >  hi ,
> > >     >
> > >     >  when i installed a new plugin , and used that in my .c file
> > >     >  for an application, while calling gst_element_factory_make()
> > >      for that plugin
> > >     >  its give me an error &quot;no such element factory
> > >      &quot;plugin&quot; &quot;. But when i
> > >     >  use the same plugin at command line , ie gst-launch  ..|
> > >     >  plugin | .....|...... it works properly. also when i did a
> > >      gst-inspect plugin,
> > >     >  its  properties are show. even the ~/.gstreamer/registry.*.xm
> > l
> > >      has the
> > >     >  plugin entry. I am unable to find the reason, can someone
> > >      give me some
> > >     >  pointers what ned to be done?
> > >     >
> > >     >  tahnks
> > >     >
> > >     >  -kapil
> > >      do you also load the library where the plugin is before trying
> > >      to call
> > >      gst_element_factory_make() ?
> > >      (by using gst_plugin_load_file)
> > >
> > >      hope that helps
> > >
> > >      -- Ben
> > >
> > >     >
> > >      ---------------------------------------------------------------
> > ---------
> > >     >
> > >     >
> > >      ---------------------------------------------------------------
> > ----------
> > >
> > >     >  Using Tomcat but need to do more? Need to support web
> > >      services, security?
> > >     >  Get stuff done quickly with pre-integrated technology to make
> > >      your job easier
> > >     >  Download IBM WebSphere Application Server v.1.0.1 based on
> > >      Apache Geronimo
> > >     >
> > >      http://sel.as-us.falkag.net/sel?cmd=lnk&amp;kid=120709&amp;bid=
> > 263057&amp;dat=121642
> > >
> > >     >
> > >      ---------------------------------------------------------------
> > ---------
> > >     >
> > >     >  _______________________________________________
> > >     >  gstreamer-devel mailing list
> > >     >  gstreamer-devel at lists.sourceforge.net
> > >
> > >     >  https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> > >     >
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20061114/ceaff8a5/attachment.htm>


More information about the gstreamer-devel mailing list