10#ifndef RTP_AUDIO_FILE_H
11#define RTP_AUDIO_FILE_H
16#include <speex/speex_resampler.h>
20#include <QTemporaryFile>
56 explicit RtpAudioFile(
bool use_disk_for_temp,
bool use_disk_for_frames);
114 bool open(QIODevice::OpenMode mode)
override;
120 qint64
size()
const override;
126 qint64
pos()
const override;
133 bool seek(qint64 off)
override;
174 qint64
readData(
char *data, qint64 maxSize)
override;
182 qint64
writeData(
const char *data, qint64 maxSize)
override;
186 QIODevice *sample_file_;
189 QIODevice *sample_file_frame_;
216 qint64 frameWriteFrame(uint32_t frame_num, qint64 real_pos, qint64 sample_pos, qint64 len,
rtp_frame_type type);
222 void frameUpdateRealCounters(qint64 written_bytes);
228 void frameUpdateSampleCounters(qint64 written_bytes);
239 qint64 readFrameData(
char *data , qint64 want_read);
A QIODevice subclass that handles reading and writing of RTP audio files and frames.
Definition rtp_audio_file.h:49
void frameWriteSilence(uint32_t frame_num, qint64 samples)
Writes a silence frame.
Definition rtp_audio_file.cpp:140
qint64 pos() const override
Gets the current byte position in the file.
Definition rtp_audio_file.cpp:236
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.
Definition rtp_audio_file.cpp:178
bool seek(qint64 off) override
Seeks to a specific byte offset.
Definition rtp_audio_file.cpp:246
qint64 sampleFileSize()
Retrieves the underlying sample file size.
Definition rtp_audio_file.cpp:287
bool open(QIODevice::OpenMode mode) override
Opens the device with the specified mode.
Definition rtp_audio_file.cpp:222
qint64 writeData(const char *data, qint64 maxSize) override
Writes up to maxSize bytes of data from the given buffer.
Definition rtp_audio_file.cpp:379
qint64 getTotalSamples()
Gets the total number of samples.
Definition rtp_audio_file.cpp:325
~RtpAudioFile()
Destroys the RtpAudioFile object.
Definition rtp_audio_file.cpp:76
qint64 readSample(SAMPLE *sample)
Reads a single sample.
Definition rtp_audio_file.cpp:320
qint64 size() const override
Gets the size of the file.
Definition rtp_audio_file.cpp:231
void seekSample(qint64 samples)
Seeks to a specific sample position.
Definition rtp_audio_file.cpp:292
void setFrameWriteStage()
Sets the file to the frame write stage.
Definition rtp_audio_file.cpp:85
void setDataReadStage()
Sets the file to the data read stage for playback.
Definition rtp_audio_file.cpp:215
qint64 readData(char *data, qint64 maxSize) override
Reads up to maxSize bytes of data into the given buffer.
Definition rtp_audio_file.cpp:339
qint64 getEndOfSilenceSample()
Gets the sample index at the end of inserted silence.
Definition rtp_audio_file.cpp:330
qint64 frameWriteSamples(uint32_t frame_num, const char *data, qint64 max_size)
Writes actual audio sample data for a frame.
Definition rtp_audio_file.cpp:150
void setFrameReadStage(qint64 prepend_samples)
Sets the file to the frame read stage.
Definition rtp_audio_file.cpp:169
rtp_frame_type
Defines the type of an RTP frame.
Definition rtp_audio_file.h:29
@ RTP_FRAME_SILENCE
Definition rtp_audio_file.h:31
@ RTP_FRAME_AUDIO
Definition rtp_audio_file.h:30
Definition packet-rtp.h:29
Structure used for storing frame num during visual waveform decoding.
Definition rtp_audio_file.h:37
qint64 real_pos
Definition rtp_audio_file.h:38
uint32_t frame_num
Definition rtp_audio_file.h:41
qint64 sample_pos
Definition rtp_audio_file.h:39
qint64 len
Definition rtp_audio_file.h:40
rtp_frame_type type
Definition rtp_audio_file.h:42