ogg: fix typo in comment
[platform/upstream/gstreamer.git] / 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
29 G_BEGIN_DECLS
30
31 #define GST_TYPE_OGG_MUX (gst_ogg_mux_get_type())
32 #define GST_OGG_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OGG_MUX, GstOggMux))
33 #define GST_OGG_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OGG_MUX, GstOggMux))
34 #define GST_IS_OGG_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OGG_MUX))
35 #define GST_IS_OGG_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OGG_MUX))
36
37 typedef struct _GstOggMux GstOggMux;
38 typedef struct _GstOggMuxClass GstOggMuxClass;
39
40 typedef enum
41 {
42   GST_OGG_PAD_STATE_CONTROL = 0,
43   GST_OGG_PAD_STATE_DATA = 1
44 }
45 GstOggPadState;
46
47 /* all information needed for one ogg stream */
48 typedef struct
49 {
50   GstCollectData collect;       /* we extend the CollectData */
51
52   /* These two buffers make a very simple queue - they enter as 'next_buffer'
53    * and (usually) leave as 'buffer', except at EOS, when buffer will be NULL */
54   GstBuffer *buffer;            /* the first waiting buffer for the pad */
55   GstBuffer *next_buffer;       /* the second waiting buffer for the pad */
56
57   gint serial;
58   ogg_stream_state stream;
59   gint64 packetno;              /* number of next packet */
60   gint64 pageno;                /* number of next page */
61   guint64 duration;             /* duration of current page */
62   gboolean eos;
63   gint64 offset;
64   GstClockTime timestamp;       /* timestamp of the first packet on the next
65                                  * page to be dequeued */
66   GstClockTime timestamp_end;   /* end timestamp of last complete packet on
67                                    the next page to be dequeued */
68   GstClockTime gp_time;         /* time corresponding to the gp value of the
69                                    last complete packet on the next page to be
70                                    dequeued */
71
72   GstOggPadState state;         /* state of the pad */
73
74   GList *headers;
75
76   GQueue *pagebuffers;          /* List of pages in buffers ready for pushing */
77
78   gboolean new_page;            /* starting a new page */
79   gboolean first_delta;         /* was the first packet in the page a delta */
80   gboolean prev_delta;          /* was the previous buffer a delta frame */
81
82   GstPadEventFunction collect_event;
83
84   gboolean always_flush_page;
85 }
86 GstOggPadData;
87
88 /**
89  * GstOggMux:
90  *
91  * The ogg muxer object structure.
92  */
93 struct _GstOggMux
94 {
95   GstElement element;
96
97   /* source pad */
98   GstPad *srcpad;
99
100   /* sinkpads */
101   GstCollectPads *collect;
102
103   /* number of pads which have not received EOS */
104   gint active_pads;
105
106   /* the pad we are currently using to fill a page */
107   GstOggPadData *pulling;
108
109   /* next timestamp for the page */
110   GstClockTime next_ts;
111
112   /* Last timestamp actually output on src pad */
113   GstClockTime last_ts;
114
115   /* offset in stream */
116   guint64 offset;
117
118   /* need_headers */
119   gboolean need_headers;
120
121   guint64 max_delay;
122   guint64 max_page_delay;
123
124   GstOggPadData *delta_pad;     /* when a delta frame is detected on a stream, we mark
125                                    pages as delta frames up to the page that has the
126                                    keyframe */
127
128 };
129
130 struct _GstOggMuxClass
131 {
132   GstElementClass parent_class;
133 };
134
135 GType gst_ogg_mux_get_type (void);
136
137 gboolean gst_ogg_mux_plugin_init (GstPlugin * plugin);
138
139 G_END_DECLS
140
141 #endif /* __GST_OGG_MUX_H__ */