1 /* -*- c-basic-offset: 2 -*-
2  * GStreamer
3  * Copyright (C) <2009> ogg.k.ogg.k <ogg.k.ogg.k at googlemail dot com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 
22 #ifndef __GST_KATE_SPU_H__
23 #define __GST_KATE_SPU_H__
24 
25 #include <gst/gst.h>
26 #include <kate/kate.h>
27 #include "gstkateenc.h"
28 #include "gstkatedec.h"
29 
30 #define GST_KATE_UINT16_BE(ptr) ( ( ((guint16)((ptr)[0])) <<8) | ((ptr)[1]) )
31 
32 /* taken off the DVD SPU decoder - now is time for today's WTF ???? */
33 #define GST_KATE_STM_TO_GST(stm) ((GST_MSECOND * 1024 * (stm)) / 90)
34 #define GST_KATE_GST_TO_STM(gst) ((int)(((gst) * 90000 ) / 1024))
35 
36 #define GST_KATE_SPU_MIME_TYPE "subpicture/x-dvd"
37 
38 G_BEGIN_DECLS
39 
40 enum GstKateSpuCmd
41 {
42   SPU_CMD_FSTA_DSP = 0x00,      /* Forced Display */
43   SPU_CMD_DSP = 0x01,           /* Display Start */
44   SPU_CMD_STP_DSP = 0x02,       /* Display Off */
45   SPU_CMD_SET_COLOR = 0x03,     /* Set the color indexes for the palette */
46   SPU_CMD_SET_ALPHA = 0x04,     /* Set the alpha indexes for the palette */
47   SPU_CMD_SET_DAREA = 0x05,     /* Set the display area for the SPU */
48   SPU_CMD_DSPXA = 0x06,         /* Pixel data addresses */
49   SPU_CMD_CHG_COLCON = 0x07,    /* Change Color & Contrast */
50   SPU_CMD_END = 0xff
51 };
52 
53 
54 extern const guint32 gst_kate_spu_default_clut[16];
55 
56 extern GstFlowReturn
57 gst_kate_spu_decode_spu (GstKateEnc * ke, GstBuffer * buf, kate_region * kr,
58     kate_bitmap * kb, kate_palette * kp);
59 
60 extern GstBuffer*
61 gst_kate_spu_encode_spu (GstKateDec * kd, const kate_event * ev);
62 
63 G_END_DECLS
64 
65 #endif /* __GST_KATE_SPU_H__ */
66