Dear Team,<br><br><br>I am involved in development of UI program that reads & writes metadata to a video MP4 files.<br>Reading & writing is done by lower level library, apart from UI program, which also implemented by me.<br>
<pre style="font-family: arial,helvetica,sans-serif;" class="bz_comment_text" id="comment_text_11">This is the design implementation from lower-library is to read metadata from a video:<br><br>1.<br>using a g_main_loop_new (NULL, FALSE); --> with default context<br>
<br>2.<br>getting a bus from a pipeline & adding a bus watch for the gst_messages and upon EOS / in-case any error /Paused state , iam quitting the mainloop.<br><br>bus = gst_pipeline_get_bus (GST_PIPELINE (self->pipeline));<br>
gst_bus_add_watch (bus, bus_call, (gpointer)self);<br><br><br>3. The UI program is inturn having a g_main_loop and invoking this lower-library api for reading & writing the metadata .<br><br><br>There are asyncrounous things happening .Reasons:<br>
<br>i) since in case of large video files the lower-library is taking long time while reading or witing metadata .<br>ii) mean while if we do any UI operations ..let us say suppose the same file is deleted . In this case .. before the control commes out of that lower-level api , the file is subjected to delete .<br>
this resulting in improper behavior .<br><br><br>Is there any possibility of the 2 gmainloops mixing with each other ..?<br>Is there any alternative ..so that we can remove the g_main_loop from lower-libray and use some other approach ?<br>
How to avoid g_main_loop in lower level Library ?can i replace with any..?<br>How can i make this syncronous ?<br><br>i tried with few :<br>1.<br>creating new context in lowwer-library :<br>I tried with context = g_main_context_new() and creating the loop = g_main_loop_new(context,FALSE) with that context .<br>
resulting in freezing upon g_main_loop_run(loop).<br><br>2.<br>Instead of gst_bus_add_watch() , i used gst_bus_add_signal_watch () as shown below :<br><br>here i removed g_main_loop & used g_main_iteration() Api until EOS/Error <br>
<br>Stability of the reading/writing tags is undefined, some times this works & some it wont . <br><br>3)link: <br><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-bus.html">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-bus.html</a><br>
<br>last 2 lines states that :<br><br>If you aren't using GLib mainloop, the asynchronous message signals won't<br> be available by default. You can however install a custom sync handler<br> that wakes up the custom mainloop and that uses<br>
<code class="function">gst_bus_async_signal_func ()</code> to emit the signals.<br> (see also <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstBus.html" target="_top">documentation</a> for details)<br>
<br>didnt get the idea ,how to implement this async handler ..<br>Please suggest ...<br><br></pre>4)<br>Please suggest if any more ideas ...<br><br><br>Thanks & Regards,<br>suman.<br>