GstVideoFormat * fmt)
{
switch (img->fmt) {
- case VPX_IMG_FMT_I420:
+ case GST_VPX_IMG_FMT_I420:
*fmt = GST_VIDEO_FORMAT_I420;
return TRUE;
- case VPX_IMG_FMT_YV12:
+ case GST_VPX_IMG_FMT_YV12:
*fmt = GST_VIDEO_FORMAT_YV12;
return TRUE;
- case VPX_IMG_FMT_I422:
+ case GST_VPX_IMG_FMT_I422:
*fmt = GST_VIDEO_FORMAT_Y42B;
return TRUE;
- case VPX_IMG_FMT_I444:
+ case GST_VPX_IMG_FMT_I444:
if (img->cs == VPX_CS_SRGB)
*fmt = GST_VIDEO_FORMAT_GBR;
else
*fmt = GST_VIDEO_FORMAT_Y444;
return TRUE;
-#ifdef VPX_IMG_FMT_I440
- case VPX_IMG_FMT_I440:
+ case GST_VPX_IMG_FMT_I440:
/* Planar, half height, full width U/V */
GST_FIXME_OBJECT (dec, "Please add a 4:4:0 planar frame format");
GST_ELEMENT_WARNING (dec, STREAM, NOT_IMPLEMENTED,
(NULL), ("Unsupported frame format - 4:4:0 planar"));
return FALSE;
-#endif
- case VPX_IMG_FMT_I42016:
- /* VPX_IMG_FMT_I420 | VPX_IMG_FMT_HIGHBITDEPTH */
+ case GST_VPX_IMG_FMT_I42016:
if (img->bit_depth == 10) {
*fmt = GST_VIDEO_FORMAT_I420_10LE;
return TRUE;
GST_ELEMENT_WARNING (dec, STREAM, NOT_IMPLEMENTED,
(NULL), ("Unsupported frame format - 16-bit 4:2:0 planar"));
return FALSE;
- case VPX_IMG_FMT_I42216:
- /* VPX_IMG_FMT_I422 | VPX_IMG_FMT_HIGHBITDEPTH */
+ case GST_VPX_IMG_FMT_I42216:
if (img->bit_depth == 10) {
*fmt = GST_VIDEO_FORMAT_I422_10LE;
return TRUE;
GST_ELEMENT_WARNING (dec, STREAM, NOT_IMPLEMENTED,
(NULL), ("Unsupported frame format - 16-bit 4:2:2 planar"));
return FALSE;
-#ifdef VPX_IMG_FMT_I44416
- case VPX_IMG_FMT_I44416:
- /* VPX_IMG_FMT_I444 | VPX_IMG_FMT_HIGHBITDEPTH */
+ case GST_VPX_IMG_FMT_I44416:
GST_FIXME_OBJECT (dec, "Please add 16-bit Y444 format");
GST_ELEMENT_WARNING (dec, STREAM, NOT_IMPLEMENTED,
(NULL), ("Unsupported frame format - 16-bit 4:4:4 planar"));
return FALSE;
-#endif
-#ifdef VPX_IMG_FMT_I44016
- case VPX_IMG_FMT_I44016:
- /* VPX_IMG_FMT_I440 | VPX_IMG_FMT_HIGHBITDEPTH */
+ case GST_VPX_IMG_FMT_I44016:
GST_FIXME_OBJECT (dec, "Please add 16-bit 4:4:0 planar frame format");
GST_ELEMENT_WARNING (dec, STREAM, NOT_IMPLEMENTED,
(NULL), ("Unsupported frame format - 16-bit 4:4:0 planar"));
return FALSE;
-#endif
default:
return FALSE;
}
gchar *colorimetry_str;
guint i;
+ /* *INDENT-OFF* */
static const struct
{
const gchar *str;
GST_VIDEO_COLORIMETRY_SMPTE240M, VPX_CS_SMPTE_240}, {
GST_VIDEO_COLORIMETRY_BT2020, VPX_CS_BT_2020}
};
+ /* *INDENT-ON* */
/* We support any range, all mapped CSC are by default reduced range. */
cinfo.range = GST_VIDEO_COLOR_RANGE_16_235;
{
switch (enc->input_state->info.finfo->format) {
case GST_VIDEO_FORMAT_I420:
- image->fmt = VPX_IMG_FMT_I420;
+ image->fmt = GST_VPX_IMG_FMT_I420;
image->bps = 12;
image->x_chroma_shift = image->y_chroma_shift = 1;
break;
case GST_VIDEO_FORMAT_YV12:
- image->fmt = VPX_IMG_FMT_YV12;
+ image->fmt = GST_VPX_IMG_FMT_YV12;
image->bps = 12;
image->x_chroma_shift = image->y_chroma_shift = 1;
break;
case GST_VIDEO_FORMAT_Y42B:
- image->fmt = VPX_IMG_FMT_I422;
+ image->fmt = GST_VPX_IMG_FMT_I422;
image->bps = 16;
image->x_chroma_shift = 1;
image->y_chroma_shift = 0;
break;
case GST_VIDEO_FORMAT_Y444:
- image->fmt = VPX_IMG_FMT_I444;
+ image->fmt = GST_VPX_IMG_FMT_I444;
image->bps = 24;
image->x_chroma_shift = image->y_chroma_shift = 0;
break;
case GST_VIDEO_FORMAT_I420_10LE:
- image->fmt = VPX_IMG_FMT_I42016;
+ image->fmt = GST_VPX_IMG_FMT_I42016;
image->bps = 15;
image->x_chroma_shift = image->y_chroma_shift = 1;
break;
case GST_VIDEO_FORMAT_I422_10LE:
- image->fmt = VPX_IMG_FMT_I42216;
+ image->fmt = GST_VPX_IMG_FMT_I42216;
image->bps = 20;
image->x_chroma_shift = 1;
image->y_chroma_shift = 0;
--- /dev/null
+/*
+ * GStreamer
+ * Copyright (C) 2022 Seungha Yang <seungha@centricular.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.
+ */
+
+#pragma once
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_VPX_IMG_FMT_PLANAR 0x100
+#define GST_VPX_IMG_FMT_UV_FLIP 0x200
+#define GST_VPX_IMG_FMT_HIGHBITDEPTH 0x800
+
+/* vpx_img_fmt with GST_ prefix */
+typedef enum gst_vpx_img_fmt
+{
+ GST_VPX_IMG_FMT_NONE,
+ GST_VPX_IMG_FMT_YV12 = GST_VPX_IMG_FMT_PLANAR | GST_VPX_IMG_FMT_UV_FLIP | 1,
+ GST_VPX_IMG_FMT_I420 = GST_VPX_IMG_FMT_PLANAR | 2,
+ GST_VPX_IMG_FMT_I422 = GST_VPX_IMG_FMT_PLANAR | 5,
+ GST_VPX_IMG_FMT_I444 = GST_VPX_IMG_FMT_PLANAR | 6,
+ GST_VPX_IMG_FMT_I440 = GST_VPX_IMG_FMT_PLANAR | 7,
+ GST_VPX_IMG_FMT_NV12 = GST_VPX_IMG_FMT_PLANAR | 9,
+ GST_VPX_IMG_FMT_I42016 = GST_VPX_IMG_FMT_I420 | GST_VPX_IMG_FMT_HIGHBITDEPTH,
+ GST_VPX_IMG_FMT_I42216 = GST_VPX_IMG_FMT_I422 | GST_VPX_IMG_FMT_HIGHBITDEPTH,
+ GST_VPX_IMG_FMT_I44416 = GST_VPX_IMG_FMT_I444 | GST_VPX_IMG_FMT_HIGHBITDEPTH,
+ GST_VPX_IMG_FMT_I44016 = GST_VPX_IMG_FMT_I440 | GST_VPX_IMG_FMT_HIGHBITDEPTH
+} gst_vpx_img_fmt_t;
+
+G_END_DECLS
#include <gst/gst.h>
#include <gst/video/gstvideodecoder.h>
+#include "gstvpxcompat.h"
/* FIXME: Undef HAVE_CONFIG_H because vpx_codec.h uses it,
* which causes compilation failures */
#include <gst/gst.h>
#include <gst/video/gstvideoencoder.h>
+#include "gstvpxcompat.h"
/* FIXME: Undef HAVE_CONFIG_H because vpx_codec.h uses it,
* which causes compilation failures */