Group PJMEDIA_FILE_REC¶
-
group
PJMEDIA_FILE_REC
Audio capture/recording to WAV file.
Enums
-
enum
pjmedia_file_writer_option
¶ WAV file writer options.
Values:
-
enumerator
PJMEDIA_FILE_WRITE_PCM
¶ Tell the file writer to save the audio in PCM format.
-
enumerator
PJMEDIA_FILE_WRITE_ALAW
¶ Tell the file writer to save the audio in G711 Alaw format.
-
enumerator
PJMEDIA_FILE_WRITE_ULAW
¶ Tell the file writer to save the audio in G711 Alaw format.
-
enumerator
Functions
-
pj_status_t
pjmedia_wav_writer_port_create
(pj_pool_t *pool, const char *filename, unsigned clock_rate, unsigned channel_count, unsigned samples_per_frame, unsigned bits_per_sample, unsigned flags, pj_ssize_t buff_size, pjmedia_port **p_port)¶ Create a media port to record streams to a WAV file. Note that the port must be closed properly (with pjmedia_port_destroy()) so that the WAV header can be filled with correct values (such as the file length). WAV writer port supports for writing audio in uncompressed 16 bit PCM format or compressed G.711 U-law/A-law format, this needs to be specified in flags param.
- Parameters
pool – Pool to create memory buffers for this port.
filename – File name.
clock_rate – The sampling rate.
channel_count – Number of channels.
samples_per_frame – Number of samples per frame.
bits_per_sample – Number of bits per sample (eg 16).
flags – Port creation flags, see pjmedia_file_writer_option.
buff_size – Buffer size to be allocated. If the value is zero or negative, the port will use default buffer size (which is about 4KB).
p_port – Pointer to receive the file port instance.
- Returns
PJ_SUCCESS on success.
-
pj_ssize_t
pjmedia_wav_writer_port_get_pos
(pjmedia_port *port)¶ Get current writing position. Note that this does not necessarily match the size written to the file, since the WAV writer employs some internal buffering. Also the value reported here only indicates the payload size (it does not include the size of the WAV header),
- Parameters
port – The file writer port.
- Returns
Positive value to indicate the position (in bytes), or negative value containing the error code.
-
pj_status_t
pjmedia_wav_writer_port_set_cb
(pjmedia_port *port, pj_size_t pos, void *user_data, pj_status_t (*cb)(pjmedia_port *port, void *usr_data))¶ Register the callback to be called when the file writing has reached certain size. Application can use this callback, for example, to limit the size of the output file.
- Parameters
port – The file writer port.
pos – The file position on which the callback will be called.
user_data – User data to be specified in the callback, and will be given on the callback.
cb – Callback to be called. If the callback returns non- PJ_SUCCESS, the writing will stop. Note that if application destroys the port in the callback, it must return non-PJ_SUCCESS here.
- Returns
PJ_SUCCESS on success.
-
enum