2 * Copyright (C) 2007 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_CODEC_VIDEO_H_
21 #define _SWFDEC_CODEC_VIDEO_H_
25 #include <libswfdec/swfdec_buffer.h>
27 #define SWFDEC_VIDEO_CODEC_UNDEFINED 0
28 #define SWFDEC_VIDEO_CODEC_H263 2
29 #define SWFDEC_VIDEO_CODEC_SCREEN 3
30 #define SWFDEC_VIDEO_CODEC_VP6 4
31 #define SWFDEC_VIDEO_CODEC_VP6_ALPHA 5
32 #define SWFDEC_VIDEO_CODEC_SCREEN2 6
35 SWFDEC_VIDEO_FORMAT_RGBA
,
36 SWFDEC_VIDEO_FORMAT_I420
40 guint width
; /* width of image in pixels */
41 guint height
; /* height of image in pixels */
42 const guint8
* plane
[3]; /* planes of the image, not all might be used */
43 const guint8
* mask
; /* A8 mask or NULL if none */
44 guint rowstride
[3]; /* rowstrides of the planes */
45 guint mask_rowstride
; /* rowstride of mask plane */
48 typedef struct _SwfdecVideoDecoder SwfdecVideoDecoder
;
49 typedef SwfdecVideoDecoder
* (SwfdecVideoDecoderNewFunc
) (guint format
);
51 /* notes about the decode function:
52 * - the data must be in the format specified by swfdec_video_codec_get_format()
53 * - the data returned in the image belongs to the decoder and must be valid
54 * until the next function is called on the decoder.
55 * - you need to explicitly set mask to %NULL.
57 struct _SwfdecVideoDecoder
{
59 gboolean (* decode
) (SwfdecVideoDecoder
* decoder
,
60 SwfdecBuffer
* buffer
,
61 SwfdecVideoImage
* result
);
62 void (* free
) (SwfdecVideoDecoder
* decoder
);
65 SwfdecVideoFormat
swfdec_video_codec_get_format (guint codec
);
67 SwfdecVideoDecoder
* swfdec_video_decoder_new (guint codec
);
68 void swfdec_video_decoder_free (SwfdecVideoDecoder
* decoder
);
70 cairo_surface_t
* swfdec_video_decoder_decode (SwfdecVideoDecoder
* decoder
,
71 SwfdecBuffer
* buffer
);