Float not supported by alsasink

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Float not supported by alsasink

vijaypalaniswamy
Hi All,

I tried playing ogg file, using vorbis decoder which gives PCM in float.
Even the alsa device supports FLOAT pcm, the pipeline is not working without audioconvert [Required for format conversion from float to int]

gst-launch-1.0 filesrc location=xxxx.ogg ! decodebin ! audioconvert !  alsasink device=xxx

By debugging I found in gst-plugins-base-1.8.3/ext/alsa/gstalsa.c function "gst_alsa_get_pcm_format"
the float format is not added.

So I compiled base plugin by adding below code

static snd_pcm_format_t
gst_alsa_get_pcm_format (GstAudioFormat fmt)
{
  switch (fmt) {
    ...
      case GST_AUDIO_FORMAT_U32BE:
         return SND_PCM_FORMAT_U32_BE;
+    case GST_AUDIO_FORMAT_F32LE:
+      return SND_PCM_FORMAT_FLOAT_LE;
    default:
      break;
  }
  return SND_PCM_FORMAT_UNKNOWN;
}

With above change I am able to play float PCM.
Any reason why FLOAT was not considered in base alsa? Is it expected not to have float support.
Please let me know any method to avoid using audioconvert.

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Float not supported by alsasink

Sebastian Dröge-3
On Tue, 2017-05-16 at 03:41 -0700, vijaypalaniswamy wrote:

> Hi All,
>
> I tried playing ogg file, using vorbis decoder which gives PCM in float.
> Even the alsa device supports FLOAT pcm, the pipeline is not working without
> audioconvert [Required for format conversion from float to int]
>
> gst-launch-1.0 filesrc location=xxxx.ogg ! decodebin ! audioconvert ! 
> alsasink device=xxx
>
> By debugging I found in gst-plugins-base-1.8.3/ext/alsa/gstalsa.c function
> "gst_alsa_get_pcm_format"
> the float format is not added.
>
> So I compiled base plugin by adding below code 
> [...]
>
> With above change I am able to play float PCM.
> Any reason why FLOAT was not considered in base alsa? Is it expected not to
> have float support.
> Please let me know any method to avoid using audioconvert.
It seems to be just a case of it not being added yet. Please file a bug
with your patch and we can discuss/merge that:
https://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Float not supported by alsasink

vijaypalaniswamy
Hi Sebastin,

Thank you for the quick reply.

I have filed bug.
https://bugzilla.gnome.org/show_bug.cgi?id=782695