2016-07-05 17:58:34 +02:00
|
|
|
/* Simple Plugin API
|
|
|
|
|
*
|
2018-11-05 17:48:52 +01:00
|
|
|
* Copyright © 2018 Wim Taymans
|
2016-07-05 17:58:34 +02:00
|
|
|
*
|
2018-11-05 17:48:52 +01:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2016-07-05 17:58:34 +02:00
|
|
|
*
|
2018-11-05 17:48:52 +01:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
2016-07-05 17:58:34 +02:00
|
|
|
*/
|
|
|
|
|
|
2019-01-14 12:58:23 +01:00
|
|
|
#ifndef SPA_VIDEO_RAW_H
|
|
|
|
|
#define SPA_VIDEO_RAW_H
|
2016-07-05 17:58:34 +02:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-05-21 14:03:07 +10:00
|
|
|
/**
|
|
|
|
|
* \addtogroup spa_param
|
|
|
|
|
* \{
|
|
|
|
|
*/
|
|
|
|
|
|
2018-08-23 17:47:57 +02:00
|
|
|
#include <spa/utils/defs.h>
|
2017-11-10 13:36:14 +01:00
|
|
|
#include <spa/param/video/chroma.h>
|
|
|
|
|
#include <spa/param/video/color.h>
|
|
|
|
|
#include <spa/param/video/multiview.h>
|
2016-07-05 17:58:34 +02:00
|
|
|
|
|
|
|
|
#define SPA_VIDEO_MAX_PLANES 4
|
|
|
|
|
#define SPA_VIDEO_MAX_COMPONENTS 4
|
|
|
|
|
|
2021-07-30 09:17:14 +02:00
|
|
|
/**
|
|
|
|
|
* Video formats
|
|
|
|
|
*
|
|
|
|
|
* The components are in general described in big-endian order. There are some
|
|
|
|
|
* exceptions (e.g. RGB15 and RGB16) which use the host endianness.
|
|
|
|
|
*
|
|
|
|
|
* Most of the formats are identical to their GStreamer equivalent. See the
|
|
|
|
|
* GStreamer video formats documentation for more details:
|
|
|
|
|
*
|
|
|
|
|
* https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html#formats
|
|
|
|
|
*/
|
2018-08-23 17:47:57 +02:00
|
|
|
enum spa_video_format {
|
|
|
|
|
SPA_VIDEO_FORMAT_UNKNOWN,
|
|
|
|
|
SPA_VIDEO_FORMAT_ENCODED,
|
2019-08-19 16:22:12 +02:00
|
|
|
|
2018-08-23 17:47:57 +02:00
|
|
|
SPA_VIDEO_FORMAT_I420,
|
|
|
|
|
SPA_VIDEO_FORMAT_YV12,
|
|
|
|
|
SPA_VIDEO_FORMAT_YUY2,
|
|
|
|
|
SPA_VIDEO_FORMAT_UYVY,
|
|
|
|
|
SPA_VIDEO_FORMAT_AYUV,
|
|
|
|
|
SPA_VIDEO_FORMAT_RGBx,
|
|
|
|
|
SPA_VIDEO_FORMAT_BGRx,
|
|
|
|
|
SPA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GBRA_12LE,
|
|
|
|
|
SPA_VIDEO_FORMAT_I420_12BE,
|
|
|
|
|
SPA_VIDEO_FORMAT_I420_12LE,
|
|
|
|
|
SPA_VIDEO_FORMAT_I422_12BE,
|
|
|
|
|
SPA_VIDEO_FORMAT_I422_12LE,
|
|
|
|
|
SPA_VIDEO_FORMAT_Y444_12BE,
|
|
|
|
|
SPA_VIDEO_FORMAT_Y444_12LE,
|
2019-08-19 16:22:12 +02:00
|
|
|
|
|
|
|
|
SPA_VIDEO_FORMAT_RGBA_F16,
|
|
|
|
|
SPA_VIDEO_FORMAT_RGBA_F32,
|
2020-01-09 13:40:48 +01:00
|
|
|
|
|
|
|
|
/* Aliases */
|
|
|
|
|
SPA_VIDEO_FORMAT_DSP_F32 = SPA_VIDEO_FORMAT_RGBA_F32,
|
2018-08-23 17:47:57 +02:00
|
|
|
};
|
2017-03-21 13:36:22 +01:00
|
|
|
|
2016-07-05 17:58:34 +02:00
|
|
|
/**
|
|
|
|
|
* Extra video flags
|
|
|
|
|
*/
|
2017-05-25 13:28:15 +02:00
|
|
|
enum spa_video_flags {
|
2021-05-24 18:57:00 +10:00
|
|
|
SPA_VIDEO_FLAG_NONE = 0, /**< no flags */
|
|
|
|
|
SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0), /**< a variable fps is selected, fps_n and fps_d
|
|
|
|
|
* denote the maximum fps of the video */
|
|
|
|
|
SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1), /**< Each color has been scaled by the alpha value. */
|
2017-05-25 13:28:15 +02:00
|
|
|
};
|
2016-07-05 17:58:34 +02:00
|
|
|
|
|
|
|
|
/**
|
2017-05-25 13:28:15 +02:00
|
|
|
* The possible values of the #spa_video_interlace_mode describing the interlace
|
2016-07-05 17:58:34 +02:00
|
|
|
* mode of the stream.
|
|
|
|
|
*/
|
2017-05-25 13:28:15 +02:00
|
|
|
enum spa_video_interlace_mode {
|
2021-05-24 18:57:00 +10:00
|
|
|
SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE = 0, /**< all frames are progressive */
|
|
|
|
|
SPA_VIDEO_INTERLACE_MODE_INTERLEAVED, /**< 2 fields are interleaved in one video frame.
|
|
|
|
|
* Extra buffer flags describe the field order. */
|
|
|
|
|
SPA_VIDEO_INTERLACE_MODE_MIXED, /**< frames contains both interlaced and progressive
|
|
|
|
|
* video, the buffer flags describe the frame and
|
|
|
|
|
* fields. */
|
|
|
|
|
SPA_VIDEO_INTERLACE_MODE_FIELDS, /**< 2 fields are stored in one buffer, use the
|
|
|
|
|
* frame ID to get access to the required
|
|
|
|
|
* field. For multiview (the 'views'
|
|
|
|
|
* property > 1) the fields of view N can
|
|
|
|
|
* be found at frame ID (N * 2) and (N *
|
|
|
|
|
* 2) + 1. Each field has only half the
|
|
|
|
|
* amount of lines as noted in the height
|
|
|
|
|
* property. This mode requires multiple
|
|
|
|
|
* spa_data to describe the fields. */
|
2017-05-25 13:28:15 +02:00
|
|
|
};
|
2016-07-05 17:58:34 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*/
|
2017-05-25 13:28:15 +02:00
|
|
|
struct spa_video_info_raw {
|
2021-05-24 18:57:00 +10:00
|
|
|
enum spa_video_format format; /**< the format */
|
2021-10-14 20:19:21 +02:00
|
|
|
int64_t modifier; /**< format modifier
|
|
|
|
|
* only used with DMA-BUF */
|
2021-05-24 18:57:00 +10:00
|
|
|
struct spa_rectangle size; /**< the frame size of the video */
|
|
|
|
|
struct spa_fraction framerate; /**< the framerate of the video, 0/1 means variable rate */
|
|
|
|
|
struct spa_fraction max_framerate; /**< the maximum framerate of the video. This is only valid when
|
|
|
|
|
\ref framerate is 0/1 */
|
|
|
|
|
uint32_t views; /**< the number of views in this video */
|
|
|
|
|
enum spa_video_interlace_mode interlace_mode; /**< the interlace mode */
|
|
|
|
|
struct spa_fraction pixel_aspect_ratio; /**< the pixel aspect ratio */
|
|
|
|
|
enum spa_video_multiview_mode multiview_mode; /**< multiview mode */
|
|
|
|
|
enum spa_video_multiview_flags multiview_flags; /**< multiview flags */
|
|
|
|
|
enum spa_video_chroma_site chroma_site; /**< the chroma siting */
|
|
|
|
|
enum spa_video_color_range color_range; /**< the color range. This is the valid range for the samples.
|
|
|
|
|
* It is used to convert the samples to Y'PbPr values. */
|
|
|
|
|
enum spa_video_color_matrix color_matrix; /**< the color matrix. Used to convert between Y'PbPr and
|
|
|
|
|
* non-linear RGB (R'G'B') */
|
|
|
|
|
enum spa_video_transfer_function transfer_function; /**< the transfer function. used to convert between R'G'B' and RGB */
|
|
|
|
|
enum spa_video_color_primaries color_primaries; /**< color primaries. used to convert between R'G'B' and CIE XYZ */
|
2016-07-05 17:58:34 +02:00
|
|
|
};
|
|
|
|
|
|
2018-08-29 15:53:26 +02:00
|
|
|
#define SPA_VIDEO_INFO_RAW_INIT(...) (struct spa_video_info_raw) { __VA_ARGS__ }
|
|
|
|
|
|
2020-01-09 13:40:48 +01:00
|
|
|
struct spa_video_info_dsp {
|
|
|
|
|
enum spa_video_format format;
|
|
|
|
|
int64_t modifier;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define SPA_VIDEO_INFO_DSP_INIT(...) (struct spa_video_info_dsp) { __VA_ARGS__ }
|
|
|
|
|
|
2021-05-21 14:03:07 +10:00
|
|
|
/**
|
|
|
|
|
* \}
|
|
|
|
|
*/
|
|
|
|
|
|
2016-07-05 17:58:34 +02:00
|
|
|
#ifdef __cplusplus
|
2017-05-26 08:05:01 +02:00
|
|
|
} /* extern "C" */
|
2016-07-05 17:58:34 +02:00
|
|
|
#endif
|
|
|
|
|
|
2019-01-14 12:58:23 +01:00
|
|
|
#endif /* SPA_VIDEO_RAW_H */
|