gst_plugins_base/sys/v4l/gstv4lmjpegsrc.h
branchRCL_3
changeset 29 567bb019e3e3
parent 6 9b2c3c7a1a9c
child 30 7e817e7e631c
equal deleted inserted replaced
6:9b2c3c7a1a9c 29:567bb019e3e3
     1 /* GStreamer
       
     2  *
       
     3  * gstv4lmjpegsrc.h: hardware MJPEG video source element
       
     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_V4LMJPEGSRC_H__
       
    24 #define __GST_V4LMJPEGSRC_H__
       
    25 
       
    26 #include <gstv4lelement.h>
       
    27 #include <sys/time.h>
       
    28 #include <videodev_mjpeg.h>
       
    29 
       
    30 G_BEGIN_DECLS
       
    31 
       
    32 #define GST_TYPE_V4LMJPEGSRC \
       
    33   (gst_v4lmjpegsrc_get_type())
       
    34 #define GST_V4LMJPEGSRC(obj) \
       
    35   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LMJPEGSRC,GstV4lMjpegSrc))
       
    36 #define GST_V4LMJPEGSRC_CLASS(klass) \
       
    37   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LMJPEGSRC,GstV4lMjpegSrcClass))
       
    38 #define GST_IS_V4LMJPEGSRC(obj) \
       
    39   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LMJPEGSRC))
       
    40 #define GST_IS_V4LMJPEGSRC_CLASS(klass) \
       
    41   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LMJPEGSRC))
       
    42 
       
    43 typedef struct _GstV4lMjpegSrc GstV4lMjpegSrc;
       
    44 typedef struct _GstV4lMjpegSrcClass GstV4lMjpegSrcClass;
       
    45 
       
    46 struct _GstV4lMjpegSrc {
       
    47   GstV4lElement v4lelement;
       
    48 
       
    49   /* pads */
       
    50   GstPad *srcpad;
       
    51 
       
    52   /* buffer/capture info */
       
    53   struct mjpeg_sync bsync;
       
    54   struct mjpeg_requestbuffers breq;
       
    55 
       
    56   /* num of queued frames and some GThread stuff
       
    57    * to wait if there's not enough */
       
    58   gint8 *frame_queue_state;
       
    59   GMutex *mutex_queue_state;
       
    60   GCond *cond_queue_state;
       
    61   gint num_queued;
       
    62   gint queue_frame;
       
    63 
       
    64   /* True if we want to stop */
       
    65   gboolean quit, is_capturing;
       
    66 
       
    67   /* A/V sync... frame counter and internal cache */
       
    68   gulong handled;
       
    69   gint last_frame;
       
    70   gint last_size;
       
    71   gint need_writes;
       
    72   gulong last_seq;
       
    73 
       
    74   /* clock */
       
    75   GstClock *clock;
       
    76 
       
    77   /* time to substract from clock time to get back to timestamp */
       
    78   GstClockTime substract_time;
       
    79 
       
    80   /* how often are we going to use each frame? */
       
    81   gint *use_num_times;
       
    82 
       
    83   /* how are we going to push buffers? */
       
    84   gboolean use_fixed_fps;
       
    85 
       
    86   /* end size */
       
    87   gint end_width, end_height;
       
    88 
       
    89   /* caching values */
       
    90 #if 0
       
    91   gint x_offset;
       
    92   gint y_offset;
       
    93   gint frame_width;
       
    94   gint frame_height;
       
    95 #endif
       
    96 
       
    97   gint quality;
       
    98   gint numbufs;
       
    99 };
       
   100 
       
   101 struct _GstV4lMjpegSrcClass {
       
   102   GstV4lElementClass parent_class;
       
   103 
       
   104   void (*frame_capture) (GObject *object);
       
   105   void (*frame_drop)    (GObject *object);
       
   106   void (*frame_insert)  (GObject *object);
       
   107   void (*frame_lost)    (GObject *object,
       
   108                          gint     num_lost);
       
   109 };
       
   110 
       
   111 GType gst_v4lmjpegsrc_get_type(void);
       
   112 
       
   113 
       
   114 G_END_DECLS
       
   115 
       
   116 #endif /* __GST_V4LMJPEGSRC_H__ */