#include <vlc_plugin.h>
#include <vlc_services_discovery.h>
#include <pulse/pulseaudio.h>
-#include "../audio_output/vlcpulse.h"
+#include "audio_output/vlcpulse.h"
static int Open (vlc_object_t *);
static void Close (vlc_object_t *);
VLC_SD_PROBE_HELPER("pulse", "Audio capture", SD_CAT_DEVICES);
vlc_module_begin ()
- set_shortname (N_("Video capture"))
- set_description (N_("Video capture (Video4Linux)"))
+ set_shortname (N_("Audio capture"))
+ set_description (N_("Audio capture (PulseAudio)"))
set_category (CAT_PLAYLIST)
set_subcategory (SUBCAT_PLAYLIST_SD)
set_capability ("services_discovery", 0)
{
struct device *d = data;
- if (d->sd)
- services_discovery_RemoveItem (d->sd, d->item);
+ services_discovery_RemoveItem (d->sd, d->item);
vlc_gc_decref (d->item);
free (d);
}
}
d->index = info->index;
d->item = item;
- d->sd = NULL;
struct device **dp = tsearch (d, &sys->root, cmpsrc);
if (dp == NULL) /* Out-of-memory */
{
- DestroySource (d);
+ free (d);
+ vlc_gc_decref (item);
return -1;
}
- if (*dp != d) /* Replace existing source */
+ if (*dp != d) /* Update existing source */
{
- DestroySource (*dp);
- *dp = d;
+ free (d);
+ d = *dp;
+ input_item_SetURI (d->item, item->psz_uri);
+ input_item_SetName (d->item, item->psz_name);
+ vlc_gc_decref (item);
+ return 0;
}
- char *card;
- if (info->card == PA_INVALID_INDEX
- || unlikely(asprintf (&card, N_("Card %"PRIu32), info->card) == -1))
- card = NULL;
+ const char *card = pa_proplist_gets(info->proplist, "device.product.name");
services_discovery_AddItem (sd, item,
(card != NULL) ? card : N_("Generic"));
d->sd = sd;
- free (card);
return 0;
}