2011-02-16 16:57:42 +00:00
|
|
|
/*
|
|
|
|
* tsdemux - GStreamer MPEG transport stream demuxer
|
|
|
|
* Copyright (C) 2009 Zaheer Abbas Merali
|
|
|
|
* 2010 Edward Hervey
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
|
|
|
* Edward Hervey <edward.hervey@collabora.co.uk>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2011-02-16 16:57:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef GST_TS_DEMUX_H
|
|
|
|
#define GST_TS_DEMUX_H
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/base/gstbytereader.h>
|
2014-05-23 21:26:57 +00:00
|
|
|
#include <gst/base/gstflowcombiner.h>
|
2011-02-16 16:57:42 +00:00
|
|
|
#include "mpegtsbase.h"
|
|
|
|
#include "mpegtspacketizer.h"
|
|
|
|
|
2017-07-19 14:14:21 +00:00
|
|
|
/* color specifications for JPEG 2000 stream over MPEG TS */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_UNKNOWN,
|
|
|
|
GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_SRGB,
|
|
|
|
GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_REC601,
|
|
|
|
GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_REC709,
|
|
|
|
GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_CIELUV,
|
|
|
|
GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_CIEXYZ,
|
|
|
|
GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_REC2020,
|
|
|
|
GST_MPEGTSDEMUX_JPEG2000_COLORSPEC_SMPTE2084
|
|
|
|
} GstMpegTsDemuxJpeg2000ColorSpec;
|
|
|
|
|
|
|
|
|
2011-02-16 16:57:42 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define GST_TYPE_TS_DEMUX \
|
|
|
|
(gst_ts_demux_get_type())
|
|
|
|
#define GST_TS_DEMUX(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TS_DEMUX,GstTSDemux))
|
|
|
|
#define GST_TS_DEMUX_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TS_DEMUX,GstTSDemuxClass))
|
|
|
|
#define GST_IS_TS_DEMUX(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TS_DEMUX))
|
|
|
|
#define GST_IS_TS_DEMUX_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TS_DEMUX))
|
|
|
|
#define GST_TS_DEMUX_GET_CLASS(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TS_DEMUX, GstTSDemuxClass))
|
|
|
|
#define GST_TS_DEMUX_CAST(obj) ((GstTSDemux*) obj)
|
|
|
|
typedef struct _GstTSDemux GstTSDemux;
|
|
|
|
typedef struct _GstTSDemuxClass GstTSDemuxClass;
|
|
|
|
|
|
|
|
struct _GstTSDemux
|
|
|
|
{
|
|
|
|
MpegTSBase parent;
|
|
|
|
|
2013-07-23 08:24:22 +00:00
|
|
|
gboolean have_group_id;
|
|
|
|
guint group_id;
|
|
|
|
|
2011-02-16 16:57:42 +00:00
|
|
|
/* the following vars must be protected with the OBJECT_LOCK as they can be
|
|
|
|
* accessed from the application thread and the streaming thread */
|
2013-03-09 23:07:40 +00:00
|
|
|
gint requested_program_number; /* Required program number (ignore:-1) */
|
|
|
|
guint program_number;
|
2011-02-16 16:57:42 +00:00
|
|
|
gboolean emit_statistics;
|
2021-04-05 22:36:43 +00:00
|
|
|
gboolean send_scte35_events;
|
2019-08-23 21:55:00 +00:00
|
|
|
gint latency; /* latency in ms */
|
2011-02-16 16:57:42 +00:00
|
|
|
|
|
|
|
/*< private >*/
|
2015-09-22 16:51:57 +00:00
|
|
|
gint program_generation; /* Incremented each time we switch program 0..15 */
|
2011-02-16 16:57:42 +00:00
|
|
|
MpegTSBaseProgram *program; /* Current program */
|
2015-09-10 12:55:05 +00:00
|
|
|
MpegTSBaseProgram *previous_program; /* Previous program, to deactivate once
|
|
|
|
* the new program becomes active */
|
2012-02-29 09:33:00 +00:00
|
|
|
|
2012-03-01 17:05:17 +00:00
|
|
|
/* segments to be sent */
|
|
|
|
GstEvent *segment_event;
|
2015-02-09 14:21:35 +00:00
|
|
|
gboolean reset_segment;
|
2012-03-01 17:05:17 +00:00
|
|
|
|
2014-02-25 01:43:56 +00:00
|
|
|
/* global taglist */
|
|
|
|
GstTagList *global_tags;
|
|
|
|
|
2012-03-01 17:05:17 +00:00
|
|
|
/* Full stream duration */
|
|
|
|
GstClockTime duration;
|
2013-07-24 13:50:14 +00:00
|
|
|
|
|
|
|
/* Pending seek rate (default 1.0) */
|
|
|
|
gdouble rate;
|
2014-05-23 21:26:57 +00:00
|
|
|
|
|
|
|
GstFlowCombiner *flowcombiner;
|
2014-05-30 14:52:09 +00:00
|
|
|
|
|
|
|
/* Used when seeking for a keyframe to go backward in the stream */
|
|
|
|
guint64 last_seek_offset;
|
2021-04-22 23:15:08 +00:00
|
|
|
|
|
|
|
/* The current difference between PES PTSs and our output running times,
|
|
|
|
* in the MPEG time domain. This is used for potentially updating
|
|
|
|
* SCTE 35 sections' pts_adjustment further down the line (eg mpegtsmux) */
|
|
|
|
guint64 mpeg_pts_offset;
|
2021-04-05 07:28:51 +00:00
|
|
|
|
2021-04-05 07:29:37 +00:00
|
|
|
/* This is to protect demux->segment_event */
|
2021-04-05 07:28:51 +00:00
|
|
|
GMutex lock;
|
2011-02-16 16:57:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstTSDemuxClass
|
|
|
|
{
|
|
|
|
MpegTSBaseClass parent_class;
|
|
|
|
};
|
|
|
|
|
2012-07-13 14:22:11 +00:00
|
|
|
G_GNUC_INTERNAL GType gst_ts_demux_get_type (void);
|
2021-02-25 14:22:15 +00:00
|
|
|
GST_ELEMENT_REGISTER_DECLARE (tsdemux);
|
2011-02-16 16:57:42 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* GST_TS_DEMUX_H */
|