1 /* 2 * This library is licensed under 2 different licenses and you 3 * can choose to use it under the terms of either one of them. The 4 * two licenses are the MPL 1.1 and the LGPL. 5 * 6 * MPL: 7 * 8 * The contents of this file are subject to the Mozilla Public License 9 * Version 1.1 (the "License"); you may not use this file except in 10 * compliance with the License. You may obtain a copy of the License at 11 * http://www.mozilla.org/MPL/. 12 * 13 * Software distributed under the License is distributed on an "AS IS" 14 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 15 * License for the specific language governing rights and limitations 16 * under the License. 17 * 18 * LGPL: 19 * 20 * This library is free software; you can redistribute it and/or 21 * modify it under the terms of the GNU Library General Public 22 * License as published by the Free Software Foundation; either 23 * version 2 of the License, or (at your option) any later version. 24 * 25 * This library is distributed in the hope that it will be useful, 26 * but WITHOUT ANY WARRANTY; without even the implied warranty of 27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 28 * Library General Public License for more details. 29 * 30 * You should have received a copy of the GNU Library General Public 31 * License along with this library; if not, write to the 32 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 33 * Boston, MA 02110-1301, USA. 34 * 35 * The Original Code is Fluendo MPEG Demuxer plugin. 36 * 37 * The Initial Developer of the Original Code is Fluendo, S.L. 38 * Portions created by Fluendo, S.L. are Copyright (C) 2005 39 * Fluendo, S.L. All Rights Reserved. 40 * 41 * Contributor(s): Wim Taymans <wim@fluendo.com> 42 * Jan Schmidt <thaytan@noraisin.net> 43 */ 44 45 #ifndef __GST_FLUPS_DEMUX_H__ 46 #define __GST_FLUPS_DEMUX_H__ 47 48 #include <gst/gst.h> 49 #include <gst/base/gstadapter.h> 50 51 #include "gstpesfilter.h" 52 53 G_BEGIN_DECLS 54 55 #define GST_TYPE_FLUPS_DEMUX (gst_flups_demux_get_type()) 56 #define GST_FLUPS_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FLUPS_DEMUX,GstFluPSDemux)) 57 #define GST_FLUPS_DEMUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FLUPS_DEMUX,GstFluPSDemuxClass)) 58 #define GST_FLUPS_DEMUX_GET_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS((klass),GST_TYPE_FLUPS_DEMUX,GstFluPSDemuxClass)) 59 #define GST_IS_FLUPS_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FLUPS_DEMUX)) 60 #define GST_IS_FLUPS_DEMUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FLUPS_DEMUX)) 61 62 typedef struct _GstFluPSStream GstFluPSStream; 63 typedef struct _GstFluPSDemux GstFluPSDemux; 64 typedef struct _GstFluPSDemuxClass GstFluPSDemuxClass; 65 66 #define GST_FLUPS_DEMUX_MAX_STREAMS 256 67 #define GST_FLUPS_DEMUX_MAX_PSM 256 68 69 #define MAX_DVD_AUDIO_STREAMS 8 70 #define MAX_DVD_SUBPICTURE_STREAMS 32 71 72 typedef enum 73 { 74 STATE_FLUPS_DEMUX_NEED_SYNC, 75 STATE_FLUPS_DEMUX_SYNCED, 76 STATE_FLUPS_DEMUX_NEED_MORE_DATA, 77 } GstFluPSDemuxState; 78 79 /* Information associated with a single FluPS stream. */ 80 struct _GstFluPSStream 81 { 82 GstPad *pad; 83 84 gint id; 85 gint type; 86 87 GstClockTime segment_thresh; 88 GstClockTime last_ts; 89 GstFlowReturn last_flow; 90 91 gboolean discont; 92 gboolean notlinked; 93 gboolean need_segment; 94 95 GstTagList *pending_tags; 96 }; 97 98 struct _GstFluPSDemux 99 { 100 GstElement parent; 101 102 GstPad *sinkpad; 103 gboolean random_access; /* If we operate in pull mode */ 104 gboolean in_still; 105 106 gboolean have_group_id; 107 guint group_id; 108 109 GstAdapter *adapter; 110 GstAdapter *rev_adapter; 111 guint64 adapter_offset; 112 guint32 last_sync_code; 113 GstPESFilter filter; 114 115 gint64 mux_rate; 116 guint64 first_scr; 117 guint64 first_dts; 118 guint64 base_time; 119 guint64 current_scr; 120 guint64 next_scr; 121 guint64 bytes_since_scr; 122 gint64 scr_adjust; 123 guint64 scr_rate_n; 124 guint64 scr_rate_d; 125 guint64 first_scr_offset; 126 guint64 cur_scr_offset; 127 128 gint16 psm[GST_FLUPS_DEMUX_MAX_PSM]; 129 130 GstSegment sink_segment; 131 GstSegment src_segment; 132 133 /* stream output */ 134 GstFluPSStream *current_stream; 135 guint64 next_pts; 136 guint64 next_dts; 137 GstFluPSStream **streams; 138 GstFluPSStream **streams_found; 139 gint found_count; 140 gboolean need_no_more_pads; 141 142 /* Indicates an MPEG-2 stream */ 143 gboolean is_mpeg2_pack; 144 145 /* DVD-specific stream handling */ 146 gboolean disable_stream_creation; 147 gint audio_stream_map[MAX_DVD_AUDIO_STREAMS]; 148 }; 149 150 struct _GstFluPSDemuxClass 151 { 152 GstElementClass parent_class; 153 154 GstPadTemplate *sink_template; 155 GstPadTemplate *video_template; 156 GstPadTemplate *audio_template; 157 GstPadTemplate *subpicture_template; 158 GstPadTemplate *private_template; 159 }; 160 161 GType gst_flups_demux_get_type (void); 162 163 gboolean gst_flups_demux_plugin_init (GstPlugin *plugin); 164 165 G_END_DECLS 166 #endif /* __GST_FLUPS_DEMUX_H__ */ 167