static GstCaps * gst_decklink_video_sink_get_caps (GstBaseSink * bsink, GstCaps * filter) { GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (bsink); GstCaps *mode_caps, *caps; if (self->mode == GST_DECKLINK_MODE_AUTO && self->video_format == GST_DECKLINK_VIDEO_FORMAT_AUTO) mode_caps = gst_decklink_mode_get_template_caps (FALSE); else if (self->video_format == GST_DECKLINK_VIDEO_FORMAT_AUTO) mode_caps = gst_decklink_mode_get_caps_all_formats (self->mode, FALSE); else if (self->mode == GST_DECKLINK_MODE_AUTO) mode_caps = gst_decklink_pixel_format_get_caps (gst_decklink_pixel_format_from_type (self->video_format), FALSE); else mode_caps = gst_decklink_mode_get_caps (self->mode, gst_decklink_pixel_format_from_type (self->video_format), FALSE); mode_caps = gst_caps_make_writable (mode_caps); /* For output we support any framerate and only really care about timestamps */ gst_caps_map_in_place (mode_caps, reset_framerate, NULL); if (filter) { caps = gst_caps_intersect_full (filter, mode_caps, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (mode_caps); } else { caps = mode_caps; } return caps; }
static void gst_decklink_video_sink_class_init (GstDecklinkVideoSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstBaseSinkClass *basesink_class = GST_BASE_SINK_CLASS (klass); GstCaps *templ_caps; gobject_class->set_property = gst_decklink_video_sink_set_property; gobject_class->get_property = gst_decklink_video_sink_get_property; gobject_class->finalize = gst_decklink_video_sink_finalize; element_class->change_state = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_change_state); element_class->provide_clock = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_provide_clock); basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_get_caps); basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_set_caps); basesink_class->prepare = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_prepare); basesink_class->render = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_render); // FIXME: These are misnamed in basesink! basesink_class->start = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_open); basesink_class->stop = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_close); basesink_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_decklink_video_sink_propose_allocation); g_object_class_install_property (gobject_class, PROP_MODE, g_param_spec_enum ("mode", "Playback Mode", "Video Mode to use for playback", GST_TYPE_DECKLINK_MODE, GST_DECKLINK_MODE_NTSC, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); g_object_class_install_property (gobject_class, PROP_DEVICE_NUMBER, g_param_spec_int ("device-number", "Device number", "Output device instance to use", 0, G_MAXINT, 0, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); templ_caps = gst_decklink_mode_get_template_caps (); gst_element_class_add_pad_template (element_class, gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, templ_caps)); gst_caps_unref (templ_caps); gst_element_class_set_static_metadata (element_class, "Decklink Video Sink", "Video/Sink", "Decklink Sink", "David Schleef <*****@*****.**>, " "Sebastian Dröge <*****@*****.**>"); GST_DEBUG_CATEGORY_INIT (gst_decklink_video_sink_debug, "decklinkvideosink", 0, "debug category for decklinkvideosink element"); }
static void gst_decklink_src_class_init (GstDecklinkSrcClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gobject_class->set_property = gst_decklink_src_set_property; gobject_class->get_property = gst_decklink_src_get_property; gobject_class->finalize = gst_decklink_src_finalize; element_class->change_state = GST_DEBUG_FUNCPTR (gst_decklink_src_change_state); g_object_class_install_property (gobject_class, PROP_MODE, g_param_spec_enum ("mode", "Mode", "Video mode to use for capture", GST_TYPE_DECKLINK_MODE, GST_DECKLINK_MODE_NTSC, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); g_object_class_install_property (gobject_class, PROP_CONNECTION, g_param_spec_enum ("connection", "Connection", "Video input connection to use", GST_TYPE_DECKLINK_CONNECTION, GST_DECKLINK_CONNECTION_SDI, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); g_object_class_install_property (gobject_class, PROP_AUDIO_INPUT, g_param_spec_enum ("audio-input", "Audio Input", "Audio input connection", GST_TYPE_DECKLINK_AUDIO_CONNECTION, GST_DECKLINK_AUDIO_CONNECTION_AUTO, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); /* FIXME: should be device-number or so, or turned into a string */ #if 0 g_object_class_install_property (gobject_class, PROP_DEVICE, g_param_spec_int ("device", "Device", "Capture device instance to use", 0, G_MAXINT, 0, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); #endif gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_decklink_src_audio_src_template)); gst_element_class_add_pad_template (element_class, gst_pad_template_new ("videosrc", GST_PAD_SRC, GST_PAD_ALWAYS, gst_decklink_mode_get_template_caps ())); gst_element_class_set_static_metadata (element_class, "Decklink source", "Source/Video", "DeckLink Source", "David Schleef <*****@*****.**>"); }
static void gst_decklink_src_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_decklink_src_audio_src_template)); gst_element_class_add_pad_template (element_class, gst_pad_template_new ("videosrc", GST_PAD_SRC, GST_PAD_ALWAYS, gst_decklink_mode_get_template_caps ())); gst_element_class_set_details_simple (element_class, "Decklink source", "Source/Video", "DeckLink Source", "David Schleef <*****@*****.**>"); }
static void gst_decklink_sink_class_init (GstDecklinkSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gobject_class->set_property = gst_decklink_sink_set_property; gobject_class->get_property = gst_decklink_sink_get_property; gobject_class->finalize = gst_decklink_sink_finalize; element_class->change_state = GST_DEBUG_FUNCPTR (gst_decklink_sink_change_state); g_object_class_install_property (gobject_class, PROP_MODE, g_param_spec_enum ("mode", "Playback Mode", "Video Mode to use for playback", GST_TYPE_DECKLINK_MODE, GST_DECKLINK_MODE_NTSC, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); /* FIXME: should be device-number or so, or turned into a string */ #if 0 g_object_class_install_property (gobject_class, PROP_DEVICE, g_param_spec_int ("device", "Device", "Capture device instance to use", 0, G_MAXINT, 0, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); #endif gst_element_class_add_pad_template (element_class, gst_pad_template_new ("videosink", GST_PAD_SINK, GST_PAD_ALWAYS, gst_decklink_mode_get_template_caps ())); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_decklink_sink_audiosink_template)); gst_element_class_set_static_metadata (element_class, "Decklink Sink", "Video/Sink", "Decklink Sink", "David Schleef <*****@*****.**>"); GST_DEBUG_CATEGORY_INIT (gst_decklink_sink_debug_category, "decklinksink", 0, "debug category for decklinksink element"); }
static void gst_decklink_video_src_class_init (GstDecklinkVideoSrcClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstBaseSrcClass *basesrc_class = GST_BASE_SRC_CLASS (klass); GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass); GstCaps *templ_caps; gobject_class->set_property = gst_decklink_video_src_set_property; gobject_class->get_property = gst_decklink_video_src_get_property; gobject_class->finalize = gst_decklink_video_src_finalize; element_class->change_state = GST_DEBUG_FUNCPTR (gst_decklink_video_src_change_state); element_class->provide_clock = GST_DEBUG_FUNCPTR (gst_decklink_video_src_provide_clock); basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_decklink_video_src_get_caps); basesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_decklink_video_src_set_caps); basesrc_class->query = GST_DEBUG_FUNCPTR (gst_decklink_video_src_query); basesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_decklink_video_src_unlock); basesrc_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_decklink_video_src_unlock_stop); pushsrc_class->create = GST_DEBUG_FUNCPTR (gst_decklink_video_src_create); g_object_class_install_property (gobject_class, PROP_MODE, g_param_spec_enum ("mode", "Playback Mode", "Video Mode to use for playback", GST_TYPE_DECKLINK_MODE, DEFAULT_MODE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); g_object_class_install_property (gobject_class, PROP_CONNECTION, g_param_spec_enum ("connection", "Connection", "Video input connection to use", GST_TYPE_DECKLINK_CONNECTION, DEFAULT_CONNECTION, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); g_object_class_install_property (gobject_class, PROP_DEVICE_NUMBER, g_param_spec_int ("device-number", "Device number", "Output device instance to use", 0, G_MAXINT, 0, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); g_object_class_install_property (gobject_class, PROP_BUFFER_SIZE, g_param_spec_uint ("buffer-size", "Buffer Size", "Size of internal buffer in number of video frames", 1, G_MAXINT, DEFAULT_BUFFER_SIZE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (gobject_class, PROP_VIDEO_FORMAT, g_param_spec_enum ("video-format", "Video format", "Video format type to use for input (Only use auto for mode=auto)", GST_TYPE_DECKLINK_VIDEO_FORMAT, GST_DECKLINK_VIDEO_FORMAT_AUTO, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); g_object_class_install_property (gobject_class, PROP_TIMECODE_FORMAT, g_param_spec_enum ("timecode-format", "Timecode format", "Timecode format type to use for input", GST_TYPE_DECKLINK_TIMECODE_FORMAT, GST_DECKLINK_TIMECODE_FORMAT_RP188ANY, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT))); templ_caps = gst_decklink_mode_get_template_caps (); gst_element_class_add_pad_template (element_class, gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, templ_caps)); gst_caps_unref (templ_caps); gst_element_class_set_static_metadata (element_class, "Decklink Video Source", "Video/Src", "Decklink Source", "David Schleef <*****@*****.**>, " "Sebastian Dröge <*****@*****.**>"); GST_DEBUG_CATEGORY_INIT (gst_decklink_video_src_debug, "decklinkvideosrc", 0, "debug category for decklinkvideosrc element"); }