mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
tsdemux: Various code cleanup and dead code removal
This commit is contained in:
parent
4bc7cd04c1
commit
e6ff2f7b83
1 changed files with 15 additions and 47 deletions
|
@ -305,23 +305,6 @@ gst_ts_demux_class_init (GstTSDemuxClass * klass)
|
||||||
ts_class->flush = GST_DEBUG_FUNCPTR (gst_ts_demux_flush);
|
ts_class->flush = GST_DEBUG_FUNCPTR (gst_ts_demux_flush);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_ts_demux_init (GstTSDemux * demux, GstTSDemuxClass * klass)
|
|
||||||
{
|
|
||||||
demux->need_newsegment = TRUE;
|
|
||||||
demux->program_number = -1;
|
|
||||||
demux->duration = GST_CLOCK_TIME_NONE;
|
|
||||||
demux->pts_delta = GST_CLOCK_TIME_NONE;
|
|
||||||
GST_MPEGTS_BASE (demux)->stream_size = sizeof (TSDemuxStream);
|
|
||||||
gst_segment_init (&demux->segment, GST_FORMAT_TIME);
|
|
||||||
demux->first_pcr = (TSPcrOffset) {
|
|
||||||
GST_CLOCK_TIME_NONE, 0, 0};
|
|
||||||
demux->cur_pcr = (TSPcrOffset) {
|
|
||||||
0};
|
|
||||||
demux->last_pcr = (TSPcrOffset) {
|
|
||||||
0};
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_ts_demux_reset (MpegTSBase * base)
|
gst_ts_demux_reset (MpegTSBase * base)
|
||||||
{
|
{
|
||||||
|
@ -345,6 +328,14 @@ gst_ts_demux_reset (MpegTSBase * base)
|
||||||
0};
|
0};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_ts_demux_init (GstTSDemux * demux, GstTSDemuxClass * klass)
|
||||||
|
{
|
||||||
|
GST_MPEGTS_BASE (demux)->stream_size = sizeof (TSDemuxStream);
|
||||||
|
|
||||||
|
gst_ts_demux_reset ((MpegTSBase *) demux);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_ts_demux_set_property (GObject * object, guint prop_id,
|
gst_ts_demux_set_property (GObject * object, guint prop_id,
|
||||||
|
@ -477,12 +468,10 @@ gst_ts_demux_srcpad_query (GstPad * pad, GstQuery * query)
|
||||||
static inline GstClockTime
|
static inline GstClockTime
|
||||||
calculate_gsttime (TSPcrOffset * start, guint64 pcr)
|
calculate_gsttime (TSPcrOffset * start, guint64 pcr)
|
||||||
{
|
{
|
||||||
|
|
||||||
GstClockTime time = start->gsttime;
|
GstClockTime time = start->gsttime;
|
||||||
|
|
||||||
if (start->pcr > pcr)
|
if (start->pcr > pcr)
|
||||||
time += PCRTIME_TO_GSTTIME (PCR_MAX_VALUE - start->pcr) +
|
time += PCRTIME_TO_GSTTIME (PCR_MAX_VALUE - start->pcr + pcr);
|
||||||
PCRTIME_TO_GSTTIME (pcr);
|
|
||||||
else
|
else
|
||||||
time += PCRTIME_TO_GSTTIME (pcr - start->pcr);
|
time += PCRTIME_TO_GSTTIME (pcr - start->pcr);
|
||||||
|
|
||||||
|
@ -619,19 +608,12 @@ beach:
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
TSPcrOffset_find (gconstpointer a, gconstpointer b, gpointer user_data)
|
TSPcrOffset_find (TSPcrOffset * a, TSPcrOffset * b, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
if (a->gsttime < b->gsttime)
|
||||||
/* GST_INFO ("a: %" GST_TIME_FORMAT " offset: %" G_GINT64_FORMAT, */
|
|
||||||
/* GST_TIME_ARGS (((TSPcrOffset *) a)->gsttime), ((TSPcrOffset *) a)->offset); */
|
|
||||||
/* GST_INFO ("b: %" GST_TIME_FORMAT " offset: %" G_GINT64_FORMAT, */
|
|
||||||
/* GST_TIME_ARGS (((TSPcrOffset *) b)->gsttime), ((TSPcrOffset *) b)->offset); */
|
|
||||||
|
|
||||||
if (((TSPcrOffset *) a)->gsttime < ((TSPcrOffset *) b)->gsttime)
|
|
||||||
return -1;
|
return -1;
|
||||||
else if (((TSPcrOffset *) a)->gsttime > ((TSPcrOffset *) b)->gsttime)
|
if (a->gsttime > b->gsttime)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,8 +646,8 @@ gst_ts_demux_perform_seek (MpegTSBase * base, GstSegment * segment, guint16 pid)
|
||||||
|
|
||||||
/* get the first index entry before the seek position */
|
/* get the first index entry before the seek position */
|
||||||
tmp = gst_util_array_binary_search (demux->index->data, demux->index_size,
|
tmp = gst_util_array_binary_search (demux->index->data, demux->index_size,
|
||||||
sizeof (*tmp), TSPcrOffset_find, GST_SEARCH_MODE_BEFORE, &seekpcroffset,
|
sizeof (*tmp), (GCompareDataFunc) TSPcrOffset_find,
|
||||||
NULL);
|
GST_SEARCH_MODE_BEFORE, &seekpcroffset, NULL);
|
||||||
|
|
||||||
if (G_UNLIKELY (!tmp)) {
|
if (G_UNLIKELY (!tmp)) {
|
||||||
GST_ERROR ("value not found");
|
GST_ERROR ("value not found");
|
||||||
|
@ -1796,7 +1778,6 @@ process_pcr (MpegTSBase * base, guint64 initoff, TSPcrOffset * pcroffset,
|
||||||
|
|
||||||
gst_byte_reader_init_from_buffer (&br, buf);
|
gst_byte_reader_init_from_buffer (&br, buf);
|
||||||
|
|
||||||
offset = 0;
|
|
||||||
size = GST_BUFFER_SIZE (buf);
|
size = GST_BUFFER_SIZE (buf);
|
||||||
|
|
||||||
resync:
|
resync:
|
||||||
|
@ -2045,19 +2026,6 @@ calc_gsttime_from_pts (TSPcrOffset * start, guint64 pts)
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static gint
|
|
||||||
TSPcrOffset_find_offset (gconstpointer a, gconstpointer b, gpointer user_data)
|
|
||||||
{
|
|
||||||
if (((TSPcrOffset *) a)->offset < ((TSPcrOffset *) b)->offset)
|
|
||||||
return -1;
|
|
||||||
else if (((TSPcrOffset *) a)->offset > ((TSPcrOffset *) b)->offset)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream)
|
gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue