vlc_probe.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef VLC_PROBE_H
00022 # define VLC_PROBE_H 1
00023
00024 # include <stdlib.h>
00025
00026
00027
00028
00029
00030
00031 # ifdef __cplusplus
00032 extern "C" {
00033 # endif
00034
00035 void *vlc_probe (vlc_object_t *, const char *, size_t *restrict);
00036 #define vlc_probe(obj, cap, pcount) \
00037 vlc_probe(VLC_OBJECT(obj), cap, pcount)
00038
00039 struct vlc_probe_t
00040 {
00041 VLC_COMMON_MEMBERS
00042
00043 void *list;
00044 size_t count;
00045 };
00046
00047 typedef struct vlc_probe_t vlc_probe_t;
00048
00049 static inline int vlc_probe_add(vlc_probe_t *obj, const void *data,
00050 size_t len)
00051 {
00052 char *tab = (char *)realloc (obj->list, (obj->count + 1) * len);
00053
00054 if (unlikely(tab == NULL))
00055 return VLC_ENOMEM;
00056 memcpy(tab + (obj->count * len), data, len);
00057 obj->list = tab;
00058 obj->count++;
00059 return VLC_SUCCESS;
00060 }
00061
00062 # define VLC_PROBE_CONTINUE VLC_EGENERIC
00063 # define VLC_PROBE_STOP VLC_SUCCESS
00064
00065 # ifdef __cplusplus
00066 }
00067 # endif
00068
00069 #endif