Re: PlayFile to file stream
Re: PlayFile to file stream
- Subject: Re: PlayFile to file stream
- From: William Stewart <email@hidden>
- Date: Mon, 17 Apr 2006 10:41:00 -0700
I think you'd just want to get the decoded samples out of the mp3
file - the AudioFile and ExtendedAudioFile API's are the place to
start I think. Have a look at the Convert and Play File examples in
the SimpleSDK
Bill
On 15/04/2006, at 3:53 AM, Ivan C Myrvold wrote:
I am working on an open source project called Asterisk, which is a
telephone PBX software, and we are trying to make it more OS X
friendly. It is originally Linux software.
There is something called music on hold, MOH, that will play a
music file to any caller that is put on hold. This is using an
external mp3 player called mpg123.
I have looked through the examples, and found the PlayFile example.
Is it possible to modify this example to play to a file stream
instead of through the computers speakers?
MOH is represented by a plugin called res_musiconhold which is a
single source file res_musiconhold.c. This calls an external mpg123
player and feeds the output into an asterisk file stream like so ...
ast_set_write_format(chan, AST_FORMAT_SLINEAR)
and then ...
memset(&f, 0, sizeof(f));
f.frametype = AST_FRAME_VOICE;
f.subclass = AST_FORMAT_SLINEAR;
f.mallocd = 0;
f.datalen = res;
f.samples = res / 2;
f.data = buf + AST_FRIENDLY_OFFSET / 2;
f.offset = AST_FRIENDLY_OFFSET;
if (ast_write(chan, &f)< 0) {
ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n",
chan->name,
strerror(errno));
return -1;
}
Ivan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden