From ebe0b1887aaa199cf145c607189959cb9947a252 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 23 Sep 2012 16:31:37 +0100 Subject: [PATCH] smpte: send stream-start event --- gst/smpte/gstsmpte.c | 11 +++++++++++ gst/smpte/gstsmpte.h | 1 + 2 files changed, 12 insertions(+) diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c index 6d5f092..f82f612 100644 --- a/gst/smpte/gstsmpte.c +++ b/gst/smpte/gstsmpte.c @@ -98,6 +98,7 @@ enum PROP_LAST, }; +/* FIXME: should use video meta etc. */ #define I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width)) #define I420_U_ROWSTRIDE(width) (GST_ROUND_UP_8(width)/2) #define I420_V_ROWSTRIDE(width) ((GST_ROUND_UP_8(I420_Y_ROWSTRIDE(width)))/2) @@ -386,6 +387,7 @@ gst_smpte_reset (GstSMPTE * smpte) smpte->height = -1; smpte->position = 0; smpte->end_position = 0; + smpte->send_stream_start = TRUE; } static void @@ -467,6 +469,15 @@ gst_smpte_collected (GstCollectPads * pads, GstSMPTE * smpte) !gst_pad_has_current_caps (smpte->sinkpad2)) goto not_negotiated; + if (smpte->send_stream_start) { + gchar s_id[32]; + + /* stream-start (FIXME: create id based on input ids) */ + g_snprintf (s_id, sizeof (s_id), "smpte-%08x", g_random_int ()); + gst_pad_push_event (smpte->srcpad, gst_event_new_stream_start (s_id)); + smpte->send_stream_start = FALSE; + } + ts = gst_util_uint64_scale_int (smpte->position * GST_SECOND, smpte->fps_denom, smpte->fps_num); diff --git a/gst/smpte/gstsmpte.h b/gst/smpte/gstsmpte.h index cc48108..a91f6a2 100644 --- a/gst/smpte/gstsmpte.h +++ b/gst/smpte/gstsmpte.h @@ -51,6 +51,7 @@ struct _GstSMPTE { *sinkpad1, *sinkpad2; GstCollectPads *collect; + gboolean send_stream_start; /* properties */ gint type; -- 2.7.4