FFmpegfs Fuse Multi Media Filesystem 2.16
|
#include <buffer.h>
Classes | |
struct | _tagCACHEINFO |
Structure to hold current cache state. More... | |
Public Types | |
typedef struct Buffer::_tagCACHEINFO | CACHEINFO |
Structure to hold current cache state. | |
typedef struct Buffer::_tagCACHEINFO * | LPCACHEINFO |
Pointer version of CACHEINFO. | |
typedef CACHEINFO const * | LPCCACHEINFO |
Pointer to const version of CACHEINFO. More... | |
Public Member Functions | |
Buffer () | |
Create Buffer object. More... | |
virtual | ~Buffer () |
Free Buffer object. More... | |
virtual VIRTUALTYPE | type () const override |
Get type of this virtual file. More... | |
bool | init (bool erase_cache) |
Initialise cache. More... | |
bool | set_segment (uint32_t segment_no, size_t size) |
Set the current segment. More... | |
uint32_t | segment_count () |
Get segment count. More... | |
uint32_t | current_segment_no () |
Get the currently selected segment. More... | |
bool | segment_exists (uint32_t segment_no) |
Check if segment exists. More... | |
bool | release (int flags=CACHE_CLOSE_NOOPT) |
Release cache buffer. More... | |
virtual size_t | bufsize () const override |
Size of this buffer. More... | |
virtual int | openio (LPVIRTUALFILE virtualfile) override |
Open a virtual file. More... | |
virtual size_t | readio (void *data, size_t size) override |
Not implemented. More... | |
size_t | read_frame (std::vector< uint8_t > *data, uint32_t frame_no) |
Write image data for the frame number into the buffer. More... | |
virtual int | error () const override |
Get last error. More... | |
virtual int64_t | duration () const override |
Get the duration of the file, in AV_TIME_BASE fractional seconds. More... | |
virtual size_t | size () const override |
Get the value of the internal buffer size pointer. More... | |
virtual size_t | size (uint32_t segment_no) const |
Get the value of the internal buffer size pointer. More... | |
virtual size_t | tell () const override |
Get the value of the internal read position pointer. More... | |
virtual size_t | tell (uint32_t segment_no) const |
Get the value of the internal read position pointer. More... | |
virtual int | seek (int64_t offset, int whence) override |
Seek to position in file. More... | |
virtual int | seek (int64_t offset, int whence, uint32_t segment_no) |
Seek to position in file. More... | |
virtual bool | eof () const override |
Check if at end of file. More... | |
virtual bool | eof (uint32_t segment_no) const |
Check if at end of file. More... | |
virtual void | closeio () override |
Close buffer. More... | |
size_t | writeio (const uint8_t *data, size_t length) |
Write data to the current position in the buffer. The position pointer will be updated. More... | |
size_t | write_frame (const uint8_t *data, size_t length, uint32_t frame_no) |
Write image data for the frame number into the buffer. More... | |
bool | flush () |
Flush buffer to disk. More... | |
bool | clear () |
Clear (delete) buffer. More... | |
bool | reserve (size_t size) |
Reserve memory without changing size to reduce re-allocations. More... | |
size_t | buffer_watermark (uint32_t segment_no=0) const |
Return the current watermark of the file while transcoding. More... | |
bool | copy (std::vector< uint8_t > *out_data, size_t offset, uint32_t segment_no=0) |
Copy buffered data into output buffer. More... | |
bool | copy (uint8_t *out_data, size_t offset, size_t bufsize, uint32_t segment_no=0) |
Copy buffered data into output buffer. More... | |
const std::string & | cachefile (uint32_t segment_no) const |
Get cache filename. More... | |
bool | have_frame (uint32_t frame_no) |
Check if we have the requested frame number. Works only when processing a frame set. More... | |
void | finished_segment () |
Complete the segment decoding. More... | |
bool | is_segment_finished (uint32_t segment_no) const |
Return true if transcoding of the segment is finished. More... | |
bool | open_file (uint32_t segment_no, uint32_t flags, size_t defaultsize=0) |
Open the cache file if not already open. More... | |
bool | close_file (uint32_t segment_no, uint32_t flags) |
If it hasn't already been done, close the cache file. More... | |
Public Member Functions inherited from FileIO | |
FileIO () | |
Create FileIO object. More... | |
virtual | ~FileIO ()=default |
Free FileIO object. | |
virtual VIRTUALTYPE | type () const =0 |
Get type of the virtual file. More... | |
virtual size_t | bufsize () const =0 |
Get the ideal buffer size. More... | |
virtual int | openio (LPVIRTUALFILE virtualfile)=0 |
Open a virtual file. More... | |
virtual size_t | readio (void *data, size_t size)=0 |
Read data from a file. More... | |
virtual int | error () const =0 |
Get last error. More... | |
virtual int64_t | duration () const =0 |
Get the duration of the file, in AV_TIME_BASE fractional seconds. More... | |
virtual size_t | size () const =0 |
Get the file size. More... | |
virtual size_t | tell () const =0 |
Get current read position. More... | |
virtual int | seek (int64_t offset, int whence)=0 |
Seek to position in file. More... | |
virtual bool | eof () const =0 |
Check if at end of file. More... | |
virtual void | closeio ()=0 |
Close virtual file. More... | |
LPVIRTUALFILE | virtualfile () |
Get virtual file object. More... | |
const std::string & | filename () const |
Get source filename. More... | |
const std::string & | path () const |
Path to source file (without file name) More... | |
Static Public Member Functions | |
static const std::string & | make_cachefile_name (std::string *cachefile, const std::string &filename, const std::string &fileext, bool is_idx) |
Make up a cache file name, including the full path. More... | |
static bool | remove_file (const std::string &filename) |
Remove (unlink) the file. More... | |
Static Public Member Functions inherited from FileIO | |
static std::shared_ptr< FileIO > | alloc (VIRTUALTYPE type) |
Allocate the correct object for type(). More... | |
Protected Member Functions | |
bool | remove_cachefile (uint32_t segment_no=0) const |
Remove the cachefile. More... | |
bool | is_open () |
Check if the cache file is open. More... | |
Protected Member Functions inherited from FileIO | |
void | set_virtualfile (LPVIRTUALFILE virtualfile) |
Set the virtual file object. More... | |
Private Member Functions | |
uint8_t * | write_prepare (size_t length) |
Prepare for the writing operation. More... | |
void | increment_pos (size_t increment) |
Increment buffer position. More... | |
bool | reallocate (size_t newsize) |
Reallocate the buffer to a new size. More... | |
bool | map_file (const std::string &filename, volatile int *fd, uint8_t **p, size_t *filesize, bool *isdefaultsize, size_t defaultsize, bool truncate) const |
Map memory to a file. More... | |
bool | unmap_file (const std::string &filename, volatile int *fd, uint8_t **p, size_t len, size_t *filesize) const |
Unmap memory from the file. More... | |
LPCACHEINFO | cacheinfo (uint32_t segment_no) |
Get cache information. More... | |
LPCCACHEINFO | const_cacheinfo (uint32_t segment_no) const |
Get cache information. More... | |
Private Attributes | |
std::recursive_mutex | m_mutex |
Access mutex. More... | |
LPCACHEINFO | m_cur_ci |
Convenience pointer to current write segment. More... | |
uint32_t | m_cur_open |
Number of open files. More... | |
std::vector< CACHEINFO > | m_ci |
Cache info. More... | |
Static Private Attributes | |
static constexpr int | PREALLOC_FACTOR = 5 |
PREALLOC_FACTOR - Number of elements allocated on reallocate calls Number of elements allocated on reallocate calls. The buffer keeps track of the typical buffer write size. To prevent repeated reallocations, reallocate() attempts to set aside enough memory for PREALLOC FACTOR average elements whenever it is invoked. More... | |
typedef CACHEINFO const* Buffer::LPCCACHEINFO |
|
virtual |
size_t Buffer::buffer_watermark | ( | uint32_t | segment_no = 0 | ) | const |
Return the current watermark of the file while transcoding.
While transcoding, this value reflects the current size of the transcoded file. This is the maximum byte offset until the file can be read so far.
[in] | segment_no | - If > 0 returns watermark for specific segment. If 0, returns watermark for current write segment. |
Definition at line 869 of file buffer.cc.
References const_cacheinfo().
Referenced by FFmpeg_Transcoder::encode_finish(), and write_frame().
|
overridevirtual |
const std::string & Buffer::cachefile | ( | uint32_t | segment_no | ) | const |
Get cache filename.
[in] | segment_no | - [1..n] HLS segment file number or 0 for the current segment. |
Definition at line 961 of file buffer.cc.
References const_cacheinfo().
Referenced by make_cachefile_name().
|
private |
bool Buffer::clear | ( | ) |
Clear (delete) buffer.
Definition at line 584 of file buffer.cc.
References Logging::error(), m_ci, m_mutex, and remove_file().
bool Buffer::close_file | ( | uint32_t | segment_no, |
uint32_t | flags | ||
) |
If it hasn't already been done, close the cache file.
[in] | segment_no | - [0..n-1] Index of segment file number. |
[in] | flags | - CACHE_FLAG_* options |
Definition at line 137 of file buffer.cc.
References Buffer::_tagCACHEINFO::m_buffer, Buffer::_tagCACHEINFO::m_buffer_pos, Buffer::_tagCACHEINFO::m_buffer_size, Buffer::_tagCACHEINFO::m_buffer_watermark, Buffer::_tagCACHEINFO::m_cachefile, m_ci, m_cur_open, Buffer::_tagCACHEINFO::m_fd, Buffer::_tagCACHEINFO::m_flags, m_mutex, Logging::trace(), and unmap_file().
Referenced by release(), and set_segment().
|
overridevirtual |
|
private |
Get cache information.
[in] | segment_no | - HLS segment file number [1..n] or 0 for the current segment. |
Definition at line 1138 of file buffer.cc.
References m_ci, and m_cur_ci.
Referenced by buffer_watermark(), cachefile(), copy(), is_segment_finished(), size(), and tell().
bool Buffer::copy | ( | std::vector< uint8_t > * | out_data, |
size_t | offset, | ||
uint32_t | segment_no = 0 |
||
) |
Copy buffered data into output buffer.
[in] | out_data | - Buffer to copy data to. |
[in] | offset | - Offset in buffer to copy data from. |
[in] | segment_no | - HLS segment file number [1..n] or 0 for current segment. |
Definition at line 882 of file buffer.cc.
References copy().
Referenced by copy(), FFmpeg_Transcoder::create_fake_wav_header(), FFmpeg_Transcoder::read_aiff_chunk(), and read_frame().
bool Buffer::copy | ( | uint8_t * | out_data, |
size_t | offset, | ||
size_t | bufsize, | ||
uint32_t | segment_no = 0 |
||
) |
Copy buffered data into output buffer.
[in] | out_data | - Buffer to copy data to. |
[in] | offset | - Offset in buffer to copy data from. |
[in] | bufsize | - Size of out_data buffer. |
[in] | segment_no | - [1..n] HLS segment file number or 0 for the current segment. |
Definition at line 887 of file buffer.cc.
References bufsize(), const_cacheinfo(), Logging::error(), and m_mutex.
uint32_t Buffer::current_segment_no | ( | ) |
Get the currently selected segment.
Definition at line 336 of file buffer.cc.
References m_ci, m_cur_ci, m_mutex, and segment_count().
Referenced by set_segment().
|
overridevirtual |
|
overridevirtual |
|
virtual |
|
overridevirtual |
void Buffer::finished_segment | ( | ) |
Complete the segment decoding.
Definition at line 1097 of file buffer.cc.
References flush(), m_cur_ci, and Buffer::_tagCACHEINFO::m_seg_finished.
Referenced by FFmpeg_Transcoder::encode_finish().
bool Buffer::flush | ( | ) |
Flush buffer to disk.
Definition at line 556 of file buffer.cc.
References Logging::error(), Buffer::_tagCACHEINFO::m_buffer, Buffer::_tagCACHEINFO::m_buffer_idx, Buffer::_tagCACHEINFO::m_buffer_size, Buffer::_tagCACHEINFO::m_buffer_size_idx, Buffer::_tagCACHEINFO::m_cachefile, Buffer::_tagCACHEINFO::m_cachefile_idx, m_cur_ci, m_mutex, and segment_count().
Referenced by finished_segment(), and release().
bool Buffer::have_frame | ( | uint32_t | frame_no | ) |
Check if we have the requested frame number. Works only when processing a frame set.
[in] | frame_no | - 1...frames |
Definition at line 1063 of file buffer.cc.
References Buffer::_tagCACHEINFO::m_buffer_idx, m_cur_ci, m_mutex, and FileIO::virtualfile().
Referenced by FFmpeg_Transcoder::seek_frame(), and FFmpeg_Transcoder::skip_decoded_frames().
|
private |
Increment buffer position.
Increment the location of the internal pointer. This cannot fail and so returns void. It does not ensure the position is valid memory. That is done by the write_prepare methods via reallocate.
[in] | increment | - Increment size. |
Definition at line 766 of file buffer.cc.
References Buffer::_tagCACHEINFO::m_buffer_pos, and m_cur_ci.
Referenced by writeio().
bool Buffer::init | ( | bool | erase_cache | ) |
Initialise cache.
[in] | erase_cache | - If true, delete the old file before opening. |
Definition at line 179 of file buffer.cc.
References FFMPEGFS_PARAMS::current_format(), Logging::error(), FileIO::filename(), VIRTUALFILE::get_segment_count(), is_open(), m_ci, m_cur_ci, m_mutex, VIRTUALFILE::m_video_frame_count, make_cachefile_name(), make_filename(), map_file(), mktree(), new_strdup(), params, remove_cachefile(), FileIO::virtualfile(), VIRTUALFLAG_FRAME, and VIRTUALFLAG_HLS.
|
protected |
bool Buffer::is_segment_finished | ( | uint32_t | segment_no | ) | const |
Return true if transcoding of the segment is finished.
[in] | segment_no | - [1..n] HLS segment file number or 0 for the current segment. |
Definition at line 1109 of file buffer.cc.
References const_cacheinfo().
|
static |
Make up a cache file name, including the full path.
[out] | cachefile | - Name of cache file. |
[in] | filename | - Source file name. |
[in] | fileext | - File extension (MP4, WEBM etc.). |
[in] | is_idx | - If true, create an index file; otherwise, create a cache. |
Definition at line 975 of file buffer.cc.
References cachefile(), FileIO::filename(), FFMPEGFS_PARAMS::m_mountpath, params, and transcoder_cache_path().
Referenced by init(), load_path(), and make_hls_fileset().
|
private |
Map memory to a file.
[in] | filename | - Name of the cache file to open. |
[out] | fd | - The file descriptor of the open cache file. |
[out] | p | - Memory pointer to the cache file. |
[out] | filesize | - Actual size of the cache file after this call. |
[in,out] | isdefaultsize | - In: If false, the file size will be the size of the existing file, returning the size in filesize. If the file does not exist, it will be sized to defaultsize. If true, the defaultsize will be used in any case, resizing an existing file if necessary. Out: true if the file size was set to default. |
[out] | defaultsize | - The default size of the file if it does not exist. This parameter can be zero, in which case the size will be set to the system's page size. |
[out] | truncate | - If true, when the file is opened, it is truncated. |
Definition at line 358 of file buffer.cc.
References Logging::error(), FileIO::filename(), format_size(), and Logging::trace().
Referenced by init(), and open_file().
bool Buffer::open_file | ( | uint32_t | segment_no, |
uint32_t | flags, | ||
size_t | defaultsize = 0 |
||
) |
Open the cache file if not already open.
[in] | segment_no | - [0..n-1] Index of segment file number. |
[in] | flags | - CACHE_FLAG_* options. |
[in] | defaultsize | - If nonzero, after opening, the file will be resized to this value. Works on writeable files only. |
Definition at line 77 of file buffer.cc.
References CACHE_FLAG_RW, Logging::debug(), Buffer::_tagCACHEINFO::m_buffer, Buffer::_tagCACHEINFO::m_buffer_pos, Buffer::_tagCACHEINFO::m_buffer_size, Buffer::_tagCACHEINFO::m_buffer_watermark, Buffer::_tagCACHEINFO::m_buffer_write_size, Buffer::_tagCACHEINFO::m_buffer_writes, Buffer::_tagCACHEINFO::m_cachefile, m_ci, m_cur_open, Buffer::_tagCACHEINFO::m_fd, Buffer::_tagCACHEINFO::m_flags, m_mutex, map_file(), reserve(), and Logging::trace().
Referenced by FFmpeg_Transcoder::open_output(), FFmpeg_Transcoder::open_output_frame_set(), and set_segment().
|
overridevirtual |
Open a virtual file.
[in] | virtualfile | - LPCVIRTUALFILE of file to open |
Implements FileIO.
Definition at line 64 of file buffer.cc.
References FileIO::set_virtualfile(), and FileIO::virtualfile().
size_t Buffer::read_frame | ( | std::vector< uint8_t > * | data, |
uint32_t | frame_no | ||
) |
Write image data for the frame number into the buffer.
[out] | data | - Buffer to read data in. |
[in] | frame_no | - Number of the frame to write. |
Definition at line 1016 of file buffer.cc.
References copy(), Buffer::_tagCACHEINFO::m_buffer_idx, m_cur_ci, m_mutex, and FileIO::virtualfile().
|
overridevirtual |
|
private |
Reallocate the buffer to a new size.
Ensure the allocation has at least the size of bytes available. If not, reallocate memory to make more available. Fill the newly allocated memory with zeroes.
[in] | newsize | - New buffer size. |
Definition at line 933 of file buffer.cc.
References FileIO::filename(), Buffer::_tagCACHEINFO::m_buffer_write_size, Buffer::_tagCACHEINFO::m_buffer_writes, m_cur_ci, PREALLOC_FACTOR, reserve(), size(), and Logging::trace().
Referenced by write_prepare().
bool Buffer::release | ( | int | flags = CACHE_CLOSE_NOOPT | ) |
Release cache buffer.
[in] | flags | - One of the CACHE_CLOSE_* flags. |
Definition at line 491 of file buffer.cc.
References CACHE_CHECK_BIT, CACHE_CLOSE_DELETE, CACHE_FLAG_RO, CACHE_FLAG_RW, close_file(), flush(), is_open(), m_ci, m_mutex, remove_cachefile(), segment_count(), and unmap_file().
|
protected |
Remove the cachefile.
[in] | segment_no | - [1..n] HLS segment file number or 0 for the current segment. |
Definition at line 541 of file buffer.cc.
References Buffer::_tagCACHEINFO::m_cachefile, Buffer::_tagCACHEINFO::m_cachefile_idx, m_ci, m_cur_ci, and remove_file().
|
static |
Remove (unlink) the file.
[in] | filename | - Name of the file to remove. |
Definition at line 995 of file buffer.cc.
References FileIO::filename(), and Logging::warning().
Referenced by clear(), and remove_cachefile().
bool Buffer::reserve | ( | size_t | size | ) |
Reserve memory without changing size to reduce re-allocations.
[in] | size | - Size of buffer to reserve. |
Definition at line 624 of file buffer.cc.
References Logging::error(), Buffer::_tagCACHEINFO::m_buffer, Buffer::_tagCACHEINFO::m_buffer_size, Buffer::_tagCACHEINFO::m_cachefile, m_cur_ci, Buffer::_tagCACHEINFO::m_fd, m_mutex, and size().
Referenced by open_file(), reallocate(), and set_segment().
|
overridevirtual |
Seek to position in file.
Repositions the offset of the open file to the argument offset according to the directive whence. May block for a long time if the buffer has not been filled to the requested offset.
[in] | offset | - offset in bytes |
[in] | whence | - how to seek: SEEK_SET: The offset is set to offset bytes. SEEK_CUR: The offset is set to its current location plus offset bytes. SEEK_END: The offset is set to the size of the file plus offset bytes. |
Implements FileIO.
Definition at line 771 of file buffer.cc.
References seek().
Referenced by FFmpeg_Transcoder::create_fake_aiff_header(), FFmpeg_Transcoder::create_fake_wav_header(), seek(), and write_frame().
|
virtual |
Seek to position in file.
Repositions the offset of the open file to the argument offset according to the directive whence. May block for a long time if the buffer has not been filled to the requested offset.
[in] | offset | - offset in bytes |
[in] | whence | - how to seek: SEEK_SET: The offset is set to offset bytes. SEEK_CUR: The offset is set to its current location plus offset bytes. SEEK_END: The offset is set to the size of the file plus offset bytes. |
[in] | segment_no | - [1..n] HLS segment file number or 0 for the current segment. |
Definition at line 776 of file buffer.cc.
References cacheinfo(), Buffer::_tagCACHEINFO::m_buffer, Buffer::_tagCACHEINFO::m_buffer_pos, size(), and tell().
uint32_t Buffer::segment_count | ( | ) |
Get segment count.
Definition at line 329 of file buffer.cc.
Referenced by cacheinfo(), current_segment_no(), flush(), release(), segment_exists(), and set_segment().
bool Buffer::segment_exists | ( | uint32_t | segment_no | ) |
Check if segment exists.
[in] | segment_no | - [1..n] HLS segment file number. |
Definition at line 347 of file buffer.cc.
References file_exists(), m_ci, m_cur_ci, m_mutex, and segment_count().
Referenced by FFmpeg_Transcoder::start_new_segment().
bool Buffer::set_segment | ( | uint32_t | segment_no, |
size_t | size | ||
) |
Set the current segment.
[in] | segment_no | - [1..n] HLS segment file number. |
[in] | size | - Estimated size of segment. Should be large enough to hold the resulting size. |
Definition at line 303 of file buffer.cc.
References CACHE_FLAG_RW, close_file(), current_segment_no(), m_ci, m_cur_ci, m_mutex, open_file(), reserve(), segment_count(), and size().
Referenced by FFmpeg_Transcoder::start_new_segment().
|
overridevirtual |
Get the value of the internal buffer size pointer.
Implements FileIO.
Definition at line 851 of file buffer.cc.
References size().
Referenced by eof(), reallocate(), reserve(), seek(), set_segment(), and size().
|
virtual |
Get the value of the internal buffer size pointer.
[in] | segment_no | - [1..n] HLS segment file number or 0 for the current segment. |
Definition at line 856 of file buffer.cc.
References const_cacheinfo().
|
overridevirtual |
Get the value of the internal read position pointer.
Implements FileIO.
Definition at line 828 of file buffer.cc.
References tell().
Referenced by FFmpeg_Transcoder::create_fake_aiff_header(), FFmpeg_Transcoder::create_fake_wav_header(), eof(), seek(), FFmpeg_Transcoder::start_new_segment(), and tell().
|
virtual |
Get the value of the internal read position pointer.
[in] | segment_no | - [1..n] HLS segment file number or 0 for the current segment. |
Definition at line 833 of file buffer.cc.
References const_cacheinfo().
|
overridevirtual |
Get type of this virtual file.
Implements FileIO.
Definition at line 54 of file buffer.cc.
References BUFFER.
|
private |
Unmap memory from the file.
[in] | filename | - Name of cache file to unmap. |
[in] | fd | - The file descriptor of the open cache file. |
[in] | p | - Memory pointer to the cache file. |
[in] | len | - Length of the allocated block. |
[in] | filesize | - Actual size of the cache file. |
Definition at line 441 of file buffer.cc.
References Logging::error(), FileIO::filename(), and Logging::trace().
Referenced by close_file(), and release().
size_t Buffer::write_frame | ( | const uint8_t * | data, |
size_t | length, | ||
uint32_t | frame_no | ||
) |
Write image data for the frame number into the buffer.
[in] | data | - Buffer with data to write. |
[in] | length | - Length of buffer to write. |
[in] | frame_no | - Number of the frame to write. |
Definition at line 695 of file buffer.cc.
References buffer_watermark(), IMAGE_FRAME_TAG, Buffer::_tagCACHEINFO::m_buffer_idx, m_cur_ci, IMAGE_FRAME::m_frame_no, m_mutex, IMAGE_FRAME::m_offset, IMAGE_FRAME::m_size, IMAGE_FRAME::m_tag, seek(), FileIO::virtualfile(), and writeio().
Referenced by FFmpeg_Transcoder::encode_image_frame().
|
private |
Prepare for the writing operation.
Ensure the buffer has sufficient space for the quantity of data and return a pointer to where the data may be written. The position pointer should be updated afterward with increment_pos().
[in] | length | - Buffer length to prepare. |
Definition at line 749 of file buffer.cc.
References Buffer::_tagCACHEINFO::m_buffer, Buffer::_tagCACHEINFO::m_buffer_pos, Buffer::_tagCACHEINFO::m_buffer_watermark, m_cur_ci, and reallocate().
Referenced by writeio().
size_t Buffer::writeio | ( | const uint8_t * | data, |
size_t | length | ||
) |
Write data to the current position in the buffer. The position pointer will be updated.
[in] | data | - Buffer with data to write. |
[in] | length | - Length of buffer to write. |
Definition at line 668 of file buffer.cc.
References increment_pos(), Buffer::_tagCACHEINFO::m_buffer, Buffer::_tagCACHEINFO::m_buffer_write_size, Buffer::_tagCACHEINFO::m_buffer_writes, m_cur_ci, m_mutex, and write_prepare().
Referenced by FFmpeg_Transcoder::create_fake_aiff_header(), FFmpeg_Transcoder::create_fake_wav_header(), FFmpeg_Transcoder::output_write(), and write_frame().
|
private |
Cache info.
Definition at line 477 of file buffer.h.
Referenced by cacheinfo(), clear(), close_file(), const_cacheinfo(), current_segment_no(), init(), is_open(), open_file(), release(), remove_cachefile(), segment_count(), segment_exists(), and set_segment().
|
private |
Convenience pointer to current write segment.
Definition at line 474 of file buffer.h.
Referenced by cacheinfo(), const_cacheinfo(), current_segment_no(), finished_segment(), flush(), have_frame(), increment_pos(), init(), read_frame(), reallocate(), remove_cachefile(), reserve(), segment_exists(), set_segment(), write_frame(), write_prepare(), and writeio().
|
private |
Number of open files.
Definition at line 475 of file buffer.h.
Referenced by close_file(), and open_file().
|
private |
Access mutex.
Definition at line 473 of file buffer.h.
Referenced by clear(), close_file(), copy(), current_segment_no(), flush(), have_frame(), init(), is_open(), open_file(), read_frame(), release(), reserve(), segment_count(), segment_exists(), set_segment(), write_frame(), and writeio().
|
staticconstexprprivate |
PREALLOC_FACTOR - Number of elements allocated on reallocate calls Number of elements allocated on reallocate calls. The buffer keeps track of the typical buffer write size. To prevent repeated reallocations, reallocate() attempts to set aside enough memory for PREALLOC FACTOR average elements whenever it is invoked.
Definition at line 64 of file buffer.h.
Referenced by reallocate().