fix media.class

This commit is contained in:
Wim Taymans 2017-04-04 15:32:11 +02:00
parent 8071b76e41
commit 39c3650b5f
4 changed files with 10 additions and 7 deletions

View file

@ -69,7 +69,7 @@ setup_video_node (PinosCore *core, SpaNode *spa_node, PinosProperties *pinos_pro
bool bool
pinos__module_init (PinosModule * module, const char * args) pinos__module_init (PinosModule * module, const char * args)
{ {
PinosProperties *video_props = NULL; PinosProperties *video_props = NULL, *audio_props = NULL;
if (args != NULL) { if (args != NULL) {
char **tmp_argv; char **tmp_argv;
@ -87,7 +87,7 @@ pinos__module_init (PinosModule * module, const char * args)
argv[i] = tmp_argv[i-1]; argv[i] = tmp_argv[i-1];
} }
video_props = pinos_properties_new (NULL, NULL); video_props = pinos_properties_new ("media.class", "Video/Source", NULL);
static struct option long_options[] = { static struct option long_options[] = {
{"filter", required_argument, 0, 'f' }, {"filter", required_argument, 0, 'f' },
@ -123,11 +123,12 @@ pinos__module_init (PinosModule * module, const char * args)
"build/spa/plugins/v4l2/libspa-v4l2.so", "build/spa/plugins/v4l2/libspa-v4l2.so",
"v4l2-monitor", "v4l2-monitor",
"v4l2"); "v4l2");
audio_props = pinos_properties_new ("media.class", "Audio/Source", NULL);
pinos_spa_node_load (module->core, pinos_spa_node_load (module->core,
"build/spa/plugins/audiotestsrc/libspa-audiotestsrc.so", "build/spa/plugins/audiotestsrc/libspa-audiotestsrc.so",
"audiotestsrc", "audiotestsrc",
"audiotestsrc", "audiotestsrc",
NULL, audio_props,
NULL); NULL);
pinos_spa_node_load (module->core, pinos_spa_node_load (module->core,
"build/spa/plugins/videotestsrc/libspa-videotestsrc.so", "build/spa/plugins/videotestsrc/libspa-videotestsrc.so",

View file

@ -195,6 +195,7 @@ struct pod_type_name {
{ "float", "Float" }, { "float", "Float" },
{ "double", "Double" }, { "double", "Double" },
{ "string", "String" }, { "string", "String" },
{ "bytes", "Bytes" },
{ "pointer", "Pointer" }, { "pointer", "Pointer" },
{ "rectangle", "Rectangle" }, { "rectangle", "Rectangle" },
{ "fraction", "Fraction" }, { "fraction", "Fraction" },
@ -203,7 +204,6 @@ struct pod_type_name {
{ "struct", "Struct" }, { "struct", "Struct" },
{ "object", "Object" }, { "object", "Object" },
{ "prop", "Prop" }, { "prop", "Prop" },
{ "bytes", "Bytes" },
}; };
static void static void

View file

@ -114,7 +114,7 @@ static int
fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice) fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice)
{ {
int err; int err;
const char *str, *name; const char *str, *name, *klass = NULL;
snd_pcm_t *hndl; snd_pcm_t *hndl;
char device[64]; char device[64];
SpaPODBuilder b = { NULL, }; SpaPODBuilder b = { NULL, };
@ -158,9 +158,11 @@ fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice)
return -1; return -1;
} else { } else {
factory = &spa_alsa_source_factory; factory = &spa_alsa_source_factory;
klass = "Audio/Source";
snd_pcm_close (hndl); snd_pcm_close (hndl);
} }
} else { } else {
klass = "Audio/Sink";
factory = &spa_alsa_sink_factory; factory = &spa_alsa_sink_factory;
snd_pcm_close (hndl); snd_pcm_close (hndl);
} }
@ -184,7 +186,7 @@ fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice)
SPA_POD_PROP (&f[1], this->type.monitor.flags, 0, SPA_POD_TYPE_INT, 1, 0), SPA_POD_PROP (&f[1], this->type.monitor.flags, 0, SPA_POD_TYPE_INT, 1, 0),
SPA_POD_PROP (&f[1], this->type.monitor.state, 0, SPA_POD_TYPE_INT, 1, SPA_MONITOR_ITEM_STATE_AVAILABLE), SPA_POD_PROP (&f[1], this->type.monitor.state, 0, SPA_POD_TYPE_INT, 1, SPA_MONITOR_ITEM_STATE_AVAILABLE),
SPA_POD_PROP (&f[1], this->type.monitor.name, 0, SPA_POD_TYPE_STRING, 1, name), SPA_POD_PROP (&f[1], this->type.monitor.name, 0, SPA_POD_TYPE_STRING, 1, name),
SPA_POD_PROP (&f[1], this->type.monitor.klass, 0, SPA_POD_TYPE_STRING, 1, "Audio/Device"), SPA_POD_PROP (&f[1], this->type.monitor.klass, 0, SPA_POD_TYPE_STRING, 1, klass),
SPA_POD_PROP (&f[1], this->type.monitor.factory, 0, SPA_POD_TYPE_POINTER, 1, this->type.handle_factory, SPA_POD_PROP (&f[1], this->type.monitor.factory, 0, SPA_POD_TYPE_POINTER, 1, this->type.handle_factory,
factory), factory),
0); 0);

View file

@ -301,7 +301,7 @@ make_nodes (AppData *data)
spa_pod_builder_init (&b, buffer, sizeof (buffer)); spa_pod_builder_init (&b, buffer, sizeof (buffer));
spa_pod_builder_props (&b, &f[0], data->type.props, spa_pod_builder_props (&b, &f[0], data->type.props,
SPA_POD_PROP (&f[1], data->type.props_device, 0, SPA_POD_TYPE_STRING, 1, "hw:0"), SPA_POD_PROP (&f[1], data->type.props_device, 0, SPA_POD_TYPE_STRING, 1, "hw:1"),
SPA_POD_PROP (&f[1], data->type.props_min_latency, 0, SPA_POD_TYPE_INT, 1, 256), SPA_POD_PROP (&f[1], data->type.props_min_latency, 0, SPA_POD_TYPE_INT, 1, 256),
SPA_POD_PROP (&f[1], data->type.props_live, 0, SPA_POD_TYPE_BOOL, 1, false)); SPA_POD_PROP (&f[1], data->type.props_live, 0, SPA_POD_TYPE_BOOL, 1, false));
props = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaProps); props = SPA_POD_BUILDER_DEREF (&b, f[0].ref, SpaProps);