mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
video: Add GST_VIDEO_FORMAT_ENCODED
This commit is contained in:
parent
8f00d76c97
commit
0a7d047b1f
3 changed files with 24 additions and 12 deletions
|
@ -231,7 +231,7 @@ fill_planes (GstBlendVideoFormatInfo * info)
|
||||||
info->offset[1] = info->offset[2] +
|
info->offset[1] = info->offset[2] +
|
||||||
info->stride[1] * (GST_ROUND_UP_4 (height) / 4);
|
info->stride[1] * (GST_ROUND_UP_4 (height) / 4);
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_UNKNOWN:
|
default:
|
||||||
GST_ERROR ("invalid format");
|
GST_ERROR ("invalid format");
|
||||||
g_warning ("invalid format");
|
g_warning ("invalid format");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -141,7 +141,6 @@ static VideoFormat formats[] = {
|
||||||
{0x00000000, {GST_VIDEO_FORMAT_UNKNOWN, "UNKNOWN", "unknown video", 0, DPTH0,
|
{0x00000000, {GST_VIDEO_FORMAT_UNKNOWN, "UNKNOWN", "unknown video", 0, DPTH0,
|
||||||
PSTR0, PLANE_NA,
|
PSTR0, PLANE_NA,
|
||||||
OFFS0}},
|
OFFS0}},
|
||||||
|
|
||||||
MAKE_YUV_FORMAT (I420, "raw video", GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
MAKE_YUV_FORMAT (I420, "raw video", GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
||||||
DPTH888, PSTR111,
|
DPTH888, PSTR111,
|
||||||
PLANE012, OFFS0, SUB420),
|
PLANE012, OFFS0, SUB420),
|
||||||
|
@ -258,6 +257,8 @@ static VideoFormat formats[] = {
|
||||||
MAKE_YUV_FORMAT (r210, "raw video", GST_MAKE_FOURCC ('r', '2', '1', '0'),
|
MAKE_YUV_FORMAT (r210, "raw video", GST_MAKE_FOURCC ('r', '2', '1', '0'),
|
||||||
DPTH10_10_10,
|
DPTH10_10_10,
|
||||||
PSTR444, PLANE0, OFFS0, SUB444),
|
PSTR444, PLANE0, OFFS0, SUB444),
|
||||||
|
{0x00000000, {GST_VIDEO_FORMAT_ENCODED, "ENCODED", "encoded video",
|
||||||
|
GST_VIDEO_FORMAT_FLAG_COMPLEX, DPTH0, PSTR0, PLANE_NA, OFFS0}},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1373,7 +1374,7 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
const gchar *s;
|
const gchar *s;
|
||||||
GstVideoFormat format = GST_VIDEO_FORMAT_UNKNOWN;
|
GstVideoFormat format = GST_VIDEO_FORMAT_UNKNOWN;
|
||||||
gint width, height;
|
gint width = 0, height = 0;
|
||||||
gint fps_n, fps_d;
|
gint fps_n, fps_d;
|
||||||
gint par_n, par_d;
|
gint par_n, par_d;
|
||||||
gboolean interlaced;
|
gboolean interlaced;
|
||||||
|
@ -1436,14 +1437,19 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
|
||||||
} else if (depth == 16 && bpp == 16 && endianness == G_LITTLE_ENDIAN) {
|
} else if (depth == 16 && bpp == 16 && endianness == G_LITTLE_ENDIAN) {
|
||||||
format = GST_VIDEO_FORMAT_GRAY16_LE;
|
format = GST_VIDEO_FORMAT_GRAY16_LE;
|
||||||
}
|
}
|
||||||
}
|
} else if (g_str_has_prefix (gst_structure_get_name (structure), "video/") ||
|
||||||
|
g_str_has_prefix (gst_structure_get_name (structure), "image/"))
|
||||||
|
format = GST_VIDEO_FORMAT_ENCODED;
|
||||||
|
|
||||||
if (format == GST_VIDEO_FORMAT_UNKNOWN)
|
if (format == GST_VIDEO_FORMAT_UNKNOWN)
|
||||||
goto unknown_format;
|
goto unknown_format;
|
||||||
|
|
||||||
if (!gst_structure_get_int (structure, "width", &width))
|
/* width and height are mandatory, except for non-raw-formats */
|
||||||
|
if (!gst_structure_get_int (structure, "width", &width) &&
|
||||||
|
format != GST_VIDEO_FORMAT_ENCODED)
|
||||||
goto no_width;
|
goto no_width;
|
||||||
if (!gst_structure_get_int (structure, "height", &height))
|
if (!gst_structure_get_int (structure, "height", &height) &&
|
||||||
|
format != GST_VIDEO_FORMAT_ENCODED)
|
||||||
goto no_height;
|
goto no_height;
|
||||||
|
|
||||||
gst_video_info_set_format (info, format, width, height);
|
gst_video_info_set_format (info, format, width, height);
|
||||||
|
@ -1557,6 +1563,10 @@ gst_video_info_to_caps (GstVideoInfo * info)
|
||||||
if (GST_VIDEO_INFO_IS_YUV (info))
|
if (GST_VIDEO_INFO_IS_YUV (info))
|
||||||
gst_caps_set_simple (caps, "format", GST_TYPE_FOURCC,
|
gst_caps_set_simple (caps, "format", GST_TYPE_FOURCC,
|
||||||
gst_video_format_to_fourcc (info->finfo->format), NULL);
|
gst_video_format_to_fourcc (info->finfo->format), NULL);
|
||||||
|
else if (GST_VIDEO_INFO_IS_RGB (info) || GST_VIDEO_INFO_IS_GRAY (info))
|
||||||
|
gst_caps_set_simple (caps, "depth", G_TYPE_INT,
|
||||||
|
info->finfo->bits * GST_VIDEO_INFO_N_COMPONENTS (info), NULL);
|
||||||
|
|
||||||
|
|
||||||
gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN,
|
gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN,
|
||||||
GST_VIDEO_INFO_IS_INTERLACED (info), NULL);
|
GST_VIDEO_INFO_IS_INTERLACED (info), NULL);
|
||||||
|
@ -1745,7 +1755,9 @@ fill_planes (GstVideoInfo * info)
|
||||||
info->size = info->offset[2] +
|
info->size = info->offset[2] +
|
||||||
info->stride[2] * (GST_ROUND_UP_4 (height) / 4);
|
info->stride[2] * (GST_ROUND_UP_4 (height) / 4);
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_UNKNOWN:
|
default:
|
||||||
|
if (GST_VIDEO_FORMAT_INFO_IS_COMPLEX (info->finfo))
|
||||||
|
break;
|
||||||
GST_ERROR ("invalid format");
|
GST_ERROR ("invalid format");
|
||||||
g_warning ("invalid format");
|
g_warning ("invalid format");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -30,6 +30,7 @@ G_BEGIN_DECLS
|
||||||
/**
|
/**
|
||||||
* GstVideoFormat:
|
* GstVideoFormat:
|
||||||
* @GST_VIDEO_FORMAT_UNKNOWN: Unknown or unset video format id
|
* @GST_VIDEO_FORMAT_UNKNOWN: Unknown or unset video format id
|
||||||
|
* @GST_VIDEO_FORMAT_ENCODED: Encoded video format
|
||||||
* @GST_VIDEO_FORMAT_I420: planar 4:2:0 YUV
|
* @GST_VIDEO_FORMAT_I420: planar 4:2:0 YUV
|
||||||
* @GST_VIDEO_FORMAT_YV12: planar 4:2:0 YVU (like I420 but UV planes swapped)
|
* @GST_VIDEO_FORMAT_YV12: planar 4:2:0 YVU (like I420 but UV planes swapped)
|
||||||
* @GST_VIDEO_FORMAT_YUY2: packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...)
|
* @GST_VIDEO_FORMAT_YUY2: packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...)
|
||||||
|
@ -118,7 +119,8 @@ typedef enum {
|
||||||
GST_VIDEO_FORMAT_IYU1,
|
GST_VIDEO_FORMAT_IYU1,
|
||||||
GST_VIDEO_FORMAT_ARGB64,
|
GST_VIDEO_FORMAT_ARGB64,
|
||||||
GST_VIDEO_FORMAT_AYUV64,
|
GST_VIDEO_FORMAT_AYUV64,
|
||||||
GST_VIDEO_FORMAT_r210
|
GST_VIDEO_FORMAT_r210,
|
||||||
|
GST_VIDEO_FORMAT_ENCODED
|
||||||
} GstVideoFormat;
|
} GstVideoFormat;
|
||||||
|
|
||||||
#define GST_VIDEO_BYTE1_MASK_32 "0xFF000000"
|
#define GST_VIDEO_BYTE1_MASK_32 "0xFF000000"
|
||||||
|
@ -582,6 +584,7 @@ struct _GstVideoFormatInfo {
|
||||||
#define GST_VIDEO_FORMAT_INFO_HAS_ALPHA(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_ALPHA)
|
#define GST_VIDEO_FORMAT_INFO_HAS_ALPHA(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_ALPHA)
|
||||||
#define GST_VIDEO_FORMAT_INFO_IS_LE(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_LE)
|
#define GST_VIDEO_FORMAT_INFO_IS_LE(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_LE)
|
||||||
#define GST_VIDEO_FORMAT_INFO_HAS_PALETTE(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_PALETTE)
|
#define GST_VIDEO_FORMAT_INFO_HAS_PALETTE(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_PALETTE)
|
||||||
|
#define GST_VIDEO_FORMAT_INFO_IS_COMPLEX(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_COMPLEX)
|
||||||
|
|
||||||
#define GST_VIDEO_FORMAT_INFO_BITS(info) ((info)->bits)
|
#define GST_VIDEO_FORMAT_INFO_BITS(info) ((info)->bits)
|
||||||
#define GST_VIDEO_FORMAT_INFO_N_COMPONENTS(info) ((info)->n_components)
|
#define GST_VIDEO_FORMAT_INFO_N_COMPONENTS(info) ((info)->n_components)
|
||||||
|
@ -616,8 +619,6 @@ const GstVideoFormatInfo *
|
||||||
* are interlaced in one frame.
|
* are interlaced in one frame.
|
||||||
* @GST_VIDEO_INTERLACE_MODE_MIXED: video contains both interlaced and
|
* @GST_VIDEO_INTERLACE_MODE_MIXED: video contains both interlaced and
|
||||||
* progressive frames, the buffer flags describe the frame and fields.
|
* progressive frames, the buffer flags describe the frame and fields.
|
||||||
* @GST_VIDEO_INTERLACE_MODE_FIELDS: video is interlaced and fields are stored
|
|
||||||
* separately. Use the id property to get access to the required field.
|
|
||||||
*
|
*
|
||||||
* The possible values of the #GstVideoInterlaceMode describing the interlace
|
* The possible values of the #GstVideoInterlaceMode describing the interlace
|
||||||
* mode of the stream.
|
* mode of the stream.
|
||||||
|
@ -625,8 +626,7 @@ const GstVideoFormatInfo *
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GST_VIDEO_INTERLACE_MODE_PROGRESSIVE = 0,
|
GST_VIDEO_INTERLACE_MODE_PROGRESSIVE = 0,
|
||||||
GST_VIDEO_INTERLACE_MODE_INTERLEAVED,
|
GST_VIDEO_INTERLACE_MODE_INTERLEAVED,
|
||||||
GST_VIDEO_INTERLACE_MODE_MIXED,
|
GST_VIDEO_INTERLACE_MODE_MIXED
|
||||||
GST_VIDEO_INTERLACE_MODE_FIELDS
|
|
||||||
} GstVideoInterlaceMode;
|
} GstVideoInterlaceMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue