• Main Page
  • Related Pages
  • Data Structures
  • Files
  • File List
  • Globals

grabber_common.h

Go to the documentation of this file.
00001 /*
00002  * GeeXboX Valhalla: tiny media scanner API.
00003  * Copyright (C) 2009 Mathieu Schroeter <mathieu.schroeter@gamesover.ch>
00004  *
00005  * This file is part of libvalhalla.
00006  *
00007  * libvalhalla is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * libvalhalla is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with libvalhalla; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #ifndef VALHALLA_GRABBER_COMMON_H
00023 #define VALHALLA_GRABBER_COMMON_H
00024 
00062 #include <time.h>
00063 
00064 #include "utils.h"
00065 
00069 #define GRABBER_CAP_AUDIO  (1 << 0) 
00070 #define GRABBER_CAP_VIDEO  (1 << 1) 
00071 #define GRABBER_CAP_IMAGE  (1 << 2) 
00079 typedef struct grabber_list_s {
00080   struct grabber_list_s *next;
00081 
00083   const char *name;
00085   int caps_flag;
00086 
00096   int (*init) (void *priv);
00097 
00107   void (*uninit) (void *priv);
00108 
00134   int (*grab) (void *priv, file_data_t *data);
00135 
00145   void (*loop) (void *priv);
00146 
00152   void *priv;
00153 
00155   int enable;
00157   unsigned int stat_success;
00159   unsigned int stat_failure;
00161   struct timespec stat_difftime;
00162 } grabber_list_t;
00163 
00164 
00179 #define GRABBER_REGISTER(p_name, p_caps,                                      \
00180                          fct_priv, fct_init, fct_uninit, fct_grab, fct_loop)  \
00181   grabber_list_t *                                                            \
00182   vh_grabber_##p_name##_register (void)                                       \
00183   {                                                                           \
00184     grabber_list_t *grabber;                                                  \
00185                                                                               \
00186     valhalla_log (VALHALLA_MSG_VERBOSE, __FUNCTION__);                        \
00187                                                                               \
00188     grabber = calloc (1, sizeof (grabber_list_t));                            \
00189     if (!grabber)                                                             \
00190       return NULL;                                                            \
00191                                                                               \
00192     grabber->name      = #p_name;                                             \
00193     grabber->caps_flag = p_caps;                                              \
00194     grabber->enable    = 1;                                                   \
00195     grabber->priv      = fct_priv ();                                         \
00196                                                                               \
00197     grabber->init      = fct_init;                                            \
00198     grabber->uninit    = fct_uninit;                                          \
00199     grabber->grab      = fct_grab;                                            \
00200     grabber->loop      = fct_loop;                                            \
00201                                                                               \
00202     return grabber;                                                           \
00203   }
00204 
00205 #endif /* VALHALLA_GRABBER_COMMON_H */

Generated on Sat Sep 4 2010 09:33:20 for libvalhalla by  doxygen 1.7.1