1 /* GStreamer split muxer bin
2 * Copyright (C) 2014 Jan Schmidt <jan@centricular.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., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __GST_SPLITMUXSINK_H__
21 #define __GST_SPLITMUXSINK_H__
24 #include <gst/pbutils/pbutils.h>
28 #define GST_TYPE_SPLITMUX_SINK (gst_splitmux_sink_get_type())
29 #define GST_SPLITMUX_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SPLITMUX_SINK,GstSplitMuxSink))
30 #define GST_SPLITMUX_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SPLITMUX_SINK,GstSplitMuxSinkClass))
31 #define GST_IS_SPLITMUX_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SPLITMUX_SINK))
32 #define GST_IS_SPLITMUX_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SPLITMUX_SINK))
34 typedef struct _GstSplitMuxSink GstSplitMuxSink;
35 typedef struct _GstSplitMuxSinkClass GstSplitMuxSinkClass;
37 GType gst_splitmux_sink_get_type(void);
38 gboolean register_splitmuxsink (GstPlugin * plugin);
40 typedef enum _SplitMuxState {
41 SPLITMUX_STATE_STOPPED,
42 SPLITMUX_STATE_COLLECTING_GOP_START,
43 SPLITMUX_STATE_WAITING_GOP_COMPLETE,
44 SPLITMUX_STATE_ENDING_FILE,
45 SPLITMUX_STATE_START_NEXT_FRAGMENT,
48 typedef struct _MqStreamBuf
55 typedef struct _MqStreamCtx
59 GstSplitMuxSink *splitmux;
61 guint sink_pad_block_id;
62 guint src_pad_block_id;
70 GstSegment in_segment;
71 GstSegment out_segment;
73 GstClockTime in_running_time;
74 GstClockTime out_running_time;
86 struct _GstSplitMuxSink {
95 GstClockTime threshold_time;
96 guint64 threshold_bytes;
104 GstElement *provided_muxer;
106 GstElement *provided_sink;
107 GstElement *active_sink;
114 MqStreamCtx *video_ctx;
116 GstClockTime max_in_running_time;
117 GstClockTime max_out_running_time;
119 GstClockTime muxed_out_time;
120 gsize muxed_out_bytes;
121 gboolean have_muxed_something;
123 GstClockTime mux_start_time;
124 gsize mux_start_bytes;
127 struct _GstSplitMuxSinkClass {
128 GstBinClass parent_class;
133 #endif /* __GST_SPLITMUXSINK_H__ */