22 #ifndef VALHALLA_GRABBER_COMMON_H
23 #define VALHALLA_GRABBER_COMMON_H
71 #define GRABBER_CAP_AUDIO (1 << 0)
72 #define GRABBER_CAP_VIDEO (1 << 1)
73 #define GRABBER_CAP_IMAGE (1 << 2)
81 typedef struct grabber_param_s {
91 typedef struct grabber_list_s {
92 struct grabber_list_s *next;
120 void (*uninit) (
void *priv);
147 int (*grab) (
void *priv, file_data_t *data);
158 void (*loop) (
void *priv);
179 pthread_mutex_t mutex;
184 vh_stats_cnt_t *cnt_success;
186 vh_stats_cnt_t *cnt_failure;
188 vh_stats_cnt_t *cnt_skip;
209 #define GRABBER_REGISTER(p_name, p_caps, p_pl, p_tw, \
210 fct_priv, fct_init, fct_uninit, fct_grab, fct_loop) \
212 vh_grabber_##p_name##_register (struct url_ctl_s *url_ctl) \
214 grabber_list_t *grabber; \
216 vh_log (VALHALLA_MSG_VERBOSE, __FUNCTION__); \
218 grabber = calloc (1, sizeof (grabber_list_t)); \
222 grabber->name = #p_name; \
223 grabber->caps_flag = p_caps; \
224 grabber->enable = 1; \
225 grabber->timewait = p_tw * 1000000UL; \
226 grabber->priv = fct_priv (); \
228 grabber->init = fct_init; \
229 grabber->uninit = fct_uninit; \
230 grabber->grab = fct_grab; \
231 grabber->loop = fct_loop; \
233 grabber->param.url_ctl = url_ctl; \
234 grabber->param.pl = malloc (sizeof (p_pl)); \
235 if (!grabber->param.pl) \
240 memcpy (grabber->param.pl, p_pl, sizeof (p_pl)); \
242 pthread_mutex_init (&grabber->mutex, NULL); \