[MPlayer-dev-eng] Automatic Codec Downloader

pl p_l at gmx.fr
Sun Mar 10 11:42:20 CET 2002


On Sat, Mar 09, 2002 at 09:58:47PM -0700, Mike Melanson wrote:

> 	Has anyone ever considered modifying the MPlayer distribution so
> that it can download codecs automatically from Microsoft? I figured out
> how to do it and tried to code it up this evening, but hit a roadblock
> when I tried to write a Perl script to do the downloading part.
> 
> 	I was thinking that the configure script could ask the user if
> they wanted to download codecs from Microsoft's site and then launch this
> script, which would gather up the FOURCCs and format numbers from
> etc/codecs.conf and download the required codec files Microsoft. The
> codecs are packaged as .CAB (cabinet) files, and there's a GPL'd tool for
> extracting the data that could be distributed with MPlayer. MPlayer would
> keep them in the installation tree and install them in the right place
> during the 'make install' phase. We could later adapt the script to
> download XAnim modules and others as well.

I'm not for the configure script to ask since configure should not be
interactive (would break automatic compilation scripts) but a
--do-it-for-me option is OK ;)

A setup.sh (or whatever name you feel like) wrapper that calls
configure, make, downloads, installs everything etc... well...

> 	Anyway, if there's any interest, and/or if anyone knows how to
> program the Perl WWW lib (LWP), let me know.

Basically you should do something a la:

  require IO::Handle;
  require HTTP::Request;
  require LWP::UserAgent;
  my ($ua,$url,$file,$request,$response);

  $ua = LWP::UserAgent->new;
  $ua->agent("Mozilla/4.78 [en] (X11; U; Linux 1.0.0)");
  $ua->timeout(20);

  $url = "http://foo.bar/blah.tgz";
  $file = "/home/foo/bar/foo.tgz";
  $request = HTTP::Request->new(GET => $url);
  $response = $ua->request($request, $file);
  if ($response->is_success) {
    printf("OK\n");
  } else {
    $response->error_as_HTML =~ /((\d{3}).*)/;
    printf("failed (%s)\n", $2);
  }

But using wget or lynx might be more portable (or be autodetected by
./configure).

-- 
Best regards,
  pl



More information about the MPlayer-dev-eng mailing list