• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  *
3  * jpegparse: a parser for JPEG streams
4  *
5  * Copyright (C) <2009> Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 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  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef __GST_JPEG_PARSE_H__
24 #define __GST_JPEG_PARSE_H__
25 
26 #include <gst/gst.h>
27 #include <gst/base/gstadapter.h>
28 #include <gst/base/gstbaseparse.h>
29 
30 #include "gstjpegformat.h"
31 
32 G_BEGIN_DECLS
33 
34 #define GST_TYPE_JPEG_PARSE \
35   (gst_jpeg_parse_get_type())
36 #define GST_JPEG_PARSE(obj) \
37   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JPEG_PARSE,GstJpegParse))
38 #define GST_JPEG_PARSE_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JPEG_PARSE,GstJpegParseClass))
40 #define GST_IS_JPEG_PARSE(obj) \
41   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JPEG_PARSE))
42 #define GST_IS_JPEG_PARSE_CLASS(klass) \
43   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JPEG_PARSE))
44 #define GST_JPEG_PARSE_CAST(obj) ((GstJpegParse *)obj)
45 
46 typedef struct _GstJpegParse           GstJpegParse;
47 typedef struct _GstJpegParseClass      GstJpegParseClass;
48 
49 struct _GstJpegParse {
50   GstBaseParse parse;
51 
52   guint last_offset;
53   guint last_entropy_len;
54   gboolean last_resync;
55 
56   /* negotiated state */
57   gint caps_width, caps_height;
58   gint caps_framerate_numerator;
59   gint caps_framerate_denominator;
60 
61   /* the parsed frame size */
62   guint16 width, height;
63 
64   /* format color space */
65   const gchar *format;
66 
67   /* TRUE if the src caps sets a specific framerate */
68   gboolean has_fps;
69 
70   /* the (expected) timestamp of the next frame */
71   guint64 next_ts;
72 
73   /* duration of the current frame */
74   guint64 duration;
75 
76   /* video state */
77   gint framerate_numerator;
78   gint framerate_denominator;
79 
80   /* tags */
81   GstTagList *tags;
82 };
83 
84 struct _GstJpegParseClass {
85   GstBaseParseClass  parent_class;
86 };
87 
88 GType gst_jpeg_parse_get_type (void);
89 
90 GST_ELEMENT_REGISTER_DECLARE (jpegparse);
91 
92 G_END_DECLS
93 
94 #endif /* __GST_JPEG_PARSE_H__ */
95