• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: PlayFile to file stream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >PlayFile to file stream (From: Ivan C Myrvold <email@hidden>)

  • Prev by Date: AU state & MaximumFramesPerSlice
  • Next by Date: Re: Is the documentation for SDK 1.4.3 available without installation?
  • Previous by thread: PlayFile to file stream
  • Next by thread: M4A and 10.3
  • Index(es):
    • Date
    • Thread