param: add some docs

Rename profile id to index because it better describes the property
This commit is contained in:
Wim Taymans 2019-01-18 13:37:41 +01:00
parent 5f236203d6
commit b2bf69cc42
5 changed files with 65 additions and 61 deletions

View file

@ -88,37 +88,37 @@ enum spa_media_subtype {
enum spa_format {
SPA_FORMAT_START, /**< id of the object, one of enum spa_param_type */
SPA_FORMAT_mediaType, /**< one of enum spa_media_type */
SPA_FORMAT_mediaSubtype, /**< one of enum spa_media_subtype */
SPA_FORMAT_mediaType, /**< media type (Id enum spa_media_type) */
SPA_FORMAT_mediaSubtype, /**< media subtype (Id enum spa_media_subtype) */
/* Audio format keys */
SPA_FORMAT_START_Audio,
SPA_FORMAT_AUDIO_format, /**< audio format, one of enum spa_audio_format */
SPA_FORMAT_AUDIO_flags,
SPA_FORMAT_AUDIO_rate,
SPA_FORMAT_AUDIO_channels, /**< number of audio channels */
SPA_FORMAT_AUDIO_position, /**< channel positions one of enum spa_audio_position */
SPA_FORMAT_AUDIO_format, /**< audio format, (Id enum spa_audio_format) */
SPA_FORMAT_AUDIO_flags, /**< optional flags (Int) */
SPA_FORMAT_AUDIO_rate, /**< sample rate (Int) */
SPA_FORMAT_AUDIO_channels, /**< number of audio channels (Int) */
SPA_FORMAT_AUDIO_position, /**< channel positions (Id enum spa_audio_position) */
/* Video Format keys */
SPA_FORMAT_START_Video = 0x10000,
SPA_FORMAT_VIDEO_format,
SPA_FORMAT_VIDEO_size,
SPA_FORMAT_VIDEO_framerate,
SPA_FORMAT_VIDEO_maxFramerate,
SPA_FORMAT_VIDEO_views,
SPA_FORMAT_VIDEO_interlaceMode,
SPA_FORMAT_VIDEO_pixelAspectRatio,
SPA_FORMAT_VIDEO_multiviewMode,
SPA_FORMAT_VIDEO_multiviewFlags,
SPA_FORMAT_VIDEO_chromaSite,
SPA_FORMAT_VIDEO_colorRange,
SPA_FORMAT_VIDEO_colorMatrix,
SPA_FORMAT_VIDEO_transferFunction,
SPA_FORMAT_VIDEO_colorPrimaries,
SPA_FORMAT_VIDEO_profile,
SPA_FORMAT_VIDEO_level,
SPA_FORMAT_VIDEO_streamFormat,
SPA_FORMAT_VIDEO_alignment,
SPA_FORMAT_VIDEO_format, /**< video format (Id enum spa_video_format) */
SPA_FORMAT_VIDEO_size, /**< size (Rectangle) */
SPA_FORMAT_VIDEO_framerate, /**< frame rate (Fraction) */
SPA_FORMAT_VIDEO_maxFramerate, /**< miximum frame rate (Fraction) */
SPA_FORMAT_VIDEO_views, /**< number of views (Int) */
SPA_FORMAT_VIDEO_interlaceMode, /**< (Id enum spa_video_interlace_mode) */
SPA_FORMAT_VIDEO_pixelAspectRatio, /**< (Rectangle) */
SPA_FORMAT_VIDEO_multiviewMode, /**< (Id enum spa_video_multiview_mode) */
SPA_FORMAT_VIDEO_multiviewFlags, /**< (Id enum spa_video_multiview_flags) */
SPA_FORMAT_VIDEO_chromaSite, /**< /Id enum spa_video_chroma_site) */
SPA_FORMAT_VIDEO_colorRange, /**< /Id enum spa_video_color_range) */
SPA_FORMAT_VIDEO_colorMatrix, /**< /Id enum spa_video_color_matrix) */
SPA_FORMAT_VIDEO_transferFunction, /**< /Id enum spa_video_transfer_function) */
SPA_FORMAT_VIDEO_colorPrimaries, /**< /Id enum spa_video_color_primaries) */
SPA_FORMAT_VIDEO_profile, /**< (Int) */
SPA_FORMAT_VIDEO_level, /**< (Int) */
SPA_FORMAT_VIDEO_H264_streamFormat, /**< (Id enum spa_h264_stream_format) */
SPA_FORMAT_VIDEO_H264_alignment, /**< (Id enum spa_h264_alignment) */
/* Image Format keys */
SPA_FORMAT_START_Image = 0x20000,

View file

@ -34,55 +34,55 @@ extern "C" {
/** different parameter types that can be queried */
enum spa_param_type {
SPA_PARAM_Invalid, /**< invalid */
SPA_PARAM_List, /**< available params */
SPA_PARAM_PropInfo, /**< property information */
SPA_PARAM_Props, /**< properties */
SPA_PARAM_EnumFormat, /**< available formats */
SPA_PARAM_Format, /**< configured format */
SPA_PARAM_Buffers, /**< buffer configurations */
SPA_PARAM_Meta, /**< allowed metadata for buffers */
SPA_PARAM_IO, /**< configurable IO areas */
SPA_PARAM_EnumProfile, /**< profile enumeration */
SPA_PARAM_Profile, /**< profile configuration */
SPA_PARAM_List, /**< available params as SPA_TYPE_OBJECT_ParamList */
SPA_PARAM_PropInfo, /**< property information as SPA_TYPE_OBJECT_PropInfo */
SPA_PARAM_Props, /**< properties as SPA_TYPE_OBJECT_Props */
SPA_PARAM_EnumFormat, /**< available formats as SPA_TYPE_OBJECT_Format */
SPA_PARAM_Format, /**< configured format as SPA_TYPE_OBJECT_Format */
SPA_PARAM_Buffers, /**< buffer configurations as SPA_TYPE_OBJECT_ParamBuffers*/
SPA_PARAM_Meta, /**< allowed metadata for buffers as SPA_TYPE_OBJECT_ParamMeta*/
SPA_PARAM_IO, /**< configurable IO areas as SPA_TYPE_OBJECT_ParamIO */
SPA_PARAM_EnumProfile, /**< profile enumeration as SPA_TYPE_OBJECT_ParamProfile */
SPA_PARAM_Profile, /**< profile configuration as SPA_TYPE_OBJECT_ParamProfile */
};
/** Properties for SPA_TYPE_OBJECT_ParamList */
enum spa_param_list {
SPA_PARAM_LIST_START, /**< object id, one of enum spa_param_type */
SPA_PARAM_LIST_id, /**< id of the supported list param */
SPA_PARAM_LIST_id, /**< id of the supported list param (Id enum spa_param_type) */
};
/** properties for SPA_TYPE_OBJECT_ParamBuffers */
enum spa_param_buffers {
SPA_PARAM_BUFFERS_START, /**< object id, one of enum spa_param_type */
SPA_PARAM_BUFFERS_buffers, /**< number of buffers */
SPA_PARAM_BUFFERS_blocks, /**< number of data blocks per buffer */
SPA_PARAM_BUFFERS_size, /**< size of a data block memory */
SPA_PARAM_BUFFERS_stride, /**< stride of data block memory */
SPA_PARAM_BUFFERS_align, /**< alignment of data block memory */
SPA_PARAM_BUFFERS_buffers, /**< number of buffers (Int) */
SPA_PARAM_BUFFERS_blocks, /**< number of data blocks per buffer (Int) */
SPA_PARAM_BUFFERS_size, /**< size of a data block memory (Int)*/
SPA_PARAM_BUFFERS_stride, /**< stride of data block memory (Int) */
SPA_PARAM_BUFFERS_align, /**< alignment of data block memory (Int) */
};
/** properties for SPA_TYPE_OBJECT_ParamMeta */
enum spa_param_meta {
SPA_PARAM_META_START, /**< object id, one of enum spa_param_type */
SPA_PARAM_META_type, /**< the metadata, one of enum spa_meta_type */
SPA_PARAM_META_size, /**< the expected maximum size the meta */
SPA_PARAM_META_type, /**< the metadata, one of enum spa_meta_type (Id enum spa_meta_type) */
SPA_PARAM_META_size, /**< the expected maximum size the meta (Int) */
};
/** properties for SPA_TYPE_OBJECT_ParamIO */
enum spa_param_io {
SPA_PARAM_IO_START, /**< object id, one of enum spa_param_type */
SPA_PARAM_IO_id, /**< type ID, uniquely identifies the io area */
SPA_PARAM_IO_size, /**< size of the io area */
SPA_PARAM_IO_id, /**< type ID, uniquely identifies the io area (Id enum spa_io_type) */
SPA_PARAM_IO_size, /**< size of the io area (Int) */
};
/** properties for SPA_TYPE_OBJECT_ParamProfile */
enum spa_param_profile {
SPA_PARAM_PROFILE_START, /**< object id, one of enum spa_param_type */
SPA_PARAM_PROFILE_id, /**< profile id */
SPA_PARAM_PROFILE_name, /**< profile name */
SPA_PARAM_PROFILE_direction, /**< direction, input/output */
SPA_PARAM_PROFILE_format, /**< profile format specification */
SPA_PARAM_PROFILE_index, /**< profile index (Int) */
SPA_PARAM_PROFILE_name, /**< profile name (String) */
SPA_PARAM_PROFILE_direction, /**< direction, input/output (Id enum spa_direction) */
SPA_PARAM_PROFILE_format, /**< profile format specification (Object) */
};
#ifdef __cplusplus

View file

@ -206,6 +206,9 @@ static const struct spa_type_info spa_type_media_subtype[] = {
#define SPA_TYPE_INFO_FormatVideo SPA_TYPE_INFO_FORMAT_BASE "Video"
#define SPA_TYPE_INFO_FORMAT_VIDEO_BASE SPA_TYPE_INFO_FormatVideo ":"
#define SPA_TYPE_INFO_FORMAT_VIDEO_H264 SPA_TYPE_INFO_FORMAT_VIDEO_BASE "H264"
#define SPA_TYPE_INFO_FORMAT_VIDEO_H264_BASE SPA_TYPE_INFO_FORMAT_VIDEO_H264 ":"
static const struct spa_type_info spa_type_format[] = {
{ SPA_FORMAT_START, SPA_TYPE_INFO_FORMAT_BASE, SPA_TYPE_Id, spa_type_param, },
@ -239,8 +242,9 @@ static const struct spa_type_info spa_type_format[] = {
{ SPA_FORMAT_VIDEO_colorPrimaries, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "colorPrimaries", SPA_TYPE_Id, NULL },
{ SPA_FORMAT_VIDEO_profile, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "profile", SPA_TYPE_Int, NULL },
{ SPA_FORMAT_VIDEO_level, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "level", SPA_TYPE_Int, NULL },
{ SPA_FORMAT_VIDEO_streamFormat, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "streamFormat", SPA_TYPE_Id, NULL },
{ SPA_FORMAT_VIDEO_alignment, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "alignment", SPA_TYPE_Id, NULL },
{ SPA_FORMAT_VIDEO_H264_streamFormat, SPA_TYPE_INFO_FORMAT_VIDEO_H264_BASE "streamFormat", SPA_TYPE_Id, NULL },
{ SPA_FORMAT_VIDEO_H264_alignment, SPA_TYPE_INFO_FORMAT_VIDEO_H264_BASE "alignment", SPA_TYPE_Id, NULL },
{ 0, NULL, 0, NULL },
};
@ -265,7 +269,7 @@ static const struct spa_type_info spa_type_param_buffers[] = {
static const struct spa_type_info spa_type_param_profile[] = {
{ SPA_PARAM_PROFILE_START, SPA_TYPE_INFO_PARAM_PROFILE_BASE, SPA_TYPE_Id, spa_type_param, },
{ SPA_PARAM_PROFILE_id, SPA_TYPE_INFO_PARAM_PROFILE_BASE "id", SPA_TYPE_Int, NULL },
{ SPA_PARAM_PROFILE_index, SPA_TYPE_INFO_PARAM_PROFILE_BASE "index", SPA_TYPE_Int, NULL },
{ SPA_PARAM_PROFILE_name, SPA_TYPE_INFO_PARAM_PROFILE_BASE "name", SPA_TYPE_String, NULL },
{ SPA_PARAM_PROFILE_direction, SPA_TYPE_INFO_PARAM_PROFILE_BASE "direction", SPA_TYPE_Id, spa_type_direction },
{ SPA_PARAM_PROFILE_format, SPA_TYPE_INFO_PARAM_PROFILE_BASE "format", SPA_TYPE_Object, NULL, },

View file

@ -75,11 +75,11 @@ spa_format_video_h264_parse(const struct spa_pod *format,
{
return spa_pod_parse_object(format,
SPA_TYPE_OBJECT_Format, NULL,
SPA_FORMAT_VIDEO_size, SPA_POD_OPT_Rectangle(&info->size),
SPA_FORMAT_VIDEO_framerate, SPA_POD_OPT_Fraction(&info->framerate),
SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_OPT_Fraction(&info->max_framerate),
SPA_FORMAT_VIDEO_streamFormat, SPA_POD_OPT_Id(&info->stream_format),
SPA_FORMAT_VIDEO_alignment, SPA_POD_OPT_Id(&info->alignment));
SPA_FORMAT_VIDEO_size, SPA_POD_OPT_Rectangle(&info->size),
SPA_FORMAT_VIDEO_framerate, SPA_POD_OPT_Fraction(&info->framerate),
SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_OPT_Fraction(&info->max_framerate),
SPA_FORMAT_VIDEO_H264_streamFormat, SPA_POD_OPT_Id(&info->stream_format),
SPA_FORMAT_VIDEO_H264_alignment, SPA_POD_OPT_Id(&info->alignment));
}
static inline int

View file

@ -308,13 +308,13 @@ static int impl_enum_params(struct spa_device *device,
case 0:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamProfile, id,
SPA_PARAM_PROFILE_id, SPA_POD_Int(0),
SPA_PARAM_PROFILE_index, SPA_POD_Int(0),
SPA_PARAM_PROFILE_name, SPA_POD_String("On"));
break;
case 1:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamProfile, id,
SPA_PARAM_PROFILE_id, SPA_POD_Int(1),
SPA_PARAM_PROFILE_index, SPA_POD_Int(1),
SPA_PARAM_PROFILE_name, SPA_POD_String("Off"));
break;
default:
@ -328,7 +328,7 @@ static int impl_enum_params(struct spa_device *device,
case 0:
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamProfile, id,
SPA_PARAM_PROFILE_id, SPA_POD_Int(this->profile));
SPA_PARAM_PROFILE_index, SPA_POD_Int(this->profile));
break;
default:
return 0;
@ -365,7 +365,7 @@ static int impl_set_param(struct spa_device *device,
if ((res = spa_pod_parse_object(param,
SPA_TYPE_OBJECT_ParamProfile, NULL,
SPA_PARAM_PROFILE_id, SPA_POD_Int(&id))) < 0) {
SPA_PARAM_PROFILE_index, SPA_POD_Int(&id))) < 0) {
spa_log_warn(this->log, "can't parse profile");
spa_debug_pod(0, NULL, param);
return res;