diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-06-04 11:45:05 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-06-04 11:45:05 +0200 |
commit | 96ee9b274cb96b21ae900b4abdd436004198e030 (patch) | |
tree | 352c4c5d80ab68037f843b75f83c15301b4d82f4 /ext/opus/gstopusdec.c | |
parent | 60047b6b92643f7ec87d2c81e0eafe45db6a4363 (diff) | |
download | gstreamer-plugins-bad-96ee9b274cb96b21ae900b4abdd436004198e030.tar.gz |
opusdec: gst_structure_fixate_field_nearest_int() only works if the structure has this field
Just set the rate/channels directly if the caps don't have this field.
Diffstat (limited to 'ext/opus/gstopusdec.c')
-rw-r--r-- | ext/opus/gstopusdec.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/opus/gstopusdec.c b/ext/opus/gstopusdec.c index a63478769..bd9847b0e 100644 --- a/ext/opus/gstopusdec.c +++ b/ext/opus/gstopusdec.c @@ -224,10 +224,19 @@ gst_opus_dec_negotiate (GstOpusDec * dec, const GstAudioChannelPosition * pos) caps = gst_caps_truncate (caps); caps = gst_caps_make_writable (caps); s = gst_caps_get_structure (caps, 0); - gst_structure_fixate_field_nearest_int (s, "rate", dec->sample_rate); + + if (gst_structure_has_field (s, "rate")) + gst_structure_fixate_field_nearest_int (s, "rate", dec->sample_rate); + else + gst_structure_set (s, "rate", G_TYPE_INT, dec->sample_rate, NULL); gst_structure_get_int (s, "rate", &dec->sample_rate); - gst_structure_fixate_field_nearest_int (s, "channels", dec->n_channels); + + if (gst_structure_has_field (s, "channels")) + gst_structure_fixate_field_nearest_int (s, "channels", dec->n_channels); + else + gst_structure_set (s, "channels", G_TYPE_INT, dec->n_channels, NULL); gst_structure_get_int (s, "channels", &dec->n_channels); + gst_caps_unref (caps); } |