2008-09-02 12:04:32 +00:00
|
|
|
/*
|
|
|
|
* This library is licensed under 2 different licenses and you
|
|
|
|
* can choose to use it under the terms of either one of them. The
|
|
|
|
* two licenses are the MPL 1.1 and the LGPL.
|
|
|
|
*
|
|
|
|
* MPL:
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/.
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS"
|
|
|
|
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing rights and limitations
|
|
|
|
* under the License.
|
|
|
|
*
|
|
|
|
* LGPL:
|
|
|
|
*
|
|
|
|
* 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.
|
2008-09-02 12:04:32 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Fluendo MPEG Demuxer plugin.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Fluendo, S.L.
|
|
|
|
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
|
|
|
* Fluendo, S.L. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Wim Taymans <wim@fluendo.com>
|
2012-08-31 00:51:50 +00:00
|
|
|
* Jan Schmidt <thaytan@noraisin.net>
|
2008-09-02 12:04:32 +00:00
|
|
|
*/
|
|
|
|
|
2013-09-02 22:36:43 +00:00
|
|
|
#ifndef __GST_PS_DEMUX_H__
|
|
|
|
#define __GST_PS_DEMUX_H__
|
2008-09-02 12:04:32 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/base/gstadapter.h>
|
2014-05-26 20:18:01 +00:00
|
|
|
#include <gst/base/gstflowcombiner.h>
|
2008-09-02 12:04:32 +00:00
|
|
|
|
|
|
|
#include "gstpesfilter.h"
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
2012-08-31 00:51:50 +00:00
|
|
|
|
2013-09-02 22:36:43 +00:00
|
|
|
#define GST_TYPE_PS_DEMUX (gst_ps_demux_get_type())
|
|
|
|
#define GST_PS_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PS_DEMUX,GstPsDemux))
|
|
|
|
#define GST_PS_DEMUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PS_DEMUX,GstPsDemuxClass))
|
|
|
|
#define GST_PS_DEMUX_GET_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS((klass),GST_TYPE_PS_DEMUX,GstPsDemuxClass))
|
|
|
|
#define GST_IS_PS_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PS_DEMUX))
|
|
|
|
#define GST_IS_PS_DEMUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PS_DEMUX))
|
2012-08-31 00:51:50 +00:00
|
|
|
|
2013-09-02 22:36:43 +00:00
|
|
|
typedef struct _GstPsStream GstPsStream;
|
|
|
|
typedef struct _GstPsDemux GstPsDemux;
|
|
|
|
typedef struct _GstPsDemuxClass GstPsDemuxClass;
|
2008-09-02 12:04:32 +00:00
|
|
|
|
2013-09-02 22:36:43 +00:00
|
|
|
#define GST_PS_DEMUX_MAX_STREAMS 256
|
|
|
|
#define GST_PS_DEMUX_MAX_PSM 256
|
2008-09-02 12:04:32 +00:00
|
|
|
|
2014-01-16 09:14:48 +00:00
|
|
|
#define MAX_DVD_AUDIO_STREAMS 8
|
|
|
|
#define MAX_DVD_SUBPICTURE_STREAMS 32
|
|
|
|
|
2009-02-02 22:12:07 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2013-09-02 22:36:43 +00:00
|
|
|
GST_PS_DEMUX_SYNC_AUTO = 0,
|
|
|
|
GST_PS_DEMUX_SYNC_SCR = 1,
|
|
|
|
GST_PS_DEMUX_SYNC_DTS = 2
|
|
|
|
} GstPsDemuxSync;
|
2008-09-02 12:04:32 +00:00
|
|
|
|
2009-02-02 22:12:07 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2013-09-02 22:36:43 +00:00
|
|
|
STATE_PS_DEMUX_NEED_SYNC,
|
|
|
|
STATE_PS_DEMUX_SYNCED,
|
|
|
|
STATE_PS_DEMUX_NEED_MORE_DATA,
|
|
|
|
} GstPsDemuxState;
|
2008-09-02 12:04:32 +00:00
|
|
|
|
|
|
|
/* Information associated with a single FluPS stream. */
|
2013-09-02 22:36:43 +00:00
|
|
|
struct _GstPsStream
|
2009-02-02 22:12:07 +00:00
|
|
|
{
|
|
|
|
GstPad *pad;
|
2008-09-02 12:04:32 +00:00
|
|
|
|
2009-02-02 22:12:07 +00:00
|
|
|
gint id;
|
|
|
|
gint type;
|
2008-09-02 12:04:32 +00:00
|
|
|
|
2009-05-21 10:13:54 +00:00
|
|
|
GstClockTime segment_thresh;
|
|
|
|
GstClockTime last_ts;
|
|
|
|
|
2009-02-02 22:12:07 +00:00
|
|
|
gboolean discont;
|
|
|
|
gboolean notlinked;
|
|
|
|
gboolean need_segment;
|
2012-10-12 20:33:27 +00:00
|
|
|
|
|
|
|
GstTagList *pending_tags;
|
2008-09-02 12:04:32 +00:00
|
|
|
};
|
|
|
|
|
2013-09-02 22:36:43 +00:00
|
|
|
struct _GstPsDemux
|
2009-02-02 22:12:07 +00:00
|
|
|
{
|
|
|
|
GstElement parent;
|
|
|
|
|
|
|
|
GstPad *sinkpad;
|
|
|
|
gboolean random_access; /* If we operate in pull mode */
|
2009-08-07 16:17:28 +00:00
|
|
|
gboolean flushing;
|
2009-02-02 22:12:07 +00:00
|
|
|
|
2013-07-23 08:15:58 +00:00
|
|
|
gboolean have_group_id;
|
|
|
|
guint group_id;
|
|
|
|
|
2009-02-02 22:12:07 +00:00
|
|
|
GstAdapter *adapter;
|
|
|
|
GstAdapter *rev_adapter;
|
|
|
|
guint64 adapter_offset;
|
|
|
|
guint32 last_sync_code;
|
|
|
|
GstPESFilter filter;
|
|
|
|
|
|
|
|
gint64 mux_rate;
|
|
|
|
guint64 first_scr;
|
|
|
|
guint64 last_scr;
|
|
|
|
guint64 first_dts;
|
|
|
|
guint64 base_time;
|
|
|
|
guint64 current_scr;
|
|
|
|
guint64 next_scr;
|
|
|
|
guint64 bytes_since_scr;
|
|
|
|
gint64 scr_adjust;
|
|
|
|
guint64 scr_rate_n;
|
|
|
|
guint64 scr_rate_d;
|
|
|
|
guint64 first_scr_offset;
|
|
|
|
guint64 last_scr_offset;
|
2009-02-04 15:11:23 +00:00
|
|
|
guint64 cur_scr_offset;
|
2009-02-02 22:12:07 +00:00
|
|
|
|
|
|
|
guint64 first_pts;
|
|
|
|
guint64 last_pts;
|
|
|
|
|
2013-09-02 22:36:43 +00:00
|
|
|
gint16 psm[GST_PS_DEMUX_MAX_PSM];
|
2009-02-02 22:12:07 +00:00
|
|
|
|
|
|
|
GstSegment sink_segment;
|
|
|
|
GstSegment src_segment;
|
2021-03-03 13:11:21 +00:00
|
|
|
guint32 segment_seqnum;
|
2008-09-02 12:04:32 +00:00
|
|
|
|
|
|
|
/* stream output */
|
2013-09-02 22:36:43 +00:00
|
|
|
GstPsStream *current_stream;
|
2009-02-02 22:12:07 +00:00
|
|
|
guint64 next_pts;
|
|
|
|
guint64 next_dts;
|
2013-09-02 22:36:43 +00:00
|
|
|
GstPsStream **streams;
|
|
|
|
GstPsStream **streams_found;
|
2009-08-07 16:17:28 +00:00
|
|
|
gint found_count;
|
2009-02-02 22:12:07 +00:00
|
|
|
gboolean need_no_more_pads;
|
2008-09-02 12:04:32 +00:00
|
|
|
|
2014-05-26 20:18:01 +00:00
|
|
|
GstFlowCombiner *flowcombiner;
|
|
|
|
|
2008-09-02 12:04:32 +00:00
|
|
|
/* Indicates an MPEG-2 stream */
|
|
|
|
gboolean is_mpeg2_pack;
|
2020-03-11 08:18:56 +00:00
|
|
|
|
|
|
|
/* properties */
|
|
|
|
gboolean ignore_scr;
|
2008-09-02 12:04:32 +00:00
|
|
|
};
|
|
|
|
|
2013-09-02 22:36:43 +00:00
|
|
|
struct _GstPsDemuxClass
|
2009-02-02 22:12:07 +00:00
|
|
|
{
|
2008-09-02 12:04:32 +00:00
|
|
|
GstElementClass parent_class;
|
|
|
|
|
|
|
|
GstPadTemplate *sink_template;
|
|
|
|
GstPadTemplate *video_template;
|
|
|
|
GstPadTemplate *audio_template;
|
2009-05-20 23:41:47 +00:00
|
|
|
GstPadTemplate *subpicture_template;
|
2008-09-02 12:04:32 +00:00
|
|
|
GstPadTemplate *private_template;
|
|
|
|
};
|
|
|
|
|
2013-09-02 22:36:43 +00:00
|
|
|
GType gst_ps_demux_get_type (void);
|
2021-02-25 14:22:15 +00:00
|
|
|
GST_ELEMENT_REGISTER_DECLARE (mpegpsdemux);
|
2008-09-02 12:04:32 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
2013-09-02 22:36:43 +00:00
|
|
|
#endif /* __GST_PS_DEMUX_H__ */
|