Lines Matching refs:render
149 static void gst_ttml_render_init (GstTtmlRender * render,
156 GstTtmlRender * render, GstCaps * filter);
158 GstTtmlRender * render, GstCaps * filter);
159 static gboolean gst_ttml_render_setcaps (GstTtmlRender * render,
180 static void gst_ttml_render_pop_text (GstTtmlRender * render);
283 GstTtmlRender *render = GST_TTML_RENDER (object); in gst_ttml_render_finalize() local
285 if (render->compositions) { in gst_ttml_render_finalize()
286 g_list_free_full (render->compositions, in gst_ttml_render_finalize()
288 render->compositions = NULL; in gst_ttml_render_finalize()
291 if (render->text_buffer) { in gst_ttml_render_finalize()
292 gst_buffer_unref (render->text_buffer); in gst_ttml_render_finalize()
293 render->text_buffer = NULL; in gst_ttml_render_finalize()
296 if (render->layout) { in gst_ttml_render_finalize()
297 g_object_unref (render->layout); in gst_ttml_render_finalize()
298 render->layout = NULL; in gst_ttml_render_finalize()
301 g_mutex_clear (&render->lock); in gst_ttml_render_finalize()
302 g_cond_clear (&render->cond); in gst_ttml_render_finalize()
308 gst_ttml_render_init (GstTtmlRender * render, GstTtmlRenderClass * klass) in gst_ttml_render_init() argument
314 render->video_sinkpad = gst_pad_new_from_template (template, "video_sink"); in gst_ttml_render_init()
316 gst_pad_set_event_function (render->video_sinkpad, in gst_ttml_render_init()
318 gst_pad_set_chain_function (render->video_sinkpad, in gst_ttml_render_init()
320 gst_pad_set_query_function (render->video_sinkpad, in gst_ttml_render_init()
322 GST_PAD_SET_PROXY_ALLOCATION (render->video_sinkpad); in gst_ttml_render_init()
323 gst_element_add_pad (GST_ELEMENT (render), render->video_sinkpad); in gst_ttml_render_init()
330 render->text_sinkpad = gst_pad_new_from_template (template, "text_sink"); in gst_ttml_render_init()
332 gst_pad_set_event_function (render->text_sinkpad, in gst_ttml_render_init()
334 gst_pad_set_chain_function (render->text_sinkpad, in gst_ttml_render_init()
336 gst_pad_set_link_function (render->text_sinkpad, in gst_ttml_render_init()
338 gst_pad_set_unlink_function (render->text_sinkpad, in gst_ttml_render_init()
340 gst_element_add_pad (GST_ELEMENT (render), render->text_sinkpad); in gst_ttml_render_init()
345 render->srcpad = gst_pad_new_from_template (template, "src"); in gst_ttml_render_init()
347 gst_pad_set_event_function (render->srcpad, in gst_ttml_render_init()
349 gst_pad_set_query_function (render->srcpad, in gst_ttml_render_init()
351 gst_element_add_pad (GST_ELEMENT (render), render->srcpad); in gst_ttml_render_init()
353 g_mutex_lock (GST_TTML_RENDER_GET_CLASS (render)->pango_lock); in gst_ttml_render_init()
355 render->wait_text = TRUE; in gst_ttml_render_init()
356 render->need_render = TRUE; in gst_ttml_render_init()
357 render->text_buffer = NULL; in gst_ttml_render_init()
358 render->text_linked = FALSE; in gst_ttml_render_init()
360 render->compositions = NULL; in gst_ttml_render_init()
361 render->layout = in gst_ttml_render_init()
362 pango_layout_new (GST_TTML_RENDER_GET_CLASS (render)->pango_context); in gst_ttml_render_init()
364 g_mutex_init (&render->lock); in gst_ttml_render_init()
365 g_cond_init (&render->cond); in gst_ttml_render_init()
366 gst_segment_init (&render->segment, GST_FORMAT_TIME); in gst_ttml_render_init()
367 g_mutex_unlock (GST_TTML_RENDER_GET_CLASS (render)->pango_lock); in gst_ttml_render_init()
373 gst_ttml_render_negotiate (GstTtmlRender * render, GstCaps * caps) in gst_ttml_render_negotiate() argument
384 GST_DEBUG_OBJECT (render, "performing negotiation"); in gst_ttml_render_negotiate()
386 gst_pad_check_reconfigure (render->srcpad); in gst_ttml_render_negotiate()
389 caps = gst_pad_get_current_caps (render->video_sinkpad); in gst_ttml_render_negotiate()
417 ret = gst_pad_peer_query_accept_caps (render->srcpad, overlay_caps); in gst_ttml_render_negotiate()
418 GST_DEBUG_OBJECT (render, "Downstream accepts the render meta: %d", ret); in gst_ttml_render_negotiate()
431 GST_DEBUG_OBJECT (render, "Using caps %" GST_PTR_FORMAT, caps); in gst_ttml_render_negotiate()
432 ret = gst_pad_set_caps (render->srcpad, caps); in gst_ttml_render_negotiate()
438 if (!gst_pad_peer_query (render->srcpad, query)) { in gst_ttml_render_negotiate()
440 GST_DEBUG_OBJECT (render, "ALLOCATION query failed"); in gst_ttml_render_negotiate()
451 if (!allocation_ret && render->video_flushing) { in gst_ttml_render_negotiate()
460 ret = gst_pad_set_caps (render->srcpad, caps); in gst_ttml_render_negotiate()
467 GST_DEBUG_OBJECT (render, "negotiation failed, schedule reconfigure"); in gst_ttml_render_negotiate()
468 gst_pad_mark_reconfigure (render->srcpad); in gst_ttml_render_negotiate()
474 gst_pad_mark_reconfigure (render->srcpad); in gst_ttml_render_negotiate()
482 gst_pad_mark_reconfigure (render->srcpad); in gst_ttml_render_negotiate()
502 gst_ttml_render_setcaps (GstTtmlRender * render, GstCaps * caps) in gst_ttml_render_setcaps() argument
510 render->info = info; in gst_ttml_render_setcaps()
511 render->format = GST_VIDEO_INFO_FORMAT (&info); in gst_ttml_render_setcaps()
512 render->width = GST_VIDEO_INFO_WIDTH (&info); in gst_ttml_render_setcaps()
513 render->height = GST_VIDEO_INFO_HEIGHT (&info); in gst_ttml_render_setcaps()
515 ret = gst_ttml_render_negotiate (render, caps); in gst_ttml_render_setcaps()
517 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_setcaps()
518 g_mutex_lock (GST_TTML_RENDER_GET_CLASS (render)->pango_lock); in gst_ttml_render_setcaps()
520 GST_DEBUG_OBJECT (render, "unsupported caps %" GST_PTR_FORMAT, caps); in gst_ttml_render_setcaps()
524 g_mutex_unlock (GST_TTML_RENDER_GET_CLASS (render)->pango_lock); in gst_ttml_render_setcaps()
525 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_setcaps()
532 GST_DEBUG_OBJECT (render, "could not parse caps"); in gst_ttml_render_setcaps()
542 GstTtmlRender *render; in gst_ttml_render_src_query() local
544 render = GST_TTML_RENDER (parent); in gst_ttml_render_src_query()
552 caps = gst_ttml_render_get_src_caps (pad, render, filter); in gst_ttml_render_src_query()
569 GstTtmlRender *render; in gst_ttml_render_src_event() local
572 render = GST_TTML_RENDER (parent); in gst_ttml_render_src_event()
574 if (render->text_linked) { in gst_ttml_render_src_event()
576 ret = gst_pad_push_event (render->video_sinkpad, event); in gst_ttml_render_src_event()
577 gst_pad_push_event (render->text_sinkpad, event); in gst_ttml_render_src_event()
579 ret = gst_pad_push_event (render->video_sinkpad, event); in gst_ttml_render_src_event()
668 GstTtmlRender * render, GstCaps * filter) in gst_ttml_render_get_videosink_caps() argument
670 GstPad *srcpad = render->srcpad; in gst_ttml_render_get_videosink_caps()
673 if (G_UNLIKELY (!render)) in gst_ttml_render_get_videosink_caps()
684 GST_DEBUG_OBJECT (render, "render filter %" GST_PTR_FORMAT, overlay_filter); in gst_ttml_render_get_videosink_caps()
723 GST_DEBUG_OBJECT (render, "returning %" GST_PTR_FORMAT, caps); in gst_ttml_render_get_videosink_caps()
729 gst_ttml_render_get_src_caps (GstPad * pad, GstTtmlRender * render, in gst_ttml_render_get_src_caps() argument
732 GstPad *sinkpad = render->video_sinkpad; in gst_ttml_render_get_src_caps()
735 if (G_UNLIKELY (!render)) in gst_ttml_render_get_src_caps()
788 GST_DEBUG_OBJECT (render, "returning %" GST_PTR_FORMAT, caps); in gst_ttml_render_get_src_caps()
795 gst_ttml_render_push_frame (GstTtmlRender * render, GstBuffer * video_frame) in gst_ttml_render_push_frame() argument
798 GList *compositions = render->compositions; in gst_ttml_render_push_frame()
805 if (gst_pad_check_reconfigure (render->srcpad)) { in gst_ttml_render_push_frame()
806 if (!gst_ttml_render_negotiate (render, NULL)) { in gst_ttml_render_push_frame()
807 gst_pad_mark_reconfigure (render->srcpad); in gst_ttml_render_push_frame()
809 if (GST_PAD_IS_FLUSHING (render->srcpad)) in gst_ttml_render_push_frame()
818 if (!gst_video_frame_map (&frame, &render->info, video_frame, in gst_ttml_render_push_frame()
832 return gst_pad_push (render->srcpad, video_frame); in gst_ttml_render_push_frame()
838 GST_DEBUG_OBJECT (render, "received invalid buffer"); in gst_ttml_render_push_frame()
846 GstTtmlRender *render; in gst_ttml_render_text_pad_link() local
848 render = GST_TTML_RENDER (parent); in gst_ttml_render_text_pad_link()
849 if (G_UNLIKELY (!render)) in gst_ttml_render_text_pad_link()
852 GST_DEBUG_OBJECT (render, "Text pad linked"); in gst_ttml_render_text_pad_link()
854 render->text_linked = TRUE; in gst_ttml_render_text_pad_link()
862 GstTtmlRender *render; in gst_ttml_render_text_pad_unlink() local
865 render = GST_TTML_RENDER (parent); in gst_ttml_render_text_pad_unlink()
867 GST_DEBUG_OBJECT (render, "Text pad unlinked"); in gst_ttml_render_text_pad_unlink()
869 render->text_linked = FALSE; in gst_ttml_render_text_pad_unlink()
871 gst_segment_init (&render->text_segment, GST_FORMAT_UNDEFINED); in gst_ttml_render_text_pad_unlink()
878 GstTtmlRender *render = NULL; in gst_ttml_render_text_event() local
880 render = GST_TTML_RENDER (parent); in gst_ttml_render_text_event()
889 render->text_eos = FALSE; in gst_ttml_render_text_event()
894 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_text_event()
895 gst_segment_copy_into (segment, &render->text_segment); in gst_ttml_render_text_event()
896 GST_DEBUG_OBJECT (render, "TEXT SEGMENT now: %" GST_SEGMENT_FORMAT, in gst_ttml_render_text_event()
897 &render->text_segment); in gst_ttml_render_text_event()
898 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_text_event()
900 GST_ELEMENT_WARNING (render, STREAM, MUX, (NULL), in gst_ttml_render_text_event()
909 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_text_event()
910 GST_TTML_RENDER_BROADCAST (render); in gst_ttml_render_text_event()
911 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_text_event()
923 render->text_segment.position = start; in gst_ttml_render_text_event()
927 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_text_event()
928 GST_TTML_RENDER_BROADCAST (render); in gst_ttml_render_text_event()
929 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_text_event()
936 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_text_event()
937 GST_INFO_OBJECT (render, "text flush stop"); in gst_ttml_render_text_event()
938 render->text_flushing = FALSE; in gst_ttml_render_text_event()
939 render->text_eos = FALSE; in gst_ttml_render_text_event()
940 gst_ttml_render_pop_text (render); in gst_ttml_render_text_event()
941 gst_segment_init (&render->text_segment, GST_FORMAT_TIME); in gst_ttml_render_text_event()
942 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_text_event()
947 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_text_event()
948 GST_INFO_OBJECT (render, "text flush start"); in gst_ttml_render_text_event()
949 render->text_flushing = TRUE; in gst_ttml_render_text_event()
950 GST_TTML_RENDER_BROADCAST (render); in gst_ttml_render_text_event()
951 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_text_event()
956 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_text_event()
957 render->text_eos = TRUE; in gst_ttml_render_text_event()
958 GST_INFO_OBJECT (render, "text EOS"); in gst_ttml_render_text_event()
961 GST_TTML_RENDER_BROADCAST (render); in gst_ttml_render_text_event()
962 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_text_event()
978 GstTtmlRender *render = NULL; in gst_ttml_render_video_event() local
980 render = GST_TTML_RENDER (parent); in gst_ttml_render_video_event()
988 gint prev_width = render->width; in gst_ttml_render_video_event()
989 gint prev_height = render->height; in gst_ttml_render_video_event()
992 ret = gst_ttml_render_setcaps (render, caps); in gst_ttml_render_video_event()
993 if (render->width != prev_width || render->height != prev_height) in gst_ttml_render_video_event()
994 render->need_render = TRUE; in gst_ttml_render_video_event()
1002 GST_DEBUG_OBJECT (render, "received new segment"); in gst_ttml_render_video_event()
1007 GST_DEBUG_OBJECT (render, "VIDEO SEGMENT now: %" GST_SEGMENT_FORMAT, in gst_ttml_render_video_event()
1008 &render->segment); in gst_ttml_render_video_event()
1010 gst_segment_copy_into (segment, &render->segment); in gst_ttml_render_video_event()
1012 GST_ELEMENT_WARNING (render, STREAM, MUX, (NULL), in gst_ttml_render_video_event()
1020 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_video_event()
1021 GST_INFO_OBJECT (render, "video EOS"); in gst_ttml_render_video_event()
1022 render->video_eos = TRUE; in gst_ttml_render_video_event()
1023 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_event()
1027 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_video_event()
1028 GST_INFO_OBJECT (render, "video flush start"); in gst_ttml_render_video_event()
1029 render->video_flushing = TRUE; in gst_ttml_render_video_event()
1030 GST_TTML_RENDER_BROADCAST (render); in gst_ttml_render_video_event()
1031 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_event()
1035 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_video_event()
1036 GST_INFO_OBJECT (render, "video flush stop"); in gst_ttml_render_video_event()
1037 render->video_flushing = FALSE; in gst_ttml_render_video_event()
1038 render->video_eos = FALSE; in gst_ttml_render_video_event()
1039 gst_segment_init (&render->segment, GST_FORMAT_TIME); in gst_ttml_render_video_event()
1040 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_event()
1055 GstTtmlRender *render; in gst_ttml_render_video_query() local
1057 render = GST_TTML_RENDER (parent); in gst_ttml_render_video_query()
1065 caps = gst_ttml_render_get_videosink_caps (pad, render, filter); in gst_ttml_render_video_query()
1081 gst_ttml_render_pop_text (GstTtmlRender * render) in gst_ttml_render_pop_text() argument
1083 g_return_if_fail (GST_IS_TTML_RENDER (render)); in gst_ttml_render_pop_text()
1085 if (render->text_buffer) { in gst_ttml_render_pop_text()
1086 GST_DEBUG_OBJECT (render, "releasing text buffer %p", render->text_buffer); in gst_ttml_render_pop_text()
1087 gst_buffer_unref (render->text_buffer); in gst_ttml_render_pop_text()
1088 render->text_buffer = NULL; in gst_ttml_render_pop_text()
1092 GST_TTML_RENDER_BROADCAST (render); in gst_ttml_render_pop_text()
1103 GstTtmlRender *render = NULL; in gst_ttml_render_text_chain() local
1107 render = GST_TTML_RENDER (parent); in gst_ttml_render_text_chain()
1109 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_text_chain()
1111 if (render->text_flushing) { in gst_ttml_render_text_chain()
1112 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_text_chain()
1114 GST_LOG_OBJECT (render, "text flushing"); in gst_ttml_render_text_chain()
1118 if (render->text_eos) { in gst_ttml_render_text_chain()
1119 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_text_chain()
1121 GST_LOG_OBJECT (render, "text EOS"); in gst_ttml_render_text_chain()
1125 GST_LOG_OBJECT (render, "%" GST_SEGMENT_FORMAT " BUFFER: ts=%" in gst_ttml_render_text_chain()
1126 GST_TIME_FORMAT ", end=%" GST_TIME_FORMAT, &render->segment, in gst_ttml_render_text_chain()
1139 in_seg = gst_segment_clip (&render->text_segment, GST_FORMAT_TIME, in gst_ttml_render_text_chain()
1152 while (render->text_buffer != NULL) { in gst_ttml_render_text_chain()
1155 GST_TTML_RENDER_WAIT (render); in gst_ttml_render_text_chain()
1157 if (render->text_flushing) { in gst_ttml_render_text_chain()
1158 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_text_chain()
1165 render->text_segment.position = clip_start; in gst_ttml_render_text_chain()
1167 render->text_buffer = buffer; in gst_ttml_render_text_chain()
1169 render->need_render = TRUE; in gst_ttml_render_text_chain()
1172 GST_TTML_RENDER_BROADCAST (render); in gst_ttml_render_text_chain()
1175 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_text_chain()
1432 gst_ttml_render_get_pango_font_metrics (GstTtmlRender * render, in gst_ttml_render_get_pango_font_metrics() argument
1441 pango_layout_set_markup (render->layout, string, strlen (string)); in gst_ttml_render_get_pango_font_metrics()
1442 pango_layout_get_pixel_extents (render->layout, &ink_rect, NULL); in gst_ttml_render_get_pango_font_metrics()
1446 ret.baseline = PANGO_PIXELS (pango_layout_get_baseline (render->layout)) in gst_ttml_render_get_pango_font_metrics()
1458 gst_ttml_render_get_pango_font_size (GstTtmlRender * render, in gst_ttml_render_get_pango_font_size() argument
1462 (guint) ceil (element->style_set->font_size * render->height); in gst_ttml_render_get_pango_font_size()
1469 gst_ttml_render_get_pango_font_metrics (render, element->style_set, in gst_ttml_render_get_pango_font_size()
1485 gst_ttml_render_unify_block (GstTtmlRender * render, in gst_ttml_render_unify_block() argument
1502 gst_ttml_render_get_pango_font_size (render, ue->element); in gst_ttml_render_unify_block()
1504 gst_ttml_render_get_pango_font_metrics (render, ue->element->style_set, in gst_ttml_render_unify_block()
1575 gst_ttml_render_get_line_char_ranges (GstTtmlRender * render, in gst_ttml_render_get_line_char_ranges() argument
1609 pango_layout_set_markup (render->layout, markup, strlen (markup)); in gst_ttml_render_get_line_char_ranges()
1610 pango_layout_set_width (render->layout, -1); in gst_ttml_render_get_line_char_ranges()
1612 pango_layout_get_pixel_extents (render->layout, &ink_rect, NULL); in gst_ttml_render_get_line_char_ranges()
1631 pango_layout_index_to_pos (render->layout, range->first_index, &rect); in gst_ttml_render_get_line_char_ranges()
1640 pango_layout_xy_to_index (render->layout, max_line_extent, rect.y, in gst_ttml_render_get_line_char_ranges()
1939 gst_ttml_render_draw_text (GstTtmlRender * render, const gchar * text, in gst_ttml_render_draw_text() argument
1954 pango_layout_set_markup (render->layout, text, strlen (text)); in gst_ttml_render_draw_text()
1956 pango_layout_get_text (render->layout)); in gst_ttml_render_draw_text()
1957 pango_layout_set_width (render->layout, -1); in gst_ttml_render_draw_text()
1959 pango_layout_get_pixel_extents (render->layout, &ink_rect, &logical_rect); in gst_ttml_render_draw_text()
1961 baseline = PANGO_PIXELS (pango_layout_get_baseline (render->layout)); in gst_ttml_render_draw_text()
1978 pango_cairo_show_layout (cairo_state, render->layout); in gst_ttml_render_draw_text()
2015 gst_ttml_render_render_block_elements (GstTtmlRender * render, in gst_ttml_render_render_block_elements() argument
2022 (guint) ceil (block->style_set->line_padding * render->width); in gst_ttml_render_render_block_elements()
2034 text_image = gst_ttml_render_draw_text (render, markup, in gst_ttml_render_render_block_elements()
2131 gst_ttml_render_layout_blocks (GstTtmlRender * render, GPtrArray * blocks, in gst_ttml_render_layout_blocks() argument
2142 gst_ttml_render_render_block_elements (render, block, in gst_ttml_render_layout_blocks()
2175 gst_ttml_render_get_most_frequent_descender (GstTtmlRender * render, in gst_ttml_render_get_most_frequent_descender() argument
2227 gst_ttml_render_get_block_metrics (GstTtmlRender * render, UnifiedBlock * block) in gst_ttml_render_get_block_metrics() argument
2263 descender = gst_ttml_render_get_most_frequent_descender (render, block); in gst_ttml_render_get_block_metrics()
2266 font_size = (guint) ceil (block->style_set->font_size * render->height); in gst_ttml_render_get_block_metrics()
2546 gst_ttml_render_render_text_block (GstTtmlRender * render, in gst_ttml_render_render_text_block() argument
2560 unified_block = gst_ttml_render_unify_block (render, block, text_buf); in gst_ttml_render_render_text_block()
2561 metrics = gst_ttml_render_get_block_metrics (render, unified_block); in gst_ttml_render_render_text_block()
2564 line_padding = (guint) ceil (block->style_set->line_padding * render->width); in gst_ttml_render_render_text_block()
2565 ranges = gst_ttml_render_get_line_char_ranges (render, unified_block, width - in gst_ttml_render_render_text_block()
2582 images = gst_ttml_render_layout_blocks (render, split_blocks, metrics, in gst_ttml_render_render_text_block()
2616 gst_ttml_render_render_text_region (GstTtmlRender * render, in gst_ttml_render_render_text_region() argument
2629 region_width = (guint) (round (region->style_set->extent_w * render->width)); in gst_ttml_render_render_text_region()
2631 (guint) (round (region->style_set->extent_h * render->height)); in gst_ttml_render_render_text_region()
2632 region_x = (guint) (round (region->style_set->origin_x * render->width)); in gst_ttml_render_render_text_region()
2633 region_y = (guint) (round (region->style_set->origin_y * render->height)); in gst_ttml_render_render_text_region()
2636 (guint) (round (region->style_set->padding_start * render->width)); in gst_ttml_render_render_text_region()
2638 (guint) (round (region->style_set->padding_end * render->width)); in gst_ttml_render_render_text_region()
2640 (guint) (round (region->style_set->padding_before * render->height)); in gst_ttml_render_render_text_region()
2642 (guint) (round (region->style_set->padding_after * render->height)); in gst_ttml_render_render_text_region()
2674 rendered_block = gst_ttml_render_render_text_block (render, block, text_buf, in gst_ttml_render_render_text_region()
2766 GstTtmlRender *render; in gst_ttml_render_video_chain() local
2772 render = GST_TTML_RENDER (parent); in gst_ttml_render_video_chain()
2786 GST_LOG_OBJECT (render, "%" GST_SEGMENT_FORMAT " BUFFER: ts=%" in gst_ttml_render_video_chain()
2787 GST_TIME_FORMAT ", end=%" GST_TIME_FORMAT, &render->segment, in gst_ttml_render_video_chain()
2792 if (stop == GST_CLOCK_TIME_NONE && start < render->segment.start) in gst_ttml_render_video_chain()
2795 in_seg = gst_segment_clip (&render->segment, GST_FORMAT_TIME, start, stop, in gst_ttml_render_video_chain()
2803 GST_DEBUG_OBJECT (render, "clipping buffer timestamp/duration to segment"); in gst_ttml_render_video_chain()
2814 if (render->info.fps_n && render->info.fps_d) { in gst_ttml_render_video_chain()
2815 GST_DEBUG_OBJECT (render, "estimating duration based on framerate"); in gst_ttml_render_video_chain()
2817 render->info.fps_d, render->info.fps_n); in gst_ttml_render_video_chain()
2819 GST_LOG_OBJECT (render, "no duration, assuming minimal duration"); in gst_ttml_render_video_chain()
2824 gst_object_sync_values (GST_OBJECT (render), GST_BUFFER_TIMESTAMP (buffer)); in gst_ttml_render_video_chain()
2828 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_video_chain()
2830 if (render->video_flushing) in gst_ttml_render_video_chain()
2833 if (render->video_eos) in gst_ttml_render_video_chain()
2837 if (!render->text_linked) { in gst_ttml_render_video_chain()
2838 GST_LOG_OBJECT (render, "Text pad not linked"); in gst_ttml_render_video_chain()
2839 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_chain()
2840 ret = gst_pad_push (render->srcpad, buffer); in gst_ttml_render_video_chain()
2845 if (render->text_buffer) { in gst_ttml_render_video_chain()
2855 if (!GST_BUFFER_TIMESTAMP_IS_VALID (render->text_buffer) || in gst_ttml_render_video_chain()
2856 !GST_BUFFER_DURATION_IS_VALID (render->text_buffer)) { in gst_ttml_render_video_chain()
2857 GST_WARNING_OBJECT (render, in gst_ttml_render_video_chain()
2862 text_start = GST_BUFFER_TIMESTAMP (render->text_buffer); in gst_ttml_render_video_chain()
2863 text_end = text_start + GST_BUFFER_DURATION (render->text_buffer); in gst_ttml_render_video_chain()
2867 gst_segment_to_running_time (&render->segment, GST_FORMAT_TIME, start); in gst_ttml_render_video_chain()
2869 gst_segment_to_running_time (&render->segment, GST_FORMAT_TIME, stop); in gst_ttml_render_video_chain()
2874 gst_segment_to_running_time (&render->text_segment, in gst_ttml_render_video_chain()
2877 gst_segment_to_running_time (&render->text_segment, in gst_ttml_render_video_chain()
2881 GST_LOG_OBJECT (render, "T: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT, in gst_ttml_render_video_chain()
2884 GST_LOG_OBJECT (render, "V: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT, in gst_ttml_render_video_chain()
2890 GST_LOG_OBJECT (render, "text buffer too old, popping"); in gst_ttml_render_video_chain()
2892 gst_ttml_render_pop_text (render); in gst_ttml_render_video_chain()
2893 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_chain()
2896 GST_LOG_OBJECT (render, "text in future, pushing video buf"); in gst_ttml_render_video_chain()
2897 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_chain()
2899 ret = gst_pad_push (render->srcpad, buffer); in gst_ttml_render_video_chain()
2901 if (render->need_render) { in gst_ttml_render_video_chain()
2906 if (render->compositions) { in gst_ttml_render_video_chain()
2907 g_list_free_full (render->compositions, in gst_ttml_render_video_chain()
2909 render->compositions = NULL; in gst_ttml_render_video_chain()
2912 subtitle_meta = gst_buffer_get_subtitle_meta (render->text_buffer); in gst_ttml_render_video_chain()
2919 composition = gst_ttml_render_render_text_region (render, region, in gst_ttml_render_video_chain()
2920 render->text_buffer); in gst_ttml_render_video_chain()
2922 render->compositions = g_list_append (render->compositions, in gst_ttml_render_video_chain()
2927 render->need_render = FALSE; in gst_ttml_render_video_chain()
2930 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_chain()
2931 ret = gst_ttml_render_push_frame (render, buffer); in gst_ttml_render_video_chain()
2934 GST_LOG_OBJECT (render, "text buffer not needed any longer"); in gst_ttml_render_video_chain()
2939 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_video_chain()
2940 gst_ttml_render_pop_text (render); in gst_ttml_render_video_chain()
2941 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_chain()
2946 if (render->text_eos) in gst_ttml_render_video_chain()
2949 if (!render->wait_text) in gst_ttml_render_video_chain()
2953 if (render->text_segment.format == GST_FORMAT_TIME) { in gst_ttml_render_video_chain()
2958 gst_segment_to_running_time (&render->segment, GST_FORMAT_TIME, in gst_ttml_render_video_chain()
2961 gst_segment_to_running_time (&render->text_segment, in gst_ttml_render_video_chain()
2962 GST_FORMAT_TIME, render->text_segment.start); in gst_ttml_render_video_chain()
2964 gst_segment_to_running_time (&render->text_segment, in gst_ttml_render_video_chain()
2965 GST_FORMAT_TIME, render->text_segment.position); in gst_ttml_render_video_chain()
2976 GST_DEBUG_OBJECT (render, "no text buffer, need to wait for one"); in gst_ttml_render_video_chain()
2977 GST_TTML_RENDER_WAIT (render); in gst_ttml_render_video_chain()
2978 GST_DEBUG_OBJECT (render, "resuming"); in gst_ttml_render_video_chain()
2979 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_chain()
2982 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_chain()
2983 GST_LOG_OBJECT (render, "no need to wait for a text buffer"); in gst_ttml_render_video_chain()
2984 ret = gst_pad_push (render->srcpad, buffer); in gst_ttml_render_video_chain()
2992 render->segment.position = clip_start; in gst_ttml_render_video_chain()
2998 GST_WARNING_OBJECT (render, "buffer without timestamp, discarding"); in gst_ttml_render_video_chain()
3005 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_chain()
3006 GST_DEBUG_OBJECT (render, "flushing, discarding buffer"); in gst_ttml_render_video_chain()
3012 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_video_chain()
3013 GST_DEBUG_OBJECT (render, "eos, discarding buffer"); in gst_ttml_render_video_chain()
3019 GST_DEBUG_OBJECT (render, "buffer out of segment, discarding"); in gst_ttml_render_video_chain()
3029 GstTtmlRender *render = GST_TTML_RENDER (element); in gst_ttml_render_change_state() local
3033 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_change_state()
3034 render->text_flushing = TRUE; in gst_ttml_render_change_state()
3035 render->video_flushing = TRUE; in gst_ttml_render_change_state()
3038 gst_ttml_render_pop_text (render); in gst_ttml_render_change_state()
3039 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_change_state()
3051 GST_TTML_RENDER_LOCK (render); in gst_ttml_render_change_state()
3052 render->text_flushing = FALSE; in gst_ttml_render_change_state()
3053 render->video_flushing = FALSE; in gst_ttml_render_change_state()
3054 render->video_eos = FALSE; in gst_ttml_render_change_state()
3055 render->text_eos = FALSE; in gst_ttml_render_change_state()
3056 gst_segment_init (&render->segment, GST_FORMAT_TIME); in gst_ttml_render_change_state()
3057 gst_segment_init (&render->text_segment, GST_FORMAT_TIME); in gst_ttml_render_change_state()
3058 GST_TTML_RENDER_UNLOCK (render); in gst_ttml_render_change_state()