mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
aiffparse: Add support for 32 bit and 64 bit floating point formats
This commit is contained in:
parent
5c97b148a9
commit
e6a4b71b90
2 changed files with 43 additions and 16 deletions
|
@ -655,19 +655,37 @@ gst_aiff_parse_parse_comm (GstAiffParse * aiff, GstBuffer * buf)
|
||||||
aiff->width = GST_ROUND_UP_8 (aiff->depth);
|
aiff->width = GST_ROUND_UP_8 (aiff->depth);
|
||||||
aiff->rate = (int) gst_aiff_parse_read_IEEE80 (data + 8);
|
aiff->rate = (int) gst_aiff_parse_read_IEEE80 (data + 8);
|
||||||
|
|
||||||
|
aiff->floating_point = FALSE;
|
||||||
|
|
||||||
if (aiff->is_aifc) {
|
if (aiff->is_aifc) {
|
||||||
|
guint32 fourcc = GST_READ_UINT32_LE (data + 18);
|
||||||
|
|
||||||
/* We only support the 'trivial' uncompressed AIFC, but it can be
|
/* We only support the 'trivial' uncompressed AIFC, but it can be
|
||||||
* either big or little endian */
|
* either big or little endian */
|
||||||
if (GST_READ_UINT32_LE (data + 18) == GST_MAKE_FOURCC ('N', 'O', 'N', 'E'))
|
switch (fourcc) {
|
||||||
aiff->endianness = G_BIG_ENDIAN;
|
case GST_MAKE_FOURCC ('N', 'O', 'N', 'E'):
|
||||||
else if (GST_READ_UINT32_LE (data + 18) ==
|
aiff->endianness = G_BIG_ENDIAN;
|
||||||
GST_MAKE_FOURCC ('s', 'o', 'w', 't'))
|
break;
|
||||||
aiff->endianness = G_LITTLE_ENDIAN;
|
case GST_MAKE_FOURCC ('s', 'o', 'w', 't'):
|
||||||
else {
|
aiff->endianness = G_LITTLE_ENDIAN;
|
||||||
GST_WARNING_OBJECT (aiff, "Unsupported compression in AIFC "
|
break;
|
||||||
"file: %" GST_FOURCC_FORMAT,
|
case GST_MAKE_FOURCC ('F', 'L', '3', '2'):
|
||||||
GST_FOURCC_ARGS (GST_READ_UINT32_LE (data + 18)));
|
case GST_MAKE_FOURCC ('f', 'l', '3', '2'):
|
||||||
return FALSE;
|
aiff->floating_point = TRUE;
|
||||||
|
aiff->width = aiff->depth = 32;
|
||||||
|
aiff->endianness = G_BIG_ENDIAN;
|
||||||
|
break;
|
||||||
|
case GST_MAKE_FOURCC ('f', 'l', '6', '4'):
|
||||||
|
aiff->floating_point = TRUE;
|
||||||
|
aiff->width = aiff->depth = 64;
|
||||||
|
aiff->endianness = G_BIG_ENDIAN;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
GST_WARNING_OBJECT (aiff, "Unsupported compression in AIFC "
|
||||||
|
"file: %" GST_FOURCC_FORMAT,
|
||||||
|
GST_FOURCC_ARGS (GST_READ_UINT32_LE (data + 18)));
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
aiff->endianness = G_BIG_ENDIAN;
|
aiff->endianness = G_BIG_ENDIAN;
|
||||||
|
@ -719,12 +737,20 @@ gst_aiff_parse_create_caps (GstAiffParse * aiff)
|
||||||
{
|
{
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-int",
|
if (aiff->floating_point) {
|
||||||
"width", G_TYPE_INT, aiff->width,
|
caps = gst_caps_new_simple ("audio/x-raw-float",
|
||||||
"depth", G_TYPE_INT, aiff->depth,
|
"width", G_TYPE_INT, aiff->width,
|
||||||
"channels", G_TYPE_INT, aiff->channels,
|
"channels", G_TYPE_INT, aiff->channels,
|
||||||
"endianness", G_TYPE_INT, aiff->endianness,
|
"endianness", G_TYPE_INT, aiff->endianness,
|
||||||
"rate", G_TYPE_INT, aiff->rate, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
|
"rate", G_TYPE_INT, aiff->rate, NULL);
|
||||||
|
} else {
|
||||||
|
caps = gst_caps_new_simple ("audio/x-raw-int",
|
||||||
|
"width", G_TYPE_INT, aiff->width,
|
||||||
|
"depth", G_TYPE_INT, aiff->depth,
|
||||||
|
"channels", G_TYPE_INT, aiff->channels,
|
||||||
|
"endianness", G_TYPE_INT, aiff->endianness,
|
||||||
|
"rate", G_TYPE_INT, aiff->rate, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (aiff, "Created caps: %" GST_PTR_FORMAT, caps);
|
GST_DEBUG_OBJECT (aiff, "Created caps: %" GST_PTR_FORMAT, caps);
|
||||||
return caps;
|
return caps;
|
||||||
|
|
|
@ -77,6 +77,7 @@ struct _GstAiffParse {
|
||||||
guint16 width;
|
guint16 width;
|
||||||
guint16 depth;
|
guint16 depth;
|
||||||
guint32 endianness;
|
guint32 endianness;
|
||||||
|
gboolean floating_point;
|
||||||
|
|
||||||
/* real bytes per second used or 0 when no bitrate is known */
|
/* real bytes per second used or 0 when no bitrate is known */
|
||||||
guint32 bps;
|
guint32 bps;
|
||||||
|
|
Loading…
Reference in a new issue