Lines Matching full:overlay
135 static void gst_base_cea_cc_overlay_init (GstCeaCcOverlay * overlay,
140 GstCeaCcOverlay * overlay, GstCaps * filter);
142 GstCeaCcOverlay * overlay, GstCaps * filter);
143 static gboolean gst_cea_cc_overlay_setcaps (GstCeaCcOverlay * overlay,
164 static void gst_cea_cc_overlay_pop_text (GstCeaCcOverlay * overlay);
286 "Closed Caption overlay", "Mixer/Video/Overlay/Subtitle", in gst_base_cea_cc_overlay_class_init()
287 "Decode cea608/cea708 data and overlay on proper position of a video buffer", in gst_base_cea_cc_overlay_class_init()
298 GstCeaCcOverlay *overlay = GST_CEA_CC_OVERLAY (object); in gst_cea_cc_overlay_finalize() local
300 if (overlay->current_composition) { in gst_cea_cc_overlay_finalize()
301 gst_video_overlay_composition_unref (overlay->current_composition); in gst_cea_cc_overlay_finalize()
302 overlay->current_composition = NULL; in gst_cea_cc_overlay_finalize()
304 if (overlay->next_composition) { in gst_cea_cc_overlay_finalize()
305 gst_video_overlay_composition_unref (overlay->next_composition); in gst_cea_cc_overlay_finalize()
306 overlay->next_composition = NULL; in gst_cea_cc_overlay_finalize()
309 gst_cea708dec_free (overlay->decoder); in gst_cea_cc_overlay_finalize()
310 overlay->decoder = NULL; in gst_cea_cc_overlay_finalize()
312 g_mutex_clear (&overlay->lock); in gst_cea_cc_overlay_finalize()
313 g_cond_clear (&overlay->cond); in gst_cea_cc_overlay_finalize()
319 gst_base_cea_cc_overlay_init (GstCeaCcOverlay * overlay, in gst_base_cea_cc_overlay_init() argument
323 overlay->decoder = gst_cea708dec_create (GST_CEA_CC_OVERLAY_GET_CLASS in gst_base_cea_cc_overlay_init()
324 (overlay)->pango_context); in gst_base_cea_cc_overlay_init()
328 overlay->video_sinkpad = gst_pad_new_from_template (template, "video_sink"); in gst_base_cea_cc_overlay_init()
330 gst_pad_set_event_function (overlay->video_sinkpad, in gst_base_cea_cc_overlay_init()
332 gst_pad_set_chain_function (overlay->video_sinkpad, in gst_base_cea_cc_overlay_init()
334 gst_pad_set_query_function (overlay->video_sinkpad, in gst_base_cea_cc_overlay_init()
336 GST_PAD_SET_PROXY_ALLOCATION (overlay->video_sinkpad); in gst_base_cea_cc_overlay_init()
337 gst_element_add_pad (GST_ELEMENT (overlay), overlay->video_sinkpad); in gst_base_cea_cc_overlay_init()
343 overlay->cc_sinkpad = gst_pad_new_from_template (template, "cc_sink"); in gst_base_cea_cc_overlay_init()
345 gst_pad_set_event_function (overlay->cc_sinkpad, in gst_base_cea_cc_overlay_init()
347 gst_pad_set_chain_function (overlay->cc_sinkpad, in gst_base_cea_cc_overlay_init()
349 gst_pad_set_link_function (overlay->cc_sinkpad, in gst_base_cea_cc_overlay_init()
351 gst_pad_set_unlink_function (overlay->cc_sinkpad, in gst_base_cea_cc_overlay_init()
353 gst_element_add_pad (GST_ELEMENT (overlay), overlay->cc_sinkpad); in gst_base_cea_cc_overlay_init()
358 overlay->srcpad = gst_pad_new_from_template (template, "src"); in gst_base_cea_cc_overlay_init()
360 gst_pad_set_event_function (overlay->srcpad, in gst_base_cea_cc_overlay_init()
362 gst_pad_set_query_function (overlay->srcpad, in gst_base_cea_cc_overlay_init()
364 gst_element_add_pad (GST_ELEMENT (overlay), overlay->srcpad); in gst_base_cea_cc_overlay_init()
367 overlay->silent = DEFAULT_PROP_SILENT; in gst_base_cea_cc_overlay_init()
368 overlay->need_update = TRUE; in gst_base_cea_cc_overlay_init()
369 overlay->current_composition = NULL; in gst_base_cea_cc_overlay_init()
370 overlay->next_composition = NULL; in gst_base_cea_cc_overlay_init()
371 overlay->cc_pad_linked = FALSE; in gst_base_cea_cc_overlay_init()
372 overlay->current_comp_start_time = GST_CLOCK_TIME_NONE; in gst_base_cea_cc_overlay_init()
373 overlay->next_comp_start_time = GST_CLOCK_TIME_NONE; in gst_base_cea_cc_overlay_init()
374 overlay->cea608_index[0] = 0; in gst_base_cea_cc_overlay_init()
375 overlay->cea608_index[1] = 0; in gst_base_cea_cc_overlay_init()
376 overlay->cea708_index = 0; in gst_base_cea_cc_overlay_init()
377 overlay->default_window_h_pos = DEFAULT_PROP_WINDOW_H_POS; in gst_base_cea_cc_overlay_init()
379 g_mutex_init (&overlay->lock); in gst_base_cea_cc_overlay_init()
380 g_cond_init (&overlay->cond); in gst_base_cea_cc_overlay_init()
381 gst_segment_init (&overlay->segment, GST_FORMAT_TIME); in gst_base_cea_cc_overlay_init()
384 /* only negotiate/query video overlay composition support for now */
386 gst_cea_cc_overlay_negotiate (GstCeaCcOverlay * overlay, GstCaps * caps) in gst_cea_cc_overlay_negotiate() argument
397 GST_DEBUG_OBJECT (overlay, "performing negotiation"); in gst_cea_cc_overlay_negotiate()
400 caps = gst_pad_get_current_caps (overlay->video_sinkpad); in gst_cea_cc_overlay_negotiate()
409 /* Try to use the overlay meta if possible */ in gst_cea_cc_overlay_negotiate()
412 /* if the caps doesn't have the overlay meta, we query if downstream in gst_cea_cc_overlay_negotiate()
428 ret = gst_pad_peer_query_accept_caps (overlay->srcpad, overlay_caps); in gst_cea_cc_overlay_negotiate()
429 GST_DEBUG_OBJECT (overlay, "Downstream accepts the overlay meta: %d", ret); in gst_cea_cc_overlay_negotiate()
442 GST_DEBUG_OBJECT (overlay, "Using caps %" GST_PTR_FORMAT, caps); in gst_cea_cc_overlay_negotiate()
443 ret = gst_pad_set_caps (overlay->srcpad, caps); in gst_cea_cc_overlay_negotiate()
449 if (!gst_pad_peer_query (overlay->srcpad, query)) { in gst_cea_cc_overlay_negotiate()
451 GST_DEBUG_OBJECT (overlay, "ALLOCATION query failed"); in gst_cea_cc_overlay_negotiate()
461 overlay->attach_compo_to_buffer = attach; in gst_cea_cc_overlay_negotiate()
463 if (!allocation_ret && overlay->video_flushing) { in gst_cea_cc_overlay_negotiate()
472 ret = gst_pad_set_caps (overlay->srcpad, caps); in gst_cea_cc_overlay_negotiate()
479 GST_DEBUG_OBJECT (overlay, "negotiation failed, schedule reconfigure"); in gst_cea_cc_overlay_negotiate()
480 gst_pad_mark_reconfigure (overlay->srcpad); in gst_cea_cc_overlay_negotiate()
483 GST_DEBUG_OBJECT (overlay, "ret=%d", ret); in gst_cea_cc_overlay_negotiate()
510 gst_cea_cc_overlay_setcaps (GstCeaCcOverlay * overlay, GstCaps * caps) in gst_cea_cc_overlay_setcaps() argument
518 overlay->info = info; in gst_cea_cc_overlay_setcaps()
519 overlay->format = GST_VIDEO_INFO_FORMAT (&info); in gst_cea_cc_overlay_setcaps()
520 overlay->width = GST_VIDEO_INFO_WIDTH (&info); in gst_cea_cc_overlay_setcaps()
521 overlay->height = GST_VIDEO_INFO_HEIGHT (&info); in gst_cea_cc_overlay_setcaps()
522 gst_cea708dec_set_video_width_height (overlay->decoder, overlay->width, in gst_cea_cc_overlay_setcaps()
523 overlay->height); in gst_cea_cc_overlay_setcaps()
524 ret = gst_cea_cc_overlay_negotiate (overlay, caps); in gst_cea_cc_overlay_setcaps()
526 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_setcaps()
527 g_mutex_lock (GST_CEA_CC_OVERLAY_GET_CLASS (overlay)->pango_lock); in gst_cea_cc_overlay_setcaps()
528 if (!overlay->attach_compo_to_buffer && in gst_cea_cc_overlay_setcaps()
530 GST_DEBUG_OBJECT (overlay, "unsupported caps %" GST_PTR_FORMAT, caps); in gst_cea_cc_overlay_setcaps()
534 g_mutex_unlock (GST_CEA_CC_OVERLAY_GET_CLASS (overlay)->pango_lock); in gst_cea_cc_overlay_setcaps()
535 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_setcaps()
542 GST_DEBUG_OBJECT (overlay, "could not parse caps"); in gst_cea_cc_overlay_setcaps()
551 GstCeaCcOverlay *overlay = GST_CEA_CC_OVERLAY (object); in gst_cea_cc_overlay_set_property() local
552 Cea708Dec *decoder = overlay->decoder; in gst_cea_cc_overlay_set_property()
554 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_set_property()
568 GST_LOG_OBJECT (overlay, "Got font description '%s'", fontdesc_str); in gst_cea_cc_overlay_set_property()
574 GST_INFO_OBJECT (overlay, "Setting font description: '%s'", in gst_cea_cc_overlay_set_property()
578 GST_INFO_OBJECT (overlay, "Resetting default font description"); in gst_cea_cc_overlay_set_property()
585 overlay->silent = g_value_get_boolean (value); in gst_cea_cc_overlay_set_property()
588 overlay->default_window_h_pos = g_value_get_enum (value); in gst_cea_cc_overlay_set_property()
595 overlay->need_update = TRUE; in gst_cea_cc_overlay_set_property()
596 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_set_property()
603 GstCeaCcOverlay *overlay = GST_CEA_CC_OVERLAY (object); in gst_cea_cc_overlay_get_property() local
604 Cea708Dec *decoder = overlay->decoder; in gst_cea_cc_overlay_get_property()
606 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_get_property()
612 g_value_set_boolean (value, overlay->silent); in gst_cea_cc_overlay_get_property()
618 g_value_set_enum (value, overlay->default_window_h_pos); in gst_cea_cc_overlay_get_property()
625 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_get_property()
633 GstCeaCcOverlay *overlay; in gst_cea_cc_overlay_src_query() local
635 overlay = GST_CEA_CC_OVERLAY (parent); in gst_cea_cc_overlay_src_query()
643 caps = gst_cea_cc_overlay_get_src_caps (pad, overlay, filter); in gst_cea_cc_overlay_src_query()
661 GstCeaCcOverlay *overlay; in gst_cea_cc_overlay_src_event() local
664 overlay = GST_CEA_CC_OVERLAY (parent); in gst_cea_cc_overlay_src_event()
666 if (overlay->cc_pad_linked) { in gst_cea_cc_overlay_src_event()
668 ret = gst_pad_push_event (overlay->video_sinkpad, event); in gst_cea_cc_overlay_src_event()
669 gst_pad_push_event (overlay->cc_sinkpad, event); in gst_cea_cc_overlay_src_event()
671 ret = gst_pad_push_event (overlay->video_sinkpad, event); in gst_cea_cc_overlay_src_event()
759 GstCeaCcOverlay * overlay, GstCaps * filter) in gst_cea_cc_overlay_get_videosink_caps() argument
761 GstPad *srcpad = overlay->srcpad; in gst_cea_cc_overlay_get_videosink_caps()
764 if (G_UNLIKELY (!overlay)) in gst_cea_cc_overlay_get_videosink_caps()
775 GST_DEBUG_OBJECT (overlay, "overlay filter %" GST_PTR_FORMAT, in gst_cea_cc_overlay_get_videosink_caps()
813 GST_DEBUG_OBJECT (overlay, "returning %" GST_PTR_FORMAT, caps); in gst_cea_cc_overlay_get_videosink_caps()
819 gst_cea_cc_overlay_get_src_caps (GstPad * pad, GstCeaCcOverlay * overlay, in gst_cea_cc_overlay_get_src_caps() argument
822 GstPad *sinkpad = overlay->video_sinkpad; in gst_cea_cc_overlay_get_src_caps()
825 if (G_UNLIKELY (!overlay)) in gst_cea_cc_overlay_get_src_caps()
878 GST_DEBUG_OBJECT (overlay, "returning %" GST_PTR_FORMAT, caps); in gst_cea_cc_overlay_get_src_caps()
888 gst_cea_cc_overlay_push_frame (GstCeaCcOverlay * overlay, in gst_cea_cc_overlay_push_frame() argument
893 if (overlay->current_composition == NULL) in gst_cea_cc_overlay_push_frame()
895 GST_LOG_OBJECT (overlay, "gst_cea_cc_overlay_push_frame"); in gst_cea_cc_overlay_push_frame()
897 if (gst_pad_check_reconfigure (overlay->srcpad)) in gst_cea_cc_overlay_push_frame()
898 gst_cea_cc_overlay_negotiate (overlay, NULL); in gst_cea_cc_overlay_push_frame()
902 if (overlay->attach_compo_to_buffer) { in gst_cea_cc_overlay_push_frame()
903 GST_DEBUG_OBJECT (overlay, "Attaching text overlay image to video buffer"); in gst_cea_cc_overlay_push_frame()
905 overlay->current_composition); in gst_cea_cc_overlay_push_frame()
909 if (!gst_video_frame_map (&frame, &overlay->info, video_frame, in gst_cea_cc_overlay_push_frame()
913 gst_video_overlay_composition_blend (overlay->current_composition, &frame); in gst_cea_cc_overlay_push_frame()
919 return gst_pad_push (overlay->srcpad, video_frame); in gst_cea_cc_overlay_push_frame()
932 GstCeaCcOverlay *overlay; in gst_cea_cc_overlay_cc_pad_link() local
934 overlay = GST_CEA_CC_OVERLAY (parent); in gst_cea_cc_overlay_cc_pad_link()
935 if (G_UNLIKELY (!overlay)) in gst_cea_cc_overlay_cc_pad_link()
938 GST_DEBUG_OBJECT (overlay, "Closed Caption pad linked"); in gst_cea_cc_overlay_cc_pad_link()
940 overlay->cc_pad_linked = TRUE; in gst_cea_cc_overlay_cc_pad_link()
948 GstCeaCcOverlay *overlay; in gst_cea_cc_overlay_cc_pad_unlink() local
951 overlay = GST_CEA_CC_OVERLAY (parent); in gst_cea_cc_overlay_cc_pad_unlink()
953 GST_DEBUG_OBJECT (overlay, "Closed Caption pad unlinked"); in gst_cea_cc_overlay_cc_pad_unlink()
955 overlay->cc_pad_linked = FALSE; in gst_cea_cc_overlay_cc_pad_unlink()
957 gst_segment_init (&overlay->cc_segment, GST_FORMAT_UNDEFINED); in gst_cea_cc_overlay_cc_pad_unlink()
964 GstCeaCcOverlay *overlay = NULL; in gst_cea_cc_overlay_cc_event() local
966 overlay = GST_CEA_CC_OVERLAY (parent); in gst_cea_cc_overlay_cc_event()
968 GST_LOG_OBJECT (overlay, "received event %s", GST_EVENT_TYPE_NAME (event)); in gst_cea_cc_overlay_cc_event()
980 overlay->is_cdp = !g_strcmp0 (cctype, "cdp"); in gst_cea_cc_overlay_cc_event()
988 overlay->cc_eos = FALSE; in gst_cea_cc_overlay_cc_event()
993 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_cc_event()
994 gst_segment_copy_into (segment, &overlay->cc_segment); in gst_cea_cc_overlay_cc_event()
995 GST_DEBUG_OBJECT (overlay, "TEXT SEGMENT now: %" GST_SEGMENT_FORMAT, in gst_cea_cc_overlay_cc_event()
996 &overlay->cc_segment); in gst_cea_cc_overlay_cc_event()
997 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_cc_event()
999 GST_ELEMENT_WARNING (overlay, STREAM, MUX, (NULL), in gst_cea_cc_overlay_cc_event()
1008 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_cc_event()
1009 GST_CEA_CC_OVERLAY_BROADCAST (overlay); in gst_cea_cc_overlay_cc_event()
1010 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_cc_event()
1022 overlay->cc_segment.position = start; in gst_cea_cc_overlay_cc_event()
1026 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_cc_event()
1027 GST_CEA_CC_OVERLAY_BROADCAST (overlay); in gst_cea_cc_overlay_cc_event()
1028 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_cc_event()
1035 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_cc_event()
1036 GST_INFO_OBJECT (overlay, "text flush stop"); in gst_cea_cc_overlay_cc_event()
1037 overlay->cc_flushing = FALSE; in gst_cea_cc_overlay_cc_event()
1038 overlay->cc_eos = FALSE; in gst_cea_cc_overlay_cc_event()
1039 gst_cea_cc_overlay_pop_text (overlay); in gst_cea_cc_overlay_cc_event()
1040 gst_segment_init (&overlay->cc_segment, GST_FORMAT_TIME); in gst_cea_cc_overlay_cc_event()
1041 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_cc_event()
1046 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_cc_event()
1047 GST_INFO_OBJECT (overlay, "text flush start"); in gst_cea_cc_overlay_cc_event()
1048 overlay->cc_flushing = TRUE; in gst_cea_cc_overlay_cc_event()
1049 GST_CEA_CC_OVERLAY_BROADCAST (overlay); in gst_cea_cc_overlay_cc_event()
1050 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_cc_event()
1055 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_cc_event()
1056 overlay->cc_eos = TRUE; in gst_cea_cc_overlay_cc_event()
1057 GST_INFO_OBJECT (overlay, "closed caption EOS"); in gst_cea_cc_overlay_cc_event()
1060 GST_CEA_CC_OVERLAY_BROADCAST (overlay); in gst_cea_cc_overlay_cc_event()
1061 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_cc_event()
1078 GstCeaCcOverlay *overlay = NULL; in gst_cea_cc_overlay_video_event() local
1080 overlay = GST_CEA_CC_OVERLAY (parent); in gst_cea_cc_overlay_video_event()
1090 ret = gst_cea_cc_overlay_setcaps (overlay, caps); in gst_cea_cc_overlay_video_event()
1098 GST_DEBUG_OBJECT (overlay, "received new segment"); in gst_cea_cc_overlay_video_event()
1103 GST_DEBUG_OBJECT (overlay, "VIDEO SEGMENT now: %" GST_SEGMENT_FORMAT, in gst_cea_cc_overlay_video_event()
1104 &overlay->segment); in gst_cea_cc_overlay_video_event()
1106 gst_segment_copy_into (segment, &overlay->segment); in gst_cea_cc_overlay_video_event()
1108 GST_ELEMENT_WARNING (overlay, STREAM, MUX, (NULL), in gst_cea_cc_overlay_video_event()
1116 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_video_event()
1117 GST_INFO_OBJECT (overlay, "video EOS"); in gst_cea_cc_overlay_video_event()
1118 overlay->video_eos = TRUE; in gst_cea_cc_overlay_video_event()
1119 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_event()
1123 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_video_event()
1124 GST_INFO_OBJECT (overlay, "video flush start"); in gst_cea_cc_overlay_video_event()
1125 overlay->video_flushing = TRUE; in gst_cea_cc_overlay_video_event()
1126 GST_CEA_CC_OVERLAY_BROADCAST (overlay); in gst_cea_cc_overlay_video_event()
1127 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_event()
1131 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_video_event()
1132 GST_INFO_OBJECT (overlay, "video flush stop"); in gst_cea_cc_overlay_video_event()
1133 overlay->video_flushing = FALSE; in gst_cea_cc_overlay_video_event()
1134 overlay->video_eos = FALSE; in gst_cea_cc_overlay_video_event()
1135 gst_segment_init (&overlay->segment, GST_FORMAT_TIME); in gst_cea_cc_overlay_video_event()
1136 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_event()
1152 GstCeaCcOverlay *overlay; in gst_cea_cc_overlay_video_query() local
1154 overlay = GST_CEA_CC_OVERLAY (parent); in gst_cea_cc_overlay_video_query()
1162 caps = gst_cea_cc_overlay_get_videosink_caps (pad, overlay, filter); in gst_cea_cc_overlay_video_query()
1178 gst_cea_cc_overlay_pop_text (GstCeaCcOverlay * overlay) in gst_cea_cc_overlay_pop_text() argument
1180 g_return_if_fail (GST_IS_CEA_CC_OVERLAY (overlay)); in gst_cea_cc_overlay_pop_text()
1182 if (GST_CLOCK_TIME_IS_VALID (overlay->current_comp_start_time) in gst_cea_cc_overlay_pop_text()
1183 && overlay->current_composition) { in gst_cea_cc_overlay_pop_text()
1184 GST_DEBUG_OBJECT (overlay, "releasing composition %p", in gst_cea_cc_overlay_pop_text()
1185 overlay->current_composition); in gst_cea_cc_overlay_pop_text()
1186 gst_video_overlay_composition_unref (overlay->current_composition); in gst_cea_cc_overlay_pop_text()
1187 overlay->current_composition = NULL; in gst_cea_cc_overlay_pop_text()
1188 overlay->current_comp_start_time = GST_CLOCK_TIME_NONE; in gst_cea_cc_overlay_pop_text()
1192 GST_CEA_CC_OVERLAY_BROADCAST (overlay); in gst_cea_cc_overlay_pop_text()
1264 gst_cea_cc_overlay_create_and_push_buffer (GstCeaCcOverlay * overlay) in gst_cea_cc_overlay_create_and_push_buffer() argument
1266 Cea708Dec *decoder = overlay->decoder; in gst_cea_cc_overlay_create_and_push_buffer()
1277 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_create_and_push_buffer()
1286 GST_DEBUG_OBJECT (overlay, "Allocating buffer"); in gst_cea_cc_overlay_create_and_push_buffer()
1308 v_anchor = window->screen_vertical * overlay->height / 100; in gst_cea_cc_overlay_create_and_push_buffer()
1309 switch (overlay->default_window_h_pos) { in gst_cea_cc_overlay_create_and_push_buffer()
1314 window->h_offset = (overlay->width - window->image_width) / 2; in gst_cea_cc_overlay_create_and_push_buffer()
1317 window->h_offset = overlay->width - window->image_width; in gst_cea_cc_overlay_create_and_push_buffer()
1374 GST_INFO_OBJECT (overlay, in gst_cea_cc_overlay_create_and_push_buffer()
1393 if (GST_CLOCK_TIME_IS_VALID (overlay->current_comp_start_time)) { in gst_cea_cc_overlay_create_and_push_buffer()
1394 overlay->next_composition = comp; in gst_cea_cc_overlay_create_and_push_buffer()
1395 overlay->next_comp_start_time = decoder->current_time; in gst_cea_cc_overlay_create_and_push_buffer()
1396 GST_DEBUG_OBJECT (overlay, in gst_cea_cc_overlay_create_and_push_buffer()
1399 overlay->next_composition, overlay->current_composition, in gst_cea_cc_overlay_create_and_push_buffer()
1400 GST_TIME_ARGS (overlay->next_comp_start_time), in gst_cea_cc_overlay_create_and_push_buffer()
1401 GST_TIME_ARGS (overlay->current_comp_start_time)); in gst_cea_cc_overlay_create_and_push_buffer()
1403 GST_DEBUG_OBJECT (overlay, "has a closed caption buffer queued, waiting"); in gst_cea_cc_overlay_create_and_push_buffer()
1404 GST_CEA_CC_OVERLAY_WAIT (overlay); in gst_cea_cc_overlay_create_and_push_buffer()
1405 GST_DEBUG_OBJECT (overlay, "resuming"); in gst_cea_cc_overlay_create_and_push_buffer()
1406 if (overlay->cc_flushing) { in gst_cea_cc_overlay_create_and_push_buffer()
1407 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_create_and_push_buffer()
1412 overlay->next_composition = NULL; in gst_cea_cc_overlay_create_and_push_buffer()
1413 overlay->next_comp_start_time = GST_CLOCK_TIME_NONE; in gst_cea_cc_overlay_create_and_push_buffer()
1414 overlay->current_composition = comp; in gst_cea_cc_overlay_create_and_push_buffer()
1415 overlay->current_comp_start_time = decoder->current_time; in gst_cea_cc_overlay_create_and_push_buffer()
1416 GST_DEBUG_OBJECT (overlay, "T: %" GST_TIME_FORMAT, in gst_cea_cc_overlay_create_and_push_buffer()
1417 GST_TIME_ARGS (overlay->current_comp_start_time)); in gst_cea_cc_overlay_create_and_push_buffer()
1418 overlay->need_update = FALSE; in gst_cea_cc_overlay_create_and_push_buffer()
1421 GST_CEA_CC_OVERLAY_BROADCAST (overlay); in gst_cea_cc_overlay_create_and_push_buffer()
1422 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_create_and_push_buffer()
1426 gst_cea_cc_overlay_process_packet (GstCeaCcOverlay * overlay, guint8 cc_type) in gst_cea_cc_overlay_process_packet() argument
1436 index = &overlay->cea608_index[cc_type]; in gst_cea_cc_overlay_process_packet()
1437 buffer = overlay->cea608_buffer[cc_type]; in gst_cea_cc_overlay_process_packet()
1442 index = &overlay->cea708_index; in gst_cea_cc_overlay_process_packet()
1443 buffer = overlay->cea708_buffer; in gst_cea_cc_overlay_process_packet()
1446 GST_ERROR_OBJECT (overlay, in gst_cea_cc_overlay_process_packet()
1454 GST_LOG_OBJECT (overlay, in gst_cea_cc_overlay_process_packet()
1460 gst_cea708dec_process_dtvcc_packet (overlay->decoder, dtvcc_buffer, in gst_cea_cc_overlay_process_packet()
1464 gst_cea_cc_overlay_create_and_push_buffer (overlay); in gst_cea_cc_overlay_process_packet()
1473 * @overlay: The #GstCeaCcOverlay
1506 gst_cea_cc_overlay_user_data_decode (GstCeaCcOverlay * overlay, in gst_cea_cc_overlay_user_data_decode() argument
1525 GST_LOG_OBJECT (overlay, "cc_data_pkt(%d): cc_valid=%d cc_type=%d " in gst_cea_cc_overlay_user_data_decode()
1534 if (overlay->cea608_index[cc_type] <= DTVCC_LENGTH - 2) { in gst_cea_cc_overlay_user_data_decode()
1538 gst_cea_cc_overlay_process_packet (overlay, cc_type); in gst_cea_cc_overlay_user_data_decode()
1540 overlay->cea608_buffer[cc_type][overlay-> in gst_cea_cc_overlay_user_data_decode()
1544 GST_ERROR_OBJECT (overlay, "cea608_buffer[%d] overflow!", cc_type); in gst_cea_cc_overlay_user_data_decode()
1554 gst_cea_cc_overlay_process_packet (overlay, cc_type); in gst_cea_cc_overlay_user_data_decode()
1557 if (overlay->cea708_index <= DTVCC_LENGTH - 2) { in gst_cea_cc_overlay_user_data_decode()
1558 overlay->cea708_buffer[overlay->cea708_index++] = cc_data[0]; in gst_cea_cc_overlay_user_data_decode()
1559 overlay->cea708_buffer[overlay->cea708_index++] = cc_data[1]; in gst_cea_cc_overlay_user_data_decode()
1561 GST_ERROR_OBJECT (overlay, "cea708_buffer overflow!"); in gst_cea_cc_overlay_user_data_decode()
1566 gst_cea_cc_overlay_process_packet (overlay, cc_type); in gst_cea_cc_overlay_user_data_decode()
1661 GstCeaCcOverlay *overlay = (GstCeaCcOverlay *) parent; in gst_cea_cc_overlay_cc_chain() local
1665 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_cc_chain()
1667 if (overlay->cc_flushing) { in gst_cea_cc_overlay_cc_chain()
1668 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_cc_chain()
1670 GST_LOG_OBJECT (overlay, "closed caption flushing"); in gst_cea_cc_overlay_cc_chain()
1674 if (overlay->cc_eos) { in gst_cea_cc_overlay_cc_chain()
1675 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_cc_chain()
1677 GST_LOG_OBJECT (overlay, "closed caption EOS"); in gst_cea_cc_overlay_cc_chain()
1681 GST_LOG_OBJECT (overlay, "%" GST_SEGMENT_FORMAT " BUFFER: ts=%" in gst_cea_cc_overlay_cc_chain()
1682 GST_TIME_FORMAT ", end=%" GST_TIME_FORMAT, &overlay->segment, in gst_cea_cc_overlay_cc_chain()
1695 in_seg = gst_segment_clip (&overlay->cc_segment, GST_FORMAT_TIME, in gst_cea_cc_overlay_cc_chain()
1697 GST_LOG_OBJECT (overlay, "stop:%" GST_TIME_FORMAT ", in_seg: %d", in gst_cea_cc_overlay_cc_chain()
1709 overlay->cc_segment.position = clip_start; in gst_cea_cc_overlay_cc_chain()
1710 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_cc_chain()
1713 if (overlay->is_cdp) { in gst_cea_cc_overlay_cc_chain()
1720 gst_cea_cc_overlay_user_data_decode (overlay, ccdata, ccsize); in gst_cea_cc_overlay_cc_chain()
1721 overlay->decoder->current_time = GST_BUFFER_PTS (buffer); in gst_cea_cc_overlay_cc_chain()
1725 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_cc_chain()
1737 GstCeaCcOverlay *overlay; in gst_cea_cc_overlay_video_chain() local
1742 overlay = GST_CEA_CC_OVERLAY (parent); in gst_cea_cc_overlay_video_chain()
1756 GST_LOG_OBJECT (overlay, "%" GST_SEGMENT_FORMAT " BUFFER: ts=%" in gst_cea_cc_overlay_video_chain()
1757 GST_TIME_FORMAT ", end=%" GST_TIME_FORMAT, &overlay->segment, in gst_cea_cc_overlay_video_chain()
1762 if (stop == GST_CLOCK_TIME_NONE && start < overlay->segment.start) in gst_cea_cc_overlay_video_chain()
1765 in_seg = gst_segment_clip (&overlay->segment, GST_FORMAT_TIME, start, stop, in gst_cea_cc_overlay_video_chain()
1773 GST_DEBUG_OBJECT (overlay, "clipping buffer timestamp/duration to segment"); in gst_cea_cc_overlay_video_chain()
1784 if (overlay->info.fps_n && overlay->info.fps_d) { in gst_cea_cc_overlay_video_chain()
1785 GST_DEBUG_OBJECT (overlay, "estimating duration based on framerate"); in gst_cea_cc_overlay_video_chain()
1787 overlay->info.fps_d, overlay->info.fps_n); in gst_cea_cc_overlay_video_chain()
1789 GST_LOG_OBJECT (overlay, "no duration, assuming minimal duration"); in gst_cea_cc_overlay_video_chain()
1794 gst_object_sync_values (GST_OBJECT (overlay), GST_BUFFER_TIMESTAMP (buffer)); in gst_cea_cc_overlay_video_chain()
1798 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_video_chain()
1800 if (overlay->video_flushing) in gst_cea_cc_overlay_video_chain()
1803 if (overlay->video_eos) in gst_cea_cc_overlay_video_chain()
1806 if (overlay->silent) { in gst_cea_cc_overlay_video_chain()
1807 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_chain()
1808 ret = gst_pad_push (overlay->srcpad, buffer); in gst_cea_cc_overlay_video_chain()
1811 overlay->segment.position = clip_start; in gst_cea_cc_overlay_video_chain()
1817 if (!overlay->cc_pad_linked) { in gst_cea_cc_overlay_video_chain()
1818 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_chain()
1819 ret = gst_pad_push (overlay->srcpad, buffer); in gst_cea_cc_overlay_video_chain()
1822 if (GST_CLOCK_TIME_IS_VALID (overlay->current_comp_start_time)) { in gst_cea_cc_overlay_video_chain()
1834 gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME, in gst_cea_cc_overlay_video_chain()
1838 gst_segment_to_running_time (&overlay->segment, GST_FORMAT_TIME, in gst_cea_cc_overlay_video_chain()
1840 if (GST_CLOCK_TIME_IS_VALID (overlay->next_comp_start_time)) { in gst_cea_cc_overlay_video_chain()
1842 gst_segment_to_running_time (&overlay->cc_segment, GST_FORMAT_TIME, in gst_cea_cc_overlay_video_chain()
1843 overlay->next_comp_start_time); in gst_cea_cc_overlay_video_chain()
1847 GST_DEBUG_OBJECT (overlay, in gst_cea_cc_overlay_video_chain()
1849 " - overlay->next_comp_start_time: %" GST_TIME_FORMAT, in gst_cea_cc_overlay_video_chain()
1851 GST_TIME_ARGS (overlay->next_comp_start_time)); in gst_cea_cc_overlay_video_chain()
1852 GST_DEBUG_OBJECT (overlay, in gst_cea_cc_overlay_video_chain()
1856 GST_LOG_OBJECT (overlay, in gst_cea_cc_overlay_video_chain()
1859 gst_cea_cc_overlay_pop_text (overlay); in gst_cea_cc_overlay_video_chain()
1860 GST_CEA_CC_OVERLAY_WAIT (overlay); in gst_cea_cc_overlay_video_chain()
1861 GST_DEBUG_OBJECT (overlay, "resuming"); in gst_cea_cc_overlay_video_chain()
1862 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_chain()
1870 if (!GST_CLOCK_TIME_IS_VALID (overlay->current_comp_start_time)) { in gst_cea_cc_overlay_video_chain()
1871 GST_WARNING_OBJECT (overlay, "Got text buffer with invalid timestamp"); in gst_cea_cc_overlay_video_chain()
1879 gst_segment_to_running_time (&overlay->cc_segment, in gst_cea_cc_overlay_video_chain()
1880 GST_FORMAT_TIME, overlay->current_comp_start_time); in gst_cea_cc_overlay_video_chain()
1883 GST_DEBUG_OBJECT (overlay, "T: %" GST_TIME_FORMAT, in gst_cea_cc_overlay_video_chain()
1885 GST_DEBUG_OBJECT (overlay, "V: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT, in gst_cea_cc_overlay_video_chain()
1890 GST_LOG_OBJECT (overlay, "text in future, pushing video buf"); in gst_cea_cc_overlay_video_chain()
1891 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_chain()
1893 ret = gst_pad_push (overlay->srcpad, buffer); in gst_cea_cc_overlay_video_chain()
1895 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_chain()
1896 ret = gst_cea_cc_overlay_push_frame (overlay, buffer); in gst_cea_cc_overlay_video_chain()
1899 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_video_chain()
1900 gst_cea_cc_overlay_pop_text (overlay); in gst_cea_cc_overlay_video_chain()
1901 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_chain()
1904 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_chain()
1905 GST_LOG_OBJECT (overlay, "no need to wait for a text buffer"); in gst_cea_cc_overlay_video_chain()
1906 ret = gst_pad_push (overlay->srcpad, buffer); in gst_cea_cc_overlay_video_chain()
1911 overlay->segment.position = clip_start; in gst_cea_cc_overlay_video_chain()
1912 GST_DEBUG_OBJECT (overlay, "ret=%d", ret); in gst_cea_cc_overlay_video_chain()
1918 GST_WARNING_OBJECT (overlay, "buffer without timestamp, discarding"); in gst_cea_cc_overlay_video_chain()
1925 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_chain()
1926 GST_DEBUG_OBJECT (overlay, "flushing, discarding buffer"); in gst_cea_cc_overlay_video_chain()
1932 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_video_chain()
1933 GST_DEBUG_OBJECT (overlay, "eos, discarding buffer"); in gst_cea_cc_overlay_video_chain()
1939 GST_DEBUG_OBJECT (overlay, "buffer out of segment, discarding"); in gst_cea_cc_overlay_video_chain()
1950 GstCeaCcOverlay *overlay = GST_CEA_CC_OVERLAY (element); in gst_cea_cc_overlay_change_state() local
1954 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_change_state()
1955 overlay->cc_flushing = TRUE; in gst_cea_cc_overlay_change_state()
1956 overlay->video_flushing = TRUE; in gst_cea_cc_overlay_change_state()
1959 gst_cea_cc_overlay_pop_text (overlay); in gst_cea_cc_overlay_change_state()
1960 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_change_state()
1972 GST_CEA_CC_OVERLAY_LOCK (overlay); in gst_cea_cc_overlay_change_state()
1973 overlay->cc_flushing = FALSE; in gst_cea_cc_overlay_change_state()
1974 overlay->video_flushing = FALSE; in gst_cea_cc_overlay_change_state()
1975 overlay->video_eos = FALSE; in gst_cea_cc_overlay_change_state()
1976 overlay->cc_eos = FALSE; in gst_cea_cc_overlay_change_state()
1977 gst_segment_init (&overlay->segment, GST_FORMAT_TIME); in gst_cea_cc_overlay_change_state()
1978 gst_segment_init (&overlay->cc_segment, GST_FORMAT_TIME); in gst_cea_cc_overlay_change_state()
1979 GST_CEA_CC_OVERLAY_UNLOCK (overlay); in gst_cea_cc_overlay_change_state()