/** * gst_video_time_code_copy: * @tc: a #GstVideoTimeCode * * Returns: a new #GstVideoTimeCode with the same values as @tc . * * Since: 1.10 */ GstVideoTimeCode * gst_video_time_code_copy (const GstVideoTimeCode * tc) { return gst_video_time_code_new (tc->config.fps_n, tc->config.fps_d, tc->config.latest_daily_jam, tc->config.flags, tc->hours, tc->minutes, tc->seconds, tc->frames, tc->field_count); }
static void gst_decklink_video_src_got_frame (GstElement * element, IDeckLinkVideoInputFrame * frame, GstDecklinkModeEnum mode, GstClockTime capture_time, GstClockTime capture_duration, guint hours, guint minutes, guint seconds, guint frames, BMDTimecodeFlags bflags) { GstDecklinkVideoSrc *self = GST_DECKLINK_VIDEO_SRC_CAST (element); GST_LOG_OBJECT (self, "Got video frame at %" GST_TIME_FORMAT, GST_TIME_ARGS (capture_time)); gst_decklink_video_src_convert_to_external_clock (self, &capture_time, &capture_duration); GST_LOG_OBJECT (self, "Actual timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (capture_time)); g_mutex_lock (&self->lock); if (!self->flushing) { CaptureFrame *f; const GstDecklinkMode *bmode; GstVideoTimeCodeFlags flags = GST_VIDEO_TIME_CODE_FLAGS_NONE; guint field_count = 0; while (g_queue_get_length (&self->current_frames) >= self->buffer_size) { f = (CaptureFrame *) g_queue_pop_head (&self->current_frames); GST_WARNING_OBJECT (self, "Dropping old frame at %" GST_TIME_FORMAT, GST_TIME_ARGS (f->capture_time)); capture_frame_free (f); } f = (CaptureFrame *) g_malloc0 (sizeof (CaptureFrame)); f->frame = frame; f->capture_time = capture_time; f->capture_duration = capture_duration; f->mode = mode; f->format = frame->GetPixelFormat (); bmode = gst_decklink_get_mode (mode); if (bmode->interlaced) { flags = (GstVideoTimeCodeFlags) (flags | GST_VIDEO_TIME_CODE_FLAGS_INTERLACED); if (bflags & bmdTimecodeFieldMark) field_count = 2; else field_count = 1; } if (bflags & bmdTimecodeIsDropFrame) flags = (GstVideoTimeCodeFlags) (flags | GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME); f->tc = gst_video_time_code_new (bmode->fps_n, bmode->fps_d, NULL, flags, hours, minutes, seconds, frames, field_count); frame->AddRef (); g_queue_push_tail (&self->current_frames, f); g_cond_signal (&self->cond); } g_mutex_unlock (&self->lock); }