mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-23 09:04:15 +00:00
fix gstarts. the sound is krappy, but it does make sound -- remember to do osssink sync=false
Original commit message from CVS: fix gstarts. the sound is krappy, but it does make sound -- remember to do osssink sync=false
This commit is contained in:
parent
986a3eb8c6
commit
79453e9df4
2 changed files with 20 additions and 3 deletions
|
@ -44,13 +44,13 @@ GST_PAD_TEMPLATE_FACTORY ( sink_temp,
|
||||||
GST_CAPS_NEW (
|
GST_CAPS_NEW (
|
||||||
"arts_sample",
|
"arts_sample",
|
||||||
"audio/raw",
|
"audio/raw",
|
||||||
"format", GST_PROPS_INT ("int"),
|
"format", GST_PROPS_STRING ("int"),
|
||||||
"law", GST_PROPS_INT (0),
|
"law", GST_PROPS_INT (0),
|
||||||
"depth", GST_PROPS_INT (16),
|
"depth", GST_PROPS_INT (16),
|
||||||
"width", GST_PROPS_INT (16),
|
"width", GST_PROPS_INT (16),
|
||||||
"signed", GST_PROPS_BOOLEAN (TRUE),
|
"signed", GST_PROPS_BOOLEAN (TRUE),
|
||||||
"channels", GST_PROPS_INT (2),
|
"channels", GST_PROPS_INT (2),
|
||||||
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN)
|
"endianness", GST_PROPS_INT (G_BYTE_ORDER)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ GST_PAD_TEMPLATE_FACTORY ( src_temp,
|
||||||
GST_CAPS_NEW (
|
GST_CAPS_NEW (
|
||||||
"arts_sample",
|
"arts_sample",
|
||||||
"audio/raw",
|
"audio/raw",
|
||||||
"format", GST_PROPS_INT ("int"),
|
"format", GST_PROPS_STRING ("int"),
|
||||||
"law", GST_PROPS_INT (0),
|
"law", GST_PROPS_INT (0),
|
||||||
"depth", GST_PROPS_INT (16),
|
"depth", GST_PROPS_INT (16),
|
||||||
"width", GST_PROPS_INT (16),
|
"width", GST_PROPS_INT (16),
|
||||||
|
|
|
@ -17,6 +17,7 @@ class ArtsStereoSink_impl : virtual public ArtsStereoSink_skel,
|
||||||
{
|
{
|
||||||
|
|
||||||
GstPad *sinkpad;
|
GstPad *sinkpad;
|
||||||
|
GstPad *srcpad;
|
||||||
unsigned long remainingsamples;
|
unsigned long remainingsamples;
|
||||||
GstBuffer *inbuf;
|
GstBuffer *inbuf;
|
||||||
unsigned char *dataptr;
|
unsigned char *dataptr;
|
||||||
|
@ -46,6 +47,17 @@ public:
|
||||||
|
|
||||||
// start by pulling a buffer from GStreamer
|
// start by pulling a buffer from GStreamer
|
||||||
inbuf = gst_pad_pull (sinkpad);
|
inbuf = gst_pad_pull (sinkpad);
|
||||||
|
while (GST_IS_EVENT (inbuf)) {
|
||||||
|
switch (GST_EVENT_TYPE (inbuf)) {
|
||||||
|
case GST_EVENT_EOS:
|
||||||
|
gst_element_set_eos (GST_PAD_PARENT (sinkpad));
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gst_pad_event_default (srcpad, (GstEvent*)inbuf);
|
||||||
|
inbuf = gst_pad_pull (sinkpad);
|
||||||
|
}
|
||||||
|
|
||||||
dataptr = GST_BUFFER_DATA(inbuf);
|
dataptr = GST_BUFFER_DATA(inbuf);
|
||||||
remainingsamples = GST_BUFFER_SIZE(inbuf) / 4;
|
remainingsamples = GST_BUFFER_SIZE(inbuf) / 4;
|
||||||
//fprintf(stderr,"got a buffer with %d samples\n",remainingsamples);
|
//fprintf(stderr,"got a buffer with %d samples\n",remainingsamples);
|
||||||
|
@ -67,6 +79,10 @@ public:
|
||||||
{
|
{
|
||||||
sinkpad = pad;
|
sinkpad = pad;
|
||||||
}
|
}
|
||||||
|
void setSrcPad(GstPad *pad)
|
||||||
|
{
|
||||||
|
srcpad = pad;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,6 +130,7 @@ public:
|
||||||
ArtsStereoSink_impl *sink_impl = new ArtsStereoSink_impl();
|
ArtsStereoSink_impl *sink_impl = new ArtsStereoSink_impl();
|
||||||
ArtsStereoSrc_impl *source_impl = new ArtsStereoSrc_impl();
|
ArtsStereoSrc_impl *source_impl = new ArtsStereoSrc_impl();
|
||||||
sink_impl->setPad(sinkpad);
|
sink_impl->setPad(sinkpad);
|
||||||
|
sink_impl->setSrcPad(sourcepad);
|
||||||
source_impl->setPad(sourcepad);
|
source_impl->setPad(sourcepad);
|
||||||
sink = ArtsStereoSink::_from_base(sink_impl);
|
sink = ArtsStereoSink::_from_base(sink_impl);
|
||||||
source = ArtsStereoSrc::_from_base(source_impl);
|
source = ArtsStereoSrc::_from_base(source_impl);
|
||||||
|
|
Loading…
Reference in a new issue