format: make helper functions to create formats

Use helper functions to create a fully specified format.
This commit is contained in:
Wim Taymans 2018-08-29 15:53:26 +02:00
parent 80de83f38a
commit 514528f2c7
24 changed files with 158 additions and 430 deletions

View file

@ -144,6 +144,8 @@ struct spa_audio_info_raw {
uint32_t channel_mask; /*< channel mask */
};
#define SPA_AUDIO_INFO_RAW_INIT(...) (struct spa_audio_info_raw) { __VA_ARGS__ }
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -25,6 +25,7 @@ extern "C" {
#endif
#include <spa/pod/parser.h>
#include <spa/pod/builder.h>
#include <spa/param/video/format.h>
#include <spa/param/format-utils.h>
@ -49,6 +50,19 @@ spa_format_video_raw_parse(const struct spa_pod *format,
":", SPA_FORMAT_VIDEO_colorPrimaries, "?i", &info->color_primaries, NULL);
}
static inline struct spa_pod *
spa_format_video_raw_build(struct spa_pod_builder *builder, uint32_t id,
struct spa_video_info_raw *info)
{
return spa_pod_builder_object(builder,
SPA_TYPE_OBJECT_Format, id,
"I", SPA_MEDIA_TYPE_video,
"I", SPA_MEDIA_SUBTYPE_raw,
":", SPA_FORMAT_VIDEO_format, "I", &info->format,
":", SPA_FORMAT_VIDEO_size, "R", &info->size,
":", SPA_FORMAT_VIDEO_framerate, "F", &info->framerate);
}
static inline int
spa_format_video_h264_parse(const struct spa_pod *format,
struct spa_video_info_h264 *info)

View file

@ -191,6 +191,8 @@ struct spa_video_info_raw {
enum spa_video_color_primaries color_primaries;
};
#define SPA_VIDEO_INFO_RAW_INIT(...) (struct spa_video_info_raw) { __VA_ARGS__ }
#ifdef __cplusplus
} /* extern "C" */
#endif