I need some help. Gstreamer. H.264 encoding + decoding + displaying. In c code

Marc Leeman marc.leeman at gmail.com
Thu Jul 30 10:26:47 UTC 2020


Decodebin does not have src pads by default, you'll need to subscribe to
pad-added and link that pad to your video sink.

   944     g_signal_connect (uridecodebin , "pad-added",
   945         G_CALLBACK (uridecodebin_on_pad_added_cb), NULL);

On Thu, 30 Jul 2020 at 12:00, peter12 <mikelblaz6 at gmail.com> wrote:

> Fist of all, I have to say that I am new in Gstreamer's enviroment.
>
> I would like to encode the source (video/x264), later to decode and finally
> to display. But I am doing something wrong. Can someone help me?
>
> You can see here the code I am using:
>
>
> #include <glib.h>
> #include <gst/gst.h>
>
> int main(int argc, char* argv[])
> {
>   GMainLoop* loop;
>
>   GstElement *pipeline, *source, *encoder, *decoder, *sink;
>
>   gst_init(&argc, &argv);
>
>   loop = g_main_loop_new(NULL, FALSE);
>
>   // initialize elements
>   pipeline = gst_pipeline_new("audio-player");
>   source = gst_element_factory_make("videotestsrc", "source");
>   sink = gst_element_factory_make("autovideosink", "sink");
>   encoder = gst_element_factory_make("x264enc", "encoder");
>   decoder = gst_element_factory_make("decodebin", "decoder");
>
>   if (!pipeline || !source || !encoder || !decoder || !sink) {
>     g_printerr("One element could not be created. Exiting.\n");
>     return -1;
>   }
>
>   // add elements to pipeline
>   gst_bin_add_many(GST_BIN(pipeline), source, encoder, decoder, sink,
> NULL);
>
>   // link elements
>   gst_element_link(source,encoder);
>   gst_element_link(encoder,decoder);
>   gst_element_link(decoder,sink);
>   //gst_element_link_many(source, sink, NULL);
>
>   gst_element_set_state(pipeline, GST_STATE_PLAYING);
>
>   g_main_loop_run(loop);
>
>   // cleanup
>   gst_element_set_state(pipeline, GST_STATE_NULL);
>   gst_object_unref(GST_OBJECT(pipeline));
>   g_main_loop_unref(loop);
>
>   return 0;
> }
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


-- 
g. Marc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200730/e25389e6/attachment.htm>


More information about the gstreamer-devel mailing list