[RoarAudio] New VS API File Interface
lion at lion.leolix.org
Wed Nov 3 15:01:15 CET 2010
Because the simple API has such a function and because I was asked for
it I just added support to VS API to directly work on files to play
them. Support for this is still very limited but for sure as powerful as
needed for simple use cases. It will be included in next version
(0.4beta2) and is included in current/trunk.
Here is how it works:
(For for the exact meaing and types of the vars see the full docs!)
Basicly a VIO is attached to a opened VS Object.
You can do with with:
ret = roar_vs_file(vss, &vio, close_on_eof, &err);
To make it more simple there is a function working with filenames.
Those are opened using DSTR:
ret = roar_vs_file_simple(vss, filename, &err);
After you set up the VS Object this way just run:
ret = roar_vs_run(vss, &err);
It will loop untill EOF. You MUST close the VS Object directly after
this returned (this may change in future to allow more options).
If you do not want to be blocked you can use roar_vs_iterate() directly.
However this may require you to do a roar_vio_select() yourself. If you
are going to do this you may be beter off with using full VS or threads
or simular. In any case this is a more advanced topic. Just ask on this
list if unsure!
To make it even more simple there are two more ways to open the VS
You can use roar_vs_new_from_file() wich will set up your VS Object
completly for you.
vss = roar_vs_new_from_file(NULL, "My App", filename, &err);
roar_vs_close(vss, ROAR_VS_FALSE, &err);
This is the most simple way.
However this *currently* requires seeking support.
To disable the need for streaming you can provide all the needed infos
on your own. Normaly by doing roar_vs_new() and roar_vs_stream(), but
you can just use roar_vs_new_playback() as you are used to.
vss = roar_vs_new_playback(NULL, NULL, ROAR_RATE_DEFAULT, ROAR_CHANNELS_DEFAULT, ROAR_CODEC_OGG_VORBIS, ROAR_BITS_DEFAULT, NULL);
roar_vs_file_simple(vss, url_to_stream, NULL);
roar_vs_close(vss, ROAR_VS_FALSE, NULL);
This is an example for a Ogg Vorbis using radio stream, just set:
url_to_stream = "http://..."
Note that the auto detection of stream parameters is subject to improve.
This will soon work for HTTP streams without this little trick.
Please send any comments to me you have.
Have fun && Happy Hacking!
(Rah of PH2)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 482 bytes
Desc: This is a digitally signed message part
More information about the RoarAudio