1 /* GStreamer
2  * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
3  *
4  * gstmultipartmux.h: multipart stream muxer
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef __GST_MULTIPART_MUX__
23 #define __GST_MULTIPART_MUX__
24 
25 #include <gst/gst.h>
26 #include <gst/base/gstcollectpads.h>
27 
28 #include <string.h>
29 
30 G_BEGIN_DECLS
31 
32 #define GST_TYPE_MULTIPART_MUX (gst_multipart_mux_get_type())
33 #define GST_MULTIPART_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MULTIPART_MUX, GstMultipartMux))
34 #define GST_MULTIPART_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MULTIPART_MUX, GstMultipartMux))
35 #define GST_MULTIPART_MUX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MULTIPART_MUX, GstMultipartMuxClass))
36 #define GST_IS_MULTIPART_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MULTIPART_MUX))
37 #define GST_IS_MULTIPART_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MULTIPART_MUX))
38 
39 typedef struct _GstMultipartMux GstMultipartMux;
40 typedef struct _GstMultipartMuxClass GstMultipartMuxClass;
41 
42 /* all information needed for one multipart stream */
43 typedef struct
44 {
45   GstCollectData collect;       /* we extend the CollectData */
46 
47   GstBuffer *buffer;            /* the queued buffer for this pad */
48   GstClockTime pts_timestamp;   /* its pts timestamp, converted to running_time so that we can
49                                    correctly sort over multiple segments. */
50   GstClockTime dts_timestamp;   /* its dts timestamp, converted to running_time so that we can
51                                    correctly sort over multiple segments. */
52   GstPad *pad;
53 }
54 GstMultipartPadData;
55 
56 /**
57  * GstMultipartMux:
58  *
59  * The opaque #GstMultipartMux structure.
60  */
61 struct _GstMultipartMux
62 {
63   GstElement element;
64 
65   /* pad */
66   GstPad *srcpad;
67 
68   /* sinkpads */
69   GstCollectPads *collect;
70 
71   gint numpads;
72 
73   /* offset in stream */
74   guint64 offset;
75 
76   /* boundary string */
77   gchar *boundary;
78 
79   gboolean negotiated;
80   gboolean need_segment;
81   gboolean need_stream_start;
82 };
83 
84 struct _GstMultipartMuxClass
85 {
86   GstElementClass parent_class;
87 
88   GHashTable *mimetypes;
89 };
90 
91 GType gst_multipart_mux_get_type (void);
92 
93 gboolean gst_multipart_mux_plugin_init (GstPlugin * plugin);
94 
95 G_END_DECLS
96 
97 #endif /* __GST_MULTIPART_MUX__ */
98 
99