Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / ext / ogg / gstoggmux.h
1 /* OGG muxer plugin for GStreamer
2  * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
3  * Copyright (C) 2006 Thomas Vander Stichele <thomas at apestaart dot org>
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., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __GST_OGG_MUX_H__
22 #define __GST_OGGEMUX_H__
23
24 #include <ogg/ogg.h>
25
26 #include <gst/gst.h>
27 #include <gst/base/gstcollectpads.h>
28 #include "gstoggstream.h"
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_OGG_MUX (gst_ogg_mux_get_type())
33 #define GST_OGG_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OGG_MUX, GstOggMux))
34 #define GST_OGG_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OGG_MUX, GstOggMux))
35 #define GST_IS_OGG_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OGG_MUX))
36 #define GST_IS_OGG_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OGG_MUX))
37
38 typedef struct _GstOggMux GstOggMux;
39 typedef struct _GstOggMuxClass GstOggMuxClass;
40
41 typedef enum
42 {
43   GST_OGG_PAD_STATE_CONTROL = 0,
44   GST_OGG_PAD_STATE_DATA = 1
45 }
46 GstOggPadState;
47
48 /* all information needed for one ogg stream */
49 typedef struct
50 {
51   GstCollectData collect;       /* we extend the CollectData */
52
53   GstOggStream map;
54   gboolean have_type;
55
56   GstSegment segment;
57
58   /* These two buffers make a very simple queue - they enter as 'next_buffer'
59    * and (usually) leave as 'buffer', except at EOS, when buffer will be NULL */
60   GstBuffer *buffer;            /* the first waiting buffer for the pad */
61   GstBuffer *next_buffer;       /* the second waiting buffer for the pad */
62
63   gint64 packetno;              /* number of next packet */
64   gint64 pageno;                /* number of next page */
65   guint64 duration;             /* duration of current page */
66   gboolean eos;
67   gint64 offset;
68   GstClockTime timestamp;       /* timestamp of the first packet on the next
69                                  * page to be dequeued */
70   GstClockTime timestamp_end;   /* end timestamp of last complete packet on
71                                    the next page to be dequeued */
72   GstClockTime gp_time;         /* time corresponding to the gp value of the
73                                    last complete packet on the next page to be
74                                    dequeued */
75
76   GstOggPadState state;         /* state of the pad */
77
78   GQueue *pagebuffers;          /* List of pages in buffers ready for pushing */
79
80   gboolean new_page;            /* starting a new page */
81   gboolean first_delta;         /* was the first packet in the page a delta */
82   gboolean prev_delta;          /* was the previous buffer a delta frame */
83   gboolean data_pushed;         /* whether we pushed data already */
84
85   GstPadEventFunction collect_event;
86
87   gboolean always_flush_page;
88 }
89 GstOggPadData;
90
91 /**
92  * GstOggMux:
93  *
94  * The ogg muxer object structure.
95  */
96 struct _GstOggMux
97 {
98   GstElement element;
99
100   /* source pad */
101   GstPad *srcpad;
102
103   /* sinkpads */
104   GstCollectPads *collect;
105
106   /* number of pads which have not received EOS */
107   gint active_pads;
108
109   /* the pad we are currently using to fill a page */
110   GstOggPadData *pulling;
111
112   /* next timestamp for the page */
113   GstClockTime next_ts;
114
115   /* Last timestamp actually output on src pad */
116   GstClockTime last_ts;
117
118   /* offset in stream */
119   guint64 offset;
120
121   /* need_headers */
122   gboolean need_headers;
123
124   guint64 max_delay;
125   guint64 max_page_delay;
126
127   GstOggPadData *delta_pad;     /* when a delta frame is detected on a stream, we mark
128                                    pages as delta frames up to the page that has the
129                                    keyframe */
130
131 };
132
133 struct _GstOggMuxClass
134 {
135   GstElementClass parent_class;
136 };
137
138 GType gst_ogg_mux_get_type (void);
139
140 gboolean gst_ogg_mux_plugin_init (GstPlugin * plugin);
141
142 G_END_DECLS
143
144 #endif /* __GST_OGG_MUX_H__ */