Data Structures | Defines

grabber_common.h File Reference

#include <time.h>
#include "utils.h"

Go to the source code of this file.

Data Structures

struct  grabber_list_t
 Structure for a grabber. More...

Defines

#define GRABBER_REGISTER(p_name, p_caps,fct_priv, fct_init, fct_uninit, fct_grab, fct_loop)
 Macro to register and populate a grabber structure.
Flags for the capabilities of the grabbers.

#define GRABBER_CAP_AUDIO   (1 << 0)
 grab for audio files
#define GRABBER_CAP_VIDEO   (1 << 1)
 grab for video files
#define GRABBER_CAP_IMAGE   (1 << 2)
 grab for image files

Detailed Description

GeeXboX Valhalla Grabber private API header.

To add a new grabber, a good approach is to copy an existing grabber like grabber_dummy.[ch] in order to have at least the structure. A grabber must not use global/static variables. A grabber must be thread-safe in the case where more than one instance of Valhalla are running concurrently. But, the functions in one grabber are not called in concurrency in one instance of Valhalla.

Some others points to consider:

Some utils are available for the grabbers:

Main header for all grabbers:

See also:
grabber_list_t for details on the functions.

Definition in file grabber_common.h.


Define Documentation

#define GRABBER_CAP_AUDIO   (1 << 0)

grab for audio files

Definition at line 69 of file grabber_common.h.

#define GRABBER_CAP_IMAGE   (1 << 2)

grab for image files

Definition at line 71 of file grabber_common.h.

#define GRABBER_CAP_VIDEO   (1 << 1)

grab for video files

Definition at line 70 of file grabber_common.h.

#define GRABBER_REGISTER (   p_name,
  p_caps,
  fct_priv,
  fct_init,
  fct_uninit,
  fct_grab,
  fct_loop 
)
Value:
grabber_list_t *                                                            \
  vh_grabber_##p_name##_register (void)                                       \
  {                                                                           \
    grabber_list_t *grabber;                                                  \
                                                                              \
    valhalla_log (VALHALLA_MSG_VERBOSE, __FUNCTION__);                        \
                                                                              \
    grabber = calloc (1, sizeof (grabber_list_t));                            \
    if (!grabber)                                                             \
      return NULL;                                                            \
                                                                              \
    grabber->name      = #p_name;                                             \
    grabber->caps_flag = p_caps;                                              \
    grabber->enable    = 1;                                                   \
    grabber->priv      = fct_priv ();                                         \
                                                                              \
    grabber->init      = fct_init;                                            \
    grabber->uninit    = fct_uninit;                                          \
    grabber->grab      = fct_grab;                                            \
    grabber->loop      = fct_loop;                                            \
                                                                              \
    return grabber;                                                           \
  }

Macro to register and populate a grabber structure.

See struct grabber_list_s for more informations on the structure and the functions.

Parameters:
[in] p_name Grabber's name.
[in] p_caps Capabilities flags.
[in] fct_priv Function to retrieve the private data pointer.
[in] fct_init grabber_list_t::init().
[in] fct_uninit grabber_list_t::uninit().
[in] fct_grab grabber_list_t::grab().
[in] fct_loop grabber_list_t::loop().

Definition at line 180 of file grabber_common.h.