summaryrefslogtreecommitdiffstats
path: root/gst/mpegdemux/gstmpegtsdemux.h
diff options
context:
space:
mode:
authorZaheer Merali <zaheerabbas@merali.org>2009-05-08 18:24:28 +0100
committerZaheer Merali <zaheerabbas@merali.org>2009-05-08 18:26:43 +0100
commitff7b54e7da95a401665f8d7ae922155a32edac91 (patch)
treeb121ff924beecc87bb0f7a4b3e361504082a1400 /gst/mpegdemux/gstmpegtsdemux.h
parente8504019d88878bc6b40b270319d3db03edf4e81 (diff)
downloadgst-plugins-bad-ff7b54e7da95a401665f8d7ae922155a32edac91.tar.gz
gst-plugins-bad-ff7b54e7da95a401665f8d7ae922155a32edac91.tar.bz2
gst-plugins-bad-ff7b54e7da95a401665f8d7ae922155a32edac91.zip
mpegtsdemux: Add initial naive seeking support and fix duration query.
Sync from gst-fluendo-mpegdemux and have seeking/duration query improvements in. No support however for wrapped around pcrs etc. but a start nonetheless. Also fix indentation issues.
Diffstat (limited to 'gst/mpegdemux/gstmpegtsdemux.h')
-rw-r--r--gst/mpegdemux/gstmpegtsdemux.h186
1 files changed, 98 insertions, 88 deletions
diff --git a/gst/mpegdemux/gstmpegtsdemux.h b/gst/mpegdemux/gstmpegtsdemux.h
index 8a4ca3d2..c4a907a5 100644
--- a/gst/mpegdemux/gstmpegtsdemux.h
+++ b/gst/mpegdemux/gstmpegtsdemux.h
@@ -34,9 +34,9 @@
*
* 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.
+ * The Initial Developer of the Original Code is Fluendo, S.A.
+ * Portions created by Fluendo, S.A. are Copyright (C) 2005,2006,2007,2008,2009
+ * Fluendo, S.A. All Rights Reserved.
*
* Contributor(s): Wim Taymans <wim@fluendo.com>
*/
@@ -52,18 +52,14 @@
#include "gstsectionfilter.h"
G_BEGIN_DECLS
-
#define MPEGTS_MIN_PES_BUFFER_SIZE 4 * 1024
#define MPEGTS_MAX_PES_BUFFER_SIZE 256 * 1024
-
#define MPEGTS_MAX_PID 0x1fff
#define MPEGTS_NORMAL_TS_PACKETSIZE 188
#define MPEGTS_M2TS_TS_PACKETSIZE 192
-
#define IS_MPEGTS_SYNC(data) (((data)[0] == 0x47) && \
(((data)[1] & 0x80) == 0x00) && \
(((data)[3] & 0x10) == 0x10))
-
#define GST_TYPE_MPEGTS_DEMUX (gst_mpegts_demux_get_type())
#define GST_MPEGTS_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
GST_TYPE_MPEGTS_DEMUX,GstMpegTSDemux))
@@ -75,7 +71,6 @@ G_BEGIN_DECLS
GST_TYPE_MPEGTS_DEMUX))
#define GST_IS_MPEGTS_DEMUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),\
GST_TYPE_MPEGTS_DEMUX))
-
typedef struct _GstMpegTSStream GstMpegTSStream;
typedef struct _GstMpegTSPMTEntry GstMpegTSPMTEntry;
typedef struct _GstMpegTSPMT GstMpegTSPMT;
@@ -84,142 +79,157 @@ typedef struct _GstMpegTSPAT GstMpegTSPAT;
typedef struct _GstMpegTSDemux GstMpegTSDemux;
typedef struct _GstMpegTSDemuxClass GstMpegTSDemuxClass;
-struct _GstMpegTSPMTEntry {
- guint16 PID;
+struct _GstMpegTSPMTEntry
+{
+ guint16 PID;
};
-struct _GstMpegTSPMT {
- guint16 program_number;
- guint8 version_number;
- gboolean current_next_indicator;
- guint8 section_number;
- guint8 last_section_number;
- guint16 PCR_PID;
- guint16 program_info_length;
- GstMPEGDescriptor * program_info;
-
- GArray * entries;
+struct _GstMpegTSPMT
+{
+ guint16 program_number;
+ guint8 version_number;
+ gboolean current_next_indicator;
+ guint8 section_number;
+ guint8 last_section_number;
+ guint16 PCR_PID;
+ guint16 program_info_length;
+ GstMPEGDescriptor *program_info;
+
+ GArray *entries;
};
-struct _GstMpegTSPATEntry {
- guint16 program_number;
- guint16 PID;
+struct _GstMpegTSPATEntry
+{
+ guint16 program_number;
+ guint16 PID;
};
-struct _GstMpegTSPAT {
- guint16 transport_stream_id;
- guint8 version_number;
- gboolean current_next_indicator;
- guint8 section_number;
- guint8 last_section_number;
+struct _GstMpegTSPAT
+{
+ guint16 transport_stream_id;
+ guint8 version_number;
+ gboolean current_next_indicator;
+ guint8 section_number;
+ guint8 last_section_number;
- GArray * entries;
+ GArray *entries;
};
-typedef enum _MpegTsStreamFlags {
+typedef enum _MpegTsStreamFlags
+{
MPEGTS_STREAM_FLAG_STREAM_TYPE_UNKNOWN = 0x01,
MPEGTS_STREAM_FLAG_PMT_VALID = 0x02,
- MPEGTS_STREAM_FLAG_IS_VIDEO = 0x04
+ MPEGTS_STREAM_FLAG_IS_VIDEO = 0x04
} MpegTsStreamFlags;
/* Information associated to a single MPEG stream. */
-struct _GstMpegTSStream {
- GstMpegTSDemux * demux;
+struct _GstMpegTSStream
+{
+ GstMpegTSDemux *demux;
- MpegTsStreamFlags flags;
+ MpegTsStreamFlags flags;
/* PID and type */
- guint16 PID;
- guint8 PID_type;
+ guint16 PID;
+ guint8 PID_type;
/* adaptation_field data */
- guint64 last_PCR;
- guint64 base_PCR;
- guint64 last_OPCR;
- guint64 last_PCR_difference;
- gboolean discont_PCR;
- GstClockTimeDiff discont_difference;
+ guint64 last_PCR;
+ guint64 base_PCR;
+ guint64 last_OPCR;
+ guint64 last_PCR_difference;
+ gboolean discont_PCR;
+ GstClockTimeDiff discont_difference;
/* for PAT streams */
- GstMpegTSPAT PAT;
+ GstMpegTSPAT PAT;
/* for PMT streams */
- GstMpegTSPMT PMT;
+ GstMpegTSPMT PMT;
/* for CA streams */
/* for PAT, PMT, CA and private streams */
- GstSectionFilter section_filter;
+ GstSectionFilter section_filter;
/* for PES streams */
- guint8 id;
- guint8 stream_type;
- GstBuffer * pes_buffer;
- guint32 pes_buffer_size;
- guint32 pes_buffer_used;
- gboolean pes_buffer_overflow;
- gboolean pes_buffer_in_sync;
- GstPESFilter filter;
- GstPad * pad;
- GstFlowReturn last_ret;
+ guint8 id;
+ guint8 stream_type;
+ GstBuffer *pes_buffer;
+ guint32 pes_buffer_size;
+ guint32 pes_buffer_used;
+ gboolean pes_buffer_overflow;
+ gboolean pes_buffer_in_sync;
+ GstPESFilter filter;
+ GstPad *pad;
+ GstFlowReturn last_ret;
GstMPEGDescriptor *ES_info;
/* needed because 33bit mpeg timestamps wrap around every (approx) 26.5 hrs */
- GstClockTimeDiff base_time;
- GstClockTime last_time;
+ GstClockTimeDiff base_time;
+ GstClockTime last_time;
/* pid of PMT that this stream belongs to */
- guint16 PMT_pid;
+ guint16 PMT_pid;
};
-struct _GstMpegTSDemux {
- GstElement parent;
+struct _GstMpegTSDemux
+{
+ GstElement parent;
/* properties */
- gboolean check_crc;
+ gboolean check_crc;
/* sink pad and adapter */
- GstPad * sinkpad;
- GstAdapter * adapter;
- guint8 ** sync_lut;
- guint sync_lut_len;
+ GstPad *sinkpad;
+ GstAdapter *adapter;
+ guint8 **sync_lut;
+ guint sync_lut_len;
/* current PMT PID */
- guint16 current_PMT;
+ guint16 current_PMT;
/* Array of MPEGTS_MAX_PID + 1 stream entries */
- GstMpegTSStream ** streams;
+ GstMpegTSStream **streams;
/* Array to perform pmts checks at gst_mpegts_demux_parse_adaptation_field */
- gboolean pmts_checked[MPEGTS_MAX_PID + 1];
-
+ gboolean pmts_checked[MPEGTS_MAX_PID + 1];
+
/* Array of Elementary Stream pids for ts with PMT */
- guint16 * elementary_pids;
- guint nb_elementary_pids;
+ guint16 *elementary_pids;
+ guint nb_elementary_pids;
/* Program number to use */
- gint program_number;
+ gint program_number;
/* indicates that we need to close our pad group, because we've added
* at least one pad */
- gboolean need_no_more_pads;
- guint16 packetsize;
- gboolean m2ts_mode;
+ gboolean need_no_more_pads;
+ guint16 packetsize;
+ gboolean m2ts_mode;
/* clocking */
- GstClock * clock;
- GstClockTime clock_base;
+ GstClock *clock;
+ GstClockTime clock_base;
+ /* Additional information required for seeking */
+ guint64 num_packets;
+ gint64 bitrate;
+ /* Two PCRs observations to calculate bitrate */
+ gint64 pcr[2];
+ GstClockTime cache_duration;
+ /* Cached base_PCR in GStreamer time. */
+ GstClockTime base_pts;
};
-struct _GstMpegTSDemuxClass {
- GstElementClass parent_class;
+struct _GstMpegTSDemuxClass
+{
+ GstElementClass parent_class;
- GstPadTemplate * sink_template;
- GstPadTemplate * video_template;
- GstPadTemplate * audio_template;
- GstPadTemplate * private_template;
+ GstPadTemplate *sink_template;
+ GstPadTemplate *video_template;
+ GstPadTemplate *audio_template;
+ GstPadTemplate *private_template;
};
-GType gst_mpegts_demux_get_type (void);
+GType gst_mpegts_demux_get_type (void);
-gboolean gst_mpegts_demux_plugin_init (GstPlugin *plugin);
+gboolean gst_mpegts_demux_plugin_init (GstPlugin * plugin);
G_END_DECLS
-
#endif /* __GST_MPEGTS_DEMUX_H__ */