1
mirror of https://code.videolan.org/videolan/vlc synced 2024-10-03 01:31:53 +02:00
Commit Graph

634 Commits

Author SHA1 Message Date
Thomas Guillem
9dc34b4205 input: hide input_thread_t 2019-06-03 16:15:55 +02:00
Rémi Denis-Courmont
32bc2c18cf misc: remove unused vlc_error_string() 2019-05-28 19:56:08 +03:00
Steve Lhomme
16040ccb7a do not use tchar.h in VLC
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.
2019-04-03 10:28:50 +02:00
Rémi Denis-Courmont
3e8986472a Rename vlc_error() to vlc_error_string()
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.
2019-03-04 22:02:35 +02:00
Thomas Guillem
599ad7a13d vlc_common: implement VLC_WEAK for MACH-O 2019-01-22 18:28:53 +01:00
Thomas Guillem
8443136fd7 vlc_common: don't use doc inline comments for defines
Otherwise, the comment is included on every doc that mention these defines.
2018-10-19 12:09:54 +02:00
Romain Vimont
983c43f059 vlc_vector: add helpers for vectors
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>
2018-10-18 13:12:22 +02:00
Thomas Guillem
7e719ff464 es_out: add a new ES track identifier
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.
2018-09-03 17:04:04 +02:00
Hugo Beauzée-Luyssen
ee525e65e7 vlc_common.h: Remove unused xcalloc() 2018-08-22 11:41:16 +02:00
Hugo Beauzée-Luyssen
244e4b9daf vlc_common.h: Remove tabs 2018-08-21 11:57:26 +02:00
Rémi Denis-Courmont
c85147a421 include: do not issue assertions in external plug-ins 2018-07-02 21:45:54 +03:00
Steve Lhomme
a6149e2c1e include: rename vlc_mtime.h to vlc_tick.h 2018-06-22 13:26:57 +02:00
Steve Lhomme
b8d32c7cc0 include: move vlc_tick_t in vlc_mtime.h 2018-06-22 13:26:57 +02:00
Steve Lhomme
ff56c92a5e rename mtime_t to vlc_tick_t
Keep a copy of vlc_tick_tfor backward compatibility.
2018-06-22 13:19:24 +02:00
Rémi Denis-Courmont
2d14f88ea3 include: remove vlc_list_t 2018-06-10 13:08:44 +03:00
Rémi Denis-Courmont
13c6d120d7 Remove vlc_value_t.p_list 2018-06-10 13:08:44 +03:00
Rémi Denis-Courmont
8349b1a82a modules: constify vlc_gettext()
The returned string is actually not modifiable. We have no obligations
to reproduce the deficient prototype of the standard gettext().
2018-06-10 13:08:44 +03:00
Romain Vimont
35dd7a8f18 core: remove global picture_sys_t typedef
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>
2018-04-30 17:10:14 +02:00
Romain Vimont
ff2901aff3 core: remove global *_sys_t typedefs
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>
2018-04-30 14:20:50 +02:00
Kamil Rytarowski
7e9ef3d72b include: Rename the bswap functions to vlc_bswap
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>
2018-03-12 09:18:15 +01:00
Martin Storsjö
070fcc422e include: Don't use the gnu_printf format attribute with clang
Clang doesn't support this attribute yet.
2018-02-28 11:48:21 +02:00
Rémi Denis-Courmont
897703bb54 demux: make demux_t an alias of stream_t (refs #18504) 2018-02-26 21:54:15 +02:00
Rémi Denis-Courmont
924d56751b include: revector bit ops 2018-02-26 18:56:24 +02:00
Kamil Rytarowski
ab23a02cc9 Rename popcount to vlc_popcount
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>
2018-02-26 18:56:24 +02:00
Rémi Denis-Courmont
4d1b85c242 include: fix clz on pure ISO C compilers 2018-02-24 09:54:47 +02:00
Francois Cartegnie
ccc3b13f18 fix build / c++ parity usage 2018-02-13 10:58:49 +01:00
Rémi Denis-Courmont
40b92a1446 Add VLC_WEAK wrapper 2018-02-12 19:31:50 +02:00
Rémi Denis-Courmont
417ed9eb80 include: layer the plugin API documentation 2018-02-11 21:55:42 +02:00
Rémi Denis-Courmont
d4c9575d0b include: enable built-in bit operations on Clang 2018-02-11 15:08:23 +02:00
Rémi Denis-Courmont
5a743dcb69 include: document the function and prediction annotation 2018-02-11 15:05:01 +02:00
Rémi Denis-Courmont
1703087d96 clang: enable branch prediction as on GCC 2018-02-11 14:32:54 +02:00
Rémi Denis-Courmont
e097fa0543 Add signed parity on GCC 2018-02-11 14:25:09 +02:00
Rémi Denis-Courmont
d0d9c185fa Make C parity() handle all unsigned types 2018-02-11 13:15:20 +02:00
Rémi Denis-Courmont
0979f5a581 Make C popcount() handle all integer types 2018-02-11 13:15:20 +02:00
Rémi Denis-Courmont
9364337aac include: document generic integer functions 2018-02-11 13:15:20 +02:00
Rémi Denis-Courmont
f96abe51ba Make ctz() handle all integer sizes 2018-02-11 13:15:20 +02:00
Rémi Denis-Courmont
00c2ff8d87 Remove fixed-size clzXX() 2018-02-11 13:15:20 +02:00
Rémi Denis-Courmont
4f58c049f0 Make clz() type-generic, accept long and long long 2018-02-11 13:15:20 +02:00
Rémi Denis-Courmont
2eff4fa122 include: move vlc_common_members to <vlc_objects.h> 2017-12-11 18:46:09 +02:00
Rémi Denis-Courmont
69b0b5a86c include: fold trivial vlc_main.h into vlc_object.h 2017-12-10 22:25:22 +02:00
Rémi Denis-Courmont
12efcaae59 include: guard overflow builtins
Pointed-out-by: KO Myung-Hun <komh78@gmail.com>
2017-11-24 21:54:24 +02:00
KO Myung-Hun
82da9eeee2 vlc_common: include limits.h for UINT_MAX, ULONG_MAX and ULLONG_MAX
Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
2017-11-23 13:35:28 +01:00
Rémi Denis-Courmont
a1c3e136c4 Drop broken C99 support 2017-11-14 18:28:02 +02:00
Rémi Denis-Courmont
b372a4430d Use overflow built-ins also on clang
They were already available as of version 3.4.0.
2017-11-12 19:07:47 +02:00
Rémi Denis-Courmont
aebbbf0288 vlc_alloc: use multiplication overflow helper
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2017-11-12 15:24:19 +02:00
Rémi Denis-Courmont
621449d63a Add helpers for unsigned integer overflow
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2017-11-12 15:24:16 +02:00
Rémi Denis-Courmont
f5e485d1e3 core: add vlc_alloc: helper for table allocation
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2017-11-11 17:20:38 +01:00
Rémi Denis-Courmont
6b386c16fd x*alloc: handle zero-size allocations (fixes #19052) 2017-11-08 19:02:50 +02:00
Rémi Denis-Courmont
85ef8b747d include: remove unused CEIL and PAD macros 2017-11-04 14:09:28 +02:00
Steve Lhomme
edbb0399b3 vlc_common: GCC enumerator attributes are only available since gcc 6
Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
2017-08-07 15:23:17 +02:00