From 1b81e05ab9203fead9fbca4997703b2ed6484ec2 Mon Sep 17 00:00:00 2001 From: Jade Macho Date: Mon, 15 Mar 2021 20:35:35 +0100 Subject: Hook up audio/x-xma: xmaversion: [1,2] to AV_CODEC_ID_XMA[1,2] Part-of: --- docs/gst_plugins_cache.json | 4 ++-- ext/libav/gstavcodecmap.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/docs/gst_plugins_cache.json b/docs/gst_plugins_cache.json index dc3805e..962e189 100644 --- a/docs/gst_plugins_cache.json +++ b/docs/gst_plugins_cache.json @@ -24153,7 +24153,7 @@ "long-name": "libav Xbox Media Audio 1 decoder", "pad-templates": { "sink": { - "caps": "unknown/unknown:\n", + "caps": "audio/x-xma:\n xmaversion: 1\n", "direction": "sink", "presence": "always" }, @@ -24181,7 +24181,7 @@ "long-name": "libav Xbox Media Audio 2 decoder", "pad-templates": { "sink": { - "caps": "unknown/unknown:\n", + "caps": "audio/x-xma:\n xmaversion: 2\n", "direction": "sink", "presence": "always" }, diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c index be22f22..d0421c9 100644 --- a/ext/libav/gstavcodecmap.c +++ b/ext/libav/gstavcodecmap.c @@ -1233,6 +1233,21 @@ gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id, break; } + case AV_CODEC_ID_XMA1: + { + caps = + gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-xma", + "xmaversion", G_TYPE_INT, 1, NULL); + break; + } + case AV_CODEC_ID_XMA2: + { + caps = + gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-xma", + "xmaversion", G_TYPE_INT, 2, NULL); + break; + } + case AV_CODEC_ID_MACE3: case AV_CODEC_ID_MACE6: { @@ -3997,6 +4012,21 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context) } if (id != AV_CODEC_ID_NONE) audio = TRUE; + } else if (!strcmp (mimetype, "audio/x-xma")) { + gint xmaversion = 0; + + if (gst_structure_get_int (structure, "xmaversion", &xmaversion)) { + switch (xmaversion) { + case 1: + id = AV_CODEC_ID_XMA1; + break; + case 2: + id = AV_CODEC_ID_XMA2; + break; + } + } + if (id != AV_CODEC_ID_NONE) + audio = TRUE; } else if (!strcmp (mimetype, "audio/x-wms")) { id = AV_CODEC_ID_WMAVOICE; audio = TRUE; -- cgit v1.2.3