format: make formats as uri

This commit is contained in:
Wim Taymans 2017-03-21 13:36:22 +01:00
parent 6f0a12462b
commit ff62c1b9ce
11 changed files with 476 additions and 222 deletions

View file

@ -322,8 +322,18 @@ print_format_value (uint32_t size, uint32_t type, void *body)
fprintf (stderr, "%s", *(int32_t *) body ? "true" : "false");
break;
case SPA_POD_TYPE_URI:
fprintf (stderr, "%"PRIi32, *(int32_t *) body);
{
const char *str = spa_id_map_get_uri (spa_id_map_get_default(), *(int32_t*)body);
if (str) {
const char *h = strstr (str, "#");
if (h)
str = h + 1;
} else {
str = "unknown";
}
fprintf (stderr, "%s", str);
break;
}
case SPA_POD_TYPE_INT:
fprintf (stderr, "%"PRIi32, *(int32_t *) body);
break;

View file

@ -61,7 +61,8 @@ id_map_get_uri (SpaIDMap *map, uint32_t id)
if (id < this->n_uris)
return this->uris[id];
return 0;
return NULL;
}
static IDMap default_id_map = {

View file

@ -31,6 +31,7 @@ compare_value (SpaPODType type, const void *r1, const void *r2)
case SPA_POD_TYPE_INVALID:
return 0;
case SPA_POD_TYPE_BOOL:
case SPA_POD_TYPE_URI:
return *(int32_t*)r1 == *(uint32_t*)r2;
case SPA_POD_TYPE_INT:
return *(int32_t*)r1 - *(int32_t*)r2;

View file

@ -50,7 +50,7 @@ spa_format_video_parse (const SpaFormat *format,
if (info->media_subtype == media_subtypes.raw)
spa_format_query (format,
prop_video.format, SPA_POD_TYPE_INT, &info->info.raw.format,
prop_video.format, SPA_POD_TYPE_URI, &info->info.raw.format,
prop_video.size, SPA_POD_TYPE_RECTANGLE, &info->info.raw.size,
prop_video.framerate, SPA_POD_TYPE_FRACTION, &info->info.raw.framerate,
prop_video.max_framerate, SPA_POD_TYPE_FRACTION, &info->info.raw.max_framerate,