[streaming] Re: Controlling VLC

Stefan Seyfried seife at gmane0305.slipkontur.de
Mon Sep 29 19:08:46 CEST 2003


Benjamin PRACHT <bigben at via.ecp.fr> writes:
> scripts languages  (such as  perl) allows  to get the  pid of  a spawned

i did something like this this weekend.

from memory:
----------------------------------------------------------------
#!/usr/bin/perl -w

use Time::localtime;

$start = time();
$nowstr = ctime();
$nowstr =~ s/ /_/g;
$nowstr =~ s/://g;
$filename="file/ts:file-to-write-$nowstr.ts";
$runtime = 5*60; # 5 minutes
$end = $start + $runtime;

my $pid;
defined ($pid = fork()) or die "can't fork: $!";
if ($pid == 0) {
  # child...
  exec("vlc", 'udp:@239.255.10.13', '--sout', $filename);
  die "can't exec: $!";
} else {
  # father
  while (sleep 1) {
    last if (ctime() >= $end);
  }
}

kill 15, $pid;
exit;
----------------------------------------------------------------

At home i did it a bit more sophisticated, but i have no access
to the machine now :-)

Regards,

   Stefan Seyfried
-- 
 Stefan Seyfried, seife at gmane0305.slipkontur.de
+----------------------------------------------+

"If you want to travel around the world and be invited to speak at a lot of
 different places, just write a Unix operating system." -- [Linus Torvalds]
.

-- 
This is the streaming mailing-list, see http://www.videolan.org/streaming/
To unsubscribe, please read http://www.videolan.org/support/lists.html
If you are in trouble, please contact <postmaster at videolan.org>



More information about the streaming mailing list