decklinkaudiosrc: Option to use max channels supported by device
Query the device for the maximum number of channels supported and have an option to use that. Default is still 2. https://bugzilla.gnome.org/show_bug.cgi?id=777458
This commit is contained in:
parent
926c9a243d
commit
f23277e55d
@ -200,6 +200,7 @@ gst_decklink_audio_channels_get_type (void)
|
|||||||
{GST_DECKLINK_AUDIO_CHANNELS_2, "2 Channels", "2"},
|
{GST_DECKLINK_AUDIO_CHANNELS_2, "2 Channels", "2"},
|
||||||
{GST_DECKLINK_AUDIO_CHANNELS_8, "8 Channels", "8"},
|
{GST_DECKLINK_AUDIO_CHANNELS_8, "8 Channels", "8"},
|
||||||
{GST_DECKLINK_AUDIO_CHANNELS_16, "16 Channels", "16"},
|
{GST_DECKLINK_AUDIO_CHANNELS_16, "16 Channels", "16"},
|
||||||
|
{GST_DECKLINK_AUDIO_CHANNELS_MAX, "Maximum channels supported", "max"},
|
||||||
{0, NULL, NULL}
|
{0, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ typedef enum {
|
|||||||
GType gst_decklink_audio_connection_get_type (void);
|
GType gst_decklink_audio_connection_get_type (void);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
GST_DECKLINK_AUDIO_CHANNELS_MAX = 0,
|
||||||
GST_DECKLINK_AUDIO_CHANNELS_2 = 2,
|
GST_DECKLINK_AUDIO_CHANNELS_2 = 2,
|
||||||
GST_DECKLINK_AUDIO_CHANNELS_8 = 8,
|
GST_DECKLINK_AUDIO_CHANNELS_8 = 8,
|
||||||
GST_DECKLINK_AUDIO_CHANNELS_16 = 16
|
GST_DECKLINK_AUDIO_CHANNELS_16 = 16
|
||||||
|
@ -427,10 +427,11 @@ gst_decklink_audio_src_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
|
|||||||
|
|
||||||
if (!caps) {
|
if (!caps) {
|
||||||
GstCaps *channel_filter, *templ;
|
GstCaps *channel_filter, *templ;
|
||||||
|
|
||||||
templ = gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (bsrc));
|
templ = gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (bsrc));
|
||||||
channel_filter =
|
channel_filter =
|
||||||
gst_caps_new_simple ("audio/x-raw", "channels", G_TYPE_INT,
|
gst_caps_new_simple ("audio/x-raw", "channels", G_TYPE_INT,
|
||||||
self->channels, NULL);
|
self->channels_found, NULL);
|
||||||
caps = gst_caps_intersect (channel_filter, templ);
|
caps = gst_caps_intersect (channel_filter, templ);
|
||||||
gst_caps_unref (channel_filter);
|
gst_caps_unref (channel_filter);
|
||||||
gst_caps_unref (templ);
|
gst_caps_unref (templ);
|
||||||
@ -736,6 +737,23 @@ gst_decklink_audio_src_open (GstDecklinkAudioSrc * self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_mutex_lock (&self->input->lock);
|
g_mutex_lock (&self->input->lock);
|
||||||
|
if (self->channels > 0) {
|
||||||
|
self->channels_found = self->channels;
|
||||||
|
} else {
|
||||||
|
if (self->input->attributes) {
|
||||||
|
HRESULT ret = self->input->attributes->GetInt
|
||||||
|
(BMDDeckLinkMaximumAudioChannels, &self->channels_found);
|
||||||
|
/* Sometimes the card may report an invalid number of channels. In
|
||||||
|
* that case, we should (empirically) use 8. */
|
||||||
|
if (ret != S_OK ||
|
||||||
|
self->channels_found == 0 || g_enum_get_value ((GEnumClass *)
|
||||||
|
g_type_class_peek (GST_TYPE_DECKLINK_AUDIO_CHANNELS),
|
||||||
|
self->channels_found)
|
||||||
|
== NULL) {
|
||||||
|
self->channels_found = GST_DECKLINK_AUDIO_CHANNELS_8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
self->input->got_audio_packet = gst_decklink_audio_src_got_packet;
|
self->input->got_audio_packet = gst_decklink_audio_src_got_packet;
|
||||||
g_mutex_unlock (&self->input->lock);
|
g_mutex_unlock (&self->input->lock);
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ struct _GstDecklinkAudioSrc
|
|||||||
GstDecklinkAudioConnectionEnum connection;
|
GstDecklinkAudioConnectionEnum connection;
|
||||||
gint device_number;
|
gint device_number;
|
||||||
GstDecklinkAudioChannelsEnum channels;
|
GstDecklinkAudioChannelsEnum channels;
|
||||||
|
gint64 channels_found;
|
||||||
|
|
||||||
GstAudioInfo info;
|
GstAudioInfo info;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user