mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-15 07:00:05 -05:00
format: make helper functions to create formats
Use helper functions to create a fully specified format.
This commit is contained in:
parent
80de83f38a
commit
514528f2c7
24 changed files with 158 additions and 430 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue