2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
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.
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.
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.
21 #ifndef __GST_FLX_FMT__H__
22 #define __GST_FLX_FMT_H__
31 FLX_PREFIX_TYPE = 0xf100,
32 FLX_SCRIPT_CHUNK = 0xf1e0,
33 FLX_FRAME_TYPE = 0xf1fa,
34 FLX_SEGMENT_TABLE = 0xf1fb,
35 FLX_HUFFMAN_TABLE = 0xf1fc,
65 FLX_MAGICHDR_FLI = 0xaf11,
66 FLX_MAGICHDR_FLC = 0xaf12,
67 FLX_MAGICHDR_FLX = 0xaf44,
68 FLX_MAGICHDR_HUFFBWT = 0xaf30
71 typedef struct _FlxHeader
76 guint16 width,height,depth,flags;
80 guint32 created,creator,updated,updater;
81 guint16 aspect_dx, aspect_dy;
83 guint16 ext_flags,keyframes,totalframes;
85 guint16 max_regions,transp_num;
88 guint32 oframe1,oframe2;
91 #define FlxHeaderSize 128
93 typedef struct _FlxFrameChunk
98 #define FlxFrameChunkSize 6
100 typedef struct _FlxPrefixChunk
106 typedef struct _FlxSegmentTable
111 typedef struct _FlxHuffmanTable
118 typedef struct _FlxFrameType
124 #define FlxFrameTypeSize 10
126 #if G_BYTE_ORDER == G_BIG_ENDIAN
127 #define LE_TO_BE_16(i16) ((guint16) (((i16) << 8) | ((i16) >> 8)))
128 #define LE_TO_BE_32(i32) \
129 (((guint32) (LE_TO_BE_16((guint16) (i32))) << 16) | (LE_TO_BE_16((i32) >> 16)))
131 #define FLX_FRAME_TYPE_FIX_ENDIANNESS(frm_type_p) \
133 (frm_type_p)->chunks = LE_TO_BE_16((frm_type_p)->chunks); \
134 (frm_type_p)->delay = LE_TO_BE_16((frm_type_p)->delay); \
137 #define FLX_HUFFMAN_TABLE_FIX_ENDIANNESS(hffmn_table_p) \
139 (hffmn_table_p)->codelength = \
140 LE_TO_BE_16((hffmn_table_p)->codelength); \
141 (hffmn_table_p)->numcodes = LE_TO_BE_16((hffmn_table_p)->numcodes); \
144 #define FLX_SEGMENT_TABLE_FIX_ENDIANNESS(sgmnt_table_p) \
145 ((sgmnt_table_p)->segments = LE_TO_BE_16((sgmnt_table_p)->segments))
147 #define FLX_PREFIX_CHUNK_FIX_ENDIANNESS(prfx_chnk_p) \
149 (prfx_chnk_p)->chunks = LE_TO_BE_16((prfx_chnk_p)->chunks); \
152 #define FLX_FRAME_CHUNK_FIX_ENDIANNESS(frm_chnk_p) \
154 (frm_chnk_p)->size = LE_TO_BE_32((frm_chnk_p)->size); \
155 (frm_chnk_p)->id = LE_TO_BE_16((frm_chnk_p)->id); \
158 #define FLX_HDR_FIX_ENDIANNESS(hdr_p) \
160 (hdr_p)->size = LE_TO_BE_32((hdr_p)->size); \
161 (hdr_p)->type = LE_TO_BE_16((hdr_p)->type); \
162 (hdr_p)->frames = LE_TO_BE_16((hdr_p)->frames); \
163 (hdr_p)->width = LE_TO_BE_16((hdr_p)->width); \
164 (hdr_p)->height = LE_TO_BE_16((hdr_p)->height); \
165 (hdr_p)->depth = LE_TO_BE_16((hdr_p)->depth); \
166 (hdr_p)->flags = LE_TO_BE_16((hdr_p)->flags); \
167 (hdr_p)->speed = LE_TO_BE_32((hdr_p)->speed); \
168 (hdr_p)->reserved1 = LE_TO_BE_16((hdr_p)->reserved1); \
169 (hdr_p)->created = LE_TO_BE_32((hdr_p)->created); \
170 (hdr_p)->creator = LE_TO_BE_32((hdr_p)->creator); \
171 (hdr_p)->updated = LE_TO_BE_32((hdr_p)->updated); \
172 (hdr_p)->updater = LE_TO_BE_32((hdr_p)->updater); \
173 (hdr_p)->aspect_dx = LE_TO_BE_16((hdr_p)->aspect_dx); \
174 (hdr_p)->aspect_dy = LE_TO_BE_16((hdr_p)->aspect_dy); \
175 (hdr_p)->ext_flags = LE_TO_BE_16((hdr_p)->ext_flags); \
176 (hdr_p)->keyframes = LE_TO_BE_16((hdr_p)->keyframes); \
177 (hdr_p)->totalframes = LE_TO_BE_16((hdr_p)->totalframes); \
178 (hdr_p)->req_memory = LE_TO_BE_32((hdr_p)->req_memory); \
179 (hdr_p)->max_regions = LE_TO_BE_16((hdr_p)->max_regions); \
180 (hdr_p)->transp_num = LE_TO_BE_16((hdr_p)->transp_num); \
181 (hdr_p)->oframe1 = LE_TO_BE_32((hdr_p)->oframe1); \
182 (hdr_p)->oframe2 = LE_TO_BE_32((hdr_p)->oframe2); \
186 #define LE_TO_BE_16(i16) ((i16))
187 #define LE_TO_BE_32(i32) ((i32))
189 #define FLX_FRAME_TYPE_FIX_ENDIANNESS(frm_type_p)
190 #define FLX_HUFFMAN_TABLE_FIX_ENDIANNESS(hffmn_table_p)
191 #define FLX_SEGMENT_TABLE_FIX_ENDIANNESS(sgmnt_table_p)
192 #define FLX_PREFIX_CHUNK_FIX_ENDIANNESS(prfx_chnk_p)
193 #define FLX_FRAME_CHUNK_FIX_ENDIANNESS(frm_chnk_p)
194 #define FLX_HDR_FIX_ENDIANNESS(hdr_p)
196 #endif /* G_BYTE_ORDER == G_BIG_ENDIAN */
200 #endif /* __GST_FLX_FMT_H__ */