Lines Matching refs:pcr
57 MpegTSPCR * pcr, guint64 pcrtime, GstClockTime time);
60 guint64 pcr, guint64 offset);
334 guint64 pcr, pcr_ext; in mpegts_packetizer_compute_pcr() local
338 pcr = ((guint64) pcr1) << 1; in mpegts_packetizer_compute_pcr()
339 pcr |= (pcr2 & 0x8000) >> 15; in mpegts_packetizer_compute_pcr()
341 return pcr * 300 + pcr_ext % 300; in mpegts_packetizer_compute_pcr()
416 packet->pcr = mpegts_packetizer_compute_pcr (data); in mpegts_packetizer_parse_adaptation_field_control()
419 ") offset:%" G_GUINT64_FORMAT, packet->pid, packet->pcr, in mpegts_packetizer_parse_adaptation_field_control()
420 GST_TIME_ARGS (PCRTIME_TO_GSTTIME (packet->pcr)), packet->offset); in mpegts_packetizer_parse_adaptation_field_control()
426 calculate_skew (packetizer, pcrtable, packet->pcr, in mpegts_packetizer_parse_adaptation_field_control()
432 record_pcr (packetizer, pcrtable, packet->pcr, packet->offset); in mpegts_packetizer_parse_adaptation_field_control()
505 packet->pcr = G_MAXUINT64; in mpegts_packetizer_parse_packet()
1260 mpegts_packetizer_resync (MpegTSPCR * pcr, GstClockTime time, in mpegts_packetizer_resync() argument
1263 pcr->base_time = time; in mpegts_packetizer_resync()
1264 pcr->base_pcrtime = gstpcrtime; in mpegts_packetizer_resync()
1265 pcr->prev_out_time = GST_CLOCK_TIME_NONE; in mpegts_packetizer_resync()
1266 pcr->prev_send_diff = GST_CLOCK_TIME_NONE; in mpegts_packetizer_resync()
1268 pcr->window_filling = TRUE; in mpegts_packetizer_resync()
1269 pcr->window_pos = 0; in mpegts_packetizer_resync()
1270 pcr->window_min = 0; in mpegts_packetizer_resync()
1271 pcr->window_size = 0; in mpegts_packetizer_resync()
1272 pcr->skew = 0; in mpegts_packetizer_resync()
1343 MpegTSPCR * pcr, guint64 pcrtime, GstClockTime time) in calculate_skew() argument
1354 gstpcrtime = PCRTIME_TO_GSTTIME (pcrtime) + pcr->pcroffset; in calculate_skew()
1357 if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (pcr->base_time))) { in calculate_skew()
1358 pcr->base_time = time; in calculate_skew()
1359 pcr->prev_out_time = GST_CLOCK_TIME_NONE; in calculate_skew()
1363 if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (pcr->base_pcrtime))) { in calculate_skew()
1364 pcr->base_pcrtime = gstpcrtime; in calculate_skew()
1365 pcr->prev_send_diff = -1; in calculate_skew()
1371 if (GST_CLOCK_TIME_IS_VALID (pcr->last_pcrtime) && in calculate_skew()
1372 gstpcrtime < pcr->last_pcrtime) { in calculate_skew()
1373 if (pcr->last_pcrtime - gstpcrtime > PCR_GST_MAX_VALUE / 2) { in calculate_skew()
1376 pcr->pcroffset += PCR_GST_MAX_VALUE; in calculate_skew()
1377 gstpcrtime = PCRTIME_TO_GSTTIME (pcrtime) + pcr->pcroffset; in calculate_skew()
1378 send_diff = gstpcrtime - pcr->base_pcrtime; in calculate_skew()
1380 && pcr->last_pcrtime - gstpcrtime > 15 * GST_SECOND) { in calculate_skew()
1402 pcr->pcroffset += time - pcr->base_time + pcr->base_pcrtime - gstpcrtime; in calculate_skew()
1403 gstpcrtime = PCRTIME_TO_GSTTIME (pcrtime) + pcr->pcroffset; in calculate_skew()
1404 send_diff = gstpcrtime - pcr->base_pcrtime; in calculate_skew()
1407 GST_TIME_ARGS (pcr->pcroffset), GST_TIME_ARGS (gstpcrtime)); in calculate_skew()
1416 if (time == pcr->base_time) { in calculate_skew()
1424 } else if (pcr->last_pcrtime - gstpcrtime < GST_SECOND) { in calculate_skew()
1435 pcr->base_pcrtime = GST_CLOCK_TIME_NONE; in calculate_skew()
1439 send_diff = gstpcrtime - pcr->base_pcrtime; in calculate_skew()
1444 GST_TIME_ARGS (pcr->base_pcrtime), GST_TIME_ARGS (send_diff)); in calculate_skew()
1447 pcr->last_pcrtime = gstpcrtime; in calculate_skew()
1452 || !GST_CLOCK_TIME_IS_VALID (pcr->base_time)) in calculate_skew()
1456 recv_diff = time - pcr->base_time; in calculate_skew()
1459 if (G_UNLIKELY (time == pcr->prev_in_time in calculate_skew()
1460 && GST_CLOCK_TIME_IS_VALID (pcr->prev_in_time))) in calculate_skew()
1475 GST_TIME_ARGS (time), GST_TIME_ARGS (pcr->base_time), in calculate_skew()
1481 if (ABS (delta - pcr->skew) > packetizer->pcr_discont_threshold) { in calculate_skew()
1483 GST_STIME_ARGS (delta - pcr->skew)); in calculate_skew()
1484 mpegts_packetizer_resync (pcr, time, gstpcrtime, TRUE); in calculate_skew()
1489 pos = pcr->window_pos; in calculate_skew()
1491 if (G_UNLIKELY (pcr->window_filling)) { in calculate_skew()
1494 pcr->window[pos++] = delta; in calculate_skew()
1496 if (G_UNLIKELY (pos == 1 || delta < pcr->window_min)) in calculate_skew()
1497 pcr->window_min = delta; in calculate_skew()
1500 pcr->window_size = pos; in calculate_skew()
1503 GST_DEBUG ("min %" G_GINT64_FORMAT, pcr->window_min); in calculate_skew()
1506 pcr->skew = pcr->window_min; in calculate_skew()
1507 pcr->window_filling = FALSE; in calculate_skew()
1523 pcr->skew = in calculate_skew()
1524 (perc * pcr->window_min + ((10000 - perc) * pcr->skew)) / 10000; in calculate_skew()
1525 pcr->window_size = pos + 1; in calculate_skew()
1530 old = pcr->window[pos]; in calculate_skew()
1531 pcr->window[pos++] = delta; in calculate_skew()
1533 if (G_UNLIKELY (delta <= pcr->window_min)) { in calculate_skew()
1536 pcr->window_min = delta; in calculate_skew()
1537 } else if (G_UNLIKELY (old == pcr->window_min)) { in calculate_skew()
1541 for (i = 0; i < pcr->window_size; i++) { in calculate_skew()
1543 if (pcr->window[i] == old) { in calculate_skew()
1547 if (pcr->window[i] < min) in calculate_skew()
1548 min = pcr->window[i]; in calculate_skew()
1550 pcr->window_min = min; in calculate_skew()
1553 pcr->skew = (pcr->window_min + (124 * pcr->skew)) / 125; in calculate_skew()
1555 delta, pcr->window_min); in calculate_skew()
1558 if (G_UNLIKELY (pos >= pcr->window_size)) in calculate_skew()
1561 pcr->window_pos = pos; in calculate_skew()
1566 if (pcr->base_time != -1) { in calculate_skew()
1567 out_time = pcr->base_time + send_diff; in calculate_skew()
1569 if (pcr->skew < 0 && out_time < -pcr->skew) { in calculate_skew()
1572 out_time += pcr->skew; in calculate_skew()
1576 if (G_LIKELY (pcr->prev_out_time != -1 && pcr->prev_send_diff != -1)) { in calculate_skew()
1580 (send_diff > pcr->prev_send_diff in calculate_skew()
1581 && out_time < pcr->prev_out_time) || in calculate_skew()
1583 (send_diff < pcr->prev_send_diff in calculate_skew()
1584 && out_time > pcr->prev_out_time) || in calculate_skew()
1586 send_diff == pcr->prev_send_diff)) { in calculate_skew()
1596 pcr->prev_out_time = out_time; in calculate_skew()
1597 pcr->prev_in_time = time; in calculate_skew()
1598 pcr->prev_send_diff = send_diff; in calculate_skew()
1601 pcr->skew, GST_TIME_ARGS (out_time)); in calculate_skew()
1671 prevpcr = current->pending[current->last].pcr + prev->first_pcr; in _reevaluate_group_pcr_offset()
1676 current->pending[current->last].pcr); in _reevaluate_group_pcr_offset()
1681 pcr)), prevbr); in _reevaluate_group_pcr_offset()
1684 prevpcr = prev->values[prev->last_value].pcr + prev->first_pcr; in _reevaluate_group_pcr_offset()
1689 prev->values[prev->last_value].pcr); in _reevaluate_group_pcr_offset()
1694 pcr)), prevbr); in _reevaluate_group_pcr_offset()
1698 prevpcr = prev->values[prev->last_value].pcr + prev->first_pcr; in _reevaluate_group_pcr_offset()
1711 GST_TIME_ARGS (PCRTIME_TO_GSTTIME (cur->values[cur->last_value].pcr + in _reevaluate_group_pcr_offset()
1728 guess_offset + cur->values[cur->last_value].pcr - (prevpcr - in _reevaluate_group_pcr_offset()
1792 _new_group (guint64 pcr, guint64 offset, guint64 pcr_offset, guint flags) in _new_group() argument
1798 GST_TIME_ARGS (PCRTIME_TO_GSTTIME (pcr)), offset, pcr_offset, flags); in _new_group()
1803 group->values[0].pcr = group->values[0].offset = 0; in _new_group()
1807 group->first_pcr = pcr; in _new_group()
1871 PCROffsetGroup * prev, guint64 pcr, guint64 offset, gboolean contiguous) in _set_current_group() argument
1879 guint64 lastpcr = prev->first_pcr + prev->values[prev->last_value].pcr; in _set_current_group()
1886 if (lastpcr > pcr) { in _set_current_group()
1890 if (lastpcr - pcr > (PCR_MAX_VALUE * 99 / 100)) { in _set_current_group()
1892 GST_TIME_ARGS (PCRTIME_TO_GSTTIME (lastpcr - pcr))); in _set_current_group()
1894 pcr_offset += PCR_MAX_VALUE - prev->first_pcr + pcr; in _set_current_group()
1897 GST_TIME_ARGS (PCRTIME_TO_GSTTIME (lastpcr - pcr))); in _set_current_group()
1899 pcr_offset += prev->values[prev->last_value].pcr + 100 * PCR_MSECOND; in _set_current_group()
1901 } else if (lastpcr < pcr - 500 * PCR_MSECOND) { in _set_current_group()
1903 GST_TIME_ARGS (PCRTIME_TO_GSTTIME (pcr - lastpcr))); in _set_current_group()
1905 pcr_offset += prev->values[prev->last_value].pcr + 500 * PCR_MSECOND; in _set_current_group()
1908 pcr_offset += pcr - prev->first_pcr; in _set_current_group()
1915 group = _new_group (pcr, offset, pcr_offset, flags); in _set_current_group()
1927 group->values[group->last_value].pcr == pcroffset.pcr) { in _append_group_values()
1946 GST_TIME_ARGS (PCRTIME_TO_GSTTIME (pcroffset.pcr)), pcroffset.offset); in _append_group_values()
1971 guint64 pcr, guint64 offset) in record_pcr() argument
1978 pcrtable->last_pcrtime = PCRTIME_TO_GSTTIME (pcr); in record_pcr()
2010 pcr)), group->values[group->last_value].offset); in record_pcr()
2024 pcr - group->first_pcr - group->values[group->last_value].pcr <= in record_pcr()
2033 _set_current_group (pcrtable, prev, pcr, offset, FALSE); in record_pcr()
2037 corpcr = pcr - current->first_pcr; in record_pcr()
2048 GST_TIME_ARGS (PCRTIME_TO_GSTTIME (current->pending[current->last].pcr)), in record_pcr()
2055 if (G_UNLIKELY (corpcr < current->pending[current->last].pcr)) { in record_pcr()
2065 _set_current_group (pcrtable, current->group, pcr, offset, TRUE); in record_pcr()
2069 if (G_UNLIKELY (corpcr - current->pending[current->last].pcr > in record_pcr()
2077 _set_current_group (pcrtable, current->group, pcr, offset, TRUE); in record_pcr()
2081 if (G_UNLIKELY (corpcr == current->last_value.pcr)) { in record_pcr()
2087 current->pending[current->write].pcr = corpcr; in record_pcr()
2099 GST_TIME_ARGS (PCRTIME_TO_GSTTIME (current->pending[current->last].pcr)), in record_pcr()
2112 if (current->pending[current->first].pcr - current->prev.pcr > PCR_SECOND) { in record_pcr()
2117 current->pending[current->last].pcr - in record_pcr()
2118 current->pending[current->first].pcr); in record_pcr()
2126 current->pending[current->first].pcr - current->prev.pcr); in record_pcr()
2218 lastpcr = last->values[last->last_value].pcr + last->pcr_offset; in mpegts_packetizer_offset_to_ts()
2233 lastpcr = current->group->pcr_offset + current->pending[current->last].pcr; in mpegts_packetizer_offset_to_ts()
2422 current->pending[current->last].pcr) { in mpegts_packetizer_ts_to_offset()
2452 if (nextgroup->values[nextgroup->last_value].pcr + in mpegts_packetizer_ts_to_offset()
2473 lastpcr += current->pending[current->last].pcr; in mpegts_packetizer_ts_to_offset()
2476 lastpcr += nextgroup->values[nextgroup->last_value].pcr; in mpegts_packetizer_ts_to_offset()
2486 prevgroup->values[prevgroup->last_value].pcr + prevgroup->pcr_offset; in mpegts_packetizer_ts_to_offset()