10#ifndef RTP_AUDIO_FILE_H
11#define RTP_AUDIO_FILE_H
18#include <QTemporaryFile>
54 explicit RtpAudioFile(
bool use_disk_for_temp,
bool use_disk_for_frames);
112 bool open(QIODevice::OpenMode mode)
override;
118 qint64
size()
const override;
124 qint64
pos()
const override;
131 bool seek(qint64 off)
override;
172 qint64
readData(
char *data, qint64 maxSize)
override;
180 qint64
writeData(
const char *data, qint64 maxSize)
override;
184 QIODevice *sample_file_;
187 QIODevice *sample_file_frame_;
214 qint64 frameWriteFrame(uint32_t frame_num, qint64 real_pos, qint64 sample_pos, qint64 len,
rtp_frame_type type);
220 void frameUpdateRealCounters(qint64 written_bytes);
226 void frameUpdateSampleCounters(qint64 written_bytes);
237 qint64 readFrameData(
char *data , qint64 want_read);
RtpAudioFile(bool use_disk_for_temp, bool use_disk_for_frames)
Constructs an RtpAudioFile object.
Definition rtp_audio_file.cpp:35
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 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
bool readFrameSamples(int32_t *read_buff_bytes, SAMPLE **read_buff, uint32_t *read_len, uint32_t *frame_num, rtp_frame_type *type)
Reads samples for a single frame.
Definition rtp_audio_file.cpp:178
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:27
@ RTP_FRAME_SILENCE
Definition rtp_audio_file.h:29
@ RTP_FRAME_AUDIO
Definition rtp_audio_file.h:28
Definition packet-rtp.h:29
Structure used for storing frame num during visual waveform decoding.
Definition rtp_audio_file.h:35
qint64 real_pos
Definition rtp_audio_file.h:36
uint32_t frame_num
Definition rtp_audio_file.h:39
qint64 sample_pos
Definition rtp_audio_file.h:37
qint64 len
Definition rtp_audio_file.h:38
rtp_frame_type type
Definition rtp_audio_file.h:40