Next: Audio Devices, Previous: Prerequisites, Up: Media [Contents][Index]
SXEmacs provides a common and opaque API to all of the above libraries. Media files or streams are encapsulated into media stream objects, which behave equally whatever library is used to parse them.
The fundamental function to create such media streams is
make-media-stream
.
Create a new media stream from data.
from is a keyword and defines how data is
interpreted:
:file
- data is the name of a file
:data
- data is a string with the stream data
:url
- data is a url (string) for streamed media contents
Optional argument driver (a symbol) may be used to force the use of a certain driver instead of automatically detecting a suitable one. It is one of ‘ffmpeg’, ‘sndfile’, ‘sox’, ‘mad’, ‘xine’, ‘gstreamer’, or ‘internal’.
Hereby, the media driver which is used in order to handle the resulting media stream is chosen automatically. Portions of the data are passed to all available media APIs, that is all APIs which have been configured at compile time. The first such API which parses the portion successfully is chosen as driver.
(make-media-stream :file "/home/media/audio/Bloke.mp3") ⇒ #<media-stream :kind #<file "/home/media/audio/Bloke.mp3"> #<media-substream :type #<audio mp3 (mp3), stereo, 44100 Hz, 16 Bit, 128 kb/s>> driven by ffmpeg :author "Chris Franklin " :title: "Bloke " :year 2000>
Media stream objects contain information about where to find a medium, the characteristics (like number of channels, sample rate, resolution), which demuxer and which decoder to use, and some informational extras. They do not contain the medium itself nor a raw (i.e. undecoded) form nor portions of these. Hence, if you want to use a media stream object after its creation you should make sure that it still exists.
Media streams usually consist of several substreams internally. These substreams each represent a certain partition of the whole stream. If you regard an ordinary movie DVD, the media stream with location ‘/path/dvd-drive’ would be made up of a substream which contains the motion picture, a substream which contains a language track, other audio track substreams which contain the further languages, possibly a substream for subtitles and so forth.
Substreams cannot be accessed individually nor extracted. This may change in the future.
Next: Audio Devices, Previous: Prerequisites, Up: Media [Contents][Index]