diff options
author | David Schleef <ds@schleef.org> | 2011-07-07 16:07:50 -0700 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2011-08-03 13:39:33 -0700 |
commit | 2b5e8db968a210160e39d67a424801c4af5c4588 (patch) | |
tree | 5dae8df12ef4199d69faf1eefa63438c98121f24 /sys/decklink | |
parent | 70c3fea5acfe630ff67173dbe5050b76fffad296 (diff) |
decklink: Add audio-input property
Diffstat (limited to 'sys/decklink')
-rw-r--r-- | sys/decklink/gstdecklink.cpp | 19 | ||||
-rw-r--r-- | sys/decklink/gstdecklink.h | 9 | ||||
-rw-r--r-- | sys/decklink/gstdecklinksrc.cpp | 52 | ||||
-rw-r--r-- | sys/decklink/gstdecklinksrc.h | 1 |
4 files changed, 71 insertions, 10 deletions
diff --git a/sys/decklink/gstdecklink.cpp b/sys/decklink/gstdecklink.cpp index e720b9a4d..0920cca2f 100644 --- a/sys/decklink/gstdecklink.cpp +++ b/sys/decklink/gstdecklink.cpp @@ -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 diff --git a/sys/decklink/gstdecklink.h b/sys/decklink/gstdecklink.h index 2363dd47c..9dd637501 100644 --- a/sys/decklink/gstdecklink.h +++ b/sys/decklink/gstdecklink.h @@ -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; diff --git a/sys/decklink/gstdecklinksrc.cpp b/sys/decklink/gstdecklinksrc.cpp index e918b1d2d..c866204f6 100644 --- a/sys/decklink/gstdecklinksrc.cpp +++ b/sys/decklink/gstdecklinksrc.cpp @@ -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,15 +472,24 @@ 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); - if (ret != S_OK) { - GST_ERROR ("set configuration (audio input connection)"); - return FALSE; - } + 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 diff --git a/sys/decklink/gstdecklinksrc.h b/sys/decklink/gstdecklinksrc.h index 40ef4f10a..3afdb5e63 100644 --- a/sys/decklink/gstdecklinksrc.h +++ b/sys/decklink/gstdecklinksrc.h @@ -72,6 +72,7 @@ struct _GstDecklinkSrc gboolean copy_data; GstDecklinkModeEnum mode; GstDecklinkConnectionEnum connection; + GstDecklinkAudioConnectionEnum audio_connection; }; struct _GstDecklinkSrcClass |