gst-indent
[platform/upstream/gst-plugins-good.git] / ext / gdk_pixbuf / gstgdkanimation.h
1 /*
2  * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __GST_LOADER_H__
21 #define __GST_LOADER_H__
22
23 #include <gst/gst.h>
24 #include <gdk-pixbuf/gdk-pixbuf.h>
25 #include <gdk-pixbuf/gdk-pixbuf-animation.h>
26 #include <gdk-pixbuf/gdk-pixbuf-io.h>
27 #include <stdio.h>
28
29 G_BEGIN_DECLS
30 /* how many bytes we need to have available before we dare to start a new iteration */
31 #define GST_GDK_BUFFER_SIZE (102400)
32 /* how far behind we need to be before we attempt to seek */
33 #define GST_GDK_MAX_DELAY_TO_SEEK (GST_SECOND / 4)
34 #define GST_TYPE_GDK_ANIMATION                  (gst_gdk_animation_get_type())
35 #define GST_GDK_ANIMATION(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GDK_ANIMATION,GstGdkAnimation))
36 #define GST_GDK_ANIMATION_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GDK_ANIMATION,GstGdkAnimation))
37 #define GST_IS_GDK_ANIMATION(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GDK_ANIMATION))
38 #define GST_IS_GDK_ANIMATION_CLASS(obj)         (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GDK_ANIMATION))
39 typedef struct _GstGdkAnimation GstGdkAnimation;
40 typedef struct _GstGdkAnimationClass GstGdkAnimationClass;
41
42 typedef struct _GstGdkAnimationIter GstGdkAnimationIter;
43 typedef struct _GstGdkAnimationIterClass GstGdkAnimationIterClass;
44
45 struct _GstGdkAnimation
46 {
47   GdkPixbufAnimation parent;
48
49   /* name of temporary buffer file */
50   gchar *temp_location;
51   /* file descriptor to temporary file or 0 if we're done writing */
52   int temp_fd;
53
54   /* size of image */
55   gint width;
56   gint height;
57   gint bpp;
58   /* static image we use */
59   GdkPixbuf *pixbuf;
60 };
61
62 struct _GstGdkAnimationClass
63 {
64   GdkPixbufAnimationClass parent_class;
65 };
66
67 GType gst_gdk_animation_get_type (void);
68
69 GstGdkAnimation *gst_gdk_animation_new (GError ** error);
70
71 gboolean gst_gdk_animation_add_data (GstGdkAnimation * ani,
72     const guint8 * data, guint size);
73 void gst_gdk_animation_done_adding (GstGdkAnimation * ani);
74
75
76 #define GST_TYPE_GDK_ANIMATION_ITER             (gst_gdk_animation_iter_get_type ())
77 #define GST_GDK_ANIMATION_ITER(object)          (G_TYPE_CHECK_INSTANCE_CAST ((object), GST_TYPE_GDK_ANIMATION_ITER, GstGdkAnimationIter))
78 #define GST_IS_GDK_ANIMATION_ITER(object)       (G_TYPE_CHECK_INSTANCE_TYPE ((object), GST_TYPE_GDK_ANIMATION_ITER))
79
80 #define GST_GDK_ANIMATION_ITER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GDK_ANIMATION_ITER, GstGdkAnimationIterClass))
81 #define GST_IS_GDK_ANIMATION_ITER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GDK_ANIMATION_ITER))
82 #define GST_GDK_ANIMATION_ITER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GDK_ANIMATION_ITER, GstGdkAnimationIterClass))
83
84 struct _GstGdkAnimationIter
85 {
86   GdkPixbufAnimationIter parent;
87
88   /* our animation */
89   GstGdkAnimation *ani;
90   /* start timeval */
91   GTimeVal start;
92   /* timestamp of last buffer */
93   GstClockTime last_timestamp;
94
95   /* pipeline we're using */
96   GstElement *pipeline;
97   gboolean eos;
98   gboolean just_seeked;
99
100   /* current image and the buffers containing the data */
101   GdkPixbuf *pixbuf;
102   GQueue *buffers;
103 };
104
105 struct _GstGdkAnimationIterClass
106 {
107   GdkPixbufAnimationIterClass parent_class;
108 };
109
110 GType
111 gst_gdk_animation_iter_get_type (void)
112     G_GNUC_CONST;
113
114 G_END_DECLS
115 #endif /* __GST_GDK_ANIMATION_H__ */