pipewire/spa/include/spa/video/raw.h
Wim Taymans b67c216a04 Make new USE_BUFFERS command
Make a new USE_BUFFERS command to atomically send a buffer array to the
remote client. We can use this to then clean up an old array and go to
the PAUSED state if possible.
Work on formats. Make one structure that can hold all video formats.
Work on pipeline suspend and resume.
Add jpeg support to v4l2.
Work on enum_formats with a filter in v4l2.
2016-08-26 17:43:48 +02:00

189 lines
6 KiB
C

/* Simple Plugin API
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_VIDEO_RAW_H__
#define __SPA_VIDEO_RAW_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _SpaVideoInfoRaw SpaVideoInfoRaw;
#include <spa/props.h>
#include <spa/video/chroma.h>
#include <spa/video/color.h>
#include <spa/video/multiview.h>
#include <endian.h>
#define SPA_VIDEO_MAX_PLANES 4
#define SPA_VIDEO_MAX_COMPONENTS 4
typedef enum {
SPA_VIDEO_FORMAT_UNKNOWN,
SPA_VIDEO_FORMAT_ENCODED,
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_VIDEO_FORMAT_xRGB,
SPA_VIDEO_FORMAT_xBGR,
SPA_VIDEO_FORMAT_RGBA,
SPA_VIDEO_FORMAT_BGRA,
SP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FORMAT_A444_10BE,
SPA_VIDEO_FORMAT_A444_10LE,
SPA_VIDEO_FORMAT_NV61,
SPA_VIDEO_FORMAT_P010_10BE,
SPA_VIDEO_FORMAT_P010_10LE,
SPA_VIDEO_FORMAT_IYU2,
} SpaVideoFormat;
/**
* SpaVideoFlags:
* @SPA_VIDEO_FLAG_NONE: no flags
* @SPA_VIDEO_FLAG_VARIABLE_FPS: a variable fps is selected, fps_n and fps_d
* denote the maximum fps of the video
* @SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA: Each color has been scaled by the alpha
* value.
*
* Extra video flags
*/
typedef enum {
SPA_VIDEO_FLAG_NONE = 0,
SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0),
SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1)
} SpaVideoFlags;
/**
* SpaVideoInterlaceMode:
* @SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE: 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 SpaVideoMeta metadata
* to describe the fields.
*
* The possible values of the #SpaVideoInterlaceMode describing the interlace
* mode of the stream.
*/
typedef enum {
SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE = 0,
SPA_VIDEO_INTERLACE_MODE_INTERLEAVED,
SPA_VIDEO_INTERLACE_MODE_MIXED,
SPA_VIDEO_INTERLACE_MODE_FIELDS
} SpaVideoInterlaceMode;
/**
* SpaVideoInfoRaw:
* @format: the format
* @size: the frame size of the video
* @framerate: the framerate of the video 0/1 means variable rate
* @max_framerate: the maximum framerate of the video. This is only valid when
* @framerate is 0/1
* @views: the number of views in this video
* @interlace_mode: the interlace mode
* @pixel_aspect_ratio: The pixel aspect ratio
* @multiview_mode: multiview mode
* @multiview_flags: multiview flags
* @chroma_site: the chroma siting
* @color_range: the color range. This is the valid range for the samples.
* It is used to convert the samples to Y'PbPr values.
* @color_matrix: the color matrix. Used to convert between Y'PbPr and
* non-linear RGB (R'G'B')
* @transfer_function: the transfer function. used to convert between R'G'B' and RGB
* @color_primaries: color primaries. used to convert between R'G'B' and CIE XYZ
*/
struct _SpaVideoInfoRaw {
SpaVideoFormat format;
SpaRectangle size;
SpaFraction framerate;
SpaFraction max_framerate;
unsigned int views;
SpaVideoInterlaceMode interlace_mode;
SpaFraction pixel_aspect_ratio;
SpaVideoMultiviewMode multiview_mode;
SpaVideoMultiviewFlags multiview_flags;
SpaVideoChromaSite chroma_site;
SpaVideoColorRange color_range;
SpaVideoColorMatrix color_matrix;
SpaVideoTransferFunction transfer_function;
SpaVideoColorPrimaries color_primaries;
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_VIDEO_RAW_H__ */