decklink: Add property for configuring the input connection of the video sources

This commit is contained in:
Florian Langlois 2015-01-06 14:02:38 +01:00 committed by Sebastian Dröge
parent 1b2de14000
commit 81c1ef190d
4 changed files with 58 additions and 0 deletions

View file

@ -1,6 +1,7 @@
/* GStreamer /* GStreamer
* Copyright (C) 2011 David Schleef <ds@schleef.org> * Copyright (C) 2011 David Schleef <ds@schleef.org>
* Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com> * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
* Copyright (C) 2015 Florian Langlois <florian.langlois@fr.thalesgroup.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -175,9 +176,28 @@ static const GstDecklinkMode modes[] = {
const GstDecklinkMode * const GstDecklinkMode *
gst_decklink_get_mode (GstDecklinkModeEnum e) gst_decklink_get_mode (GstDecklinkModeEnum e)
{ {
if (e < GST_DECKLINK_MODE_NTSC || e > GST_DECKLINK_MODE_3184p60)
return NULL;
return &modes[e]; return &modes[e];
} }
static const BMDVideoConnection connections[] = {
bmdVideoConnectionSDI,
bmdVideoConnectionHDMI,
bmdVideoConnectionOpticalSDI,
bmdVideoConnectionComponent,
bmdVideoConnectionComposite,
bmdVideoConnectionSVideo
};
const BMDVideoConnection
gst_decklink_get_connection (GstDecklinkConnectionEnum e)
{
if (e < GST_DECKLINK_CONNECTION_SDI || e > GST_DECKLINK_CONNECTION_SVIDEO)
e = GST_DECKLINK_CONNECTION_SDI;
return connections[e];
}
static GstStructure * static GstStructure *
gst_decklink_mode_get_structure (GstDecklinkModeEnum e) gst_decklink_mode_get_structure (GstDecklinkModeEnum e)
{ {

View file

@ -1,6 +1,7 @@
/* GStreamer /* GStreamer
* Copyright (C) 2011 David Schleef <ds@schleef.org> * Copyright (C) 2011 David Schleef <ds@schleef.org>
* Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com> * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
* Copyright (C) 2015 Florian Langlois <florian.langlois@fr.thalesgroup.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -118,6 +119,7 @@ struct _GstDecklinkMode {
}; };
const GstDecklinkMode * gst_decklink_get_mode (GstDecklinkModeEnum e); const GstDecklinkMode * gst_decklink_get_mode (GstDecklinkModeEnum e);
const BMDVideoConnection gst_decklink_get_connection (GstDecklinkConnectionEnum e);
GstCaps * gst_decklink_mode_get_caps (GstDecklinkModeEnum e); GstCaps * gst_decklink_mode_get_caps (GstDecklinkModeEnum e);
GstCaps * gst_decklink_mode_get_template_caps (void); GstCaps * gst_decklink_mode_get_template_caps (void);

View file

@ -1,6 +1,7 @@
/* GStreamer /* GStreamer
* Copyright (C) 2011 David Schleef <ds@entropywave.com> * Copyright (C) 2011 David Schleef <ds@entropywave.com>
* Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com> * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
* Copyright (C) 2015 Florian Langlois <florian.langlois@fr.thalesgroup.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -34,6 +35,7 @@ enum
{ {
PROP_0, PROP_0,
PROP_MODE, PROP_MODE,
PROP_CONNECTION,
PROP_DEVICE_NUMBER, PROP_DEVICE_NUMBER,
PROP_BUFFER_SIZE PROP_BUFFER_SIZE
}; };
@ -129,6 +131,13 @@ gst_decklink_video_src_class_init (GstDecklinkVideoSrcClass * klass)
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
G_PARAM_CONSTRUCT))); 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_DEVICE_NUMBER, g_object_class_install_property (gobject_class, PROP_DEVICE_NUMBER,
g_param_spec_int ("device-number", "Device number", g_param_spec_int ("device-number", "Device number",
"Output device instance to use", 0, G_MAXINT, 0, "Output device instance to use", 0, G_MAXINT, 0,
@ -158,6 +167,7 @@ static void
gst_decklink_video_src_init (GstDecklinkVideoSrc * self) gst_decklink_video_src_init (GstDecklinkVideoSrc * self)
{ {
self->mode = GST_DECKLINK_MODE_NTSC; self->mode = GST_DECKLINK_MODE_NTSC;
self->connection = GST_DECKLINK_CONNECTION_SDI;
self->device_number = 0; self->device_number = 0;
self->buffer_size = DEFAULT_BUFFER_SIZE; self->buffer_size = DEFAULT_BUFFER_SIZE;
@ -180,6 +190,9 @@ gst_decklink_video_src_set_property (GObject * object, guint property_id,
case PROP_MODE: case PROP_MODE:
self->mode = (GstDecklinkModeEnum) g_value_get_enum (value); self->mode = (GstDecklinkModeEnum) g_value_get_enum (value);
break; break;
case PROP_CONNECTION:
self->connection = (GstDecklinkConnectionEnum) g_value_get_enum (value);
break;
case PROP_DEVICE_NUMBER: case PROP_DEVICE_NUMBER:
self->device_number = g_value_get_int (value); self->device_number = g_value_get_int (value);
break; break;
@ -202,6 +215,9 @@ gst_decklink_video_src_get_property (GObject * object, guint property_id,
case PROP_MODE: case PROP_MODE:
g_value_set_enum (value, self->mode); g_value_set_enum (value, self->mode);
break; break;
case PROP_CONNECTION:
g_value_set_enum (value, self->connection);
break;
case PROP_DEVICE_NUMBER: case PROP_DEVICE_NUMBER:
g_value_set_int (value, self->device_number); g_value_set_int (value, self->device_number);
break; break;
@ -410,6 +426,24 @@ gst_decklink_video_src_open (GstDecklinkVideoSrc * self)
return FALSE; return FALSE;
} }
if (self->input->config) {
ret = self->input->config->SetInt (bmdDeckLinkConfigVideoInputConnection,
gst_decklink_get_connection(self->connection));
if (ret != S_OK) {
GST_ERROR_OBJECT (self, "Failed to set configuration (input source)");
return FALSE;
}
if (self->connection == GST_DECKLINK_CONNECTION_COMPOSITE) {
ret = self->input->config->SetInt (bmdDeckLinkConfigAnalogVideoInputFlags,
bmdAnalogVideoFlagCompositeSetup75);
if (ret != S_OK) {
GST_ERROR_OBJECT (self, "Failed to set configuration (composite setup)");
return FALSE;
}
}
}
mode = gst_decklink_get_mode (self->mode); mode = gst_decklink_get_mode (self->mode);
g_assert (mode != NULL); g_assert (mode != NULL);

View file

@ -2,6 +2,7 @@
* *
* Copyright (C) 2011 David Schleef <ds@schleef.org> * Copyright (C) 2011 David Schleef <ds@schleef.org>
* Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com> * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
* Copyright (C) 2015 Florian Langlois <florian.langlois@fr.thalesgroup.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -50,6 +51,7 @@ struct _GstDecklinkVideoSrc
GstPushSrc parent; GstPushSrc parent;
GstDecklinkModeEnum mode; GstDecklinkModeEnum mode;
GstDecklinkConnectionEnum connection;
gint device_number; gint device_number;
GstVideoInfo info; GstVideoInfo info;