1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
/*
* 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
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* 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>
* Jan Schmidt <thaytan@noraisin.net>
*/
#ifndef __GST_PS_DEMUX_H__
#define __GST_PS_DEMUX_H__
#include <gst/gst.h>
#include <gst/base/gstadapter.h>
#include <gst/base/gstflowcombiner.h>
#include "gstpesfilter.h"
G_BEGIN_DECLS
#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))
typedef struct _GstPsStream GstPsStream;
typedef struct _GstPsDemux GstPsDemux;
typedef struct _GstPsDemuxClass GstPsDemuxClass;
#define GST_PS_DEMUX_MAX_STREAMS 256
#define GST_PS_DEMUX_MAX_PSM 256
#define MAX_DVD_AUDIO_STREAMS 8
#define MAX_DVD_SUBPICTURE_STREAMS 32
typedef enum
{
GST_PS_DEMUX_SYNC_AUTO = 0,
GST_PS_DEMUX_SYNC_SCR = 1,
GST_PS_DEMUX_SYNC_DTS = 2
} GstPsDemuxSync;
typedef enum
{
STATE_PS_DEMUX_NEED_SYNC,
STATE_PS_DEMUX_SYNCED,
STATE_PS_DEMUX_NEED_MORE_DATA,
} GstPsDemuxState;
/* Information associated with a single FluPS stream. */
struct _GstPsStream
{
GstPad *pad;
gint id;
gint type;
GstClockTime segment_thresh;
GstClockTime last_ts;
gboolean discont;
gboolean notlinked;
gboolean need_segment;
GstTagList *pending_tags;
};
struct _GstPsDemux
{
GstElement parent;
GstPad *sinkpad;
gboolean random_access; /* If we operate in pull mode */
gboolean flushing;
gboolean have_group_id;
guint group_id;
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;
guint64 cur_scr_offset;
guint64 first_pts;
guint64 last_pts;
gint16 psm[GST_PS_DEMUX_MAX_PSM];
GstSegment sink_segment;
GstSegment src_segment;
guint32 segment_seqnum;
/* stream output */
GstPsStream *current_stream;
guint64 next_pts;
guint64 next_dts;
GstPsStream **streams;
GstPsStream **streams_found;
gint found_count;
gboolean need_no_more_pads;
GstFlowCombiner *flowcombiner;
/* Indicates an MPEG-2 stream */
gboolean is_mpeg2_pack;
/* properties */
gboolean ignore_scr;
};
struct _GstPsDemuxClass
{
GstElementClass parent_class;
GstPadTemplate *sink_template;
GstPadTemplate *video_template;
GstPadTemplate *audio_template;
GstPadTemplate *subpicture_template;
GstPadTemplate *private_template;
};
GType gst_ps_demux_get_type (void);
GST_ELEMENT_REGISTER_DECLARE (mpegpsdemux);
G_END_DECLS
#endif /* __GST_PS_DEMUX_H__ */
|