1 /* 2 * mpegts_parse.h - GStreamer MPEG transport stream parser 3 * Copyright (C) 2007 Alessandro Decina 4 * 5 * Authors: 6 * Alessandro Decina <alessandro@nnva.org> 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Library General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Library General Public License for more details. 17 * 18 * You should have received a copy of the GNU Library General Public 19 * License along with this library; if not, write to the 20 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 21 * Boston, MA 02110-1301, USA. 22 */ 23 24 25 #ifndef GST_MPEG_TS_PARSE_H 26 #define GST_MPEG_TS_PARSE_H 27 28 #include <gst/gst.h> 29 #include <gst/base/gstflowcombiner.h> 30 #include "mpegtsbase.h" 31 #include "mpegtspacketizer.h" 32 33 G_BEGIN_DECLS 34 35 #define GST_TYPE_MPEGTS_PARSE \ 36 (mpegts_parse_get_type()) 37 #define GST_MPEGTS_PARSE(obj) \ 38 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MPEGTS_PARSE,MpegTSParse2)) 39 #define GST_MPEGTS_PARSE_CLASS(klass) \ 40 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MPEGTS_PARSE,MpegTSParse2Class)) 41 #define GST_IS_MPEGTS_PARSE(obj) \ 42 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MPEGTS_PARSE)) 43 #define GST_IS_MPEGTS_PARSE_CLASS(klass) \ 44 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPEGTS_PARSE)) 45 46 typedef struct _MpegTSParse2 MpegTSParse2; 47 typedef struct _MpegTSParse2Class MpegTSParse2Class; 48 49 typedef struct _MpegTSParse2Adapter { 50 GstAdapter *adapter; 51 guint packets_in_adapter; 52 gboolean first_is_keyframe; 53 } MpegTSParse2Adapter; 54 55 struct _MpegTSParse2 { 56 MpegTSBase parent; 57 58 gboolean have_group_id; 59 guint group_id; 60 61 GstClockTime smoothing_latency; 62 GstClockTime base_pcr; 63 GstClockTime ts_offset; 64 GstClockTime current_pcr; 65 gint user_pcr_pid; 66 gint pcr_pid; 67 68 /* Always present source pad */ 69 GstPad *srcpad; 70 71 /* Request source (single program) pads */ 72 GList *srcpads; 73 74 GstFlowCombiner *flowcombiner; 75 76 /* state */ 77 gboolean first; 78 gboolean set_timestamps; 79 80 /* Pending buffer state */ 81 GList *pending_buffers; 82 GstClockTime previous_pcr; 83 guint bytes_since_pcr; 84 85 /* Combine several packets into a larger buffer */ 86 MpegTSParse2Adapter ts_adapter; 87 guint alignment; 88 gboolean split_on_rai; 89 gboolean is_eos; 90 guint32 header; 91 }; 92 93 struct _MpegTSParse2Class { 94 MpegTSBaseClass parent_class; 95 }; 96 97 G_GNUC_INTERNAL GType mpegts_parse_get_type(void); 98 GST_ELEMENT_REGISTER_DECLARE (tsparse); 99 100 G_END_DECLS 101 102 #endif /* GST_MPEG_TS_PARSE_H */ 103