1 /* 2 * tsdemux - GStreamer MPEG transport stream demuxer 3 * Copyright (C) 2009 Zaheer Abbas Merali 4 * 2010 Edward Hervey 5 * 6 * Authors: 7 * Zaheer Abbas Merali <zaheerabbas at merali dot org> 8 * Edward Hervey <edward.hervey@collabora.co.uk> 9 * 10 * This library is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Library General Public 12 * License as published by the Free Software Foundation; either 13 * version 2 of the License, or (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Library General Public License for more details. 19 * 20 * You should have received a copy of the GNU Library General Public 21 * License along with this library; if not, write to the 22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 23 * Boston, MA 02110-1301, USA. 24 */ 25 26 27 #ifndef GST_TS_DEMUX_H 28 #define GST_TS_DEMUX_H 29 30 #include <gst/gst.h> 31 #include <gst/base/gstbytereader.h> 32 #include <gst/base/gstflowcombiner.h> 33 #include "mpegtsbase.h" 34 #include "mpegtspacketizer.h" 35 36 /* color specifications for JPEG 2000 stream over MPEG TS */ 37 typedef enum 38 { 39 GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_UNKNOWN, 40 GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_SRGB, 41 GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_REC601, 42 GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_REC709, 43 GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_CIELUV, 44 GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_CIEXYZ, 45 GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_REC2020, 46 GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_SMPTE2084 47 } GstMpegTsDemuxJpeg2000ColorSpec; 48 49 50 G_BEGIN_DECLS 51 #define GST_TYPE_TS_DEMUX \ 52 (gst_ts_demux_get_type()) 53 #define GST_TS_DEMUX(obj) \ 54 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TS_DEMUX,GstTSDemux)) 55 #define GST_TS_DEMUX_CLASS(klass) \ 56 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TS_DEMUX,GstTSDemuxClass)) 57 #define GST_IS_TS_DEMUX(obj) \ 58 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TS_DEMUX)) 59 #define GST_IS_TS_DEMUX_CLASS(klass) \ 60 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TS_DEMUX)) 61 #define GST_TS_DEMUX_GET_CLASS(obj) \ 62 (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TS_DEMUX, GstTSDemuxClass)) 63 #define GST_TS_DEMUX_CAST(obj) ((GstTSDemux*) obj) 64 typedef struct _GstTSDemux GstTSDemux; 65 typedef struct _GstTSDemuxClass GstTSDemuxClass; 66 67 struct _GstTSDemux 68 { 69 MpegTSBase parent; 70 71 gboolean have_group_id; 72 guint group_id; 73 74 /* the following vars must be protected with the OBJECT_LOCK as they can be 75 * accessed from the application thread and the streaming thread */ 76 gint requested_program_number; /* Required program number (ignore:-1) */ 77 guint program_number; 78 gboolean emit_statistics; 79 gboolean send_scte35_events; 80 gint latency; /* latency in ms */ 81 82 /*< private >*/ 83 gint program_generation; /* Incremented each time we switch program 0..15 */ 84 MpegTSBaseProgram *program; /* Current program */ 85 MpegTSBaseProgram *previous_program; /* Previous program, to deactivate once 86 * the new program becomes active */ 87 88 /* segments to be sent */ 89 GstEvent *segment_event; 90 gboolean reset_segment; 91 92 /* global taglist */ 93 GstTagList *global_tags; 94 95 /* Full stream duration */ 96 GstClockTime duration; 97 98 /* Pending seek rate (default 1.0) */ 99 gdouble rate; 100 101 GstFlowCombiner *flowcombiner; 102 103 /* Used when seeking for a keyframe to go backward in the stream */ 104 guint64 last_seek_offset; 105 106 /* The current difference between PES PTSs and our output running times, 107 * in the MPEG time domain. This is used for potentially updating 108 * SCTE 35 sections' pts_adjustment further down the line (eg mpegtsmux) */ 109 guint64 mpeg_pts_offset; 110 111 /* This is to protect demux->segment_event */ 112 GMutex lock; 113 }; 114 115 struct _GstTSDemuxClass 116 { 117 MpegTSBaseClass parent_class; 118 }; 119 120 G_GNUC_INTERNAL GType gst_ts_demux_get_type (void); 121 GST_ELEMENT_REGISTER_DECLARE (tsdemux); 122 123 G_END_DECLS 124 #endif /* GST_TS_DEMUX_H */ 125