working jack elements (fixed a problem in upstream jack) random other fixen...
Original commit message from CVS: * working jack elements (fixed a problem in upstream jack) * random other fixen...
This commit is contained in:
parent
5789a18e0a
commit
af472ca88b
@ -400,7 +400,7 @@ gst_jack_loop (GstElement *element)
|
|||||||
{
|
{
|
||||||
GstJack *this;
|
GstJack *this;
|
||||||
GList *pads;
|
GList *pads;
|
||||||
gint len;
|
gint len, peeked_len;
|
||||||
gchar *peeked;
|
gchar *peeked;
|
||||||
gint avail;
|
gint avail;
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
@ -421,7 +421,9 @@ gst_jack_loop (GstElement *element)
|
|||||||
if (!pad->bs)
|
if (!pad->bs)
|
||||||
pad->bs = gst_bytestream_new (pad->pad);
|
pad->bs = gst_bytestream_new (pad->pad);
|
||||||
|
|
||||||
if (gst_bytestream_peek_bytes (pad->bs, (guint8**)&peeked, len) < len) {
|
read:
|
||||||
|
peeked_len = gst_bytestream_peek_bytes (pad->bs, (guint8**)&peeked, len);
|
||||||
|
if (peeked_len < len) {
|
||||||
gst_bytestream_get_status(pad->bs, &avail, &event);
|
gst_bytestream_get_status(pad->bs, &avail, &event);
|
||||||
if (event) {
|
if (event) {
|
||||||
g_warning("got an event on jacksink");
|
g_warning("got an event on jacksink");
|
||||||
@ -430,9 +432,12 @@ gst_jack_loop (GstElement *element)
|
|||||||
* me know when this is needed ;)
|
* me know when this is needed ;)
|
||||||
* also, for sample accuracy etc, we should play avail
|
* also, for sample accuracy etc, we should play avail
|
||||||
* bytes, but hey. */
|
* bytes, but hey. */
|
||||||
gst_element_set_eos(GST_ELEMENT(this));
|
gst_element_set_eos (element);
|
||||||
gst_event_free(event);
|
gst_event_free (event);
|
||||||
|
gst_element_yield (element); /* shouldn't return */
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
goto read;
|
||||||
} else {
|
} else {
|
||||||
/* the element at the top of the chain did not emit an eos
|
/* the element at the top of the chain did not emit an eos
|
||||||
* event. this is a Bug(tm) */
|
* event. this is a Bug(tm) */
|
||||||
@ -440,8 +445,9 @@ gst_jack_loop (GstElement *element)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy (pad->data, peeked, len);
|
|
||||||
gst_bytestream_flush (pad->bs, len);
|
memcpy (pad->data, peeked, peeked_len);
|
||||||
|
gst_bytestream_flush (pad->bs, peeked_len);
|
||||||
} else {
|
} else {
|
||||||
buffer = gst_buffer_new ();
|
buffer = gst_buffer_new ();
|
||||||
GST_BUFFER_DATA (buffer) = pad->data;
|
GST_BUFFER_DATA (buffer) = pad->data;
|
||||||
|
@ -102,7 +102,7 @@ gst_jack_bin_change_state (GstElement *element)
|
|||||||
|
|
||||||
switch (GST_STATE_PENDING (element)) {
|
switch (GST_STATE_PENDING (element)) {
|
||||||
case GST_STATE_NULL:
|
case GST_STATE_NULL:
|
||||||
g_message ("jack: NULL state");
|
g_message ("jackbin: NULL state");
|
||||||
if (this->client) {
|
if (this->client) {
|
||||||
g_message ("jack: closing client");
|
g_message ("jack: closing client");
|
||||||
jack_client_close (this->client);
|
jack_client_close (this->client);
|
||||||
@ -113,7 +113,7 @@ gst_jack_bin_change_state (GstElement *element)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_STATE_READY:
|
case GST_STATE_READY:
|
||||||
g_message ("jack: READY");
|
g_message ("jackbin: READY");
|
||||||
if (!this->client) {
|
if (!this->client) {
|
||||||
if (!(this->client = jack_client_new ("gst-jack"))) {
|
if (!(this->client = jack_client_new ("gst-jack"))) {
|
||||||
g_warning ("jack server not running?");
|
g_warning ("jack server not running?");
|
||||||
@ -154,24 +154,25 @@ gst_jack_bin_change_state (GstElement *element)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_STATE_PAUSED:
|
case GST_STATE_PAUSED:
|
||||||
g_message ("jack: PAUSED");
|
g_message ("jackbin: PAUSED");
|
||||||
|
|
||||||
if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) {
|
if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) {
|
||||||
l = this->src_pads;
|
l = this->src_pads;
|
||||||
while (l) {
|
while (l) {
|
||||||
pad = GST_JACK_PAD (l);
|
pad = GST_JACK_PAD (l);
|
||||||
g_message ("jack: registering pad %s:%s", pad->name, pad->peer_name);
|
g_message ("jack: registering pad %s:%s", pad->name, pad->peer_name);
|
||||||
pad->port = jack_port_register (this->client, pad->name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
|
pad->port = jack_port_register (this->client, pad->name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput|JackPortIsTerminal, 0);
|
||||||
l = g_list_next (l);
|
l = g_list_next (l);
|
||||||
}
|
}
|
||||||
l = this->sink_pads;
|
l = this->sink_pads;
|
||||||
while (l) {
|
while (l) {
|
||||||
pad = GST_JACK_PAD (l);
|
pad = GST_JACK_PAD (l);
|
||||||
g_message ("jack: registering pad %s:%s", pad->name, pad->peer_name);
|
g_message ("jack: registering pad %s:%s", pad->name, pad->peer_name);
|
||||||
pad->port = jack_port_register (this->client, pad->name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
|
pad->port = jack_port_register (this->client, pad->name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput|JackPortIsTerminal, 0);
|
||||||
l = g_list_next (l);
|
l = g_list_next (l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* must activate before connecting */
|
||||||
if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
|
if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
|
||||||
g_message ("jack: activating client");
|
g_message ("jack: activating client");
|
||||||
jack_activate (this->client);
|
jack_activate (this->client);
|
||||||
@ -201,7 +202,7 @@ gst_jack_bin_change_state (GstElement *element)
|
|||||||
l = g_list_next (l);
|
l = g_list_next (l);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_message ("jack: setting OPEN flag");
|
g_message ("jackbin: setting OPEN flag");
|
||||||
GST_FLAG_SET (GST_OBJECT (this), GST_JACK_OPEN);
|
GST_FLAG_SET (GST_OBJECT (this), GST_JACK_OPEN);
|
||||||
} else {
|
} else {
|
||||||
g_cond_wait (this->cond, this->lock);
|
g_cond_wait (this->cond, this->lock);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user