SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

RaWrapper - Version 0.1 - 01/03/99
Max Spring <sepp@cs.tu-berlin.de>

COPYRIGHT

RaWrapper is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2

INTRODUCTION

RaWrapper is a simple program which allows to control X11-based audio stream players, like RealNetwork's RealPlayer, from the command line, without the necessity of having a regular X server running. RaWrapper is inspired by Toby Reed's <toby@eskimo.com> Traplayer v0.5 available at:

ftp://sunsite.unc.edu/pub/Linux/apps/sound/players/traplayer-0.5.tar.gz

Launching the audio player itself is a fairly simple task by using the virtual framebuffer X server Xfvb from XFree86:

ftp://ftp.xfree86.org/pub/XFree86/3.3.3/binaries/Linux-ix86-glibc/Xvfb.tgz or
ftp://ftp.xfree86.org/pub/XFree86/3.3.3/binaries/Linux-ix86-libc5/Xvfb.tgz

The actual problem in controlling the player is to detect whether the player is playing the audio properly or not, so that in case it doesn't the player can be killed.

The problem I found with Traplayer is that it is doing this detection by using the error code of a 'head -c 1 /dev/dsp', i.e. if the audio player is playing, the 'head' command will return an error, since /dev/dsp can be opened by only one process at a time. This caused a problem from time to time, if the audio player was trying to open /dev/dsp in the exact time between the head's open and close, so that the audio player complained with a message "audio device not accessible".

Besides the fact that Traplayer is a shell script and RaWrapper is written in C, RaWrapper takes also a different approach in detecting whether the player is idle. Via the means of the /proc pseudo file system, RaWrapper monitors the audio player's number of used file handles and consumed cpu time.

If the number of open file handles is not what it is usually, or the cpu time is zero, the audio player is killed after a certain amount of timeout seconds.

FILES

The package rawrapper-0.1.tar.gz consists of the following files:

      COPYING     - GNU General Public License v2
      README      - This file
      Makefile    - Simple Makefile for easier compilation
      rawrapper   - A binary for Linux i386
      rawrapper.c - The C source file

COMMAND LINE ARGUMENTS

Usage: rawrapper [option] location
Options (defaults shown in parentheses):

     -h                show usage
     -v                verbose
     -display <string> display for audio player (localhost:2.0)
     -d <int>          display number           (2)
     -xp <filespec>    Xvfb path                (/usr/X11R6/bin/Xvfb)
     -fp <dirspec>     font path                (/usr/X11R6/lib/X11/fonts/misc)
     -s <string>       screen size              (360x200x8)
     -fn <name>        default font             (7x14)
     -rp <filespec>    audio player path        (/opt/rvplayer5.0/rvplayer)
     -fd <int>         fd count when playing    (9)
     -to <int>         time out in seconds      (60)

OPTIONS

-h Will display usage information; same as starting RaWrapper without any

arguments at all.

-v Will display some additional information useful for debugging.

-display <string>

       By default, RaWrapper launches a Xvfb pseudo X server with a display
       number 2 and lets the audio player connect to that X server.  For
       debugging purposes it is sometimes useful to specify here the name of a
       regular X server, e.g. "localhost:0.0", so the audio player can be seen.

-d Is supposed to be used to specify a different display number in case 2

       is already in use.  The Xvfb I have here seems to have problems with
       that.

-xp <filespec>

Defines the full path of the Xvfb executable.

-fp <dirspec>

       Defines the full path of the directory containing the fonts which
       are supposed to be used by Xvfb.

-s <string>

       Defines the geometry of the pseudo X server in the format of
       WIDTHxHEIGHTxCOLORDEPTH.

-fn <name>

       Defines the default font which is supposed to be used by the audio
       player.  "7x14" should be availabe on most systems; "nil2" might reduce
       the geometry of the audio player.

-rp <filespec>

       Defines the full path of the audio player executable.  RaWrapper will
       create an environment variable "LD_LIBRARY_PATH" with the name of the
       directory containing that executable before it launches the audio player.

-fd <int>

       Defines the number of file handles which are usually open when the audio
       player properly plays audio.  Can be figured out by using option "-v".

-to <int>

       Defines the number of seconds until the audio player process (and the
       Xvfb process) is killed after RaPlayer has detected that the audio
       player is idle.

EXIT CODE

0 Termination without error.
1 RaWrapper received a SIGTERM, or SIGINT. 2 RaWrapper terminated with a timeout.


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.