diff options
author | Christian Schaller <uraeus@gnome.org> | 2004-03-07 11:24:38 +0000 |
---|---|---|
committer | Christian Schaller <uraeus@gnome.org> | 2004-03-07 11:24:38 +0000 |
commit | c2bd172e390be9f72bd2442a19dd2cd7c7705013 (patch) | |
tree | 1d848d733bb12b19a588c31310fbefe55f63b9a3 /ext | |
parent | 2f215bf9d456bbad04178a89e2f25062534264ba (diff) | |
download | gst-plugins-bad-c2bd172e390be9f72bd2442a19dd2cd7c7705013.tar.gz gst-plugins-bad-c2bd172e390be9f72bd2442a19dd2cd7c7705013.tar.bz2 gst-plugins-bad-c2bd172e390be9f72bd2442a19dd2cd7c7705013.zip |
Arwed von Merkatz provides us with more NAS fixes
Original commit message from CVS:
Arwed von Merkatz provides us with more NAS fixes
Diffstat (limited to 'ext')
-rw-r--r-- | ext/nas/nassink.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/ext/nas/nassink.c b/ext/nas/nassink.c index 45862750..6ad2767f 100644 --- a/ext/nas/nassink.c +++ b/ext/nas/nassink.c @@ -32,6 +32,7 @@ #define NAS_SOUND_PORT_DURATION (2) +GST_DEBUG_CATEGORY(NAS); /* Signals and args */ enum { /* FILL ME */ @@ -130,6 +131,7 @@ gst_nassink_base_init (gpointer g_class) gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_factory)); gst_element_class_set_details (element_class, &nassink_details); + GST_DEBUG_CATEGORY_INIT(NAS, "NAS", 0, NULL); } static void @@ -160,6 +162,7 @@ gst_nassink_class_init (GstNassinkClass *klass) static void gst_nassink_init(GstNassink *nassink) { + GST_CAT_DEBUG(NAS,"nassink: init"); nassink->sinkpad = gst_pad_new_from_template ( gst_static_pad_template_get (&sink_factory), "sink"); gst_element_add_pad(GST_ELEMENT(nassink), nassink->sinkpad); @@ -191,8 +194,10 @@ gst_nassink_sync_parms (GstNassink *nassink) if (nassink->audio == NULL) return TRUE; + GST_CAT_DEBUG(NAS,"depth=%i rate=%i", nassink->depth, nassink->rate); if (nassink->flow != AuNone) { + GST_CAT_DEBUG(NAS,"flushing buffer"); while (nassink->pos && nassink->buf) NAS_flush(nassink); AuStopFlow( nassink->audio, nassink->flow, NULL); @@ -253,7 +258,6 @@ gst_nassink_chain (GstPad *pad, GstData *_data) if (GST_BUFFER_DATA (buf) != NULL) { if (!nassink->mute && nassink->audio != NULL) { - GST_DEBUG ("nassink: data=%p size=%d", GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); remaining = GST_BUFFER_SIZE (buf); while ((nassink->flow != AuNone) && ( remaining > 0)) { @@ -379,6 +383,7 @@ gst_nassink_open_audio (GstNassink *sink) GST_FLAG_SET (sink, GST_NASSINK_OPEN); + GST_CAT_DEBUG(NAS,"opened audio device"); return TRUE; } @@ -408,7 +413,7 @@ gst_nassink_close_audio (GstNassink *sink) GST_FLAG_UNSET (sink, GST_NASSINK_OPEN); - GST_DEBUG ("nassink: closed sound device"); + GST_CAT_DEBUG (NAS,"closed audio device"); } static GstElementStateReturn @@ -582,18 +587,43 @@ NAS_createFlow(GstNassink *sink, unsigned char format, unsigned short rate, int AuElement elements[2]; AuUint32 buf_samples; + GST_CAT_DEBUG(NAS,"getting device"); device = NAS_getDevice(sink->audio, numTracks); if (device == AuNone) { + GST_CAT_DEBUG(NAS,"no device found"); return -1; } sink->flow = AuGetScratchFlow(sink->audio, NULL); if (sink->flow == 0) { + GST_CAT_DEBUG(NAS,"couldn't get flow"); return -1; } + /* free old Elements and reconnet to server, needed to change samplerate */ + { + AuBool clocked; + int num_elements; + AuStatus status; + AuElement *oldelems; + oldelems = AuGetElements(sink->audio, sink->flow, &clocked, &num_elements, &status); + if (num_elements > 0) { + GST_CAT_DEBUG(NAS,"GetElements status: %i", status); + if (oldelems) + AuFreeElements(sink->audio, num_elements, oldelems); + gst_nassink_close_audio(sink); + gst_nassink_open_audio(sink); + sink->flow = AuGetScratchFlow(sink->audio, NULL); + if (sink->flow == 0) { + GST_CAT_DEBUG(NAS,"couldn't get flow"); + return -1; + } + } + } + buf_samples = rate * NAS_SOUND_PORT_DURATION; + AuMakeElementImportClient( &elements[0], /* element */ rate, /* rate */ format, /* format */ |