mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 10:25:33 +00:00
matroska-demux: make up an OpusHead block if possible when missing
https://bugzilla.gnome.org/show_bug.cgi?id=761489
This commit is contained in:
parent
565607107f
commit
6861d11c49
1 changed files with 30 additions and 1 deletions
|
@ -5614,8 +5614,37 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
|
||||||
caps = gst_codec_utils_opus_create_caps_from_header (tmp, NULL);
|
caps = gst_codec_utils_opus_create_caps_from_header (tmp, NULL);
|
||||||
gst_buffer_unref (tmp);
|
gst_buffer_unref (tmp);
|
||||||
*codec_name = g_strdup ("Opus");
|
*codec_name = g_strdup ("Opus");
|
||||||
|
} else if (context->codec_priv_size == 0) {
|
||||||
|
GST_WARNING ("No Opus codec data found, trying to create one");
|
||||||
|
if (audiocontext->channels >= 0 && audiocontext->channels <= 2) {
|
||||||
|
guint8 streams, coupled, channels;
|
||||||
|
guint32 samplerate;
|
||||||
|
|
||||||
|
samplerate =
|
||||||
|
audiocontext->samplerate == 0 ? 48000 : audiocontext->samplerate;
|
||||||
|
channels = audiocontext->channels == 0 ? 2 : audiocontext->channels;
|
||||||
|
if (channels == 1) {
|
||||||
|
streams = 1;
|
||||||
|
coupled = 0;
|
||||||
|
} else {
|
||||||
|
streams = 1;
|
||||||
|
coupled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
caps =
|
||||||
|
gst_codec_utils_opus_create_caps (samplerate, channels, 0, streams,
|
||||||
|
coupled, NULL);
|
||||||
|
if (caps) {
|
||||||
|
*codec_name = g_strdup ("Opus");
|
||||||
|
} else {
|
||||||
|
GST_WARNING ("Failed to create Opus caps from audio context");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GST_WARNING ("No Opus codec data, and not enough info to create one");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING ("Invalid Opus codec data size");
|
GST_WARNING ("Invalid Opus codec data size (got %" G_GSIZE_FORMAT
|
||||||
|
", expected 19)", context->codec_priv_size);
|
||||||
}
|
}
|
||||||
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_ACM)) {
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_ACM)) {
|
||||||
gst_riff_strf_auds auds;
|
gst_riff_strf_auds auds;
|
||||||
|
|
Loading…
Reference in a new issue