2003-11-05 03:24:54 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2003-11-05 03:24:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_LOADER_H__
|
|
|
|
#define __GST_LOADER_H__
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
|
|
#include <gdk-pixbuf/gdk-pixbuf-animation.h>
|
|
|
|
#include <gdk-pixbuf/gdk-pixbuf-io.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
2004-03-15 16:32:54 +00:00
|
|
|
|
2003-11-05 03:24:54 +00:00
|
|
|
/* how many bytes we need to have available before we dare to start a new iteration */
|
2003-11-24 22:18:07 +00:00
|
|
|
#define GST_GDK_BUFFER_SIZE (102400)
|
|
|
|
/* how far behind we need to be before we attempt to seek */
|
|
|
|
#define GST_GDK_MAX_DELAY_TO_SEEK (GST_SECOND / 4)
|
2004-03-15 16:32:54 +00:00
|
|
|
|
|
|
|
|
2005-12-06 19:44:58 +00:00
|
|
|
#define GST_TYPE_GDK_ANIMATION (gst_gdk_animation_get_type())
|
|
|
|
#define GST_GDK_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GDK_ANIMATION,GstGdkAnimation))
|
2006-06-01 21:07:26 +00:00
|
|
|
#define GST_GDK_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GDK_ANIMATION,GstGdkAnimationClass))
|
2005-12-06 19:44:58 +00:00
|
|
|
#define GST_IS_GDK_ANIMATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GDK_ANIMATION))
|
2006-06-01 21:07:26 +00:00
|
|
|
#define GST_IS_GDK_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GDK_ANIMATION))
|
2004-03-15 16:32:54 +00:00
|
|
|
|
|
|
|
typedef struct _GstGdkAnimation GstGdkAnimation;
|
2003-11-05 03:24:54 +00:00
|
|
|
typedef struct _GstGdkAnimationClass GstGdkAnimationClass;
|
|
|
|
|
|
|
|
typedef struct _GstGdkAnimationIter GstGdkAnimationIter;
|
|
|
|
typedef struct _GstGdkAnimationIterClass GstGdkAnimationIterClass;
|
|
|
|
|
|
|
|
struct _GstGdkAnimation
|
|
|
|
{
|
2005-12-06 19:44:58 +00:00
|
|
|
GdkPixbufAnimation parent;
|
2003-11-05 03:24:54 +00:00
|
|
|
|
|
|
|
/* name of temporary buffer file */
|
2005-12-06 19:44:58 +00:00
|
|
|
gchar * temp_location;
|
2003-11-05 03:24:54 +00:00
|
|
|
/* file descriptor to temporary file or 0 if we're done writing */
|
2005-12-06 19:44:58 +00:00
|
|
|
int temp_fd;
|
2003-11-05 03:24:54 +00:00
|
|
|
|
|
|
|
/* size of image */
|
2005-12-06 19:44:58 +00:00
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
gint bpp;
|
2003-11-11 22:43:24 +00:00
|
|
|
/* static image we use */
|
2005-12-06 19:44:58 +00:00
|
|
|
GdkPixbuf * pixbuf;
|
2003-11-05 03:24:54 +00:00
|
|
|
};
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
struct _GstGdkAnimationClass
|
2003-11-05 03:24:54 +00:00
|
|
|
{
|
2005-12-06 19:44:58 +00:00
|
|
|
GdkPixbufAnimationClass parent_class;
|
2003-11-05 03:24:54 +00:00
|
|
|
};
|
|
|
|
|
2005-12-06 19:44:58 +00:00
|
|
|
GType gst_gdk_animation_get_type (void);
|
2003-11-11 22:43:24 +00:00
|
|
|
|
2005-12-06 19:44:58 +00:00
|
|
|
GstGdkAnimation * gst_gdk_animation_new (GError **error);
|
2003-11-05 03:24:54 +00:00
|
|
|
|
2005-12-06 19:44:58 +00:00
|
|
|
gboolean gst_gdk_animation_add_data (GstGdkAnimation * ani,
|
|
|
|
const guint8 * data,
|
|
|
|
guint size);
|
|
|
|
void gst_gdk_animation_done_adding (GstGdkAnimation * ani);
|
2003-11-05 03:24:54 +00:00
|
|
|
|
|
|
|
|
2005-12-06 19:44:58 +00:00
|
|
|
#define GST_TYPE_GDK_ANIMATION_ITER (gst_gdk_animation_iter_get_type ())
|
|
|
|
#define GST_GDK_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GST_TYPE_GDK_ANIMATION_ITER, GstGdkAnimationIter))
|
|
|
|
#define GST_IS_GDK_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GST_TYPE_GDK_ANIMATION_ITER))
|
2003-11-05 03:24:54 +00:00
|
|
|
|
2005-12-06 19:44:58 +00:00
|
|
|
#define GST_GDK_ANIMATION_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GDK_ANIMATION_ITER, GstGdkAnimationIterClass))
|
|
|
|
#define GST_IS_GDK_ANIMATION_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GDK_ANIMATION_ITER))
|
|
|
|
#define GST_GDK_ANIMATION_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GDK_ANIMATION_ITER, GstGdkAnimationIterClass))
|
2003-11-05 03:24:54 +00:00
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
struct _GstGdkAnimationIter {
|
2005-12-06 19:44:58 +00:00
|
|
|
GdkPixbufAnimationIter parent;
|
2004-03-15 16:32:54 +00:00
|
|
|
|
2003-11-05 03:24:54 +00:00
|
|
|
/* our animation */
|
2005-12-06 19:44:58 +00:00
|
|
|
GstGdkAnimation * ani;
|
2003-11-05 03:24:54 +00:00
|
|
|
/* start timeval */
|
2005-12-06 19:44:58 +00:00
|
|
|
GTimeVal start;
|
2003-11-05 03:24:54 +00:00
|
|
|
/* timestamp of last buffer */
|
2005-12-06 19:44:58 +00:00
|
|
|
GstClockTime last_timestamp;
|
2004-03-15 16:32:54 +00:00
|
|
|
|
2003-11-05 03:24:54 +00:00
|
|
|
/* pipeline we're using */
|
2005-12-06 19:44:58 +00:00
|
|
|
GstElement * pipeline;
|
|
|
|
gboolean eos;
|
|
|
|
gboolean just_seeked;
|
2004-03-15 16:32:54 +00:00
|
|
|
|
2003-11-05 03:24:54 +00:00
|
|
|
/* current image and the buffers containing the data */
|
2005-12-06 19:44:58 +00:00
|
|
|
GdkPixbuf * pixbuf;
|
|
|
|
GQueue * buffers;
|
2003-11-05 03:24:54 +00:00
|
|
|
};
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
struct _GstGdkAnimationIterClass {
|
2005-12-06 19:44:58 +00:00
|
|
|
GdkPixbufAnimationIterClass parent_class;
|
2003-11-05 03:24:54 +00:00
|
|
|
};
|
|
|
|
|
2004-03-15 16:32:54 +00:00
|
|
|
GType gst_gdk_animation_iter_get_type (void) G_GNUC_CONST;
|
2003-11-05 03:24:54 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
2004-03-15 16:32:54 +00:00
|
|
|
|
2003-11-05 03:24:54 +00:00
|
|
|
#endif /* __GST_GDK_ANIMATION_H__ */
|