Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
RtpAudioFile Class Reference

A QIODevice subclass that handles reading and writing of RTP audio files and frames. More...

#include <rtp_audio_file.h>

Inheritance diagram for RtpAudioFile:

Public Member Functions

 RtpAudioFile (bool use_disk_for_temp, bool use_disk_for_frames)
 Constructs an RtpAudioFile object.
 
 ~RtpAudioFile ()
 Destroys the RtpAudioFile object.
 
void setFrameWriteStage ()
 Sets the file to the frame write stage.
 
void frameWriteSilence (uint32_t frame_num, qint64 samples)
 Writes a silence frame.
 
qint64 frameWriteSamples (uint32_t frame_num, const char *data, qint64 max_size)
 Writes actual audio sample data for a frame.
 
void setFrameReadStage (qint64 prepend_samples)
 Sets the file to the frame read stage.
 
bool readFrameSamples (int32_t *read_buff_bytes, SAMPLE **read_buff, spx_uint32_t *read_len, uint32_t *frame_num, rtp_frame_type *type)
 Reads samples for a single frame.
 
void setDataReadStage ()
 Sets the file to the data read stage for playback.
 
bool open (QIODevice::OpenMode mode) override
 Opens the device with the specified mode.
 
qint64 size () const override
 Gets the size of the file.
 
qint64 pos () const override
 Gets the current byte position in the file.
 
bool seek (qint64 off) override
 Seeks to a specific byte offset.
 
qint64 sampleFileSize ()
 Retrieves the underlying sample file size.
 
void seekSample (qint64 samples)
 Seeks to a specific sample position.
 
qint64 readSample (SAMPLE *sample)
 Reads a single sample.
 
qint64 getTotalSamples ()
 Gets the total number of samples.
 
qint64 getEndOfSilenceSample ()
 Gets the sample index at the end of inserted silence.
 

Protected Member Functions

qint64 readData (char *data, qint64 maxSize) override
 Reads up to maxSize bytes of data into the given buffer.
 
qint64 writeData (const char *data, qint64 maxSize) override
 Writes up to maxSize bytes of data from the given buffer.
 

Detailed Description

A QIODevice subclass that handles reading and writing of RTP audio files and frames.

Constructor & Destructor Documentation

◆ RtpAudioFile()

RtpAudioFile::RtpAudioFile ( bool  use_disk_for_temp,
bool  use_disk_for_frames 
)
explicit

Constructs an RtpAudioFile object.

Parameters
use_disk_for_tempIndicates whether to use disk for temporary files.
use_disk_for_framesIndicates whether to use disk for storing frame data.

Member Function Documentation

◆ frameWriteSamples()

qint64 RtpAudioFile::frameWriteSamples ( uint32_t  frame_num,
const char *  data,
qint64  max_size 
)

Writes actual audio sample data for a frame.

Parameters
frame_numThe frame number.
dataPointer to the audio data to write.
max_sizeThe maximum size of the data to write.
Returns
The number of bytes successfully written.

◆ frameWriteSilence()

void RtpAudioFile::frameWriteSilence ( uint32_t  frame_num,
qint64  samples 
)

Writes a silence frame.

Parameters
frame_numThe frame number.
samplesThe number of silence samples.

◆ getEndOfSilenceSample()

qint64 RtpAudioFile::getEndOfSilenceSample ( )

Gets the sample index at the end of inserted silence.

Returns
The sample index.

◆ getTotalSamples()

qint64 RtpAudioFile::getTotalSamples ( )

Gets the total number of samples.

Returns
The total sample count.

◆ open()

bool RtpAudioFile::open ( QIODevice::OpenMode  mode)
override

Opens the device with the specified mode.

Parameters
modeThe mode to open the device in.
Returns
True if successfully opened, false otherwise.

◆ pos()

qint64 RtpAudioFile::pos ( ) const
override

Gets the current byte position in the file.

Returns
The current position in bytes.

◆ readData()

qint64 RtpAudioFile::readData ( char *  data,
qint64  maxSize 
)
overrideprotected

Reads up to maxSize bytes of data into the given buffer.

Parameters
dataPointer to the buffer to store read data.
maxSizeMaximum number of bytes to read.
Returns
The number of bytes read.

◆ readFrameSamples()

bool RtpAudioFile::readFrameSamples ( int32_t *  read_buff_bytes,
SAMPLE **  read_buff,
spx_uint32_t *  read_len,
uint32_t *  frame_num,
rtp_frame_type type 
)

Reads samples for a single frame.

Parameters
read_buff_bytesPointer to store the number of bytes read into the buffer.
read_buffPointer to the buffer containing the read samples.
read_lenPointer to store the number of samples read.
frame_numPointer to store the frame number.
typePointer to store the type of the frame.
Returns
True if successful, false otherwise.

◆ readSample()

qint64 RtpAudioFile::readSample ( SAMPLE *  sample)

Reads a single sample.

Parameters
samplePointer to store the read sample.
Returns
The number of bytes read.

◆ sampleFileSize()

qint64 RtpAudioFile::sampleFileSize ( )

Retrieves the underlying sample file size.

Returns
The sample file size in bytes.

◆ seek()

bool RtpAudioFile::seek ( qint64  off)
override

Seeks to a specific byte offset.

Parameters
offThe byte offset to seek to.
Returns
True if successful, false otherwise.

◆ seekSample()

void RtpAudioFile::seekSample ( qint64  samples)

Seeks to a specific sample position.

Parameters
samplesThe sample index to seek to.

◆ setFrameReadStage()

void RtpAudioFile::setFrameReadStage ( qint64  prepend_samples)

Sets the file to the frame read stage.

Parameters
prepend_samplesNumber of samples to prepend.

◆ size()

qint64 RtpAudioFile::size ( ) const
override

Gets the size of the file.

Returns
The size in bytes.

◆ writeData()

qint64 RtpAudioFile::writeData ( const char *  data,
qint64  maxSize 
)
overrideprotected

Writes up to maxSize bytes of data from the given buffer.

Parameters
dataPointer to the data to write.
maxSizeMaximum number of bytes to write.
Returns
The number of bytes written.

The documentation for this class was generated from the following files: