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.
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>
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
38 SWFDEC_VIDEO_FORMAT_RGBA
,
39 SWFDEC_VIDEO_FORMAT_I420
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
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 */
65 guint codec
; /* codec this decoder uses */
66 gboolean error
; /* if this codec is in an error state */
69 struct _SwfdecVideoDecoderClass
72 GObjectClass object_class
;
75 gboolean (* prepare
) (guint codec
,
77 SwfdecVideoDecoder
* (* create
) (guint codec
);
79 void (* set_codec_data
)
80 (SwfdecVideoDecoder
* decoder
,
81 SwfdecBuffer
* buffer
);
82 void (* decode
) (SwfdecVideoDecoder
* decoder
,
83 SwfdecBuffer
* buffer
);
86 SwfdecVideoFormat
swfdec_video_codec_get_format (guint codec
);
88 GType
swfdec_video_decoder_get_type (void);
90 void swfdec_video_decoder_register (GType type
);
92 gboolean
swfdec_video_decoder_prepare (guint codec
,
95 SwfdecVideoDecoder
* swfdec_video_decoder_new (guint codec
);
97 void swfdec_video_decoder_set_codec_data
98 (SwfdecVideoDecoder
* decoder
,
99 SwfdecBuffer
* buffer
);
100 void swfdec_video_decoder_decode (SwfdecVideoDecoder
* decoder
,
101 SwfdecBuffer
* buffer
);
102 guint
swfdec_video_decoder_get_codec (SwfdecVideoDecoder
* decoder
);
103 guint
swfdec_video_decoder_get_width (SwfdecVideoDecoder
* decoder
);
104 guint
swfdec_video_decoder_get_height (SwfdecVideoDecoder
* decoder
);
105 cairo_surface_t
* swfdec_video_decoder_get_image (SwfdecVideoDecoder
* decoder
,
106 SwfdecRenderer
* renderer
);
107 gboolean
swfdec_video_decoder_get_error (SwfdecVideoDecoder
* decoder
);
110 void swfdec_video_decoder_error (SwfdecVideoDecoder
* decoder
,
112 ...) G_GNUC_PRINTF (2, 3);
113 void swfdec_video_decoder_errorv (SwfdecVideoDecoder
* decoder
,