gst_plugins_base/sys/v4l/gstv4lelement.h
changeset 0 0e761a78d257
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     1 /* GStreamer
       
     2  *
       
     3  * gstv4lelement.h: base class for V4L elements
       
     4  *
       
     5  * Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
       
     6  *
       
     7  * This library is free software; you can redistribute it and/or
       
     8  * modify it under the terms of the GNU Library General Public
       
     9  * License as published by the Free Software Foundation; either
       
    10  * version 2 of the License, or (at your option) any later version.
       
    11  *
       
    12  * This library is distributed in the hope that it will be useful,
       
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    15  * Library General Public License for more details.
       
    16  *
       
    17  * You should have received a copy of the GNU Library General Public
       
    18  * License along with this library; if not, write to the
       
    19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    20  * Boston, MA 02111-1307, USA.
       
    21  */
       
    22 
       
    23 #ifndef __GST_V4LELEMENT_H__
       
    24 #define __GST_V4LELEMENT_H__
       
    25 
       
    26 /* Because of some really cool feature in video4linux1, also known as
       
    27  * 'not including sys/types.h and sys/time.h', we had to include it
       
    28  * ourselves. In all their intelligence, these people decided to fix
       
    29  * this in the next version (video4linux2) in such a cool way that it
       
    30  * breaks all compilations of old stuff...
       
    31  * The real problem is actually that linux/time.h doesn't use proper
       
    32  * macro checks before defining types like struct timeval. The proper
       
    33  * fix here is to either fuck the kernel header (which is what we do
       
    34  * by defining _LINUX_TIME_H, an innocent little hack) or by fixing it
       
    35  * upstream, which I'll consider doing later on. If you get compiler
       
    36  * errors here, check your linux/time.h && sys/time.h header setup.
       
    37  */
       
    38 #include <sys/types.h>
       
    39 #define _LINUX_TIME_H
       
    40 #include <linux/videodev.h>
       
    41 
       
    42 #include <gst/gst.h>
       
    43 #include <gst/base/gstpushsrc.h>
       
    44 
       
    45 
       
    46 G_BEGIN_DECLS
       
    47 
       
    48 #define GST_TYPE_V4LELEMENT \
       
    49   (gst_v4lelement_get_type())
       
    50 #define GST_V4LELEMENT(obj) \
       
    51   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LELEMENT,GstV4lElement))
       
    52 #define GST_V4LELEMENT_CLASS(klass) \
       
    53   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LELEMENT,GstV4lElementClass))
       
    54 #define GST_IS_V4LELEMENT(obj) \
       
    55   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LELEMENT))
       
    56 #define GST_IS_V4LELEMENT_CLASS(klass) \
       
    57   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LELEMENT))
       
    58 #define GST_V4LELEMENT_GET_CLASS(klass) \
       
    59   (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_V4LELEMENT, GstV4lElementClass))
       
    60 
       
    61 typedef struct _GstV4lElement GstV4lElement;
       
    62 typedef struct _GstV4lElementClass GstV4lElementClass;
       
    63 typedef struct _GstV4lXv GstV4lXv;
       
    64 
       
    65 struct _GstV4lElement {
       
    66   GstPushSrc element;
       
    67 
       
    68   /* the video device */
       
    69   char *videodev;
       
    70 
       
    71   /* the video-device's file descriptor */
       
    72   gint video_fd;
       
    73 
       
    74   /* the video buffer (mmap()'ed) */
       
    75   guint8 *buffer;
       
    76 
       
    77   /* the video device's capabilities */
       
    78   struct video_capability vcap;
       
    79 
       
    80   /* the video device's window properties */
       
    81   struct video_window vwin;
       
    82 
       
    83   /* some more info about the current input's capabilities */
       
    84   struct video_channel vchan;
       
    85 
       
    86   /* lists... */
       
    87   GList *colors;
       
    88   GList *norms;
       
    89   GList *channels;
       
    90 
       
    91   /* X-overlay */
       
    92   GstV4lXv *xv;
       
    93   gulong xwindow_id;
       
    94 };
       
    95 
       
    96 struct _GstV4lElementClass {
       
    97   GstPushSrcClass parent_class;
       
    98 
       
    99   /* probed devices */
       
   100   GList *devices;
       
   101 
       
   102   /* actions */
       
   103   gboolean (*get_attribute)   (GstElement  *element,
       
   104                                const gchar *attr_name,
       
   105                                int         *value);
       
   106   gboolean (*set_attribute)   (GstElement  *element,
       
   107                                const gchar *attr_name,
       
   108                                const int    value);
       
   109 };
       
   110 
       
   111 GType gst_v4lelement_get_type(void);
       
   112 
       
   113 
       
   114 G_END_DECLS
       
   115 
       
   116 #endif /* __GST_V4LELEMENT_H__ */