<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hey guys,<div><br></div><div>I'm having trouble figuring this out. I have an application that is in its simplest form creating a GStreamer pipeline with a UDP source, H264 decoder and video output. I'll post the code below.</div><div>1. I know I can run on the same machine the pipeline via gst-launch on the command-line and it works exactly as expected showing me the video stream:<br>  <code class="gmail-java gmail-plain" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;border-radius:0px;background-image:initial;background-position:0px 50%;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;font-size:14px;min-height:inherit;white-space:nowrap;color:rgb(0,0,0)">gst-launch-</code><code class="gmail-java gmail-value" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;border-radius:0px;background-image:initial;background-position:0px 50%;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;font-size:14px;min-height:inherit;white-space:nowrap;color:rgb(0,153,0)">1.0</code><span style="color:rgb(51,51,51);font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;font-size:14px;white-space:nowrap"> </span><code class="gmail-java gmail-plain" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;border-radius:0px;background-image:initial;background-position:0px 50%;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;font-size:14px;min-height:inherit;white-space:nowrap;color:rgb(0,0,0)">udpsrc port=</code><code class="gmail-java gmail-value" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;border-radius:0px;background-image:initial;background-position:0px 50%;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;font-size:14px;min-height:inherit;white-space:nowrap;color:rgb(0,153,0)">5000</code><span style="color:rgb(51,51,51);font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;font-size:14px;white-space:nowrap"> </span><code class="gmail-java gmail-plain" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;border-radius:0px;background-image:initial;background-position:0px 50%;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;font-size:14px;min-height:inherit;white-space:nowrap;color:rgb(0,0,0)">! application/x-rtp,encoding-name=H264, payload=</code><code class="gmail-java gmail-value" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;border-radius:0px;background-image:initial;background-position:0px 50%;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;font-size:14px;min-height:inherit;white-space:nowrap;color:rgb(0,153,0)">96</code><span style="color:rgb(51,51,51);font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;font-size:14px;white-space:nowrap"> </span><code class="gmail-java gmail-plain" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;border-radius:0px;background-image:initial;background-position:0px 50%;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;font-size:14px;min-height:inherit;white-space:nowrap;color:rgb(0,0,0)">! rtph264depay ! h264parse ! queue ! avdec_h264 ! autovideosink sync=</code><code class="gmail-java gmail-keyword" style="font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;border-radius:0px;background-image:initial;background-position:0px 50%;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;border:0px;float:none;height:auto;line-height:20px;margin:0px;outline:0px;overflow:visible;padding:0px;vertical-align:baseline;width:auto;box-sizing:content-box;font-size:14px;min-height:inherit;white-space:nowrap;font-weight:bold;color:rgb(51,102,153)">false</code></div><div>2. I can build the same code on Linux and it also works just as expected showing me the video stream.</div><div><span style="color:rgb(51,102,153);font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;font-size:14px;white-space:nowrap"><font color="#222222" face="Arial, Helvetica, sans-serif" size="2"><span style="white-space:normal"><br></span></font></span></div><div><span style="color:rgb(51,102,153);font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;font-size:14px;white-space:nowrap"><font color="#222222" face="Arial, Helvetica, sans-serif" size="2"><span style="white-space:normal">Both of the above tell me:</span></font></span></div><div><span style="color:rgb(51,102,153);font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;font-size:14px;white-space:nowrap"><font color="#222222" face="Arial, Helvetica, sans-serif" size="2"><span style="white-space:normal">1. Windows can handle the pipeline correctly and in general all is installed correctly.</span></font></span></div><div><span style="color:rgb(51,102,153);font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;font-size:14px;white-space:nowrap"><font color="#222222" face="Arial, Helvetica, sans-serif" size="2"><span style="white-space:normal">2. The program code is also correct because I can see the stream correctly on Linux.</span></font></span></div><div><span style="color:rgb(51,102,153);font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;font-size:14px;white-space:nowrap"><font color="#222222" face="Arial, Helvetica, sans-serif" size="2"><span style="white-space:normal"><br></span></font></span></div><div><span style="color:rgb(51,102,153);font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace;font-size:14px;white-space:nowrap"><font color="#222222" face="Arial, Helvetica, sans-serif" size="2"><span style="white-space:normal">So when I run the application built with the below code on Windows I get the following error messages on the command line:</span></font></span></div><div><font color="#222222" size="2"><div style=""><font face="monospace, monospace">(GStreamerWindowsHostSample.exe:133520): GLib-CRITICAL **: g_datalist_id_set_data_full: assertion 'key_id > 0' failed</font></div><div style=""><font face="monospace, monospace">(GStreamerWindowsHostSample.exe:133520): GLib-GObject-CRITICAL **: g_param_spec_pool_lookup: assertion 'pool != NULL' failed<br></font></div><div style=""><font face="monospace, monospace">(GStreamerWindowsHostSample.exe:133520): GLib-GObject-WARNING **: g_object_set_valist: object class '(NULL)' has no property named 'port'<br></font></div><div style=""><font face="monospace, monospace"><br></font></div><div style=""><font face="monospace, monospace">(GStreamerWindowsHostSample.exe:133520): GLib-CRITICAL **: g_datalist_id_set_data_full: assertion 'key_id > 0' failed<br></font></div><div style=""><font face="monospace, monospace">(GStreamerWindowsHostSample.exe:133520): GLib-GObject-CRITICAL **: g_param_spec_pool_lookup: assertion 'pool != NULL' failed<br></font></div><div style=""><font face="monospace, monospace">(GStreamerWindowsHostSample.exe:133520): GLib-GObject-WARNING **: g_object_set_valist: object class '(NULL)' has no property named 'sync'</font><br></div></font><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><br></div><div dir="ltr">I don't see these errors in the other two examples. The above errors imply to me that gstreamer of glib is having trouble identifying the correct object type somehow. But why does it not have the problem when I run the gst-launch pipeline?</div><div dir="ltr"><br></div><div>In the Visual Studio debugger I can see in the output window that it loads all the right dlls, like libgstudp.dll and libgstcoreelements.dll which contain the elements above. Btw I'm using VS2017, a CMake project and am running this on Windows 10 1709 with gstreamer version 1.14.1. No build errors whatsoever.</div><div><br></div><div>I'm at a loss as to what I'm missing. So any suggestion and help is appreciated! I'm sure it's something ridiculously simple...</div><div dir="ltr"><br>-Bernd --<br><br>-------------------------------<br></div><div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><b>GStreamerWindowsHostSample.cpp code:</b></div><div><br></div></div><div dir="ltr"><font face="monospace, monospace">#include "GStreamerWindowsHostSample.h"<br></font></div><div dir="ltr"><div><font face="monospace, monospace"><br></font></div></div><div dir="ltr"><div dir="ltr"><font face="monospace, monospace">using namespace std;</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace">/* Structure holding GStreamer elements neccessary to control program/pipeline execution */</font></div><div dir="ltr"><font face="monospace, monospace">typedef struct _ControlData {</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">   </span>GstElement *pipeline;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>GMainLoop  *loop;</font></div><div dir="ltr"><font face="monospace, monospace">} ControlData;</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace">/* Bus message handler */</font></div><div dir="ltr"><font face="monospace, monospace">static gboolean</font></div><div dir="ltr"><font face="monospace, monospace">bus_call(GstBus     *bus,</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">   </span>GstMessage *msg,</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">   </span>gpointer    data)</font></div><div dir="ltr"><font face="monospace, monospace">{</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span>GMainLoop *loop = (GMainLoop *)data;</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">   </span>switch (GST_MESSAGE_TYPE(msg)) {</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">       </span>case GST_MESSAGE_EOS:</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">              </span>g_print("End of stream\n");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">              </span>g_main_loop_quit(loop);</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">            </span>break;</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>case GST_MESSAGE_ERROR: {</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">          </span>gchar  *debug;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">            </span>GError *error;</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">         </span>gst_message_parse_error(msg, &error, &debug);</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">              </span>g_free(debug);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">         </span>g_printerr("Error: %s\n", error->message);</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">            </span>g_error_free(error);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">           </span>g_main_loop_quit(loop);</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">            </span>break;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span>}</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">  </span>default:</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">           </span>break;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span>}</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>return TRUE;</font></div><div dir="ltr"><font face="monospace, monospace">}</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace">/* Process keyboard input */</font></div><div dir="ltr"><font face="monospace, monospace">static gboolean</font></div><div dir="ltr"><font face="monospace, monospace">handle_keyboard(GIOChannel *source,</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">    </span>GIOCondition cond,</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>ControlData *data)</font></div><div dir="ltr"><font face="monospace, monospace">{</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>gchar *str = NULL;</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span>if (g_io_channel_read_line(source, &str, NULL, NULL, NULL) != G_IO_STATUS_NORMAL) {</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">            </span>return TRUE;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">       </span>}</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>switch (g_ascii_tolower(str[0])) {</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>case 'q':</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">          </span>g_main_loop_quit(data->loop);</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">           </span>break;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span>default:</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">           </span>break;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span>}</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>g_free(str);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">   </span>return TRUE;</font></div><div dir="ltr"><font face="monospace, monospace">}</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace">/* Main loop */</font></div><div dir="ltr"><font face="monospace, monospace">int</font></div><div dir="ltr"><font face="monospace, monospace">main(int   argc,</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>char *argv[])</font></div><div dir="ltr"><font face="monospace, monospace">{</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">   </span>ControlData data;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">  </span>GIOChannel *io_stdin;</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">  </span>GstElement *source, *depayload, *parser, *decoder, *sink;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">  </span>GstElement *queue;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>GstCaps *source_caps;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>GstBus *bus;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">       </span>guint bus_watch_id;</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">    </span>/* Initialisation */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">       </span>gst_init(&argc, &argv);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>/* Initialize our control structure */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span>memset(&data, 0, sizeof(data));</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">    </span>data.loop = g_main_loop_new(NULL, FALSE);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>/* Check input arguments */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>if (argc != 1) {</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">           </span>g_printerr("USAGE: %s \n", argv[0]);</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">             </span>return -1;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>}</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>/* Print usage map */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>g_print(</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">           </span>"USAGE: \n"</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">              </span>"Choose one of the following options, then press enter:\n"</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">               </span>" 'Q' to quit\n");</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">   </span>/* Create gstreamer elements */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">    </span>data.pipeline = gst_pipeline_new("stream-player");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">       </span>source = gst_element_factory_make("udpsrc", "streaming-source");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">       </span>depayload = gst_element_factory_make("rtph264depay", "depay");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>parser = gst_element_factory_make("h264parse", "h264-parser");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>decoder = gst_element_factory_make("avdec_h264", "decoder");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">   </span>sink = gst_element_factory_make("autovideosink", "video-output");</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">  </span>queue = gst_element_factory_make("queue", "queue");</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>if (!data.pipeline || !source || !depayload || !parser || !queue || !decoder || !sink) {</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">           </span>g_printerr("One element could not be created. Exiting.\n");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">              </span>return -1;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>}</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>/* Set up the pipeline */</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>/* Define the output window dimensions and position */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span><b>/* This is where the first critical error occurs: */</b></font></div><div dir="ltr"><b><span style="font-family:monospace,monospace;white-space:pre">     </span><span style="font-family:monospace,monospace">g_object_set(G_OBJECT(source),</span><br></b></div><div dir="ltr"><font face="monospace, monospace"><b><span style="white-space:pre">          </span>"port", 5000,</b></font></div><div dir="ltr"><font face="monospace, monospace"><b><span style="white-space:pre">         </span>NULL);</b></font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">       </span>/* we set the source caps filter options */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>source_caps = gst_caps_new_simple("application/x-rtp",</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">           </span>"encoding-name", G_TYPE_STRING, "H264",</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">                </span>"payload", G_TYPE_INT, 96,</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">               </span>NULL);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>/* Define the output window dimensions and position */</font></div><div dir="ltr"><font face="monospace, monospace"><b><span style="white-space:pre">    </span>/* This is where the other critical error occurs: */</b></font></div><div dir="ltr"><font face="monospace, monospace"><b><span style="white-space:pre">    </span>g_object_set(G_OBJECT(sink),</b></font></div><div dir="ltr"><font face="monospace, monospace"><b><span style="white-space:pre">            </span>"sync", FALSE,</b></font></div><div dir="ltr"><font face="monospace, monospace"><b><span style="white-space:pre">                </span>NULL);</b></font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">       </span>/* we add a message handler */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span>bus = gst_pipeline_get_bus(GST_PIPELINE(data.pipeline));</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">   </span>bus_watch_id = gst_bus_add_watch(bus, bus_call, data.loop);</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>gst_object_unref(bus);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>/* we add all elements into the pipeline */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>/* camera-source | depay | parse | queue | decode | sink  */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>gst_bin_add_many(GST_BIN(data.pipeline),</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">           </span>source, depayload, parser, queue, decoder, sink, NULL);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>/* we link the elements together using the caps filters we defined above */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>if ((gst_element_link_filtered(source, depayload, source_caps) != (gboolean)true) ||</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">               </span>(gst_element_link_many(depayload, parser, queue, decoder, sink, NULL) != (gboolean)true))</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">  </span>{</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">          </span>g_printerr("Elements could not be linked\n");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">            </span>gst_object_unref(data.pipeline);</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">           </span>return -1;</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>}</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>/* Some cleanup */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>gst_caps_unref(source_caps);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">   </span>/* Let's capture keyboard input to be able to react to user commands */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>io_stdin = g_io_channel_unix_new(_fileno(stdin));</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">  </span>g_io_add_watch(io_stdin, G_IO_IN, (GIOFunc)handle_keyboard, &data);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>/* Set the pipeline to "playing" state*/</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>g_print("Now playing...\n");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span>gst_element_set_state(data.pipeline, GST_STATE_PLAYING);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">       </span>/* Iterate */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>g_print("Running...\n");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre"> </span>g_main_loop_run(data.loop);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">    </span>/* Out of the main loop, clean up nicely */</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>g_print("Returned, stopping playback\n");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">        </span>gst_element_set_state(data.pipeline, GST_STATE_NULL);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">  </span>g_print("Deleting pipeline\n");</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">  </span>gst_object_unref(GST_OBJECT(data.pipeline));</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">       </span>g_source_remove(bus_watch_id);</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">     </span>g_main_loop_unref(data.loop);</font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">      </span>g_io_channel_unref(io_stdin);</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace"><span style="white-space:pre">  </span>return 0;</font></div><div dir="ltr"><font face="monospace, monospace">}</font></div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><b>GStreamerWindowsHostSample.h code:</b></div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><font face="monospace, monospace">#pragma once</font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace">#include <stdio.h></font></div><div dir="ltr"><font face="monospace, monospace"><br></font></div><div dir="ltr"><font face="monospace, monospace">#include <string.h></font></div><div dir="ltr"><font face="monospace, monospace">#include <glib.h></font></div><div dir="ltr"><font face="monospace, monospace">#include <gst/gst.h></font></div><div dir="ltr"><br></div><div><b>CMakeLists.txt:</b></div><div><br></div><div><div><font face="monospace, monospace">cmake_minimum_required (VERSION 3.8)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"># Add source to this project's executable.</font></div><div><font face="monospace, monospace">add_executable (GStreamerWindowsHostSample "GStreamerWindowsHostSample.cpp" "GStreamerWindowsHostSample.h")</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">set(GSTREAMER_BASE_PATH "C:/gstreamer/1.0/x86_64")</font></div><div><font face="monospace, monospace">set(GSTREAMER_LIB_BASE_PATH "${GSTREAMER_BASE_PATH}/lib")</font></div><div><font face="monospace, monospace">set(GSTREAMER_LIB_GST_PATH "${GSTREAMER_LIB_BASE_PATH}/gstreamer-1.0")</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">include_directories("${GSTREAMER_BASE_PATH}/include/gstreamer-1.0")</font></div><div><font face="monospace, monospace">include_directories("${GSTREAMER_BASE_PATH}/include/glib-2.0")</font></div><div><font face="monospace, monospace">include_directories("${GSTREAMER_LIB_BASE_PATH}/glib-2.0/include")</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">link_directories(${GSTREAMER_LIB_BASE_PATH})</font></div><div><font face="monospace, monospace">link_directories(${GSTREAMER_LIB_GST_PATH})</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">find_library(GLIB_LIBRARY glib-2.0 ${GSTREAMER_LIB_BASE_PATH})</font></div><div><font face="monospace, monospace">find_library(GOBJECT_LIBRARY gobject-2.0 ${GSTREAMER_LIB_BASE_PATH})</font></div><div><font face="monospace, monospace">find_library(GMODULE_LIBRARY gmodule-2.0 ${GSTREAMER_LIB_BASE_PATH})</font></div><div><font face="monospace, monospace">find_library(GTHREAD_LIBRARY gthread-2.0 ${GSTREAMER_LIB_BASE_PATH})</font></div><div><font face="monospace, monospace">find_library(GSTREAMER_LIBRARY gstreamer-1.0 ${GSTREAMER_LIB_BASE_PATH})</font></div><div><font face="monospace, monospace">find_library(GSTUDP_LIBRARY gstudp ${GSTREAMER_LIB_GST_PATH})</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">target_link_libraries(GStreamerWindowsHostSample ${GLIB_LIBRARY} ${GOBJECT_LIBRARY} ${GMODULE_LIBRARY} ${GTHREAD_LIBRARY} ${GSTREAMER_LIBRARY})</font><br></div></div></div><div><br></div></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div>