This file implements functions and structures to handle blocks of data in vlc. More...

Go to the source code of this file.
Data Structures | |
| struct | block_t |
Defines | |
| #define | BLOCK_FLAG_DISCONTINUITY 0x0001 |
| The content doesn't follow the last block, or is probably broken. | |
| #define | BLOCK_FLAG_TYPE_I 0x0002 |
| Intra frame. | |
| #define | BLOCK_FLAG_TYPE_P 0x0004 |
| Inter frame with backward reference only. | |
| #define | BLOCK_FLAG_TYPE_B 0x0008 |
| Inter frame with backward and forward reference. | |
| #define | BLOCK_FLAG_TYPE_PB 0x0010 |
| For inter frame when you don't know the real type. | |
| #define | BLOCK_FLAG_HEADER 0x0020 |
| Warn that this block is a header one. | |
| #define | BLOCK_FLAG_END_OF_FRAME 0x0040 |
| This is the last block of the frame. | |
| #define | BLOCK_FLAG_NO_KEYFRAME 0x0080 |
| This is not a key frame for bitrate shaping. | |
| #define | BLOCK_FLAG_END_OF_SEQUENCE 0x0100 |
| This block contains the last part of a sequence. | |
| #define | BLOCK_FLAG_CLOCK 0x0200 |
| This block contains a clock reference. | |
| #define | BLOCK_FLAG_SCRAMBLED 0x0400 |
| This block is scrambled. | |
| #define | BLOCK_FLAG_PREROLL 0x0800 |
| This block has to be decoded but not be displayed. | |
| #define | BLOCK_FLAG_CORRUPTED 0x1000 |
| This block is corrupted and/or there is data loss. | |
| #define | BLOCK_FLAG_TOP_FIELD_FIRST 0x2000 |
| This block contains an interlaced picture with top field first. | |
| #define | BLOCK_FLAG_BOTTOM_FIELD_FIRST 0x4000 |
| This block contains an interlaced picture with bottom field first. | |
| #define | BLOCK_FLAG_INTERLACED_MASK (BLOCK_FLAG_TOP_FIELD_FIRST|BLOCK_FLAG_BOTTOM_FIELD_FIRST) |
| This block contains an interlaced picture. | |
| #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_New(dummy, size) block_Alloc(size) |
| #define | block_cleanup_push(block) vlc_cleanup_push (block_Cleanup, block) |
Typedefs | |
| typedef struct block_sys_t | block_sys_t |
| typedef void(* | block_free_t )(block_t *) |
Functions | |
| VLC_API void | block_Init (block_t *, void *, size_t) |
| VLC_API block_t * | block_Alloc (size_t) VLC_USED |
| VLC_API block_t * | block_Realloc (block_t *, ssize_t i_pre, size_t i_body) VLC_USED |
| static VLC_USED block_t * | block_Duplicate (block_t *p_block) |
| static void | block_Release (block_t *p_block) |
| VLC_API block_t * | block_heap_Alloc (void *, void *, size_t) VLC_USED |
| Creates a block from a heap allocation. | |
| VLC_API block_t * | block_mmap_Alloc (void *addr, size_t length) VLC_USED |
| VLC_API block_t * | block_File (int fd) VLC_USED |
| Loads a file into a block of memory. | |
| static void | block_Cleanup (void *block) |
| static void | block_ChainAppend (block_t **pp_list, block_t *p_block) |
| static void | block_ChainLastAppend (block_t ***ppp_last, block_t *p_block) |
| static void | block_ChainRelease (block_t *p_block) |
| static size_t | block_ChainExtract (block_t *p_list, void *p_data, size_t i_max) |
| static void | block_ChainProperties (block_t *p_list, int *pi_count, size_t *pi_size, mtime_t *pi_length) |
| static block_t * | block_ChainGather (block_t *p_list) |
| VLC_API block_fifo_t * | block_FifoNew (void) VLC_USED |
| VLC_API void | block_FifoRelease (block_fifo_t *) |
| VLC_API void | block_FifoPace (block_fifo_t *fifo, size_t max_depth, size_t max_size) |
| Wait until the FIFO gets below a certain size (if needed). | |
| VLC_API void | block_FifoEmpty (block_fifo_t *) |
| VLC_API size_t | block_FifoPut (block_fifo_t *, block_t *) |
| Immediately queue one block at the end of a FIFO. | |
| VLC_API void | block_FifoWake (block_fifo_t *) |
| VLC_API block_t * | block_FifoGet (block_fifo_t *) VLC_USED |
| Dequeue the first block from the FIFO. | |
| VLC_API block_t * | block_FifoShow (block_fifo_t *) |
| Peeks the first block in the FIFO. | |
| size_t | block_FifoSize (const block_fifo_t *p_fifo) VLC_USED |
| VLC_API size_t | block_FifoCount (const block_fifo_t *p_fifo) VLC_USED |
This file implements functions and structures to handle blocks of data in vlc.
| #define block_cleanup_push | ( | block | ) | vlc_cleanup_push (block_Cleanup, block) |
Referenced by block_File().
| #define BLOCK_FLAG_BOTTOM_FIELD_FIRST 0x4000 |
This block contains an interlaced picture with bottom field first.
| #define BLOCK_FLAG_CLOCK 0x0200 |
This block contains a clock reference.
| #define BLOCK_FLAG_CORE_PRIVATE_MASK 0x00ff0000 |
| #define BLOCK_FLAG_CORE_PRIVATE_SHIFT 16 |
| #define BLOCK_FLAG_CORRUPTED 0x1000 |
This block is corrupted and/or there is data loss.
Referenced by DecoderBlockFlushNew(), and EsOutSend().
| #define BLOCK_FLAG_DISCONTINUITY 0x0001 |
The content doesn't follow the last block, or is probably broken.
Referenced by DecoderBlockFlushNew(), DecoderUpdatePreroll(), and EsOutSend().
| #define BLOCK_FLAG_END_OF_FRAME 0x0040 |
This is the last block of the frame.
| #define BLOCK_FLAG_END_OF_SEQUENCE 0x0100 |
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) |
This block contains an interlaced picture.
| #define BLOCK_FLAG_NO_KEYFRAME 0x0080 |
This is not a key frame for bitrate shaping.
| #define BLOCK_FLAG_PREROLL 0x0800 |
This block has to be decoded but not be displayed.
Referenced by DecoderUpdatePreroll().
| #define BLOCK_FLAG_PRIVATE_MASK 0xff000000 |
| #define BLOCK_FLAG_PRIVATE_SHIFT 24 |
| #define BLOCK_FLAG_SCRAMBLED 0x0400 |
This block is scrambled.
| #define BLOCK_FLAG_TOP_FIELD_FIRST 0x2000 |
This block contains an interlaced picture with top field 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.
| #define block_New | ( | dummy, | ||
| size | ||||
| ) | block_Alloc(size) |
Referenced by DStreamDelete(), ImageReadUrl(), stream_Block(), and stream_BlockRemaining().
| typedef void(* block_free_t)(block_t *) |
| typedef struct block_sys_t block_sys_t |
| VLC_API block_t* block_Alloc | ( | size_t | ) |
References ALIGN, BLOCK_ALIGN, block_Init(), block_sys_t::i_allocated_buffer, block_sys_t::p_allocated_buffer, block_t::pf_release, block_sys_t::self, and unlikely.
Referenced by aout_DecNewBuffer(), aout_OutputSlice(), block_ChainGather(), block_Duplicate(), block_File(), block_Realloc(), DecoderBlockFlushNew(), EsOutControlLocked(), test_block(), TsStoragePopCmd(), and VoutDisplayEventKey().
References block_t::p_next.
Referenced by block_BytestreamPush().
| static size_t block_ChainExtract | ( | block_t * | p_list, | |
| void * | p_data, | |||
| size_t | i_max | |||
| ) | [static] |
References __MIN, block_t::i_buffer, block_t::p_buffer, and block_t::p_next.
Referenced by block_ChainGather().
References block_Alloc(), block_ChainExtract(), block_ChainProperties(), block_ChainRelease(), block_t::i_buffer, block_t::i_dts, block_t::i_flags, block_t::i_length, block_t::i_pts, block_t::p_buffer, and block_t::p_next.
Referenced by DStreamPeek().
References block_t::p_next.
| static void block_ChainProperties | ( | block_t * | p_list, | |
| int * | pi_count, | |||
| size_t * | pi_size, | |||
| mtime_t * | pi_length | |||
| ) | [inline, static] |
References block_t::i_buffer, block_t::i_length, and block_t::p_next.
Referenced by block_ChainGather().
| static void block_ChainRelease | ( | block_t * | p_block | ) | [inline, static] |
References block_Release(), and block_t::p_next.
Referenced by AStreamControlReset(), AStreamDestroy(), AStreamSeekBlock(), block_ChainGather(), and DecoderFlushBuffering().
| static void block_Cleanup | ( | void * | block | ) | [inline, static] |
References block_Release().
References block_Alloc(), block_t::i_buffer, block_t::i_dts, block_t::i_flags, block_t::i_length, block_t::i_nb_samples, block_t::i_pts, and block_t::p_buffer.
Referenced by block_Realloc(), DecoderGetCc(), and EsOutSend().
| VLC_API size_t block_FifoCount | ( | const block_fifo_t * | p_fifo | ) |
References block_fifo_t::i_depth.
Referenced by DeleteDecoder(), input_DecoderIsEmpty(), sout_MuxDeleteStream(), and sout_MuxGetStream().
| VLC_API void block_FifoEmpty | ( | block_fifo_t * | ) |
References block_Release(), block_fifo_t::i_depth, block_fifo_t::i_size, block_fifo_t::lock, block_fifo_t::p_first, block_t::p_next, block_fifo_t::pp_last, vlc_cond_broadcast(), vlc_mutex_lock(), vlc_mutex_unlock(), and block_fifo_t::wait_room.
Referenced by block_FifoRelease(), DecoderFlush(), DeleteDecoder(), and input_DecoderDecode().
| VLC_API block_t* block_FifoGet | ( | block_fifo_t * | p_fifo | ) |
Dequeue the first block from the FIFO.
If necessary, wait until there is one block in the queue. This function is (always) cancellation point.
References block_fifo_t::b_force_wake, block_t::i_buffer, block_fifo_t::i_depth, block_fifo_t::i_size, block_fifo_t::lock, mutex_cleanup_push, block_fifo_t::p_first, block_t::p_next, block_fifo_t::pp_last, vlc_cleanup_pop, vlc_cond_broadcast(), vlc_cond_wait(), vlc_mutex_lock(), vlc_mutex_unlock(), vlc_testcancel(), block_fifo_t::wait, and block_fifo_t::wait_room.
Referenced by DecoderThread(), DStreamPeek(), DStreamRead(), and VoutDisplayEventKeyDispatch().
| VLC_API block_fifo_t* block_FifoNew | ( | void | ) |
References block_fifo_t::b_force_wake, block_fifo_t::i_depth, block_fifo_t::i_size, block_fifo_t::lock, block_fifo_t::p_first, block_fifo_t::pp_last, vlc_cond_init(), vlc_mutex_init(), block_fifo_t::wait, and block_fifo_t::wait_room.
Referenced by CreateDecoder(), sout_MuxAddStream(), stream_DemuxNew(), and VoutDisplayEventKey().
| VLC_API void block_FifoPace | ( | block_fifo_t * | fifo, | |
| size_t | max_depth, | |||
| size_t | max_size | |||
| ) |
Wait until the FIFO gets below a certain size (if needed).
Note that if more than one thread writes to the FIFO, you cannot assume that the FIFO is actually below the requested size upon return (since another thread could have refilled it already). This is typically not an issue, as this function is meant for (relaxed) congestion control.
This function may be a cancellation point and it is cancel-safe.
| fifo | queue to wait on | |
| max_depth | wait until the queue has no more than this many blocks (use SIZE_MAX to ignore this constraint) | |
| max_size | wait until the queue has no more than this many bytes (use SIZE_MAX to ignore this constraint) |
References block_fifo_t::i_depth, block_fifo_t::i_size, block_fifo_t::lock, mutex_cleanup_push, vlc_cleanup_pop, vlc_cond_wait(), vlc_mutex_lock(), vlc_mutex_unlock(), vlc_testcancel(), and block_fifo_t::wait_room.
Referenced by input_DecoderDecode().
| VLC_API size_t block_FifoPut | ( | block_fifo_t * | p_fifo, | |
| block_t * | p_block | |||
| ) |
Immediately queue one block at the end of a FIFO.
| fifo | queue | |
| block | head of a block list to queue (may be NULL) |
References block_t::i_buffer, block_fifo_t::i_depth, block_fifo_t::i_size, block_fifo_t::lock, block_t::p_next, block_fifo_t::pp_last, vlc_cond_signal(), vlc_mutex_lock(), vlc_mutex_unlock(), and block_fifo_t::wait.
Referenced by DStreamDelete(), input_DecoderDecode(), sout_MuxSendBuffer(), stream_DemuxSend(), and VoutDisplayEventKey().
| VLC_API void block_FifoRelease | ( | block_fifo_t * | ) |
| VLC_API block_t* block_FifoShow | ( | block_fifo_t * | p_fifo | ) |
Peeks the first block in the FIFO.
If necessary, wait until there is one block. This function is (always) a cancellation point.
References block_fifo_t::lock, mutex_cleanup_push, block_fifo_t::p_first, vlc_cleanup_run, vlc_cond_wait(), vlc_mutex_lock(), vlc_testcancel(), and block_fifo_t::wait.
Referenced by sout_MuxGetStream().
| size_t block_FifoSize | ( | const block_fifo_t * | p_fifo | ) |
References block_fifo_t::i_size.
Referenced by input_DecoderDecode(), and input_DecoderGetFifoSize().
| VLC_API void block_FifoWake | ( | block_fifo_t * | ) |
References block_fifo_t::b_force_wake, block_fifo_t::lock, block_fifo_t::p_first, vlc_cond_broadcast(), vlc_mutex_lock(), vlc_mutex_unlock(), and block_fifo_t::wait.
Referenced by input_DecoderWaitBuffering().
| VLC_API block_t* block_File | ( | int | fd | ) |
Loads a file into a block of memory.
If possible a private file mapping is created. Otherwise, the file is read normally. On 32-bits platforms, this function will not work for very large files, due to memory space constraints. Cancellation point.
| fd | file descriptor to load from |
References block_Alloc(), block_cleanup_push, block_mmap_Alloc(), block_Release(), block_t::p_buffer, pread(), S_TYPEISSHM, and vlc_cleanup_pop.
Referenced by test_block_File().
| VLC_API block_t* block_heap_Alloc | ( | void * | ptr, | |
| void * | addr, | |||
| size_t | length | |||
| ) |
Creates a block from a 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.
| ptr | base address of the heap allocation (will be free()'d) | |
| addr | base address of the useful buffer data | |
| length | bytes length of the useful buffer data |
References block_Init(), block_heap_t::mem, block_t::pf_release, and block_heap_t::self.
| VLC_API void block_Init | ( | block_t * | , | |
| void * | , | |||
| size_t | ||||
| ) |
| VLC_API block_t* block_mmap_Alloc | ( | void * | addr, | |
| size_t | length | |||
| ) |
Referenced by block_File().
| static void block_Release | ( | block_t * | p_block | ) | [inline, static] |
References block_t::pf_release.
Referenced by aout_InputPlay(), aout_OutputPlay(), aout_PacketNext(), AStreamRefillBlock(), block_BytestreamFlush(), block_BytestreamRelease(), block_ChainRelease(), block_Cleanup(), block_FifoEmpty(), block_File(), block_Realloc(), CmdCleanSend(), CmdExecuteSend(), DecoderDecodeAudio(), DecoderDecodeVideo(), DecoderError(), DecoderGetCc(), DecoderProcess(), DecoderThread(), DStreamDelete(), DStreamRead(), EsOutSend(), ImageWriteUrl(), sout_InputSendBuffer(), stream_Block(), test_block(), test_block_File(), TsStoragePushCmd(), VoutDisplayEventKeyDispatch(), and VoutSaveSnapshot().
1.7.1