#include <RTPAVProfileSampleBasedAudioReceiver.h>
Inheritance diagram for RTPAVProfileSampleBasedAudioReceiver:

Protected Member Functions | |
| virtual void | processPacket (RTPPacket *packet) |
| virtual void | openOutputFile (const char *fileName) |
| virtual void | closeOutputFile () |
| virtual void | insertSilence (simtime_t duration) |
Protected Attributes | |
| AFfilehandle | _audioFile |
| AFfilesetup | _fileSetup |
| int | _samplingRate |
| int | _sampleWidth |
| int | _numberOfChannels |
Private Member Functions | |
| Module_Class_Members (RTPAVProfileSampleBasedAudioReceiver, RTPPayloadReceiver, 0) virtual ~RTPAVProfileSampleBasedAudioReceiver() | |
|
|
Closes the output file stream. Reimplemented from RTPPayloadReceiver. 00092 {
00093 if (afCloseFile(_audioFile)) {
00094 opp_error("payload receiver: error closing output file");
00095 };
00096 };
|
|
|
When packets arrival late or have been lost, this method can be called to insert a silence period. It must be overwritten because in different audio formats different values for silence exist. Reimplemented in RTPAVProfilePayload10Receiver. 00099 {
00100 // depends at least on sampling rate and sample width
00101 }
|
|
||||||||||||||||
|
|
|
|
This method is called by initialize and opens the output file stream. For most payload receivers this method works well, only when using a library for a payload type which provides an own open method it must Reimplemented from RTPPayloadReceiver. 00079 {
00080 _fileSetup = afNewFileSetup();
00081 afInitByteOrder(_fileSetup, AF_DEFAULT_TRACK, AF_BYTEORDER_LITTLEENDIAN);
00082 afInitChannels(_fileSetup, AF_DEFAULT_TRACK, _numberOfChannels);
00083 afInitSampleFormat(_fileSetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, _sampleWidth);
00084 afInitRate(_fileSetup, AF_DEFAULT_TRACK, (double)_samplingRate);
00085 _audioFile = afOpenFile(fileName, "w", _fileSetup);
00086 if (_audioFile == AF_NULL_FILEHANDLE) {
00087 opp_error("payload receiver: error creating output file");
00088 };
00089 };
|
|
|
Writes contents of this RTPPacket into the output file. Must be overwritten by subclasses. Reimplemented from RTPPayloadReceiver. 00070 {
00071 //RTPPayloadReceiver::processPacket(packet);
00072 void *data = packet->par("data");
00073 int dataSize = packet->payloadLength();
00074 int numberOfFrames = dataSize / ((_sampleWidth / 8) * _numberOfChannels);
00075 afWriteFrames(_audioFile, AF_DEFAULT_TRACK, data, numberOfFrames);
00076 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.4.1