decklink: Add subdevice property

This commit is contained in:
David Schleef 2011-08-18 14:29:53 -07:00
parent cfd68a8e7a
commit e246d92bd5
2 changed files with 30 additions and 7 deletions

View file

@ -125,7 +125,8 @@ enum
PROP_0,
PROP_MODE,
PROP_CONNECTION,
PROP_AUDIO_INPUT
PROP_AUDIO_INPUT,
PROP_SUBDEVICE
};
/* pad templates */
@ -200,7 +201,14 @@ gst_decklink_src_class_init (GstDecklinkSrcClass * klass)
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,
GST_TYPE_DECKLINK_AUDIO_CONNECTION,
GST_DECKLINK_AUDIO_CONNECTION_AUTO,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
G_PARAM_CONSTRUCT)));
g_object_class_install_property (gobject_class, PROP_SUBDEVICE,
g_param_spec_int ("subdevice", "Subdevice", "Subdevice",
0, 3, 0,
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
G_PARAM_CONSTRUCT)));
}
@ -244,9 +252,9 @@ gst_decklink_src_init (GstDecklinkSrc * decklinksrc,
decklinksrc->videosrcpad = gst_pad_new_from_template (
gst_element_class_get_pad_template(GST_ELEMENT_CLASS(decklinksrc_class),
"videosrc"), "videosrc");
decklinksrc->videosrcpad =
gst_pad_new_from_template (gst_element_class_get_pad_template
(GST_ELEMENT_CLASS (decklinksrc_class), "videosrc"), "videosrc");
gst_pad_set_getcaps_function (decklinksrc->videosrcpad,
GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_getcaps));
gst_pad_set_setcaps_function (decklinksrc->videosrcpad,
@ -281,6 +289,7 @@ gst_decklink_src_init (GstDecklinkSrc * decklinksrc,
decklinksrc->mode = GST_DECKLINK_MODE_NTSC;
decklinksrc->connection = GST_DECKLINK_CONNECTION_SDI;
decklinksrc->audio_connection = GST_DECKLINK_AUDIO_CONNECTION_AUTO;
decklinksrc->subdevice = 0;
decklinksrc->stop = FALSE;
decklinksrc->dropped_frames = 0;
@ -327,6 +336,9 @@ gst_decklink_src_set_property (GObject * object, guint property_id,
decklinksrc->audio_connection =
(GstDecklinkAudioConnectionEnum) g_value_get_enum (value);
break;
case PROP_SUBDEVICE:
decklinksrc->subdevice = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@ -352,6 +364,9 @@ gst_decklink_src_get_property (GObject * object, guint property_id,
case PROP_AUDIO_INPUT:
g_value_set_enum (value, decklinksrc->audio_connection);
break;
case PROP_SUBDEVICE:
g_value_set_int (value, decklinksrc->subdevice);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@ -478,6 +493,7 @@ gst_decklink_src_start (GstElement * element)
IDeckLinkConfiguration *config;
BMDVideoConnection conn;
BMDAudioConnection aconn;
int i;
GST_DEBUG_OBJECT (decklinksrc, "start");
@ -492,6 +508,13 @@ gst_decklink_src_start (GstElement * element)
GST_ERROR ("no card");
return FALSE;
}
for (i = 0; i < decklinksrc->subdevice; i++) {
ret = iterator->Next (&decklinksrc->decklink);
if (ret != S_OK) {
GST_ERROR ("no card");
return FALSE;
}
}
ret = decklinksrc->decklink->QueryInterface (IID_IDeckLinkInput,
(void **) &decklinksrc->input);
@ -573,7 +596,6 @@ gst_decklink_src_start (GstElement * element)
GST_ERROR ("set configuration (audio input connection)");
return FALSE;
}
#if 0
ret = decklinksrc->input->GetDisplayModeIterator (&mode_iterator);
if (ret != S_OK) {

View file

@ -74,6 +74,7 @@ struct _GstDecklinkSrc
GstDecklinkModeEnum mode;
GstDecklinkConnectionEnum connection;
GstDecklinkAudioConnectionEnum audio_connection;
int subdevice;
#ifdef _MSC_VER
gboolean comInitialized;