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
51 GstClockTimeDiff run_ts;
55 typedef struct _MqStreamCtx
59 GstSplitMuxSink *splitmux;
61 guint sink_pad_block_id;
62 guint src_pad_block_id;
64 gboolean is_reference;
70 GstSegment in_segment;
71 GstSegment out_segment;
73 GstClockTimeDiff in_running_time;
74 GstClockTimeDiff out_running_time;
86 struct _GstSplitMuxSink {
95 GstClockTime threshold_time;
96 guint64 threshold_bytes;
105 GstElement *provided_muxer;
107 GstElement *provided_sink;
108 GstElement *active_sink;
115 MqStreamCtx *reference_ctx;
117 GstClockTimeDiff max_in_running_time;
118 GstClockTimeDiff max_out_running_time;
120 GstClockTimeDiff muxed_out_time;
121 gsize muxed_out_bytes;
122 gboolean have_muxed_something;
124 GstClockTimeDiff mux_start_time;
125 gsize mux_start_bytes;
127 gboolean opening_first_fragment;
128 gboolean switching_fragment;
131 struct _GstSplitMuxSinkClass {
132 GstBinClass parent_class;
137 #endif /* __GST_SPLITMUXSINK_H__ */