From 2a51113351ede1fc3e3b9e8da5eb8ed4f5d0b031 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 2 Jul 2012 17:52:15 -0700 Subject: [PATCH] decklinksrc: Send newsegment events --- sys/decklink/gstdecklinksrc.cpp | 30 ++++++++++++++++++++++++++++++ sys/decklink/gstdecklinksrc.h | 2 ++ 2 files changed, 32 insertions(+) diff --git a/sys/decklink/gstdecklinksrc.cpp b/sys/decklink/gstdecklinksrc.cpp index 891b88eecd..6b70649354 100644 --- a/sys/decklink/gstdecklinksrc.cpp +++ b/sys/decklink/gstdecklinksrc.cpp @@ -1266,6 +1266,21 @@ gst_decklink_src_task (void *priv) decklinksrc->dropped_frames_old = decklinksrc->dropped_frames; } + if (!decklinksrc->video_new_segment) { + GstEvent *event; + gboolean ret; + + event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, + 0, GST_CLOCK_TIME_NONE, 0); + + ret = gst_pad_push_event (decklinksrc->videosrcpad, event); + if (!ret) { + GST_WARNING ("new segment event not handled"); + } + + decklinksrc->video_new_segment = TRUE; + } + mode = gst_decklink_get_mode (decklinksrc->mode); video_frame->GetBytes (&data); @@ -1340,6 +1355,21 @@ gst_decklink_src_task (void *priv) } if (gst_pad_is_linked (decklinksrc->audiosrcpad)) { + if (!decklinksrc->audio_new_segment) { + GstEvent *event; + gboolean ret; + + event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, + 0, GST_CLOCK_TIME_NONE, 0); + + ret = gst_pad_push_event (decklinksrc->audiosrcpad, event); + if (!ret) { + GST_WARNING ("new segment event not handled"); + } + + decklinksrc->audio_new_segment = TRUE; + } + n_samples = audio_frame->GetSampleFrameCount (); audio_frame->GetBytes (&data); audio_buffer = gst_buffer_new_and_alloc (n_samples * 2 * 2); diff --git a/sys/decklink/gstdecklinksrc.h b/sys/decklink/gstdecklinksrc.h index c47279a88b..38d00d7116 100644 --- a/sys/decklink/gstdecklinksrc.h +++ b/sys/decklink/gstdecklinksrc.h @@ -67,6 +67,8 @@ struct _GstDecklinkSrc int height; gboolean interlaced; BMDDisplayMode bmd_mode; + gboolean video_new_segment; + gboolean audio_new_segment; /* properties */ gboolean copy_data;