static GstFlowReturn
gst_cc_extractor_handle_meta (GstCCExtractor * filter, GstBuffer * buf,
- GstVideoCaptionMeta * meta)
+ GstVideoCaptionMeta * meta, GstVideoTimeCodeMeta * tc_meta)
{
GstBuffer *outbuf = NULL;
GstEvent *event;
GST_BUFFER_DTS (outbuf) = GST_BUFFER_DTS (buf);
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
+ if (tc_meta)
+ gst_buffer_add_video_time_code_meta (outbuf, &tc_meta->tc);
+
/* We don't really care about the flow return */
flow = gst_pad_push (filter->captionpad, outbuf);
GstCCExtractor *filter = (GstCCExtractor *) parent;
GstFlowReturn flow = GST_FLOW_OK;
GstVideoCaptionMeta *cc_meta;
+ GstVideoTimeCodeMeta *tc_meta;
gpointer iter = NULL;
+ tc_meta = gst_buffer_get_video_time_code_meta (buf);
+
while ((cc_meta =
(GstVideoCaptionMeta *) gst_buffer_iterate_meta_filtered (buf, &iter,
GST_VIDEO_CAPTION_META_API_TYPE)) && flow == GST_FLOW_OK) {
- flow = gst_cc_extractor_handle_meta (filter, buf, cc_meta);
+ flow = gst_cc_extractor_handle_meta (filter, buf, cc_meta, tc_meta);
}
/* If there's an issue handling the CC, return immediately */
GstBuffer *buf, *outbuf;
const guint8 caption_data[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
GstCaps *caps;
+ GstVideoTimeCode *tc;
+ GstVideoTimeCodeMeta *tc_meta;
h = gst_harness_new ("ccextractor");
h2 = gst_harness_new_with_element (h->element, NULL, NULL);
gst_buffer_add_video_caption_meta (buf, GST_VIDEO_CAPTION_TYPE_CEA708_RAW,
caption_data, sizeof (caption_data));
+ tc = gst_video_time_code_new (30, 1, NULL, GST_VIDEO_TIME_CODE_FLAGS_NONE, 0,
+ 0, 0, 0, 0);
+ gst_buffer_add_video_time_code_meta (buf, tc);
+
outbuf = gst_harness_push_and_pull (h, gst_buffer_ref (buf));
fail_unless (outbuf != NULL);
fail_unless (outbuf == buf);
+
+ tc_meta = gst_buffer_get_video_time_code_meta (outbuf);
+ fail_unless (tc_meta != NULL);
+ fail_unless_equals_int (gst_video_time_code_compare (&tc_meta->tc, tc), 0);
+
gst_buffer_unref (outbuf);
gst_buffer_unref (buf);
fail_unless (outbuf != NULL);
fail_unless (gst_buffer_memcmp (outbuf, 0, caption_data,
sizeof (caption_data)) == 0);
+
+ tc_meta = gst_buffer_get_video_time_code_meta (outbuf);
+ fail_unless (tc_meta != NULL);
+ fail_unless_equals_int (gst_video_time_code_compare (&tc_meta->tc, tc), 0);
+ gst_video_time_code_free (tc);
+
gst_buffer_unref (outbuf);
caps = gst_pad_get_current_caps (h->sinkpad);
gst_buffer_add_video_caption_meta (buf, GST_VIDEO_CAPTION_TYPE_CEA708_RAW,
caption_data, sizeof (caption_data));
+ tc = gst_video_time_code_new (30, 1, NULL, GST_VIDEO_TIME_CODE_FLAGS_NONE, 0,
+ 0, 0, 1, 0);
+ gst_buffer_add_video_time_code_meta (buf, tc);
+
outbuf = gst_harness_push_and_pull (h, gst_buffer_ref (buf));
fail_unless (outbuf != NULL);
fail_unless (outbuf == buf);
+
+ tc_meta = gst_buffer_get_video_time_code_meta (outbuf);
+ fail_unless (tc_meta != NULL);
+ fail_unless_equals_int (gst_video_time_code_compare (&tc_meta->tc, tc), 0);
+
gst_buffer_unref (outbuf);
gst_buffer_unref (buf);
fail_unless (outbuf != NULL);
fail_unless (gst_buffer_memcmp (outbuf, 0, caption_data,
sizeof (caption_data)) == 0);
+
+ tc_meta = gst_buffer_get_video_time_code_meta (outbuf);
+ fail_unless (tc_meta != NULL);
+ fail_unless_equals_int (gst_video_time_code_compare (&tc_meta->tc, tc), 0);
+ gst_video_time_code_free (tc);
+
gst_buffer_unref (outbuf);
caps = gst_pad_get_current_caps (h->sinkpad);