Changes between Version 97 and Version 98 of FAQ
- Timestamp:
- Aug 13, 2010 11:56:21 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
FAQ
v97 v98 436 436 === How can I manipulate audio samples directly? === #audio-man 437 437 438 In PJMEDIA, audio frames are sent back and forth between what is called [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__PORT __CONCEPT.htm media port (pjmedia_port)]. So to be able to peek or manipulate audio frames, we need to implement our own media port.438 In PJMEDIA, audio frames are sent back and forth between what is called [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__PORT.htm media port (pjmedia_port)]. So to be able to peek or manipulate audio frames, we need to implement our own media port. 439 439 440 440 Implementing media port should be easy. Basically we just need to implement these: … … 450 450 }; 451 451 }}} 452 1. Fill in the media port information to describe the media port (like, the name, clock rate, bits per sample, etc.). Use [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__PORT __INTERFACE.htm#gb3259d2924c7a2243733391f6f8f0a9a pjmedia_port_info_init()] to initialize the port into.452 1. Fill in the media port information to describe the media port (like, the name, clock rate, bits per sample, etc.). Use [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__PORT.htm#gb3259d2924c7a2243733391f6f8f0a9a pjmedia_port_info_init()] to initialize the port into. 453 453 1. Implement {{{get_frame()}}} callback (of the ''pjmedia_port'') if the media port is a source (that is, the media port feed audio frames to other media ports). 454 454 1. Implement {{{put_frame()}}} callback (of the ''pjmedia_port'') if the media port is a sink (that is, other media ports may feed audio frames to our media port). … … 614 614 615 615 Currently PJMEDIA lacks built-in tone detection routine. But if you you have the routine, it shouldn't be straightforward to integrate it to the framework: 616 1. First, you need to wrap your routine as [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__PORT __CONCEPT.htm pjmedia_port] so that it can be plugged to the media framework. Your implementation would be similar to [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__FILE__REC.htm WAV writer] media port ([source:pjproject/trunk/pjmedia/src/pjmedia/wav_writer.c pjmedia/wav_writer.c]), but instead of writing to WAV file, it would monitor the audio signal for tone and call some callback when a tone is detected.616 1. First, you need to wrap your routine as [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__PORT.htm pjmedia_port] so that it can be plugged to the media framework. Your implementation would be similar to [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__FILE__REC.htm WAV writer] media port ([source:pjproject/trunk/pjmedia/src/pjmedia/wav_writer.c pjmedia/wav_writer.c]), but instead of writing to WAV file, it would monitor the audio signal for tone and call some callback when a tone is detected. 617 617 1. Once you have the tone detector media port implementation, you can just add this media port to the conference bridge with [http://www.pjsip.org/pjsip/docs/html/group__PJSUA__LIB__MEDIA.htm#g833528c1019f4ab5c8fb216b4b5f788b pjsua_conf_add_port()], and connect the audio source to your tone detector. 618 618