decklink: Add a default profile id
This causes no changes to the profile but keeps the existing settings. The profile can also be changed from e.g. the card's configuration application and in that case probably should be left alone. The default is the new value as it keeps the profile setting as it is, which is consistent with the previous behaviour in 1.18. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1721>
This commit is contained in:
parent
d1df412d70
commit
56b2130300
@ -8089,7 +8089,7 @@
|
|||||||
"construct": true,
|
"construct": true,
|
||||||
"construct-only": false,
|
"construct-only": false,
|
||||||
"controllable": false,
|
"controllable": false,
|
||||||
"default": "one-sub-device-full (0)",
|
"default": "default (0)",
|
||||||
"mutable": "null",
|
"mutable": "null",
|
||||||
"readable": true,
|
"readable": true,
|
||||||
"type": "GstDecklinkProfileId",
|
"type": "GstDecklinkProfileId",
|
||||||
@ -8262,7 +8262,7 @@
|
|||||||
"construct": true,
|
"construct": true,
|
||||||
"construct-only": false,
|
"construct-only": false,
|
||||||
"controllable": false,
|
"controllable": false,
|
||||||
"default": "one-sub-device-full (0)",
|
"default": "default (0)",
|
||||||
"mutable": "null",
|
"mutable": "null",
|
||||||
"readable": true,
|
"readable": true,
|
||||||
"type": "GstDecklinkProfileId",
|
"type": "GstDecklinkProfileId",
|
||||||
@ -8673,30 +8673,35 @@
|
|||||||
"GstDecklinkProfileId": {
|
"GstDecklinkProfileId": {
|
||||||
"kind": "enum",
|
"kind": "enum",
|
||||||
"values": [
|
"values": [
|
||||||
|
{
|
||||||
|
"desc": "Default, don't change profile",
|
||||||
|
"name": "default",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc": "One sub-device, Full-Duplex",
|
"desc": "One sub-device, Full-Duplex",
|
||||||
"name": "one-sub-device-full",
|
"name": "one-sub-device-full",
|
||||||
"value": "0"
|
"value": "1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc": "One sub-device, Half-Duplex",
|
"desc": "One sub-device, Half-Duplex",
|
||||||
"name": "one-sub-device-half",
|
"name": "one-sub-device-half",
|
||||||
"value": "1"
|
"value": "2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc": "Two sub-devices, Full-Duplex",
|
"desc": "Two sub-devices, Full-Duplex",
|
||||||
"name": "two-sub-devices-full",
|
"name": "two-sub-devices-full",
|
||||||
"value": "2"
|
"value": "3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc": "Two sub-devices, Half-Duplex",
|
"desc": "Two sub-devices, Half-Duplex",
|
||||||
"name": "two-sub-devices-half",
|
"name": "two-sub-devices-half",
|
||||||
"value": "3"
|
"value": "4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc": "Four sub-devices, Half-Duplex",
|
"desc": "Four sub-devices, Half-Duplex",
|
||||||
"name": "four-sub-devices-half",
|
"name": "four-sub-devices-half",
|
||||||
"value": "4"
|
"value": "5"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -158,6 +158,7 @@ gst_decklink_video_format_get_type (void)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* GstDecklinkProfileId:
|
* GstDecklinkProfileId:
|
||||||
|
* @GST_DECKLINK_PROFILE_ID_DEFAULT: Don't change the profile
|
||||||
* @GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX: Equivalent to bmdProfileOneSubDeviceFullDuplex
|
* @GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX: Equivalent to bmdProfileOneSubDeviceFullDuplex
|
||||||
* @GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_HALF_DUPLEX: Equivalent to bmdProfileOneSubDeviceHalfDuplex
|
* @GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_HALF_DUPLEX: Equivalent to bmdProfileOneSubDeviceHalfDuplex
|
||||||
* @GST_DECKLINK_PROFILE_ID_TWO_SUB_DEVICES_FULL_DUPLEX: Equivalent to bmdProfileTwoSubDevicesFullDuplex
|
* @GST_DECKLINK_PROFILE_ID_TWO_SUB_DEVICES_FULL_DUPLEX: Equivalent to bmdProfileTwoSubDevicesFullDuplex
|
||||||
@ -173,6 +174,7 @@ gst_decklink_profile_id_get_type (void)
|
|||||||
{
|
{
|
||||||
static gsize id = 0;
|
static gsize id = 0;
|
||||||
static const GEnumValue types[] = {
|
static const GEnumValue types[] = {
|
||||||
|
{GST_DECKLINK_PROFILE_ID_DEFAULT, "Default, don't change profile", "default"},
|
||||||
{GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX, "One sub-device, Full-Duplex", "one-sub-device-full"},
|
{GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX, "One sub-device, Full-Duplex", "one-sub-device-full"},
|
||||||
{GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_HALF_DUPLEX, "One sub-device, Half-Duplex", "one-sub-device-half"},
|
{GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_HALF_DUPLEX, "One sub-device, Half-Duplex", "one-sub-device-half"},
|
||||||
{GST_DECKLINK_PROFILE_ID_TWO_SUB_DEVICES_FULL_DUPLEX, "Two sub-devices, Full-Duplex", "two-sub-devices-full"},
|
{GST_DECKLINK_PROFILE_ID_TWO_SUB_DEVICES_FULL_DUPLEX, "Two sub-devices, Full-Duplex", "two-sub-devices-full"},
|
||||||
@ -366,20 +368,6 @@ static const struct
|
|||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct
|
|
||||||
{
|
|
||||||
BMDProfileID profile;
|
|
||||||
GstDecklinkProfileId gstprofile;
|
|
||||||
} profiles[] = {
|
|
||||||
/* *INDENT-OFF* */
|
|
||||||
{bmdProfileOneSubDeviceFullDuplex, GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX},
|
|
||||||
{bmdProfileOneSubDeviceHalfDuplex, GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_HALF_DUPLEX},
|
|
||||||
{bmdProfileTwoSubDevicesFullDuplex, GST_DECKLINK_PROFILE_ID_TWO_SUB_DEVICES_FULL_DUPLEX},
|
|
||||||
{bmdProfileTwoSubDevicesHalfDuplex, GST_DECKLINK_PROFILE_ID_TWO_SUB_DEVICES_HALF_DUPLEX},
|
|
||||||
{bmdProfileFourSubDevicesHalfDuplex, GST_DECKLINK_PROFILE_ID_FOUR_SUB_DEVICES_HALF_DUPLEX},
|
|
||||||
/* *INDENT-ON* */
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ProfileSetOperationResult
|
enum ProfileSetOperationResult
|
||||||
{
|
{
|
||||||
PROFILE_SET_UNSUPPORTED,
|
PROFILE_SET_UNSUPPORTED,
|
||||||
@ -614,25 +602,6 @@ gst_decklink_timecode_format_to_enum (BMDTimecodeFormat f)
|
|||||||
return GST_DECKLINK_TIMECODE_FORMAT_RP188ANY;
|
return GST_DECKLINK_TIMECODE_FORMAT_RP188ANY;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BMDProfileID
|
|
||||||
gst_decklink_profile_id_from_enum (GstDecklinkProfileId p)
|
|
||||||
{
|
|
||||||
return profiles[p].profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GstDecklinkProfileId
|
|
||||||
gst_decklink_profile_id_to_enum (BMDProfileID p)
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (profiles); i++) {
|
|
||||||
if (profiles[i].profile == p)
|
|
||||||
return profiles[i].gstprofile;
|
|
||||||
}
|
|
||||||
g_assert_not_reached ();
|
|
||||||
return GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX;
|
|
||||||
}
|
|
||||||
|
|
||||||
const BMDKeyerMode
|
const BMDKeyerMode
|
||||||
gst_decklink_keyer_mode_from_enum (GstDecklinkKeyerMode m)
|
gst_decklink_keyer_mode_from_enum (GstDecklinkKeyerMode m)
|
||||||
{
|
{
|
||||||
@ -885,7 +854,7 @@ struct _Device
|
|||||||
};
|
};
|
||||||
|
|
||||||
static ProfileSetOperationResult gst_decklink_configure_profile (Device * device,
|
static ProfileSetOperationResult gst_decklink_configure_profile (Device * device,
|
||||||
BMDProfileID profile_id);
|
GstDecklinkProfileId profile_id);
|
||||||
|
|
||||||
class GStreamerDecklinkInputCallback:public IDeckLinkInputCallback
|
class GStreamerDecklinkInputCallback:public IDeckLinkInputCallback
|
||||||
{
|
{
|
||||||
@ -1826,20 +1795,46 @@ gst_decklink_release_nth_input (gint n, GstElement * src, gboolean is_audio)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ProfileSetOperationResult
|
static ProfileSetOperationResult
|
||||||
gst_decklink_configure_profile (Device * device, BMDProfileID profile_id)
|
gst_decklink_configure_profile (Device * device, GstDecklinkProfileId profile_id)
|
||||||
{
|
{
|
||||||
HRESULT res;
|
HRESULT res;
|
||||||
|
|
||||||
|
if (profile_id == GST_DECKLINK_PROFILE_ID_DEFAULT)
|
||||||
|
return PROFILE_SET_SUCCESS;
|
||||||
|
|
||||||
GstDecklinkInput *input = &device->input;
|
GstDecklinkInput *input = &device->input;
|
||||||
IDeckLink *decklink = input->device;
|
IDeckLink *decklink = input->device;
|
||||||
|
|
||||||
IDeckLinkProfileManager *manager = NULL;
|
IDeckLinkProfileManager *manager = NULL;
|
||||||
if (decklink->QueryInterface(IID_IDeckLinkProfileManager, (void **)&manager) == S_OK) {
|
if (decklink->QueryInterface(IID_IDeckLinkProfileManager, (void **)&manager) == S_OK) {
|
||||||
|
BMDProfileID bmd_profile_id;
|
||||||
|
|
||||||
|
switch (profile_id) {
|
||||||
|
case GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX:
|
||||||
|
bmd_profile_id = bmdProfileOneSubDeviceFullDuplex;
|
||||||
|
break;
|
||||||
|
case GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_HALF_DUPLEX:
|
||||||
|
bmd_profile_id = bmdProfileOneSubDeviceHalfDuplex;
|
||||||
|
break;
|
||||||
|
case GST_DECKLINK_PROFILE_ID_TWO_SUB_DEVICES_FULL_DUPLEX:
|
||||||
|
bmd_profile_id = bmdProfileTwoSubDevicesFullDuplex;
|
||||||
|
break;
|
||||||
|
case GST_DECKLINK_PROFILE_ID_TWO_SUB_DEVICES_HALF_DUPLEX:
|
||||||
|
bmd_profile_id = bmdProfileTwoSubDevicesHalfDuplex;
|
||||||
|
break;
|
||||||
|
case GST_DECKLINK_PROFILE_ID_FOUR_SUB_DEVICES_HALF_DUPLEX:
|
||||||
|
bmd_profile_id = bmdProfileFourSubDevicesHalfDuplex;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case GST_DECKLINK_PROFILE_ID_DEFAULT:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
IDeckLinkProfile *profile = NULL;
|
IDeckLinkProfile *profile = NULL;
|
||||||
res = manager->GetProfile(profile_id, &profile);
|
res = manager->GetProfile(bmd_profile_id, &profile);
|
||||||
|
|
||||||
if (res == S_OK) {
|
if (res == S_OK && profile) {
|
||||||
res = profile->SetActive();
|
res = profile->SetActive();
|
||||||
profile->Release();
|
profile->Release();
|
||||||
}
|
}
|
||||||
@ -1854,9 +1849,7 @@ gst_decklink_configure_profile (Device * device, BMDProfileID profile_id)
|
|||||||
GST_ERROR("Failed to set profile.\n");
|
GST_ERROR("Failed to set profile.\n");
|
||||||
return PROFILE_SET_FAILURE;
|
return PROFILE_SET_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
GST_DEBUG("Device has only one profile.\n");
|
GST_DEBUG("Device has only one profile.\n");
|
||||||
return PROFILE_SET_UNSUPPORTED;
|
return PROFILE_SET_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,7 @@ typedef enum {
|
|||||||
GType gst_decklink_video_format_get_type (void);
|
GType gst_decklink_video_format_get_type (void);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
GST_DECKLINK_PROFILE_ID_DEFAULT,
|
||||||
GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX, /* bmdProfileOneSubDeviceFullDuplex */
|
GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX, /* bmdProfileOneSubDeviceFullDuplex */
|
||||||
GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_HALF_DUPLEX, /* bmdProfileOneSubDeviceHalfDuplex */
|
GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_HALF_DUPLEX, /* bmdProfileOneSubDeviceHalfDuplex */
|
||||||
GST_DECKLINK_PROFILE_ID_TWO_SUB_DEVICES_FULL_DUPLEX, /* bmdProfileTwoSubDevicesFullDuplex */
|
GST_DECKLINK_PROFILE_ID_TWO_SUB_DEVICES_FULL_DUPLEX, /* bmdProfileTwoSubDevicesFullDuplex */
|
||||||
|
@ -360,7 +360,7 @@ gst_decklink_video_sink_class_init (GstDecklinkVideoSinkClass * klass)
|
|||||||
"same profile group."
|
"same profile group."
|
||||||
"DeckLink Duo 2 support configuration of the duplex mode of "
|
"DeckLink Duo 2 support configuration of the duplex mode of "
|
||||||
"individual sub-devices.",
|
"individual sub-devices.",
|
||||||
GST_TYPE_DECKLINK_PROFILE_ID, GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX,
|
GST_TYPE_DECKLINK_PROFILE_ID, GST_DECKLINK_PROFILE_ID_DEFAULT,
|
||||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
||||||
G_PARAM_CONSTRUCT)));
|
G_PARAM_CONSTRUCT)));
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ gst_decklink_video_sink_init (GstDecklinkVideoSink * self)
|
|||||||
self->mode = GST_DECKLINK_MODE_NTSC;
|
self->mode = GST_DECKLINK_MODE_NTSC;
|
||||||
self->device_number = 0;
|
self->device_number = 0;
|
||||||
self->video_format = GST_DECKLINK_VIDEO_FORMAT_8BIT_YUV;
|
self->video_format = GST_DECKLINK_VIDEO_FORMAT_8BIT_YUV;
|
||||||
self->profile_id = bmdProfileOneSubDeviceFullDuplex;
|
self->profile_id = GST_DECKLINK_PROFILE_ID_DEFAULT;
|
||||||
/* VITC is legacy, we should expect RP188 in modern use cases */
|
/* VITC is legacy, we should expect RP188 in modern use cases */
|
||||||
self->timecode_format = bmdTimecodeRP188Any;
|
self->timecode_format = bmdTimecodeRP188Any;
|
||||||
self->caption_line = 0;
|
self->caption_line = 0;
|
||||||
@ -467,9 +467,7 @@ gst_decklink_video_sink_set_property (GObject * object, guint property_id,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_PROFILE_ID:
|
case PROP_PROFILE_ID:
|
||||||
self->profile_id =
|
self->profile_id = (GstDecklinkProfileId) g_value_get_enum (value);
|
||||||
gst_decklink_profile_id_from_enum ((GstDecklinkProfileId)
|
|
||||||
g_value_get_enum (value));
|
|
||||||
break;
|
break;
|
||||||
case PROP_TIMECODE_FORMAT:
|
case PROP_TIMECODE_FORMAT:
|
||||||
self->timecode_format =
|
self->timecode_format =
|
||||||
@ -513,8 +511,7 @@ gst_decklink_video_sink_get_property (GObject * object, guint property_id,
|
|||||||
g_value_set_enum (value, self->video_format);
|
g_value_set_enum (value, self->video_format);
|
||||||
break;
|
break;
|
||||||
case PROP_PROFILE_ID:
|
case PROP_PROFILE_ID:
|
||||||
g_value_set_enum (value,
|
g_value_set_enum (value, self->profile_id);
|
||||||
gst_decklink_profile_id_to_enum (self->profile_id));
|
|
||||||
break;
|
break;
|
||||||
case PROP_TIMECODE_FORMAT:
|
case PROP_TIMECODE_FORMAT:
|
||||||
g_value_set_enum (value,
|
g_value_set_enum (value,
|
||||||
|
@ -52,7 +52,7 @@ struct _GstDecklinkVideoSink
|
|||||||
GstDecklinkModeEnum mode;
|
GstDecklinkModeEnum mode;
|
||||||
gint device_number;
|
gint device_number;
|
||||||
GstDecklinkVideoFormat video_format;
|
GstDecklinkVideoFormat video_format;
|
||||||
BMDProfileID profile_id;
|
GstDecklinkProfileId profile_id;
|
||||||
BMDTimecodeFormat timecode_format;
|
BMDTimecodeFormat timecode_format;
|
||||||
BMDKeyerMode keyer_mode;
|
BMDKeyerMode keyer_mode;
|
||||||
gint keyer_level;
|
gint keyer_level;
|
||||||
|
@ -317,7 +317,7 @@ gst_decklink_video_src_class_init (GstDecklinkVideoSrcClass * klass)
|
|||||||
"same profile group."
|
"same profile group."
|
||||||
"DeckLink Duo 2 support configuration of the duplex mode of "
|
"DeckLink Duo 2 support configuration of the duplex mode of "
|
||||||
"individual sub-devices.",
|
"individual sub-devices.",
|
||||||
GST_TYPE_DECKLINK_PROFILE_ID, GST_DECKLINK_PROFILE_ID_ONE_SUB_DEVICE_FULL_DUPLEX,
|
GST_TYPE_DECKLINK_PROFILE_ID, GST_DECKLINK_PROFILE_ID_DEFAULT,
|
||||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
||||||
G_PARAM_CONSTRUCT)));
|
G_PARAM_CONSTRUCT)));
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ gst_decklink_video_src_init (GstDecklinkVideoSrc * self)
|
|||||||
self->device_number = 0;
|
self->device_number = 0;
|
||||||
self->buffer_size = DEFAULT_BUFFER_SIZE;
|
self->buffer_size = DEFAULT_BUFFER_SIZE;
|
||||||
self->video_format = GST_DECKLINK_VIDEO_FORMAT_AUTO;
|
self->video_format = GST_DECKLINK_VIDEO_FORMAT_AUTO;
|
||||||
self->profile_id = bmdProfileOneSubDeviceFullDuplex;
|
self->profile_id = GST_DECKLINK_PROFILE_ID_DEFAULT;
|
||||||
self->timecode_format = bmdTimecodeRP188Any;
|
self->timecode_format = bmdTimecodeRP188Any;
|
||||||
self->signal_state = SIGNAL_STATE_UNKNOWN;
|
self->signal_state = SIGNAL_STATE_UNKNOWN;
|
||||||
self->output_stream_time = DEFAULT_OUTPUT_STREAM_TIME;
|
self->output_stream_time = DEFAULT_OUTPUT_STREAM_TIME;
|
||||||
@ -469,9 +469,7 @@ gst_decklink_video_src_set_property (GObject * object, guint property_id,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROP_PROFILE_ID:
|
case PROP_PROFILE_ID:
|
||||||
self->profile_id =
|
self->profile_id = (GstDecklinkProfileId) g_value_get_enum (value);
|
||||||
gst_decklink_profile_id_from_enum ((GstDecklinkProfileId)
|
|
||||||
g_value_get_enum (value));
|
|
||||||
break;
|
break;
|
||||||
case PROP_TIMECODE_FORMAT:
|
case PROP_TIMECODE_FORMAT:
|
||||||
self->timecode_format =
|
self->timecode_format =
|
||||||
@ -522,8 +520,7 @@ gst_decklink_video_src_get_property (GObject * object, guint property_id,
|
|||||||
g_value_set_enum (value, self->video_format);
|
g_value_set_enum (value, self->video_format);
|
||||||
break;
|
break;
|
||||||
case PROP_PROFILE_ID:
|
case PROP_PROFILE_ID:
|
||||||
g_value_set_enum (value,
|
g_value_set_enum (value, self->profile_id);
|
||||||
gst_decklink_profile_id_to_enum (self->profile_id));
|
|
||||||
break;
|
break;
|
||||||
case PROP_TIMECODE_FORMAT:
|
case PROP_TIMECODE_FORMAT:
|
||||||
g_value_set_enum (value,
|
g_value_set_enum (value,
|
||||||
|
@ -71,7 +71,7 @@ struct _GstDecklinkVideoSrc
|
|||||||
|
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
GstDecklinkVideoFormat video_format;
|
GstDecklinkVideoFormat video_format;
|
||||||
BMDProfileID profile_id;
|
GstDecklinkProfileId profile_id;
|
||||||
BMDTimecodeFormat timecode_format;
|
BMDTimecodeFormat timecode_format;
|
||||||
|
|
||||||
GstDecklinkInput *input;
|
GstDecklinkInput *input;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user