Suggestion needed while Metadata Reading & Writing to a large files via Gstreamer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Suggestion needed while Metadata Reading & Writing to a large files via Gstreamer

namus
Dear Team,


I amĀ  involved in development of UI program that reads & writes metadata to a video MP4 files.
Reading & writing is done by lower level library, apart from UI program, which also implemented by me.
This is the design implementation from lower-library is to read metadata from a video:

1.
using a g_main_loop_new (NULL, FALSE); --> with default context

2.
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.

bus = gst_pipeline_get_bus (GST_PIPELINE (self->pipeline));
gst_bus_add_watch (bus, bus_call, (gpointer)self);


3. The UI program is inturn having a g_main_loop and invoking this lower-library api for reading & writing the metadata .


There are asyncrounous things happening .Reasons:

i) since in case of large video files the lower-library is taking long time while reading or witing metadata .
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 .
this resulting in improper behavior .


Is there any possibility of the 2 gmainloops mixing with each other ..?
Is there any alternative ..so that we can remove the g_main_loop from lower-libray and use some other approach ?
How to avoid g_main_loop in lower level Library ?can i replace with any..?
How can i make this syncronous ?

i tried with few :
1.
creating new context in lowwer-library :
I tried with context = g_main_context_new() and creating the loop = g_main_loop_new(context,FALSE) with that context .
resulting in freezing upon g_main_loop_run(loop).

2.
Instead of gst_bus_add_watch() , i used gst_bus_add_signal_watch () as shown below :

here i removed g_main_loop & used g_main_iteration() Api until EOS/Error

Stability of the reading/writing tags is undefined, some times this works & some it wont .

3)link:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-bus.html

last 2 lines states that :

If you aren't using GLib mainloop, the asynchronous message signals won't
be available by default. You can however install a custom sync handler
that wakes up the custom mainloop and that uses
gst_bus_async_signal_func () to emit the signals.
(see also documentation for details)

didnt get the idea ,how to implement this async handler ..
Please suggest ...

4)
Please suggest if any more ideas ...


Thanks & Regards,
suman.

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Suggestion needed while Metadata Reading & Writing to a large files via Gstreamer

Stefan Sauer
suman kolaganti wrote:

> Dear Team,
>
>
> I am  involved in development of UI program that reads & writes
> metadata to a video MP4 files.
> Reading & writing is done by lower level library, apart from UI
> program, which also implemented by me.
> This is the design implementation from lower-library is to read metadata from a video:
>
> 1.
> using a  g_main_loop_new (NULL, FALSE);                                --> with default context
>
>
> 2.
> 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.
>
> bus = gst_pipeline_get_bus (GST_PIPELINE (self->pipeline));
>
> gst_bus_add_watch (bus, bus_call, (gpointer)self);
>
>
> 3. The UI program is inturn having a g_main_loop and invoking this lower-library api for reading & writing the metadata  .
>
>
> There are asyncrounous things  happening .Reasons:
>
>
> i) since in case of large video files the lower-library is taking long time while reading or witing metadata .
> 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 .
>
> this resulting in improper behavior .
>
>
> Is there any possibility of the 2 gmainloops  mixing with each other ..?
> Is there any alternative  ..so that  we can remove the g_main_loop from lower-libray  and use some other approach ?
>
> How to avoid g_main_loop in lower level Library ?can i replace with any..?
> How can i make this syncronous ?
>  

Why can't you add signals to your lower library to signal that the
tag-operation has finished. Then you can leave it async. If you make it
sync, you will anyway block your ui for too long.

Stefan

> i tried  with few :
> 1.
> creating new context in lowwer-library :
> I tried with context = g_main_context_new() and creating the loop = g_main_loop_new(context,FALSE) with that context .
>
> resulting in freezing upon g_main_loop_run(loop).
>
> 2.
> Instead of gst_bus_add_watch()  , i used gst_bus_add_signal_watch () as shown below :
>
> here i removed g_main_loop & used g_main_iteration() Api until EOS/Error
>
>
> Stability  of the reading/writing tags is undefined, some times this works & some it wont .
>
> 3)link:
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-bus.html
>
>
> last 2 lines states that :
>
> If you aren't using GLib mainloop, the asynchronous message signals won't
>       be available by default. You can however install a custom sync handler
>       that wakes up the custom mainloop and that uses
>
>       |gst_bus_async_signal_func ()| to emit the signals.
>       (see also documentation <http://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstBus.html> for details)
>
>    
> didnt get the idea ,how to implement this async handler ..
> Please suggest ...
>
>  
> 4)
> Please suggest if any more ideas ...
>
>
> Thanks & Regards,
> suman.
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ------------------------------------------------------------------------
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>  


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel