Imported Upstream version 0.10.36
[profile/ivi/gst-plugins-base.git] / sys / v4l / gstv4lmjpegsink.h
1 /* GStreamer
2  *
3  * gstv4lmjpegsink.h: hardware MJPEG video sink 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_V4LMJPEGSINK_H__
24 #define __GST_V4LMJPEGSINK_H__
25
26 #include <gstv4lelement.h>
27 #include <sys/time.h>
28 #include <videodev_mjpeg.h>
29
30
31 G_BEGIN_DECLS
32
33
34 #define GST_TYPE_V4LMJPEGSINK \
35   (gst_v4lmjpegsink_get_type())
36 #define GST_V4LMJPEGSINK(obj) \
37   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4LMJPEGSINK,GstV4lMjpegSink))
38 #define GST_V4LMJPEGSINK_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4LMJPEGSINK,GstV4lMjpegSinkClass))
40 #define GST_IS_V4LMJPEGSINK(obj) \
41   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4LMJPEGSINK))
42 #define GST_IS_V4LMJPEGSINK_CLASS(klass) \
43   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4LMJPEGSINK))
44
45 typedef struct _GstV4lMjpegSink GstV4lMjpegSink;
46 typedef struct _GstV4lMjpegSinkClass GstV4lMjpegSinkClass;
47
48 struct _GstV4lMjpegSink {
49   GstV4lElement v4lelement;
50
51   /* the sink pas */
52   GstPad *sinkpad;
53
54   /* frame properties for common players */
55   gint frames_displayed;
56   guint64 frame_time;
57
58   /* system clock object */
59   GstClock *clock;
60
61   /* buffer/capture info */
62   struct mjpeg_sync bsync;
63   struct mjpeg_requestbuffers breq;
64
65   /* thread to keep track of synced frames */
66   gint8 *isqueued_queued_frames; /* 1 = queued, 0 = unqueued, -1 = error */
67   GThread *thread_queued_frames;
68   GMutex *mutex_queued_frames;
69   GCond **cond_queued_frames;
70   gint current_frame;
71
72   /* width/height/norm of the jpeg stream */
73   gint width;
74   gint height;
75   gint norm;
76
77   /* cache values */
78   gint x_offset;
79   gint y_offset;
80
81   gint numbufs;
82   gint bufsize; /* in KB */
83 };
84
85 struct _GstV4lMjpegSinkClass {
86   GstV4lElementClass parent_class;
87
88   /* signals */
89   void (*frame_displayed) (GstElement *element);
90 };
91
92 GType gst_v4lmjpegsink_get_type(void);
93
94
95 G_END_DECLS
96
97 #endif /* __GST_SDLVIDEOSINK_H__ */