We don't include tchar.h anymore, nor TCHAR, nor the *tcs* APIs. Using any of
these will fail to compile if tchar.h is not included. In MinGW it's never
included through other headers.
We don't need _UNICODE either which is specific to tchar.h.
As a sort of VLC equivalent for strerror(), it is tempting to call it
vlc_strerror()... but that is already taken for converting actual
standard error codes to strings.
Add a new API for handling general-purpose vectors, intended to replace
ARRAY_*.
Like ARRAY_*, it provides macros to handle a dynamic array generic
over the type of its items.
Contrary to ARRAY_*:
- it does not abort on allocation failure (but reports the error);
- it uses size_t instead of int to store the capacity and the size;
- it checks for overflows on reallocation.
For illustration purpose, embedding a vector of input_item_t* in a
struct looks like:
struct playlist {
struct VLC_VECTOR(input_item_t *) items;
// ...
};
The main features (with names inspired by std::vector from C++ and
std::vec::Vec from Rust) are:
- void vlc_vector_init(pv)
init the vector (use VLC_VECTOR_INITIALIZER for static init)
- void vlc_vector_destroy(pv)
destroy the vector and release any associated resources
- void vlc_vector_clear(pv)
remove all items from the vector
- vec.size
read the size of the vector
- vec.data[i]
access the i_th item
- bool vlc_vector_push(pv, item)
push an item to the end of the vector
- bool vlc_vector_push_all(pv, items, count)
push serveral items to the end of the vector
- bool vlc_vector_insert(pv, index, item)
insert an item at index
- bool vlc_vector_insert_all(pv, index, items, count)
insert several items at index
- void vlc_vector_move(pv, index, target)
move an item to target
- void vlc_vector_move_all(pv, index, count, target)
move a slice of items to target
- void vlc_vector_remove(pv, index)
remove an item
- void vlc_vector_remove_slice(pv, index, count)
remove a slice of items
- void vlc_vector_swap_remove(pv, index)
remove an item in O(1) without preserving ordering
- bool vlc_vector_reserve(pv, mincap)
increase the capacity of the vector in advance
- void vlc_vector_shrink_to_fit(pv)
resize the vector to its actual size
- void vlc_vector_index_of(pv, index, pidx)
find the index of an item (returns the result in *pidx)
- vlc_vector_foreach(item, pv)
a for-each loop
It uses an exponential growth policy for both increasing and decreasing
the size. As a consequence, the amortized complexity of
vlc_vector_push() is O(1).
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
Add the vlc_es_id_t structure representing an ES track ID.
This new struct will be used to select/unselect/restart tracks.
Users will receive this new struct from input thread event callbacks. They will
be able to hold/release it (and use it even after the track is terminated by
the es_out).
ES Tracks will still be selectable via their i_id (for TS cases) and legacy
track selection via "video-es"/"audio-es"/"spu-es" is still functional.
ES tracks of the input item will now keep the same fmt.i_id than the demuxer
one.
The fmt of the ES events will now keep the decoder codec. The original codec
from the demuxer is still available via fmt.i_original_fourcc.
Replace picture_sys_t* by void* in picture_resource_t, and remove its
typedef in vlc_common.h (for ODR).
This implies to use void* for private data in the vaapi.
See #17078 and #18033
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
Do not declare *_sys_t typedefs globally in vlc_common.h. Instead,
declare them locally in each module that provides a definition.
This paves the way to move C++ definitions into anonymous namespaces in
order to respect C++ ODR.
The picture_resource_t and sout_stream_id_sys_t typedefs will be handled
separately, since they require specific additional changes.
See #18033
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
The bswap16, bswap32 and bswap64 functions are already present on NetBSD
and cannot be redefined in include/vlc_common.h as this causes fatal build
errors.
Rename these functions to vlc_bswap16, vlc_bswap32 and vlc_bswap64 and
keep them as they are without fallback to the NetBSD's libc one. These
functions are already small enough and we can bear with them as duplicates
on the gain of no extra ifdefs in the vlc_common.h public header.
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
This removes conflicts with the NetBSD headers and libc.
The conflicts caused fatal build errors.
No functional change intended for other Operating Systems.
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>