• Home
  • Raw
  • Download

Lines Matching refs:parse

113 static MpegTSParsePad *mpegts_parse_create_tspad (MpegTSParse2 * parse,
115 static void mpegts_parse_destroy_tspad (MpegTSParse2 * parse,
136 drain_pending_buffers (MpegTSParse2 * parse, gboolean drain_all);
141 MpegTSParse2 *parse = (MpegTSParse2 *) object; in mpegts_parse_finalize() local
143 gst_flow_combiner_free (parse->flowcombiner); in mpegts_parse_finalize()
145 gst_adapter_clear (parse->ts_adapter.adapter); in mpegts_parse_finalize()
146 g_object_unref (parse->ts_adapter.adapter); in mpegts_parse_finalize()
211 mpegts_parse_init (MpegTSParse2 * parse) in mpegts_parse_init() argument
213 MpegTSBase *base = (MpegTSBase *) parse; in mpegts_parse_init()
220 parse->user_pcr_pid = parse->pcr_pid = -1; in mpegts_parse_init()
222 parse->flowcombiner = gst_flow_combiner_new (); in mpegts_parse_init()
224 parse->srcpad = gst_pad_new_from_static_template (&src_template, "src"); in mpegts_parse_init()
225 gst_flow_combiner_add_pad (parse->flowcombiner, parse->srcpad); in mpegts_parse_init()
226 parse->first = TRUE; in mpegts_parse_init()
227 gst_pad_set_query_function (parse->srcpad, in mpegts_parse_init()
229 gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad); in mpegts_parse_init()
231 parse->have_group_id = FALSE; in mpegts_parse_init()
232 parse->group_id = G_MAXUINT; in mpegts_parse_init()
234 parse->ts_adapter.adapter = gst_adapter_new (); in mpegts_parse_init()
235 parse->ts_adapter.packets_in_adapter = 0; in mpegts_parse_init()
236 parse->ts_adapter.first_is_keyframe = TRUE; in mpegts_parse_init()
237 parse->alignment = 0; in mpegts_parse_init()
238 parse->is_eos = FALSE; in mpegts_parse_init()
239 parse->header = 0; in mpegts_parse_init()
240 parse->split_on_rai = FALSE; in mpegts_parse_init()
246 MpegTSParse2 *parse = (MpegTSParse2 *) base; in mpegts_parse_reset() local
271 parse->first = TRUE; in mpegts_parse_reset()
272 parse->have_group_id = FALSE; in mpegts_parse_reset()
273 parse->group_id = G_MAXUINT; in mpegts_parse_reset()
275 g_list_free_full (parse->pending_buffers, (GDestroyNotify) gst_buffer_unref); in mpegts_parse_reset()
276 parse->pending_buffers = NULL; in mpegts_parse_reset()
278 parse->current_pcr = GST_CLOCK_TIME_NONE; in mpegts_parse_reset()
279 parse->previous_pcr = GST_CLOCK_TIME_NONE; in mpegts_parse_reset()
280 parse->base_pcr = GST_CLOCK_TIME_NONE; in mpegts_parse_reset()
281 parse->bytes_since_pcr = 0; in mpegts_parse_reset()
282 parse->pcr_pid = parse->user_pcr_pid; in mpegts_parse_reset()
283 parse->ts_offset = 0; in mpegts_parse_reset()
285 gst_adapter_clear (parse->ts_adapter.adapter); in mpegts_parse_reset()
286 parse->ts_adapter.packets_in_adapter = 0; in mpegts_parse_reset()
287 parse->ts_adapter.first_is_keyframe = TRUE; in mpegts_parse_reset()
288 parse->is_eos = FALSE; in mpegts_parse_reset()
289 parse->header = 0; in mpegts_parse_reset()
296 MpegTSParse2 *parse = (MpegTSParse2 *) object; in mpegts_parse_set_property() local
300 parse->set_timestamps = g_value_get_boolean (value); in mpegts_parse_set_property()
303 parse->smoothing_latency = GST_USECOND * g_value_get_uint (value); in mpegts_parse_set_property()
305 (parse)->packetizer, parse->smoothing_latency); in mpegts_parse_set_property()
308 parse->pcr_pid = parse->user_pcr_pid = g_value_get_int (value); in mpegts_parse_set_property()
311 parse->alignment = g_value_get_uint (value); in mpegts_parse_set_property()
314 parse->split_on_rai = g_value_get_boolean (value); in mpegts_parse_set_property()
325 MpegTSParse2 *parse = (MpegTSParse2 *) object; in mpegts_parse_get_property() local
329 g_value_set_boolean (value, parse->set_timestamps); in mpegts_parse_get_property()
332 g_value_set_uint (value, parse->smoothing_latency / GST_USECOND); in mpegts_parse_get_property()
335 g_value_set_int (value, parse->pcr_pid); in mpegts_parse_get_property()
338 g_value_set_uint (value, parse->alignment); in mpegts_parse_get_property()
341 g_value_set_boolean (value, parse->split_on_rai); in mpegts_parse_get_property()
349 prepare_src_pad (MpegTSBase * base, MpegTSParse2 * parse) in prepare_src_pad() argument
355 if (!parse->first) in prepare_src_pad()
363 gst_pad_create_stream_id (parse->srcpad, GST_ELEMENT_CAST (base), in prepare_src_pad()
367 gst_pad_get_sticky_event (parse->parent.sinkpad, GST_EVENT_STREAM_START, in prepare_src_pad()
370 if (gst_event_parse_group_id (event, &parse->group_id)) in prepare_src_pad()
371 parse->have_group_id = TRUE; in prepare_src_pad()
373 parse->have_group_id = FALSE; in prepare_src_pad()
375 } else if (!parse->have_group_id) { in prepare_src_pad()
376 parse->have_group_id = TRUE; in prepare_src_pad()
377 parse->group_id = gst_util_group_id_next (); in prepare_src_pad()
380 if (parse->have_group_id) in prepare_src_pad()
381 gst_event_set_group_id (event, parse->group_id); in prepare_src_pad()
383 gst_pad_push_event (parse->srcpad, event); in prepare_src_pad()
390 gst_pad_set_caps (parse->srcpad, caps); in prepare_src_pad()
394 if (parse->set_timestamps == FALSE || base->segment.format == GST_FORMAT_TIME) in prepare_src_pad()
400 GST_DEBUG_OBJECT (parse, in prepare_src_pad()
403 gst_pad_push_event (parse->srcpad, in prepare_src_pad()
406 parse->first = FALSE; in prepare_src_pad()
414 MpegTSParse2 *parse = (MpegTSParse2 *) base; in push_event() local
417 if (G_UNLIKELY (parse->first)) { in push_event()
423 prepare_src_pad (base, parse); in push_event()
428 parse->is_eos = TRUE; in push_event()
430 if (packet_size > 0 && parse->alignment > 0 && in push_event()
431 parse->ts_adapter.packets_in_adapter > 0 in push_event()
432 && parse->ts_adapter.packets_in_adapter < parse->alignment) { in push_event()
437 parse->alignment - parse->ts_adapter.packets_in_adapter; in push_event()
440 GST_DEBUG_OBJECT (parse, "Adding %d dummy packets", missing_packets); in push_event()
450 parse->header++; in push_event()
451 GST_WRITE_UINT32_BE (data, parse->header); in push_event()
466 gst_adapter_push (parse->ts_adapter.adapter, buf); in push_event()
467 parse->ts_adapter.packets_in_adapter += missing_packets; in push_event()
469 drain_pending_buffers (parse, TRUE); in push_event()
473 parse->ts_offset = 0; in push_event()
475 for (tmp = parse->srcpads; tmp; tmp = tmp->next) { in push_event()
483 gst_pad_push_event (parse->srcpad, event); in push_event()
489 mpegts_parse_create_tspad (MpegTSParse2 * parse, const gchar * pad_name) in mpegts_parse_create_tspad() argument
509 gst_flow_combiner_add_pad (parse->flowcombiner, pad); in mpegts_parse_create_tspad()
515 mpegts_parse_destroy_tspad (MpegTSParse2 * parse, MpegTSParsePad * tspad) in mpegts_parse_destroy_tspad() argument
528 MpegTSParse2 *parse = GST_MPEGTS_PARSE (element); in mpegts_parse_pad_removed() local
535 mpegts_parse_destroy_tspad (parse, tspad); in mpegts_parse_pad_removed()
537 parse->srcpads = g_list_remove_all (parse->srcpads, pad); in mpegts_parse_pad_removed()
548 MpegTSParse2 *parse; in mpegts_parse_request_new_pad() local
564 parse = GST_MPEGTS_PARSE (element); in mpegts_parse_request_new_pad()
566 tspad = mpegts_parse_create_tspad (parse, padname); in mpegts_parse_request_new_pad()
571 (MpegTSParseProgram *) mpegts_base_get_program (GST_MPEGTS_BASE (parse), in mpegts_parse_request_new_pad()
579 parse->srcpads = g_list_append (parse->srcpads, pad); in mpegts_parse_request_new_pad()
586 gst_pad_get_sticky_event (parse->parent.sinkpad, GST_EVENT_STREAM_START, in mpegts_parse_request_new_pad()
589 if (gst_event_parse_group_id (event, &parse->group_id)) in mpegts_parse_request_new_pad()
590 parse->have_group_id = TRUE; in mpegts_parse_request_new_pad()
592 parse->have_group_id = FALSE; in mpegts_parse_request_new_pad()
594 } else if (!parse->have_group_id) { in mpegts_parse_request_new_pad()
595 parse->have_group_id = TRUE; in mpegts_parse_request_new_pad()
596 parse->group_id = gst_util_group_id_next (); in mpegts_parse_request_new_pad()
599 if (parse->have_group_id) in mpegts_parse_request_new_pad()
600 gst_event_set_group_id (event, parse->group_id); in mpegts_parse_request_new_pad()
623 MpegTSParse2 *parse = (MpegTSParse2 *) element; in mpegts_parse_release_pad() local
627 gst_flow_combiner_remove_pad (parse->flowcombiner, pad); in mpegts_parse_release_pad()
632 empty_adapter_into_pad (MpegTSParse2 * parse, MpegTSParse2Adapter * ts_adapter, in empty_adapter_into_pad() argument
647 offset = MIN (GST_MPEGTS_BASE (parse)->packetizer->packet_size, 188); in empty_adapter_into_pad()
670 enqueue_and_maybe_push_buffer (MpegTSParse2 * parse, GstPad * pad, in enqueue_and_maybe_push_buffer() argument
676 if (parse->alignment == 1) { in enqueue_and_maybe_push_buffer()
678 ret = gst_flow_combiner_update_flow (parse->flowcombiner, ret); in enqueue_and_maybe_push_buffer()
681 && parse->split_on_rai) { in enqueue_and_maybe_push_buffer()
682 ret = empty_adapter_into_pad (parse, ts_adapter, pad); in enqueue_and_maybe_push_buffer()
683 ret = gst_flow_combiner_update_flow (parse->flowcombiner, ret); in enqueue_and_maybe_push_buffer()
687 if (ts_adapter->packets_in_adapter == 1 && parse->split_on_rai) { in enqueue_and_maybe_push_buffer()
692 if (ts_adapter->packets_in_adapter == parse->alignment in enqueue_and_maybe_push_buffer()
694 ret = empty_adapter_into_pad (parse, ts_adapter, pad); in enqueue_and_maybe_push_buffer()
695 ret = gst_flow_combiner_update_flow (parse->flowcombiner, ret); in enqueue_and_maybe_push_buffer()
704 mpegts_parse_tspad_push_section (MpegTSParse2 * parse, MpegTSParsePad * tspad, in mpegts_parse_tspad_push_section() argument
728 GST_DEBUG_OBJECT (parse, in mpegts_parse_tspad_push_section()
734 enqueue_and_maybe_push_buffer (parse, tspad->pad, in mpegts_parse_tspad_push_section()
738 GST_LOG_OBJECT (parse, "Returning %s", gst_flow_get_name (ret)); in mpegts_parse_tspad_push_section()
743 mpegts_parse_tspad_push (MpegTSParse2 * parse, MpegTSParsePad * tspad, in mpegts_parse_tspad_push() argument
753 bp = mpegts_base_get_program ((MpegTSBase *) parse, in mpegts_parse_tspad_push()
762 ret = gst_flow_combiner_update_flow (parse->flowcombiner, ret); in mpegts_parse_tspad_push()
765 GST_DEBUG_OBJECT (parse, "Returning %s", gst_flow_get_name (ret)); in mpegts_parse_tspad_push()
771 pad_clear_for_push (GstPad * pad, MpegTSParse2 * parse) in pad_clear_for_push() argument
783 MpegTSParse2 *parse = (MpegTSParse2 *) base; in mpegts_parse_push() local
792 GST_OBJECT_LOCK (parse); in mpegts_parse_push()
793 srcpads = parse->srcpads; in mpegts_parse_push()
796 g_list_foreach (srcpads, (GFunc) pad_clear_for_push, parse); in mpegts_parse_push()
803 pads_cookie = GST_ELEMENT_CAST (parse)->pads_cookie; in mpegts_parse_push()
808 GST_OBJECT_UNLOCK (parse); in mpegts_parse_push()
811 if (parse->split_on_rai in mpegts_parse_push()
827 mpegts_parse_tspad_push_section (parse, tspad, section, packet, in mpegts_parse_push()
831 mpegts_parse_tspad_push (parse, tspad, packet, buf); in mpegts_parse_push()
850 GST_OBJECT_LOCK (parse); in mpegts_parse_push()
851 if (G_UNLIKELY (pads_cookie != GST_ELEMENT_CAST (parse)->pads_cookie)) { in mpegts_parse_push()
854 pads_cookie = GST_ELEMENT_CAST (parse)->pads_cookie; in mpegts_parse_push()
855 srcpads = parse->srcpads; in mpegts_parse_push()
867 GST_OBJECT_UNLOCK (parse); in mpegts_parse_push()
878 MpegTSParse2 *parse = GST_MPEGTS_PARSE (base); in mpegts_parse_inspect_packet() local
886 if (parse->current_pcr == GST_CLOCK_TIME_NONE && in mpegts_parse_inspect_packet()
889 if (parse->pcr_pid == -1) in mpegts_parse_inspect_packet()
890 parse->pcr_pid = packet->pid; in mpegts_parse_inspect_packet()
892 if (parse->pcr_pid == packet->pid) { in mpegts_parse_inspect_packet()
893 parse->current_pcr = mpegts_packetizer_pts_to_ts (base->packetizer, in mpegts_parse_inspect_packet()
894 PCRTIME_TO_GSTTIME (packet->pcr), parse->pcr_pid); in mpegts_parse_inspect_packet()
896 GST_TIME_ARGS (parse->current_pcr), packet->pcr); in mpegts_parse_inspect_packet()
897 if (parse->base_pcr == GST_CLOCK_TIME_NONE) { in mpegts_parse_inspect_packet()
898 parse->base_pcr = parse->current_pcr; in mpegts_parse_inspect_packet()
905 get_pending_timestamp_diff (MpegTSParse2 * parse) in get_pending_timestamp_diff() argument
910 if (parse->pending_buffers == NULL) in get_pending_timestamp_diff()
913 l = g_list_last (parse->pending_buffers); in get_pending_timestamp_diff()
918 l = g_list_first (parse->pending_buffers); in get_pending_timestamp_diff()
927 drain_pending_buffers (MpegTSParse2 * parse, gboolean drain_all) in drain_pending_buffers() argument
937 if (parse->pending_buffers == NULL) in drain_pending_buffers()
960 if (!GST_CLOCK_TIME_IS_VALID (parse->current_pcr) && !drain_all) in drain_pending_buffers()
963 if (GST_CLOCK_TIME_IS_VALID (parse->current_pcr)) { in drain_pending_buffers()
964 pcr = parse->current_pcr; in drain_pending_buffers()
965 parse->current_pcr = GST_CLOCK_TIME_NONE; in drain_pending_buffers()
969 buffer = GST_BUFFER (g_list_nth_data (parse->pending_buffers, 0)); in drain_pending_buffers()
972 pcr_bytes = parse->bytes_since_pcr - bytes_since_pcr; in drain_pending_buffers()
975 end = g_list_first (parse->pending_buffers); in drain_pending_buffers()
978 if (!GST_CLOCK_TIME_IS_VALID (parse->previous_pcr)) { in drain_pending_buffers()
979 pcr_diff = get_pending_timestamp_diff (parse); in drain_pending_buffers()
989 start_ts = parse->previous_pcr; in drain_pending_buffers()
990 pcr_diff = get_pending_timestamp_diff (parse); in drain_pending_buffers()
992 start_ts = parse->previous_pcr; in drain_pending_buffers()
997 if (drain_all == FALSE && pcr_diff < parse->smoothing_latency) in drain_pending_buffers()
1001 GST_INFO_OBJECT (parse, "Pushing buffers - startTS %" GST_TIME_FORMAT in drain_pending_buffers()
1007 l = g_list_last (parse->pending_buffers); in drain_pending_buffers()
1020 GST_DEBUG_OBJECT (parse, in drain_pending_buffers()
1024 GST_BUFFER_PTS (buffer) = out_ts + parse->ts_offset; in drain_pending_buffers()
1025 GST_BUFFER_DTS (buffer) = out_ts + parse->ts_offset; in drain_pending_buffers()
1028 enqueue_and_maybe_push_buffer (parse, parse->srcpad, in drain_pending_buffers()
1029 &parse->ts_adapter, buffer); in drain_pending_buffers()
1036 parse->pending_buffers = g_list_delete_link (parse->pending_buffers, l); in drain_pending_buffers()
1040 if (parse->is_eos) { in drain_pending_buffers()
1041 empty_adapter_into_pad (parse, &parse->ts_adapter, parse->srcpad); in drain_pending_buffers()
1044 parse->pending_buffers = end; in drain_pending_buffers()
1045 parse->bytes_since_pcr = bytes_since_pcr; in drain_pending_buffers()
1046 parse->previous_pcr = pcr; in drain_pending_buffers()
1053 MpegTSParse2 *parse = GST_MPEGTS_PARSE (base); in mpegts_parse_have_buffer() local
1056 GST_LOG_OBJECT (parse, "Received buffer %" GST_PTR_FORMAT, buffer); in mpegts_parse_have_buffer()
1059 if (parse->alignment > 0 && in mpegts_parse_have_buffer()
1067 parse->header = GST_READ_UINT32_BE (data); in mpegts_parse_have_buffer()
1071 if (parse->current_pcr != GST_CLOCK_TIME_NONE) { in mpegts_parse_have_buffer()
1072 GST_DEBUG_OBJECT (parse, in mpegts_parse_have_buffer()
1075 GST_TIME_ARGS (parse->current_pcr)); in mpegts_parse_have_buffer()
1078 if (parse->set_timestamps || parse->first) { in mpegts_parse_have_buffer()
1079 parse->pending_buffers = g_list_prepend (parse->pending_buffers, buffer); in mpegts_parse_have_buffer()
1080 parse->bytes_since_pcr += gst_buffer_get_size (buffer); in mpegts_parse_have_buffer()
1084 if (!prepare_src_pad (base, parse)) in mpegts_parse_have_buffer()
1087 if (parse->pending_buffers != NULL) { in mpegts_parse_have_buffer()
1089 gboolean drain_all = (parse->set_timestamps == FALSE); in mpegts_parse_have_buffer()
1090 ret = drain_pending_buffers (parse, drain_all); in mpegts_parse_have_buffer()
1099 enqueue_and_maybe_push_buffer (parse, parse->srcpad, in mpegts_parse_have_buffer()
1100 &parse->ts_adapter, buffer); in mpegts_parse_have_buffer()
1105 empty_pad (GstPad * pad, MpegTSParse2 * parse) in empty_pad() argument
1109 ret = empty_adapter_into_pad (parse, &tspad->ts_adapter, tspad->pad); in empty_pad()
1110 ret = gst_flow_combiner_update_flow (parse->flowcombiner, ret); in empty_pad()
1116 MpegTSParse2 *parse = GST_MPEGTS_PARSE (base); in mpegts_parse_input_done() local
1119 if (!prepare_src_pad (base, parse)) in mpegts_parse_input_done()
1122 if (parse->alignment == 0) { in mpegts_parse_input_done()
1123 ret = empty_adapter_into_pad (parse, &parse->ts_adapter, parse->srcpad); in mpegts_parse_input_done()
1124 ret = gst_flow_combiner_update_flow (parse->flowcombiner, ret); in mpegts_parse_input_done()
1125 g_list_foreach (parse->srcpads, (GFunc) empty_pad, parse); in mpegts_parse_input_done()
1131 find_pad_for_program (MpegTSParse2 * parse, guint program_number) in find_pad_for_program() argument
1135 for (tmp = parse->srcpads; tmp; tmp = tmp->next) { in find_pad_for_program()
1148 MpegTSParse2 *parse = GST_MPEGTS_PARSE (base); in mpegts_parse_program_started() local
1153 tspad = find_pad_for_program (parse, program->program_number); in mpegts_parse_program_started()
1164 MpegTSParse2 *parse = GST_MPEGTS_PARSE (base); in mpegts_parse_program_stopped() local
1169 tspad = find_pad_for_program (parse, program->program_number); in mpegts_parse_program_stopped()
1176 parse->pcr_pid = -1; in mpegts_parse_program_stopped()
1177 parse->ts_offset += parse->current_pcr - parse->base_pcr; in mpegts_parse_program_stopped()
1178 parse->base_pcr = GST_CLOCK_TIME_NONE; in mpegts_parse_program_stopped()
1184 MpegTSParse2 *parse = GST_MPEGTS_PARSE (parent); in mpegts_parse_src_pad_query() local
1190 if ((res = gst_pad_peer_query (((MpegTSBase *) parse)->sinkpad, query))) { in mpegts_parse_src_pad_query()
1197 if (parse->set_timestamps) { in mpegts_parse_src_pad_query()
1198 extra_latency = MAX (extra_latency, parse->smoothing_latency); in mpegts_parse_src_pad_query()