<div>I am going to create an app that streams video over Bluetooth. I was trying to figure out gstreamer, and have the following code. It just creates a pipeline that saves the file into an mp4 file. This does save a file, but the application techniquelly never exits. It just says "Running..." forever. </div>
<div><br></div><div>Either way, my intention is to somehow throw in an appsink for the source so that I can take the encoded stream and send it over Bluetooth from the application. I have not found a good example to do this. I can hand all the Bluetooth programming, I am just new to gstreamer. </div>
<div><br></div><div>Any help is appreciated on getting the appsink concept rolling.</div><div><br></div><div>MY CODE:</div><div><div><br></div><div>#include <gst/gst.h></div><div>#include <glib.h></div><div><br>
</div><div><br></div><div>int</div><div>main (int argc,</div><div> char *argv[]){</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>GMainLoop *loop;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>/* Initialisation */</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>gst_init (&argc, &argv);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>loop = g_main_loop_new (NULL, FALSE);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>GstElement * pipeline = GST_PIPELINE(gst_parse_launch("v4l2src num-buffers=50 ! queue ! "</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>"x264enc ! mp4mux ! filesink location=fromFile.mp4", </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> <span class="Apple-tab-span" style="white-space:pre">                        </span>NULL));</div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>gst_element_set_state (pipeline, GST_STATE_PLAYING);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>/* Iterate */</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>g_print ("Running...\n");</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>g_main_loop_run (loop);</div>
<div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>/* Out of the main loop, clean up nicely */</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>g_print ("Returned, stopping playback\n");</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>gst_element_set_state (pipeline, GST_STATE_NULL);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>g_print ("Deleting pipeline\n");</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>gst_object_unref (GST_OBJECT (pipeline));</div><div><br></div><div>}</div></div><div><br></div><div><br></div><div><br></div>