~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to mpeglib/lib/tplay/README

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
This is a buffered audio player for Linux. POSIX-thread library is
 
2
used. This is still considered BETA software and may not work as
 
3
expected. Please mail me for bug reports, opinions or suggestions.
 
4
 
 
5
This is primarily made for use with MPEG-decoders. They typically
 
6
consume lots of CPU-time and some kind of audio buffer is needed to
 
7
reduce cutting while writing to audio device. You can also play any
 
8
audio files with tplay or use it with any program that writes audio 
 
9
data to standard out.
 
10
 
 
11
RIFF/WAVE (WAV) and Sun audio (AU) file headers are recognized by
 
12
now.
 
13
 
 
14
Binary:
 
15
 
 
16
In the source tree there is a readily compiled binary that is build
 
17
under Linux/ELF 2.0.30 with libc 5.4.20 and LinuxThreads 0.6 (the
 
18
thread library is statically linked).
 
19
 
 
20
Command line options:
 
21
 
 
22
  tplay [-hvVmuxrf] [-s Hz] [-b 8|16] [-B kilobytes] [filename]
 
23
 
 
24
        -h, --help              Print help, then exit
 
25
        -v, --version           Print version, then exit
 
26
        -V, --verbose           Print useful information about the sample
 
27
        -x, --swap              Swap endianness
 
28
        -r, --raw               Force raw audio format. Ignore headers.
 
29
        -f, --force             Force playing with any parameters
 
30
        -m, --mono              Mono sample
 
31
        -u, --usage             Print buffer usage while playing
 
32
        -s, --speed=SPEED       Sample speed (Hz)
 
33
        -b, --bytes=BYTES       Bytes in a sample
 
34
        -B, --buffer-size=SIZE  Buffer size in (kB)
 
35
 
 
36
Buffer size is defaulted to 512k. It is about 3 seconds CD audio
 
37
(44100Hz/sample, 16bytes, stereo). If filename is not given, standard
 
38
input is used. If -x (or --swap) flag is set, the byte order of
 
39
audio sample is swapped before playing. The default is Intel little-
 
40
endian which is mostly used in x86 machines. The world outside Intel
 
41
is big-endian.
 
42
Option -r (or --raw) forces tplay to handle the sample as an raw
 
43
PCM audio sample. Sun audio or WAV headers are ignored.
 
44
 
 
45
Requirements:
 
46
 
 
47
        - Linux 2.0 or newer with audio card support
 
48
        - POSIX thread library
 
49
        - Audio card
 
50
 
 
51
There are several POSIX thread libraries available. I used
 
52
LinuxThreads by Xavier Leroy (Xavier.Leroy@inria.fr). LinuxThreads
 
53
library use clone() that is provided by Linux 2.0 kernel. 
 
54
 
 
55
The code:
 
56
 
 
57
tplay starts one thread, named consumer, that reads circular audio
 
58
buffer and writes it to audio device. The producer is a function that
 
59
runs in parallel with the consumer and its task is to read the sample
 
60
file or standard input and write this data to audio buffer to meet
 
61
consumer's needs. Usually, the buffer is full but on the times when
 
62
CPU-time is suddenly needed for other processes (usually: disk
 
63
read/write), the producer can't write fast enough and consumer can use
 
64
the buffer to keep audio stream uninterrupted. If the buffer is used
 
65
and the producer is still unable to feed it fast enough, underflow
 
66
situation is met and consumer waits for awhile (typically: one second)
 
67
for the producer to fill the buffer again.
 
68
 
 
69
Building:
 
70
 
 
71
If you want to link tplay with static libpthread library, edit
 
72
Makefile and uncomment preferred LIBS-setting there.  Type:
 
73
 
 
74
        - make
 
75
        - make install
 
76
        - make install.man
 
77
 
 
78
Thanks:
 
79
 
 
80
Jerko Golubovic <jerko.golubovic@public.srce.hr>
 
81
Jukka Palviainen <oh3kjt@ele.tut.fi>
 
82
 
 
83
TODO:
 
84
 
 
85
Find out the best sizes for the audio buffer and one block.  
 
86
Better documentation.
 
87
Better RIFF/WAVE checking.
 
88
 
 
89
Ilkka Karvinen
 
90
ik@iki.fi
 
91
 
 
92
 
 
93
 
 
94
 
 
95