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