make swfdec_as_object_mark() only mark if not marked yet
[swfdec.git] / swfdec / swfdec_video_decoder.h
blob091c42c6a8b82c8f946211c05bcc422ce42cf220
1 /* Swfdec
2 * Copyright (C) 2006-2008 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifndef _SWFDEC_VIDEO_DECODER_H_
21 #define _SWFDEC_VIDEO_DECODER_H_
23 #include <swfdec/swfdec_buffer.h>
24 #include <swfdec/swfdec_renderer.h>
26 G_BEGIN_DECLS
29 #define SWFDEC_VIDEO_CODEC_UNDEFINED 0
30 #define SWFDEC_VIDEO_CODEC_H263 2
31 #define SWFDEC_VIDEO_CODEC_SCREEN 3
32 #define SWFDEC_VIDEO_CODEC_VP6 4
33 #define SWFDEC_VIDEO_CODEC_VP6_ALPHA 5
34 #define SWFDEC_VIDEO_CODEC_SCREEN2 6
35 #define SWFDEC_VIDEO_CODEC_H264 7
37 typedef enum {
38 SWFDEC_VIDEO_FORMAT_RGBA,
39 SWFDEC_VIDEO_FORMAT_I420
40 } SwfdecVideoFormat;
43 typedef struct _SwfdecVideoDecoder SwfdecVideoDecoder;
44 typedef struct _SwfdecVideoDecoderClass SwfdecVideoDecoderClass;
46 #define SWFDEC_TYPE_VIDEO_DECODER (swfdec_video_decoder_get_type())
47 #define SWFDEC_IS_VIDEO_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_VIDEO_DECODER))
48 #define SWFDEC_IS_VIDEO_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_VIDEO_DECODER))
49 #define SWFDEC_VIDEO_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_VIDEO_DECODER, SwfdecVideoDecoder))
50 #define SWFDEC_VIDEO_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_VIDEO_DECODER, SwfdecVideoDecoderClass))
51 #define SWFDEC_VIDEO_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_VIDEO_DECODER, SwfdecVideoDecoderClass))
53 struct _SwfdecVideoDecoder
55 GObject object;
57 /*< protected >*/
58 guint width; /* width of the current image */
59 guint height; /* height of the current image */
60 guint8 * plane[3]; /* planes of the image, not all might be used */
61 guint rowstride[3]; /* rowstrides of the planes */
62 guint8 * mask; /* A8 mask or NULL if none */
63 guint mask_rowstride; /* rowstride of mask plane */
64 /*< private >*/
65 guint codec; /* codec this decoder uses */
66 gboolean error; /* if this codec is in an error state */
69 struct _SwfdecVideoDecoderClass
71 /*< private >*/
72 GObjectClass object_class;
74 /*< public >*/
75 gboolean (* prepare) (guint codec,
76 char ** missing);
77 SwfdecVideoDecoder * (* create) (guint codec,
78 SwfdecBuffer * data);
80 void (* decode) (SwfdecVideoDecoder * decoder,
81 SwfdecBuffer * buffer);
84 SwfdecVideoFormat swfdec_video_codec_get_format (guint codec);
86 GType swfdec_video_decoder_get_type (void);
88 void swfdec_video_decoder_register (GType type);
90 gboolean swfdec_video_decoder_prepare (guint codec,
91 char ** missing);
93 SwfdecVideoDecoder * swfdec_video_decoder_new (guint codec,
94 SwfdecBuffer * buffer);
96 void swfdec_video_decoder_decode (SwfdecVideoDecoder * decoder,
97 SwfdecBuffer * buffer);
98 guint swfdec_video_decoder_get_codec (SwfdecVideoDecoder * decoder);
99 guint swfdec_video_decoder_get_width (SwfdecVideoDecoder * decoder);
100 guint swfdec_video_decoder_get_height (SwfdecVideoDecoder * decoder);
101 cairo_surface_t * swfdec_video_decoder_get_image (SwfdecVideoDecoder * decoder,
102 SwfdecRenderer * renderer);
103 gboolean swfdec_video_decoder_get_error (SwfdecVideoDecoder * decoder);
105 /* for subclasses */
106 void swfdec_video_decoder_error (SwfdecVideoDecoder * decoder,
107 const char * error,
108 ...) G_GNUC_PRINTF (2, 3);
109 void swfdec_video_decoder_errorv (SwfdecVideoDecoder * decoder,
110 const char * error,
111 va_list args);
115 G_END_DECLS
116 #endif