summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorDave Robillard <dave@drobilla.net>2009-05-31 19:26:30 -0400
committerDave Robillard <dave@drobilla.net>2009-05-31 19:26:30 -0400
commitaf14cf34e69e46bfd6544a420b3fdd7e131aa69a (patch)
tree2bd39ab6ab67995d6e4c69a3e6c6eae2a17f350e /ext
parentbd9a3cbd254714bf71cd87c31d4e5b77f6a96cba (diff)
parentb19dd5920605c0036dacf19591a6feca7a736a50 (diff)
downloadgst-plugins-bad-af14cf34e69e46bfd6544a420b3fdd7e131aa69a.tar.gz
gst-plugins-bad-af14cf34e69e46bfd6544a420b3fdd7e131aa69a.tar.bz2
gst-plugins-bad-af14cf34e69e46bfd6544a420b3fdd7e131aa69a.zip
Merge branch 'fdo' into lv2
Diffstat (limited to 'ext')
-rw-r--r--ext/jack/gstjackaudioclient.c32
-rw-r--r--ext/jack/gstjackaudiosink.c7
-rw-r--r--ext/resindvd/gstmpegdemux.c17
-rw-r--r--ext/resindvd/gstmpegdemux.h1
-rw-r--r--ext/resindvd/resindvdsrc.c7
-rw-r--r--ext/resindvd/rsnaudiomunge.c5
6 files changed, 53 insertions, 16 deletions
diff --git a/ext/jack/gstjackaudioclient.c b/ext/jack/gstjackaudioclient.c
index 1aa1baf8..60e41381 100644
--- a/ext/jack/gstjackaudioclient.c
+++ b/ext/jack/gstjackaudioclient.c
@@ -42,6 +42,7 @@ typedef struct
{
gint refcount;
GMutex *lock;
+ GCond *flush_cond;
/* id/server pair and the connection */
gchar *id;
@@ -61,6 +62,7 @@ struct _GstJackAudioClient
GstJackClientType type;
gboolean active;
+ gboolean deactivate;
void (*shutdown) (void *arg);
JackProcessCallback process;
@@ -92,15 +94,25 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
/* only call active clients */
- if (client->active && client->process)
+ if ((client->active || client->deactivate) && client->process) {
res = client->process (nframes, client->user_data);
+ if (client->deactivate) {
+ client->deactivate = FALSE;
+ g_cond_signal (conn->flush_cond);
+ }
+ }
}
for (walk = conn->sink_clients; walk; walk = g_list_next (walk)) {
GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
/* only call active clients */
- if (client->active && client->process)
+ if ((client->active || client->deactivate) && client->process) {
res = client->process (nframes, client->user_data);
+ if (client->deactivate) {
+ client->deactivate = FALSE;
+ g_cond_signal (conn->flush_cond);
+ }
+ }
}
g_mutex_unlock (conn->lock);
@@ -203,6 +215,7 @@ gst_jack_audio_make_connection (const gchar * id, const gchar * server,
conn = g_new (GstJackAudioConnection, 1);
conn->refcount = 1;
conn->lock = g_mutex_new ();
+ conn->flush_cond = g_cond_new ();
conn->id = g_strdup (id);
conn->server = g_strdup (server);
conn->client = jclient;
@@ -325,6 +338,7 @@ gst_jack_audio_unref_connection (GstJackAudioConnection * conn)
/* free resources */
g_mutex_free (conn->lock);
+ g_cond_free (conn->flush_cond);
g_free (conn->id);
g_free (conn->server);
g_free (conn);
@@ -409,9 +423,11 @@ gst_jack_audio_client_new (const gchar * id, const gchar * server,
if (conn == NULL)
goto no_connection;
+ GST_INFO ("new client %s", id);
+
/* make new client using the connection */
client = g_new (GstJackAudioClient, 1);
- client->active = FALSE;
+ client->active = client->deactivate = FALSE;
client->conn = conn;
client->type = type;
client->shutdown = shutdown;
@@ -446,6 +462,8 @@ gst_jack_audio_client_free (GstJackAudioClient * client)
g_return_if_fail (client != NULL);
+ GST_INFO ("free client");
+
conn = client->conn;
/* remove from connection first so that it's not scheduled anymore after this
@@ -492,6 +510,14 @@ gst_jack_audio_client_set_active (GstJackAudioClient * client, gboolean active)
/* make sure that we are not dispatching the client */
g_mutex_lock (client->conn->lock);
+ if (client->active && !active) {
+ /* we need to process once more to flush the port */
+ client->deactivate = TRUE;
+
+ /* need to wait for process_cb run once more */
+ while (client->deactivate)
+ g_cond_wait (client->conn->flush_cond, client->conn->lock);
+ }
client->active = active;
g_mutex_unlock (client->conn->lock);
diff --git a/ext/jack/gstjackaudiosink.c b/ext/jack/gstjackaudiosink.c
index 01383cbb..58a699d0 100644
--- a/ext/jack/gstjackaudiosink.c
+++ b/ext/jack/gstjackaudiosink.c
@@ -213,8 +213,8 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
if (nframes * sizeof (sample_t) != flen)
goto wrong_size;
- GST_DEBUG ("copy %d frames: %p, %d bytes, %d channels", nframes, readptr,
- flen, channels);
+ GST_DEBUG_OBJECT (sink, "copy %d frames: %p, %d bytes, %d channels",
+ nframes, readptr, flen, channels);
data = (sample_t *) readptr;
/* the samples in the ringbuffer have the channels interleaved, we need to
@@ -231,6 +231,7 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
/* we wrote one segment */
gst_ring_buffer_advance (buf, 1);
} else {
+ GST_DEBUG_OBJECT (sink, "write %d frames silence", nframes);
/* We are not allowed to read from the ringbuffer, write silence to all
* jack output buffers */
for (i = 0; i < channels; i++) {
@@ -607,7 +608,7 @@ gst_jack_ring_buffer_delay (GstRingBuffer * buf)
res = latency;
}
- GST_DEBUG_OBJECT (sink, "delay %u", res);
+ GST_LOG_OBJECT (sink, "delay %u", res);
return res;
}
diff --git a/ext/resindvd/gstmpegdemux.c b/ext/resindvd/gstmpegdemux.c
index 5ab26107..d9aefe53 100644
--- a/ext/resindvd/gstmpegdemux.c
+++ b/ext/resindvd/gstmpegdemux.c
@@ -356,7 +356,7 @@ gst_flups_demux_get_stream (GstFluPSDemux * demux, gint id, gint type)
{
GstFluPSStream *stream = demux->streams[id];
- if (stream == NULL) {
+ if (stream == NULL && !demux->disable_stream_creation) {
if (!(stream = gst_flups_demux_create_stream (demux, id, type)))
goto unknown_stream;
@@ -612,6 +612,8 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
GST_DEBUG_OBJECT (demux, "Handling language codes event");
+ demux->disable_stream_creation = FALSE;
+
/* Create a video pad to ensure it exists before emitting no more pads */
temp = gst_flups_demux_get_stream (demux, 0xe0, ST_VIDEO_MPEG2);
/* Send a video format event downstream */
@@ -719,6 +721,8 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
ST_PS_DVD_SUBPICTURE);
}
+ demux->disable_stream_creation = TRUE;
+
GST_DEBUG_OBJECT (demux, "Created all pads from Language Codes event, "
"signalling no-more-pads");
@@ -767,32 +771,33 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event)
stream_id += 0x80;
temp = demux->streams[stream_id];
break;
-#if 0 /* FIXME: Ignore non AC-3 requests until the decoder bin can handle them */
case 0x2:
case 0x3:
/* MPEG audio without and with extension stream are
* treated the same */
- stream_id = 0xC0 + i;
+ stream_id += 0xC0;
temp = demux->streams[stream_id];
break;
case 0x4:
/* LPCM */
- stream_id = 0xA0 + i;
+ stream_id += 0xA0;
temp = demux->streams[stream_id];
break;
case 0x6:
/* DTS */
- stream_id = 0x88 + i;
+ stream_id += 0x88;
temp = demux->streams[stream_id];
break;
case 0x7:
/* FIXME: What range is SDDS? */
+ temp = NULL;
break;
-#endif
default:
temp = NULL;
break;
}
+ GST_INFO_OBJECT (demux, "Have DVD audio stream select event: "
+ "stream 0x%02x", stream_id);
if (temp != NULL && temp->pad != NULL) {
/* Send event to the selector to activate the desired pad */
GstStructure *s = gst_structure_new ("application/x-gst-dvd",
diff --git a/ext/resindvd/gstmpegdemux.h b/ext/resindvd/gstmpegdemux.h
index 683b7cde..f6291500 100644
--- a/ext/resindvd/gstmpegdemux.h
+++ b/ext/resindvd/gstmpegdemux.h
@@ -106,6 +106,7 @@ struct _GstFluPSDemux {
/* Indicates an MPEG-2 stream */
gboolean is_mpeg2_pack;
+ gboolean disable_stream_creation;
/* Language codes event is stored when a dvd-lang-codes
* custom event arrives from upstream */
diff --git a/ext/resindvd/resindvdsrc.c b/ext/resindvd/resindvdsrc.c
index f24e45aa..122f2b67 100644
--- a/ext/resindvd/resindvdsrc.c
+++ b/ext/resindvd/resindvdsrc.c
@@ -1882,7 +1882,7 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
GST_DEBUG_OBJECT (src, "mapped logical audio %d to MPEG substream %d",
i, phys_id);
-#if 1
+#if 0
/* FIXME: Only output A52 streams for now, until the decoder switching
* is ready */
if (a->audio_format != 0) {
@@ -1891,7 +1891,8 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
continue;
}
#endif
- have_audio = TRUE;
+ if (a->audio_format == 0)
+ have_audio = TRUE;
GST_DEBUG_OBJECT (src, "Audio stream %d is format %d, substream %d", i,
(int) a->audio_format, phys_id);
@@ -1917,7 +1918,7 @@ rsn_dvdsrc_prepare_streamsinfo_event (resinDvdSrc * src)
}
if (have_audio == FALSE) {
- /* Always create at least one audio stream */
+ /* Always create at least one audio stream of the required type */
gst_structure_set (s, "audio-0-format", G_TYPE_INT, (int) 0,
"audio-0-stream", G_TYPE_INT, (int) 0, NULL);
}
diff --git a/ext/resindvd/rsnaudiomunge.c b/ext/resindvd/rsnaudiomunge.c
index 50d33be7..fda2a96b 100644
--- a/ext/resindvd/rsnaudiomunge.c
+++ b/ext/resindvd/rsnaudiomunge.c
@@ -200,10 +200,13 @@ rsn_audiomunge_make_audio (RsnAudioMunge * munge,
guint buf_size;
/* Just generate a 48khz stereo buffer for now */
+ /* FIXME: Adapt to the allowed formats, according to the currently
+ * plugged decoder, or at least add a source pad that accepts the
+ * caps we're outputting if the upstream decoder does not */
#if 0
caps =
gst_caps_from_string
- ("audio/x-raw-int,rate=48000,channels=2,width=16,depth=16,signed=(boolean)true,endianness=1234");
+ ("audio/x-raw-int,rate=48000,channels=2,width=16,depth=16,signed=(boolean)true,endianness=4321");
buf_size = 4 * (48000 * fill_time / GST_SECOND);
#else
caps = gst_caps_from_string ("audio/x-raw-float, endianness=(int)1234,"