Re: Seperating Multiple processes

2017-03-17 Thread Eric Cashon via gtk-app-devel-list

 
Some follow up on this. If you are starting a separate process to run your 
transcoding you need to use an async version of your run_cmd(). Otherwise the 
program will wait until the function returns and bind up the main glib thread 
if the function takes a while. This might be the easiest way to do this but may 
not give you very good control of the running process or processes. If you want 
to have more control of the transcoding work you can run the work in a thread 
pool within your program. This is more difficult to put together. In Perl there 
is a reference I found here

http://www.perlmonks.org/?node_id=735923

I don't have experience mixing Glib with Perl threads. Mostly work in C so it 
is a little different than using Perl. 

How are you working with your video files? The GStreamer library has a lot of 
audio/video functionality that is accessible from the command line or in code. 
I have been testing some code playing sounds with several different methods 
from the command line to a thread pool. It is in C but the ideas are going to 
be the same as in Perl. The gstreamer_test1.c has some basic glib spawn from 
the command line type functions and gstreamer_test2.c is putting together a 
pool of sounds to play all at once. Command line easy, thread pools hard. 

https://github.com/cecashon/OrderedSetVelociRaptor/tree/master/Misc/Sound

Hope it is of some help.

Eric


 

 



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Seperating Multiple processes

2017-03-10 Thread Eric Cashon via gtk-app-devel-list

 


Hi Mike,

Have you looked at using a thread pool?

https://developer.gnome.org/glib/stable/glib-Thread-Pools.html

If you have a folder full of files that you want to transcode you can set up 
your thread pool to cycle through them.

Eric
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Seperating Multiple processes

2017-03-10 Thread Mike Martin
Hi
I have a weird issue on an application I am developing

The application is fully tabbed and runs loops to transcode video files,
and I would like to be able to run the main transcoding loop fully in
parrellel, ie: the process running in one tab is totally seperate to that
running in another tab

I have tried this on the key sub (simplified)


sub encode_loop {
my ($optsi,$prog,$ext,$action_grid,$dvb,$type_g,$files,$video_type)=@_;
my $mainloop = Glib::MainLoop->new;
my $subname='encode';
Gtk3::main_iteration_do(0);

my
$progrun=&run_cmd($files->{$file_id},$opts,$prog,$ext,$subname,$action_grid,,0)
;#if $dvb!~/ogg/ ;
$mainloop->quit
return 1
}

However this is what happens.

I start one loop running, then open another tab and set another loop
running.

For the first file every works fine.

Then however

When the first file finishes encoding, the loop stops until the second loop
is finished.

AND

The second loop transcodes multiple files at the same time instead of
sequentially. The number is equal to the number of loops running, ie: if
two tabs are running the encode process, then two files are encoded
simultaneously, tree tabs than three files

Any ideas would be appreciated

thanks
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list