VLC
3.0.15
|
Modules | |
Block chain | |
Block FIFO | |
Thread-safe block queue functions. | |
Files | |
file | vlc_block.h |
Data Structures | |
struct | block_t |
Macros | |
#define | BLOCK_FLAG_DISCONTINUITY 0x0001 |
The content doesn't follow the last block, possible some blocks in between have been lost. More... | |
#define | BLOCK_FLAG_TYPE_I 0x0002 |
Intra frame. More... | |
#define | BLOCK_FLAG_TYPE_P 0x0004 |
Inter frame with backward reference only. More... | |
#define | BLOCK_FLAG_TYPE_B 0x0008 |
Inter frame with backward and forward reference. More... | |
#define | BLOCK_FLAG_TYPE_PB 0x0010 |
For inter frame when you don't know the real type. More... | |
#define | BLOCK_FLAG_HEADER 0x0020 |
Warn that this block is a header one. More... | |
#define | BLOCK_FLAG_END_OF_SEQUENCE 0x0040 |
This block contains the last part of a sequence More... | |
#define | BLOCK_FLAG_CLOCK 0x0080 |
This block contains a clock reference. More... | |
#define | BLOCK_FLAG_SCRAMBLED 0x0100 |
This block is scrambled. More... | |
#define | BLOCK_FLAG_PREROLL 0x0200 |
This block has to be decoded but not be displayed. More... | |
#define | BLOCK_FLAG_CORRUPTED 0x0400 |
This block is corrupted and/or there is data loss More... | |
#define | BLOCK_FLAG_TOP_FIELD_FIRST 0x0800 |
This block contains an interlaced picture with top field stored first. More... | |
#define | BLOCK_FLAG_BOTTOM_FIELD_FIRST 0x1000 |
This block contains an interlaced picture with bottom field stored first. More... | |
#define | BLOCK_FLAG_SINGLE_FIELD 0x2000 |
This block contains a single field from interlaced picture. More... | |
#define | BLOCK_FLAG_INTERLACED_MASK (BLOCK_FLAG_TOP_FIELD_FIRST|BLOCK_FLAG_BOTTOM_FIELD_FIRST|BLOCK_FLAG_SINGLE_FIELD) |
This block contains an interlaced picture. More... | |
#define | BLOCK_FLAG_TYPE_MASK (BLOCK_FLAG_TYPE_I|BLOCK_FLAG_TYPE_P|BLOCK_FLAG_TYPE_B|BLOCK_FLAG_TYPE_PB) |
#define | BLOCK_FLAG_CORE_PRIVATE_MASK 0x00ff0000 |
#define | BLOCK_FLAG_CORE_PRIVATE_SHIFT 16 |
#define | BLOCK_FLAG_PRIVATE_MASK 0xff000000 |
#define | BLOCK_FLAG_PRIVATE_SHIFT 24 |
#define | block_cleanup_push(block) vlc_cleanup_push (block_Cleanup, block) |
Typedefs | |
typedef void(* | block_free_t) (block_t *) |
Functions | |
void | block_Init (block_t *, void *, size_t) |
block_t * | block_Alloc (size_t size) |
Allocates a block. More... | |
block_t * | block_TryRealloc (block_t *, ssize_t pre, size_t body) |
block_t * | block_Realloc (block_t *, ssize_t pre, size_t body) |
Reallocates a block. More... | |
static void | block_Release (block_t *block) |
Releases a block. More... | |
static void | block_CopyProperties (block_t *dst, block_t *src) |
static block_t * | block_Duplicate (block_t *p_block) |
Duplicates a block. More... | |
block_t * | block_heap_Alloc (void *, size_t) |
Wraps heap in a block. More... | |
block_t * | block_mmap_Alloc (void *addr, size_t length) |
Wraps a memory mapping in a block. More... | |
block_t * | block_shm_Alloc (void *addr, size_t length) |
Wraps a System V memory segment in a block. More... | |
block_t * | block_File (int fd, bool write) |
Maps a file handle in memory. More... | |
block_t * | block_FilePath (const char *, bool write) |
Maps a file in memory. More... | |
static void | block_Cleanup (void *block) |
Blocks of binary data.
block_t is a generic structure to represent a binary blob within VLC. The primary goal of the structure is to avoid memory copying as data is passed around. It is notably used between the Demultiplexer, the packetizer (if present) and the Decoder, and for audio, between the Decoder, the audio filters, and the Audio output.
#define block_cleanup_push | ( | block | ) | vlc_cleanup_push (block_Cleanup, block) |
#define BLOCK_FLAG_BOTTOM_FIELD_FIRST 0x1000 |
This block contains an interlaced picture with bottom field stored first.
#define BLOCK_FLAG_CLOCK 0x0080 |
This block contains a clock reference.
#define BLOCK_FLAG_CORE_PRIVATE_MASK 0x00ff0000 |
#define BLOCK_FLAG_CORE_PRIVATE_SHIFT 16 |
#define BLOCK_FLAG_CORRUPTED 0x0400 |
This block is corrupted and/or there is data loss
#define BLOCK_FLAG_DISCONTINUITY 0x0001 |
The content doesn't follow the last block, possible some blocks in between have been lost.
#define BLOCK_FLAG_END_OF_SEQUENCE 0x0040 |
This block contains the last part of a sequence
#define BLOCK_FLAG_HEADER 0x0020 |
Warn that this block is a header one.
#define BLOCK_FLAG_INTERLACED_MASK (BLOCK_FLAG_TOP_FIELD_FIRST|BLOCK_FLAG_BOTTOM_FIELD_FIRST|BLOCK_FLAG_SINGLE_FIELD) |
This block contains an interlaced picture.
#define BLOCK_FLAG_PREROLL 0x0200 |
This block has to be decoded but not be displayed.
#define BLOCK_FLAG_PRIVATE_MASK 0xff000000 |
#define BLOCK_FLAG_PRIVATE_SHIFT 24 |
#define BLOCK_FLAG_SCRAMBLED 0x0100 |
This block is scrambled.
#define BLOCK_FLAG_SINGLE_FIELD 0x2000 |
This block contains a single field from interlaced picture.
#define BLOCK_FLAG_TOP_FIELD_FIRST 0x0800 |
This block contains an interlaced picture with top field stored first.
#define BLOCK_FLAG_TYPE_B 0x0008 |
Inter frame with backward and forward reference.
#define BLOCK_FLAG_TYPE_I 0x0002 |
Intra frame.
#define BLOCK_FLAG_TYPE_MASK (BLOCK_FLAG_TYPE_I|BLOCK_FLAG_TYPE_P|BLOCK_FLAG_TYPE_B|BLOCK_FLAG_TYPE_PB) |
#define BLOCK_FLAG_TYPE_P 0x0004 |
Inter frame with backward reference only.
#define BLOCK_FLAG_TYPE_PB 0x0010 |
For inter frame when you don't know the real type.
typedef void(* block_free_t) (block_t *) |
block_t* block_Alloc | ( | size_t | size | ) |
Allocates a block.
Creates a new block with the requested size. The block must be released with block_Release().
size | size in bytes (possibly zero) |
References BLOCK_ALIGN, block_generic_Release(), block_Init(), BLOCK_PADDING, block_t::i_buffer, block_t::p_buffer, block_t::pf_release, static_assert, and unlikely.
Referenced by aout_DecSilence(), block_Duplicate(), block_File(), block_TryRealloc(), bo_init(), decoder_NewAudioBuffer(), vlc_chunked_read(), vlc_h1_stream_read(), vlc_stream_Block(), vlc_stream_fifo_Write(), vlc_stream_Peek(), and vlc_stream_ReadBlock().
|
inlinestatic |
Referenced by block_Duplicate().
Duplicates a block.
Creates a writeable duplicate of a block.
References block_Alloc(), block_CopyProperties(), block_t::i_buffer, and block_t::p_buffer.
Referenced by DecoderPlayCc(), and EsOutSend().
block_t* block_File | ( | int | fd, |
bool | write | ||
) |
Maps a file handle in memory.
Loads a file into a block of memory through a file descriptor. If possible a private file mapping is created. Otherwise, the file is read normally. This function is a cancellation point.
fd | file descriptor to load from |
write | If true, request a read/write private mapping. If false, request a read-only potentially shared mapping. |
References block_Alloc(), block_cleanup_push, block_mmap_Alloc(), block_Release(), block_t::p_buffer, S_TYPEISSHM, and vlc_cleanup_pop.
Referenced by block_FilePath().
block_t* block_FilePath | ( | const char * | , |
bool | write | ||
) |
Maps a file in memory.
Loads a file into a block of memory from a path to the file. See also block_File().
write | If true, request a read/write private mapping. If false, request a read-only potentially shared mapping. |
References block_File(), vlc_close(), and vlc_open().
block_t* block_heap_Alloc | ( | void * | , |
size_t | |||
) |
Wraps heap in a block.
Creates a block_t out of an existing heap allocation. This is provided by LibVLC so that manually heap-allocated blocks can safely be deallocated even after the origin plugin has been unloaded from memory.
When block_Release() is called, VLC will free() the specified pointer.
addr | base address of the heap allocation (will be free()'d) |
length | bytes length of the heap allocation |
References block_heap_Release(), block_Init(), and block_t::pf_release.
Referenced by vlc_h2_stream_read().
void block_Init | ( | block_t * | , |
void * | , | ||
size_t | |||
) |
block_t* block_mmap_Alloc | ( | void * | addr, |
size_t | length | ||
) |
Wraps a memory mapping in a block.
Creates a block_t from a virtual address memory mapping (mmap). This is provided by LibVLC so that mmap blocks can safely be deallocated even after the allocating plugin has been unloaded from memory.
addr | base address of the mapping (as returned by mmap) |
length | length (bytes) of the mapping (as passed to mmap) |
Referenced by block_File().
Reallocates a block.
This function expands, shrinks or moves a data block. In many cases, this function can return without any memory allocation by reusing spare buffer space. Otherwise, a new block is created and data is copied.
pre | count of bytes to prepend if positive, count of leading bytes to discard if negative |
body | new bytes size of the block |
References block_Release(), and block_TryRealloc().
Referenced by bo_extend().
|
inlinestatic |
Releases a block.
This function works for any block_t block, regardless of the way it was allocated.
block | block to release (cannot be NULL) |
References block_t::pf_release.
Referenced by aout_DecPlay(), aout_FiltersPlay(), block_BytestreamFlush(), block_File(), block_Realloc(), block_TryRealloc(), bo_deinit(), CmdInitDel(), decoder_QueueCc(), DecoderPlayCc(), DecoderProcess(), EsOutSend(), ImageRead(), ImageWriteUrl(), stream_CommonDelete(), vlc_chunked_read(), vlc_h1_stream_read(), vlc_stream_Block(), vlc_stream_CopyBlock(), vlc_stream_fifo_Queue(), vlc_stream_ReadBlock(), vlc_stream_Seek(), and vlc_stream_vaControl().
block_t* block_shm_Alloc | ( | void * | addr, |
size_t | length | ||
) |
Wraps a System V memory segment in a block.
Creates a block_t from a System V shared memory segment (shmget()). This is provided by LibVLC so that segments can safely be deallocated even after the allocating plugin has been unloaded from memory.
addr | base address of the segment (as returned by shmat()) |
length | length (bytes) of the segment (as passed to shmget()) |
References block_Alloc(), block_Check(), block_Release(), BlockMetaCopy(), block_t::i_buffer, block_t::i_size, block_t::p_buffer, and block_t::p_start.
Referenced by block_Realloc(), and vlc_stream_Peek().