Browse code

CD+G demuxer and decoder

Patch by Michael Tison (gmail address: blackspike@....)

Originally committed as revision 20890 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Tison authored on 2009/12/18 02:25:31
Showing 10 changed files
... ...
@@ -44,6 +44,7 @@ version <next>:
44 44
 - MPEG-4 Audio Lossless Coding (ALS) decoder
45 45
 - -formats option split into -formats, -codecs, -bsfs, and -protocols
46 46
 - IV8 demuxer
47
+- CDG demuxer and decoder
47 48
 
48 49
 
49 50
 
... ...
@@ -63,6 +63,8 @@ library:
63 63
     @tab Used in the game Cyberia from Interplay.
64 64
 @item Delphine Software International CIN @tab   @tab X
65 65
     @tab Multimedia format used by Delphine Software games.
66
+@item CD+G                      @tab   @tab X
67
+    @tab Video format used by CD+G karaoke disks
66 68
 @item Core Audio Format         @tab   @tab X
67 69
     @tab Apple Core Audio Format
68 70
 @item CRC testing format        @tab X @tab
... ...
@@ -329,6 +331,8 @@ following image formats are supported:
329 329
     @tab Codec used in Cyberia game.
330 330
 @item CamStudio              @tab     @tab  X
331 331
     @tab fourcc: CSCD
332
+@item CD+G                   @tab     @tab  X
333
+    @tab Video codec for CD+G karaoke disks
332 334
 @item Chinese AVS video      @tab     @tab  X
333 335
     @tab AVS1-P2, JiZhun profile
334 336
 @item Delphine Software International CIN video  @tab     @tab  X
... ...
@@ -68,6 +68,7 @@ OBJS-$(CONFIG_BMP_ENCODER)             += bmpenc.o
68 68
 OBJS-$(CONFIG_C93_DECODER)             += c93.o
69 69
 OBJS-$(CONFIG_CAVS_DECODER)            += cavs.o cavsdec.o cavsdsp.o \
70 70
                                           mpeg12data.o mpegvideo.o
71
+OBJS-$(CONFIG_CDGRAPHICS_DECODER)      += cdgraphics.o
71 72
 OBJS-$(CONFIG_CINEPAK_DECODER)         += cinepak.o
72 73
 OBJS-$(CONFIG_CLJR_DECODER)            += cljr.o
73 74
 OBJS-$(CONFIG_CLJR_ENCODER)            += cljr.o
... ...
@@ -71,6 +71,7 @@ void avcodec_register_all(void)
71 71
     REGISTER_ENCDEC  (BMP, bmp);
72 72
     REGISTER_DECODER (C93, c93);
73 73
     REGISTER_DECODER (CAVS, cavs);
74
+    REGISTER_DECODER (CDGRAPHICS, cdgraphics);
74 75
     REGISTER_DECODER (CINEPAK, cinepak);
75 76
     REGISTER_DECODER (CLJR, cljr);
76 77
     REGISTER_DECODER (CSCD, cscd);
... ...
@@ -200,6 +200,7 @@ enum CodecID {
200 200
     CODEC_ID_MAD,
201 201
     CODEC_ID_FRWU,
202 202
     CODEC_ID_FLASHSV2,
203
+    CODEC_ID_CDGRAPHICS,
203 204
 
204 205
     /* various PCM "codecs" */
205 206
     CODEC_ID_PCM_S16LE= 0x10000,
206 207
new file mode 100644
... ...
@@ -0,0 +1,380 @@
0
+/*
1
+ * CD Graphics Video Decoder
2
+ * Copyright (c) 2009 Michael Tison
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+#include "avcodec.h"
22
+#include "bytestream.h"
23
+
24
+/**
25
+ * @file libavcodec/cdgraphics.c
26
+ * @brief CD Graphics Video Decoder
27
+ * @author Michael Tison
28
+ * @sa http://wiki.multimedia.cx/index.php?title=CD_Graphics
29
+ * @sa http://www.ccs.neu.edu/home/bchafy/cdb/info/cdg
30
+ */
31
+
32
+/// default screen sizes
33
+#define CDG_FULL_WIDTH           300
34
+#define CDG_FULL_HEIGHT          216
35
+#define CDG_DISPLAY_WIDTH        294
36
+#define CDG_DISPLAY_HEIGHT       204
37
+#define CDG_BORDER_WIDTH           6
38
+#define CDG_BORDER_HEIGHT         12
39
+
40
+/// masks
41
+#define CDG_COMMAND             0x09
42
+#define CDG_MASK                0x3F
43
+
44
+/// instruction codes
45
+#define CDG_INST_MEMORY_PRESET     1
46
+#define CDG_INST_BORDER_PRESET     2
47
+#define CDG_INST_TILE_BLOCK        6
48
+#define CDG_INST_SCROLL_PRESET    20
49
+#define CDG_INST_SCROLL_COPY      24
50
+#define CDG_INST_LOAD_PAL_LO      30
51
+#define CDG_INST_LOAD_PAL_HIGH    31
52
+#define CDG_INST_TILE_BLOCK_XOR   38
53
+
54
+/// data sizes
55
+#define CDG_PACKET_SIZE           24
56
+#define CDG_DATA_SIZE             16
57
+#define CDG_TILE_HEIGHT           12
58
+#define CDG_TILE_WIDTH             6
59
+#define CDG_MINIMUM_PKT_SIZE       6
60
+#define CDG_MINIMUM_SCROLL_SIZE    3
61
+#define CDG_HEADER_SIZE            8
62
+#define CDG_PALETTE_SIZE          16
63
+
64
+typedef struct CDGraphicsContext {
65
+    AVFrame frame;
66
+    int hscroll;
67
+    int vscroll;
68
+} CDGraphicsContext;
69
+
70
+static void cdg_init_frame(AVFrame *frame)
71
+{
72
+    avcodec_get_frame_defaults(frame);
73
+    frame->reference = 1;
74
+    frame->buffer_hints = FF_BUFFER_HINTS_VALID    |
75
+                          FF_BUFFER_HINTS_PRESERVE |
76
+                          FF_BUFFER_HINTS_REUSABLE;
77
+}
78
+
79
+static av_cold int cdg_decode_init(AVCodecContext *avctx)
80
+{
81
+    CDGraphicsContext *cc = avctx->priv_data;
82
+
83
+    cdg_init_frame(&cc->frame);
84
+
85
+    avctx->width   = CDG_FULL_WIDTH;
86
+    avctx->height  = CDG_FULL_HEIGHT;
87
+    avctx->pix_fmt = PIX_FMT_PAL8;
88
+
89
+    return 0;
90
+}
91
+
92
+static void cdg_border_preset(CDGraphicsContext *cc, uint8_t *data)
93
+{
94
+    int y;
95
+    int lsize    = cc->frame.linesize[0];
96
+    uint8_t *buf = cc->frame.data[0];
97
+    int color    = data[0] & 0x0F;
98
+
99
+    if (!(data[1] & 0x0F)) {
100
+        /// fill the top and bottom borders
101
+        memset(buf, color, CDG_BORDER_HEIGHT * lsize);
102
+        memset(buf + (CDG_FULL_HEIGHT - CDG_BORDER_HEIGHT) * lsize,
103
+               color, CDG_BORDER_HEIGHT * lsize);
104
+
105
+        /// fill the side borders
106
+        for (y = CDG_BORDER_HEIGHT; y < CDG_FULL_HEIGHT - CDG_BORDER_HEIGHT; y++) {
107
+            memset(buf + y * lsize, color, CDG_BORDER_WIDTH);
108
+            memset(buf + CDG_FULL_WIDTH - CDG_BORDER_WIDTH + y * lsize,
109
+                   color, CDG_BORDER_WIDTH);
110
+        }
111
+    }
112
+}
113
+
114
+static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low)
115
+{
116
+    uint8_t r, g, b;
117
+    uint16_t color;
118
+    int i;
119
+    int array_offset  = low ? 0 : 8;
120
+    uint32_t *palette = (uint32_t *) cc->frame.data[1];
121
+
122
+    for (i = 0; i < 8; i++) {
123
+        color = (data[2 * i] << 6) + (data[2 * i + 1] & 0x3F);
124
+        r = ((color >> 8) & 0x000F) * 17;
125
+        g = ((color >> 4) & 0x000F) * 17;
126
+        b = ((color     ) & 0x000F) * 17;
127
+        palette[i + array_offset] = r << 16 | g << 8 | b;
128
+    }
129
+    cc->frame.palette_has_changed = 1;
130
+}
131
+
132
+static int cdg_tile_block(CDGraphicsContext *cc, uint8_t *data, int b)
133
+{
134
+    unsigned ci, ri;
135
+    int color;
136
+    int x, y;
137
+    int ai;
138
+    int stride   = cc->frame.linesize[0];
139
+    uint8_t *buf = cc->frame.data[0];
140
+
141
+    ri = (data[2] & 0x1F) * CDG_TILE_HEIGHT + cc->vscroll;
142
+    ci = (data[3] & 0x3F) * CDG_TILE_WIDTH  + cc->hscroll;
143
+
144
+    if (ri > (CDG_FULL_HEIGHT - CDG_TILE_HEIGHT))
145
+        return AVERROR(EINVAL);
146
+    if (ci > (CDG_FULL_WIDTH - CDG_TILE_WIDTH))
147
+        return AVERROR(EINVAL);
148
+
149
+    for (y = 0; y < CDG_TILE_HEIGHT; y++) {
150
+        for (x = 0; x < CDG_TILE_WIDTH; x++) {
151
+            if (!((data[4 + y] >> (5 - x)) & 0x01))
152
+                color = data[0] & 0x0F;
153
+            else
154
+                color = data[1] & 0x0F;
155
+
156
+            ai = ci + x + (stride * (ri + y));
157
+            if (b)
158
+                color ^= buf[ai];
159
+            buf[ai] = color;
160
+        }
161
+    }
162
+
163
+    return 0;
164
+}
165
+
166
+#define UP    2
167
+#define DOWN  1
168
+#define LEFT  2
169
+#define RIGHT 1
170
+
171
+static void cdg_copy_rect_buf(int out_tl_x, int out_tl_y, uint8_t *out,
172
+                              int in_tl_x, int in_tl_y, uint8_t *in,
173
+                              int w, int h, int stride)
174
+{
175
+    int y;
176
+
177
+    in  += in_tl_x  + in_tl_y  * stride;
178
+    out += out_tl_x + out_tl_y * stride;
179
+    for (y = 0; y < h; y++)
180
+        memcpy(out + y * stride, in + y * stride, w);
181
+}
182
+
183
+static void cdg_fill_rect_preset(int tl_x, int tl_y, uint8_t *out,
184
+                                 int color, int w, int h, int stride)
185
+{
186
+    int y;
187
+
188
+    for (y = tl_y; y < tl_y + h; y++)
189
+        memset(out + tl_x + y * stride, color, w);
190
+}
191
+
192
+static void cdg_fill_wrapper(int out_tl_x, int out_tl_y, uint8_t *out,
193
+                             int in_tl_x, int in_tl_y, uint8_t *in,
194
+                             int color, int w, int h, int stride, int roll)
195
+{
196
+    if (roll) {
197
+        cdg_copy_rect_buf(out_tl_x, out_tl_y, out, in_tl_x, in_tl_y,
198
+                          in, w, h, stride);
199
+    } else {
200
+        cdg_fill_rect_preset(out_tl_x, out_tl_y, out, color, w, h, stride);
201
+    }
202
+}
203
+
204
+static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
205
+                       AVFrame *new_frame, int roll_over)
206
+{
207
+    int color;
208
+    int hscmd, h_off, hinc, vscmd, v_off, vinc;
209
+    int y;
210
+    int stride   = cc->frame.linesize[0];
211
+    uint8_t *in  = cc->frame.data[0];
212
+    uint8_t *out = new_frame->data[0];
213
+
214
+    color =  data[0] & 0x0F;
215
+    hscmd = (data[1] & 0x30) >> 4;
216
+    vscmd = (data[2] & 0x30) >> 4;
217
+
218
+    h_off =  FFMIN(data[1] & 0x07, CDG_BORDER_WIDTH  - 1);
219
+    v_off =  FFMIN(data[2] & 0x07, CDG_BORDER_HEIGHT - 1);
220
+
221
+    /// find the difference and save the offset for cdg_tile_block usage
222
+    hinc = h_off - cc->hscroll;
223
+    vinc = v_off - cc->vscroll;
224
+    cc->hscroll = h_off;
225
+    cc->vscroll = v_off;
226
+
227
+    if (vscmd == UP)
228
+        vinc -= 12;
229
+    if (vscmd == DOWN)
230
+        vinc += 12;
231
+    if (hscmd == LEFT)
232
+        hinc -= 6;
233
+    if (hscmd == RIGHT)
234
+        hinc += 6;
235
+
236
+    if (!hinc && !vinc)
237
+        return;
238
+
239
+    memcpy(new_frame->data[1], cc->frame.data[1], CDG_PALETTE_SIZE * 4);
240
+
241
+    for (y = FFMAX(0, vinc); y < FFMIN(CDG_FULL_HEIGHT + vinc, CDG_FULL_HEIGHT); y++)
242
+        memcpy(out + FFMAX(0, hinc) + stride * y,
243
+               in + FFMAX(0, hinc) - hinc + (y - vinc) * stride,
244
+               FFMIN(stride + hinc, stride));
245
+
246
+    if (vinc > 0)
247
+        cdg_fill_wrapper(0, 0, out,
248
+                         0, CDG_FULL_HEIGHT - vinc, in, color,
249
+                         stride, vinc, stride, roll_over);
250
+    else if (vinc < 0)
251
+        cdg_fill_wrapper(0, CDG_FULL_HEIGHT + vinc, out,
252
+                         0, 0, in, color,
253
+                         stride, -1 * vinc, stride, roll_over);
254
+
255
+    if (hinc > 0)
256
+        cdg_fill_wrapper(0, 0, out,
257
+                         CDG_FULL_WIDTH - hinc, 0, in, color,
258
+                         hinc, CDG_FULL_HEIGHT, stride, roll_over);
259
+    else if (hinc < 0)
260
+        cdg_fill_wrapper(CDG_FULL_WIDTH + hinc, 0, out,
261
+                         0, 0, in, color,
262
+                         -1 * hinc, CDG_FULL_HEIGHT, stride, roll_over);
263
+
264
+}
265
+
266
+static int cdg_decode_frame(AVCodecContext *avctx,
267
+                            void *data, int *data_size, AVPacket *avpkt)
268
+{
269
+    const uint8_t *buf = avpkt->data;
270
+    int buf_size       = avpkt->size;
271
+    int ret;
272
+    uint8_t command, inst;
273
+    uint8_t cdg_data[CDG_DATA_SIZE];
274
+    AVFrame new_frame;
275
+    CDGraphicsContext *cc = avctx->priv_data;
276
+
277
+    if (buf_size < CDG_MINIMUM_PKT_SIZE) {
278
+        av_log(avctx, AV_LOG_ERROR, "buffer too small for decoder\n");
279
+        return AVERROR(EINVAL);
280
+    }
281
+
282
+    ret = avctx->reget_buffer(avctx, &cc->frame);
283
+    if (ret) {
284
+        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
285
+        return ret;
286
+    }
287
+
288
+    command = bytestream_get_byte(&buf);
289
+    inst    = bytestream_get_byte(&buf);
290
+    inst    &= CDG_MASK;
291
+    buf += 2;  /// skipping 2 unneeded bytes
292
+    bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE);
293
+
294
+    if ((command & CDG_MASK) == CDG_COMMAND) {
295
+        switch (inst) {
296
+        case CDG_INST_MEMORY_PRESET:
297
+            if (!(cdg_data[1] & 0x0F))
298
+                memset(cc->frame.data[0], cdg_data[0] & 0x0F,
299
+                       cc->frame.linesize[0] * CDG_FULL_HEIGHT);
300
+            break;
301
+        case CDG_INST_LOAD_PAL_LO:
302
+        case CDG_INST_LOAD_PAL_HIGH:
303
+            if (buf_size - CDG_HEADER_SIZE < CDG_DATA_SIZE) {
304
+                av_log(avctx, AV_LOG_ERROR, "buffer too small for loading palette\n");
305
+                return AVERROR(EINVAL);
306
+            }
307
+
308
+            cdg_load_palette(cc, cdg_data, inst == CDG_INST_LOAD_PAL_LO);
309
+            break;
310
+        case CDG_INST_BORDER_PRESET:
311
+            cdg_border_preset(cc, cdg_data);
312
+            break;
313
+        case CDG_INST_TILE_BLOCK_XOR:
314
+        case CDG_INST_TILE_BLOCK:
315
+            if (buf_size - CDG_HEADER_SIZE < CDG_DATA_SIZE) {
316
+                av_log(avctx, AV_LOG_ERROR, "buffer too small for drawing tile\n");
317
+                return AVERROR(EINVAL);
318
+            }
319
+
320
+            ret = cdg_tile_block(cc, cdg_data, inst == CDG_INST_TILE_BLOCK_XOR);
321
+            if (ret) {
322
+                av_log(avctx, AV_LOG_ERROR, "tile is out of range\n");
323
+                return ret;
324
+            }
325
+            break;
326
+        case CDG_INST_SCROLL_PRESET:
327
+        case CDG_INST_SCROLL_COPY:
328
+            if (buf_size - CDG_HEADER_SIZE < CDG_MINIMUM_SCROLL_SIZE) {
329
+                av_log(avctx, AV_LOG_ERROR, "buffer too small for scrolling\n");
330
+                return AVERROR(EINVAL);
331
+            }
332
+
333
+            cdg_init_frame(&new_frame);
334
+            ret = avctx->get_buffer(avctx, &new_frame);
335
+            if (ret) {
336
+                av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
337
+                return ret;
338
+            }
339
+
340
+            cdg_scroll(cc, cdg_data, &new_frame, inst == CDG_INST_SCROLL_COPY);
341
+            avctx->release_buffer(avctx, &cc->frame);
342
+            cc->frame = new_frame;
343
+            break;
344
+        default:
345
+            break;
346
+        }
347
+
348
+        *data_size = sizeof(AVFrame);
349
+    } else {
350
+        *data_size = 0;
351
+        buf_size   = 0;
352
+    }
353
+
354
+    *(AVFrame *) data = cc->frame;
355
+    return buf_size;
356
+}
357
+
358
+static av_cold int cdg_decode_end(AVCodecContext *avctx)
359
+{
360
+    CDGraphicsContext *cc = avctx->priv_data;
361
+
362
+    if (cc->frame.data[0])
363
+        avctx->release_buffer(avctx, &cc->frame);
364
+
365
+    return 0;
366
+}
367
+
368
+AVCodec cdgraphics_decoder = {
369
+    "cdgraphics",
370
+    CODEC_TYPE_VIDEO,
371
+    CODEC_ID_CDGRAPHICS,
372
+    sizeof(CDGraphicsContext),
373
+    cdg_decode_init,
374
+    NULL,
375
+    cdg_decode_end,
376
+    cdg_decode_frame,
377
+    CODEC_CAP_DR1,
378
+    .long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"),
379
+};
... ...
@@ -44,6 +44,7 @@ OBJS-$(CONFIG_BFI_DEMUXER)               += bfi.o
44 44
 OBJS-$(CONFIG_C93_DEMUXER)               += c93.o vocdec.o voc.o
45 45
 OBJS-$(CONFIG_CAF_DEMUXER)               += cafdec.o caf.o mov.o riff.o isom.o
46 46
 OBJS-$(CONFIG_CAVSVIDEO_DEMUXER)         += raw.o
47
+OBJS-$(CONFIG_CDG_DEMUXER)               += cdg.o
47 48
 OBJS-$(CONFIG_CRC_MUXER)                 += crcenc.o
48 49
 OBJS-$(CONFIG_DAUD_DEMUXER)              += daud.o
49 50
 OBJS-$(CONFIG_DAUD_MUXER)                += daud.o
... ...
@@ -68,6 +68,7 @@ void av_register_all(void)
68 68
     REGISTER_DEMUXER  (C93, c93);
69 69
     REGISTER_DEMUXER  (CAF, caf);
70 70
     REGISTER_DEMUXER  (CAVSVIDEO, cavsvideo);
71
+    REGISTER_DEMUXER  (CDG, cdg);
71 72
     REGISTER_MUXER    (CRC, crc);
72 73
     REGISTER_MUXDEMUX (DAUD, daud);
73 74
     REGISTER_MUXDEMUX (DIRAC, dirac);
... ...
@@ -22,7 +22,7 @@
22 22
 #define AVFORMAT_AVFORMAT_H
23 23
 
24 24
 #define LIBAVFORMAT_VERSION_MAJOR 52
25
-#define LIBAVFORMAT_VERSION_MINOR 43
25
+#define LIBAVFORMAT_VERSION_MINOR 44
26 26
 #define LIBAVFORMAT_VERSION_MICRO  0
27 27
 
28 28
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
29 29
new file mode 100644
... ...
@@ -0,0 +1,66 @@
0
+/*
1
+ * CD Graphics Demuxer
2
+ * Copyright (c) 2009 Michael Tison
3
+ *
4
+ * This file is part of FFmpeg.
5
+ *
6
+ * FFmpeg is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * FFmpeg is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with FFmpeg; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ */
20
+
21
+#include "avformat.h"
22
+
23
+#define CDG_PACKET_SIZE    24
24
+
25
+static int read_header(AVFormatContext *s, AVFormatParameters *ap)
26
+{
27
+    AVStream *vst;
28
+    int ret;
29
+
30
+    vst = av_new_stream(s, 0);
31
+    if (!vst)
32
+        return AVERROR(ENOMEM);
33
+
34
+    vst->codec->codec_type = CODEC_TYPE_VIDEO;
35
+    vst->codec->codec_id   = CODEC_ID_CDGRAPHICS;
36
+
37
+    /// 75 sectors/sec * 4 packets/sector = 300 packets/sec
38
+    av_set_pts_info(vst, 32, 1, 300);
39
+
40
+    ret = url_fsize(s->pb);
41
+    if (ret > 0)
42
+        vst->duration = (ret * vst->time_base.den) / (CDG_PACKET_SIZE * 300);
43
+
44
+    return 0;
45
+}
46
+
47
+static int read_packet(AVFormatContext *s, AVPacket *pkt)
48
+{
49
+    int ret;
50
+
51
+    ret = av_get_packet(s->pb, pkt, CDG_PACKET_SIZE);
52
+
53
+    pkt->stream_index = 0;
54
+    return ret;
55
+}
56
+
57
+AVInputFormat cdg_demuxer = {
58
+    "cdg",
59
+    NULL_IF_CONFIG_SMALL("CD Graphics Format"),
60
+    0,
61
+    NULL,
62
+    read_header,
63
+    read_packet,
64
+    .extensions = "cdg"
65
+};