Interleave with Alsasink Pipeline Problem
adweldon
david.weldon at vecima.com
Mon Jul 7 15:50:12 PDT 2014
Thanks Tim! I really appreciate the help!
I have never used the capssetter element before, and that seems to make it work from the launcher.
In my application, I tried to set the channel-mask by doing the following below; which never seemed to work. Using your debug trap, I see now that channel_mask is set to 0x21 for some reason?? Even hard-coding it to 0x03 still still results in the wrong mask. Perhaps I'm setting the caps on the pad incorrectly...
Output:
0:00:00.705327387 12248 0xccf770 DEBUG GST_EVENT gstpad.c:5098:gst_pad_send_event_unchecked:<alsasink:sink> have event type caps event: 0x7f9be4003c70, time 99:99:99.999999999, seq-num 66, GstEventCaps, caps=(GstCaps)"audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)44100\,\ channels\=\(int\)2\,\ channel-mask\=\(bitmask\)0x0000000000000021";
0:00:00.705378555 12248 0xccf770 DEBUG GST_CAPS gstutils.c:2852:gst_pad_query_accept_caps:<alsasink:sink> accept caps of audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)44100, channels=(int)2, channel-mask=(bitmask)0x0000000000000021
Code Snippet:
interleave = gst_element_factory_make ("interleave", "interleave");
g_assert (interleave != NULL);
//Create audiochannel position array... Compiled with ignore warnings flag becuase GValueArray is not supported any longer.
GValueArray *positions = g_value_array_new (2);
GValue val = { 0, };
g_value_init (&val, GST_TYPE_AUDIO_CHANNEL_POSITION);
g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT);
g_value_array_append (positions, &val);
g_value_reset (&val);
g_value_set_enum (&val, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT);
g_value_array_append (positions, &val);
g_value_unset (&val);
g_print ("setting channel positions\n");
g_object_set(G_OBJECT(interleave), "channel-positions-from-input", FALSE, NULL);
g_object_set (interleave, "channel-positions", positions, NULL);
guint64 channel_mask = GST_AUDIO_CHANNEL_POSITION_MASK(FRONT_LEFT) | GST_AUDIO_CHANNEL_POSITION_MASK(FRONT_RIGHT);
g_print ("channel_mask: 0x%x\n", channel_mask);
GstCaps *caps = gst_caps_new_simple(
"audio/x-raw",
"rate", G_TYPE_INT, 22000,
"channels", G_TYPE_INT, 2,
"channel-mask", GST_TYPE_BITMASK, channel_mask,
NULL);
GstPad *srcpad = gst_element_get_static_pad (interleave, "src");
g_assert(srcpad);
gst_pad_set_caps(srcpad, caps );
________________________________
From: Tim Müller [via GStreamer-devel] [ml-node+s966125n4667821h86 at n4.nabble.com]
Sent: Monday, July 07, 2014 2:57 PM
To: David Weldon
Subject: Re: Interleave with Alsasink Pipeline Problem
On Mon, 2014-07-07 at 11:04 -0700, adweldon wrote:
Hi David,
> I'm trying to create a fairly simple pipeline using test sources, the
> interleave element and my alsasink. I'm essentially trying to have
> different test sources interleaved into a multichannel stream, and played
> out on the alsasink. We are starting with basic two channel stereo right
> now, so nothing too complicated.
>
> The following pipeline using pulsesink, works:
> gst-launch-1.0 -v interleave name=i ! pulsesink audiotestsrc name=t1
> volume=0.2 freq=133 ! queue ! i. audiotestsrc name=t2 volume=0.1 freq=200 !
> queue ! i.
>
> Replacing pulsesink with alsasink results in:
>
> WARN basesrc gstbasesrc.c:2933:gst_base_src_loop:<t1> error: Internal data
> flow error.
> WARN basesrc gstbasesrc.c:2933:gst_base_src_loop:<t1> error: streaming task
> paused, reason not-negotiated (-4)
> INFO GST_ERROR_SYSTEM gstelement.c:1834:gst_element_message_full:<t1>
> posting message: Internal data flow error.
> GST_ERROR_SYSTEM gstelement.c:1857:gst_element_message_full:<t1> posted
> error message: Internal data flow error.
>
> Also:
> WARN alsa conf.c:4694:snd_config_expand: alsalib error: Unknown parameters
> {AES0 0x02 AES1 0x82 AES2 0x00 AES3 0x02}
> WARN alsa pcm.c:2239:snd_pcm_open_noupdate: alsalib error: Unknown PCM
> default:{AES0 0x02 AES1 0x82 AES2 0x00 AES3 0x02}
I don't think this warning has anything to do with it.
> Removing a source, the audio will play... I have created a custom app that
> does basically the same thing as the launch pipeline, but it results in the
> same errors. I have also tried playing with channel masks and what not in
> the app to no avail...
>
> Any help is appreciated,
The debug log should tell you what the problem is:
$ GST_DEBUG=*:6 gst-launch-1.0 -v interleave name=i ! alsasink \
audiotestsrc name=t1 volume=0.2 freq=133 ! queue ! i. \
audiotestsrc name=t2 volume=0.1 freq=200 ! queue ! i. \
2>&1 | grep --max-count=1 -B25 not-negotiated
Problem appears to be that interleave output audio with 2 unpositioned
channels (channels=2,channel-mask=0), whereas alsa wants left/right for
channels=2 (i.e. channels=2,channel-mask=3). pulsesink doesn't seem to
care that's why it works.
This makes it work (i.e. forcing a left/right layout on the caps):
gst-launch-1.0 -v interleave name=i ! capssetter
caps='audio/x-raw,channel-mask=(bitmask)0x03' ! alsasink audiotestsrc
name=t1 volume=0.2 freq=133 ! queue ! i. audiotestsrc name=t2
volume=0.1 freq=200 ! queue ! i.
In code one would do that via interleave's properties I suppose, but
with gst-launch this is the only way.
Cheers
-Tim
--
Tim Müller, Centricular Ltd - http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]<UrlBlockedError.aspx>
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
________________________________
If you reply to this email, your message will be added to the discussion below:
http://gstreamer-devel.966125.n4.nabble.com/Interleave-with-Alsasink-Pipeline-Problem-tp4667819p4667821.html
To unsubscribe from Interleave with Alsasink Pipeline Problem, click here<http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4667819&code=ZGF2aWQud2VsZG9uQHZlY2ltYS5jb218NDY2NzgxOXwtNjE0OTY5OTUz>.
NAML<http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Interleave-with-Alsasink-Pipeline-Problem-tp4667819p4667822.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140707/657fa629/attachment.html>
More information about the gstreamer-devel
mailing list