mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
decklink: Add audio-input property
This commit is contained in:
parent
70c3fea5ac
commit
2b5e8db968
4 changed files with 71 additions and 10 deletions
|
@ -86,6 +86,25 @@ gst_decklink_connection_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gst_decklink_audio_connection_get_type (void)
|
||||
{
|
||||
static GType type;
|
||||
|
||||
if (!type) {
|
||||
static const GEnumValue connections[] = {
|
||||
{GST_DECKLINK_AUDIO_CONNECTION_AUTO, "auto", "Automatic"},
|
||||
{GST_DECKLINK_AUDIO_CONNECTION_EMBEDDED, "embedded", "SDI/HDMI embedded audio"},
|
||||
{GST_DECKLINK_AUDIO_CONNECTION_AES_EBU, "aes", "AES/EBU input"},
|
||||
{GST_DECKLINK_AUDIO_CONNECTION_ANALOG, "analog", "Analog input"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
type = g_enum_register_static ("GstDecklinkAudioConnection", connections);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
#define NTSC 10, 11, false, false
|
||||
#define PAL 12, 11, true, false
|
||||
#define HD 1, 1, false, true
|
||||
|
|
|
@ -63,6 +63,15 @@ typedef enum {
|
|||
#define GST_TYPE_DECKLINK_CONNECTION (gst_decklink_connection_get_type ())
|
||||
GType gst_decklink_connection_get_type (void);
|
||||
|
||||
typedef enum {
|
||||
GST_DECKLINK_AUDIO_CONNECTION_AUTO,
|
||||
GST_DECKLINK_AUDIO_CONNECTION_EMBEDDED,
|
||||
GST_DECKLINK_AUDIO_CONNECTION_AES_EBU,
|
||||
GST_DECKLINK_AUDIO_CONNECTION_ANALOG
|
||||
} GstDecklinkAudioConnectionEnum;
|
||||
#define GST_TYPE_DECKLINK_AUDIO_CONNECTION (gst_decklink_audio_connection_get_type ())
|
||||
GType gst_decklink_audio_connection_get_type (void);
|
||||
|
||||
typedef struct _GstDecklinkMode GstDecklinkMode;
|
||||
struct _GstDecklinkMode {
|
||||
BMDDisplayMode mode;
|
||||
|
|
|
@ -119,7 +119,8 @@ enum
|
|||
{
|
||||
PROP_0,
|
||||
PROP_MODE,
|
||||
PROP_CONNECTION
|
||||
PROP_CONNECTION,
|
||||
PROP_AUDIO_INPUT
|
||||
};
|
||||
|
||||
/* pad templates */
|
||||
|
@ -191,6 +192,12 @@ gst_decklink_src_class_init (GstDecklinkSrcClass * klass)
|
|||
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)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -267,6 +274,8 @@ gst_decklink_src_init (GstDecklinkSrc * decklinksrc,
|
|||
|
||||
decklinksrc->copy_data = TRUE;
|
||||
decklinksrc->mode = GST_DECKLINK_MODE_NTSC;
|
||||
decklinksrc->connection = GST_DECKLINK_CONNECTION_SDI;
|
||||
decklinksrc->audio_connection = GST_DECKLINK_AUDIO_CONNECTION_AUTO;
|
||||
|
||||
}
|
||||
|
||||
|
@ -287,6 +296,10 @@ gst_decklink_src_set_property (GObject * object, guint property_id,
|
|||
decklinksrc->connection =
|
||||
(GstDecklinkConnectionEnum) g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_AUDIO_INPUT:
|
||||
decklinksrc->audio_connection =
|
||||
(GstDecklinkAudioConnectionEnum) g_value_get_enum (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -309,6 +322,9 @@ gst_decklink_src_get_property (GObject * object, guint property_id,
|
|||
case PROP_CONNECTION:
|
||||
g_value_set_enum (value, decklinksrc->connection);
|
||||
break;
|
||||
case PROP_AUDIO_INPUT:
|
||||
g_value_set_enum (value, decklinksrc->audio_connection);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -379,6 +395,7 @@ gst_decklink_src_start (GstElement * element)
|
|||
const GstDecklinkMode *mode;
|
||||
IDeckLinkConfiguration *config;
|
||||
BMDVideoConnection conn;
|
||||
BMDAudioConnection aconn;
|
||||
|
||||
GST_DEBUG_OBJECT (decklinksrc, "start");
|
||||
|
||||
|
@ -416,21 +433,27 @@ gst_decklink_src_start (GstElement * element)
|
|||
default:
|
||||
case GST_DECKLINK_CONNECTION_SDI:
|
||||
conn = bmdVideoConnectionSDI;
|
||||
aconn = bmdAudioConnectionEmbedded;
|
||||
break;
|
||||
case GST_DECKLINK_CONNECTION_HDMI:
|
||||
conn = bmdVideoConnectionHDMI;
|
||||
aconn = bmdAudioConnectionEmbedded;
|
||||
break;
|
||||
case GST_DECKLINK_CONNECTION_OPTICAL_SDI:
|
||||
conn = bmdVideoConnectionOpticalSDI;
|
||||
aconn = bmdAudioConnectionEmbedded;
|
||||
break;
|
||||
case GST_DECKLINK_CONNECTION_COMPONENT:
|
||||
conn = bmdVideoConnectionComponent;
|
||||
aconn = bmdAudioConnectionAnalog;
|
||||
break;
|
||||
case GST_DECKLINK_CONNECTION_COMPOSITE:
|
||||
conn = bmdVideoConnectionComposite;
|
||||
aconn = bmdAudioConnectionAnalog;
|
||||
break;
|
||||
case GST_DECKLINK_CONNECTION_SVIDEO:
|
||||
conn = bmdVideoConnectionSVideo;
|
||||
aconn = bmdAudioConnectionAnalog;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -449,16 +472,25 @@ gst_decklink_src_start (GstElement * element)
|
|||
}
|
||||
}
|
||||
|
||||
if (decklinksrc->connection == GST_DECKLINK_CONNECTION_COMPOSITE ||
|
||||
decklinksrc->connection == GST_DECKLINK_CONNECTION_COMPONENT ||
|
||||
decklinksrc->connection == GST_DECKLINK_CONNECTION_SVIDEO) {
|
||||
ret = config->SetInt (bmdDeckLinkConfigAudioInputConnection,
|
||||
bmdAudioConnectionAnalog);
|
||||
switch (decklinksrc->audio_connection) {
|
||||
default:
|
||||
case GST_DECKLINK_AUDIO_CONNECTION_AUTO:
|
||||
break;
|
||||
case GST_DECKLINK_AUDIO_CONNECTION_EMBEDDED:
|
||||
aconn = bmdAudioConnectionEmbedded;
|
||||
break;
|
||||
case GST_DECKLINK_AUDIO_CONNECTION_AES_EBU:
|
||||
aconn = bmdAudioConnectionAESEBU;
|
||||
break;
|
||||
case GST_DECKLINK_AUDIO_CONNECTION_ANALOG:
|
||||
aconn = bmdAudioConnectionAnalog;
|
||||
break;
|
||||
}
|
||||
ret = config->SetInt (bmdDeckLinkConfigAudioInputConnection, aconn);
|
||||
if (ret != S_OK) {
|
||||
GST_ERROR ("set configuration (audio input connection)");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
ret = decklinksrc->input->GetDisplayModeIterator (&mode_iterator);
|
||||
|
|
|
@ -72,6 +72,7 @@ struct _GstDecklinkSrc
|
|||
gboolean copy_data;
|
||||
GstDecklinkModeEnum mode;
|
||||
GstDecklinkConnectionEnum connection;
|
||||
GstDecklinkAudioConnectionEnum audio_connection;
|
||||
};
|
||||
|
||||
struct _GstDecklinkSrcClass
|
||||
|
|
Loading…
Reference in a new issue