1 /* GStreamer DVD Sub-Picture Unit
2 * Copyright (C) 2007 Fluendo S.A. <info@fluendo.com>
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.
19 #ifndef __GST_DVD_SPU_H__
20 #define __GST_DVD_SPU_H__
24 #include "gstspu-common.h"
25 #include "gstspu-vobsub.h"
26 #include "gstspu-pgs.h"
30 #define GST_TYPE_DVD_SPU \
31 (gst_dvd_spu_get_type())
32 #define GST_DVD_SPU(obj) \
33 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DVD_SPU,GstDVDSpu))
34 #define GST_DVD_SPU_CLASS(klass) \
35 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DVD_SPU,GstDVDSpuClass))
36 #define GST_IS_DVD_SPU(obj) \
37 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DVD_SPU))
38 #define GST_IS_DVD_SPU_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DVD_SPU))
41 #define DVD_SPU_LOCK(s) g_mutex_lock ((s)->spu_lock);
42 #define DVD_SPU_UNLOCK(s) g_mutex_unlock ((s)->spu_lock);
44 typedef struct _GstDVDSpuClass GstDVDSpuClass;
46 typedef enum SpuStateFlags SpuStateFlags;
47 typedef enum SpuInputType SpuInputType;
48 typedef struct SpuPacket SpuPacket;
51 SPU_INPUT_TYPE_NONE = 0x00,
52 SPU_INPUT_TYPE_VOBSUB = 0x01,
53 SPU_INPUT_TYPE_PGS = 0x02
57 SPU_STATE_NONE = 0x00,
58 /* Flags cleared on a flush */
59 SPU_STATE_DISPLAY = 0x01,
60 SPU_STATE_FORCED_DSP = 0x02,
61 SPU_STATE_STILL_FRAME = 0x04,
62 /* Persistent flags */
63 SPU_STATE_FORCED_ONLY = 0x100
66 #define SPU_STATE_FLAGS_MASK (0xff)
69 GstClockTime next_ts; /* Next event TS in running time */
73 gint16 vid_width, vid_height;
74 gint16 Y_stride, UV_stride;
75 gint16 Y_height, UV_height;
77 guint32 *comp_bufs[3]; /* Compositing buffers for U+V & A */
81 SpuVobsubState vobsub;
85 /* Structure used to store the queue of pending SPU packets. The start_ts is
86 * stored in running time...
87 * Also used to carry in-band events so they remain serialised properly */
89 GstClockTime event_ts;
98 GstPad *subpic_sinkpad;
101 /* Mutex to protect state we access from different chain funcs */
104 GstSegment video_seg;
108 SpuInputType spu_input_type;
110 /* GQueue of SpuBuf structures */
111 GQueue *pending_spus;
113 /* Accumulator for collecting partial SPU buffers until they're complete */
114 GstBuffer *partial_spu;
116 /* Store either a reference or a copy of the last video frame for duplication
117 * during still-frame conditions */
118 GstBuffer *ref_frame;
120 /* Buffer to push after handling a DVD event, if any */
121 GstBuffer *pending_frame;
124 struct _GstDVDSpuClass {
125 GstElementClass parent_class;
128 GType gst_dvd_spu_get_type (void);
132 #endif /* __GST_DVD_SPU_H__ */