...
 
Commits (59)
include: "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/master/gitlab/ci_template.yml"
[submodule "common"]
path = common
url = https://anongit.freedesktop.org/git/gstreamer/common.git
url = https://gitlab.freedesktop.org/gstreamer/common.git
Subproject commit cd1dee06bf07f094677d0cf3eea4a2e8c2636b24
Subproject commit 59cb678164719ff59dcf6c8b93df4617a1075d11
......@@ -393,6 +393,7 @@ GST_AUDIO_DECODER_STREAM_LOCK
GST_AUDIO_DECODER_STREAM_UNLOCK
gst_audio_decoder_finish_frame
gst_audio_decoder_set_output_format
gst_audio_decoder_set_output_caps
gst_audio_decoder_negotiate
gst_audio_decoder_allocate_output_buffer
gst_audio_decoder_get_allocator
......@@ -3535,6 +3536,13 @@ gst_video_vbi_parser_free
gst_video_vbi_parser_add_line
gst_video_vbi_parser_get_ancillary
gst_video_vbi_parser_copy
GstVideoVBIEncoder
gst_video_vbi_encoder_new
gst_video_vbi_encoder_free
gst_video_vbi_encoder_add_ancillary
gst_video_vbi_encoder_write_line
gst_video_vbi_encoder_copy
<SUBSECTION closedcaption>
GstVideoCaptionType
GstVideoCaptionMeta
......@@ -3550,6 +3558,7 @@ gst_video_caption_meta_get_info
GST_VIDEO_CAPTION_META_INFO
gst_video_caption_meta_api_get_type
gst_video_vbi_parser_get_type
gst_video_vbi_encoder_get_type
gst_video_ancillary_di_d16_get_type
gst_video_ancillary_did_get_type
gst_video_caption_type_get_type
......
......@@ -62,6 +62,8 @@ static void gst_gl_deinterlace_get_property (GObject * object,
static gboolean gst_gl_deinterlace_start (GstBaseTransform * trans);
static gboolean gst_gl_deinterlace_reset (GstBaseTransform * trans);
static GstCaps *gst_gl_deinterlace_transform_internal_caps (GstGLFilter *
filter, GstPadDirection direction, GstCaps * caps, GstCaps * caps_filter);
static gboolean gst_gl_deinterlace_init_fbo (GstGLFilter * filter);
static gboolean gst_gl_deinterlace_filter (GstGLFilter * filter,
GstBuffer * inbuf, GstBuffer * outbuf);
......@@ -264,6 +266,8 @@ gst_gl_deinterlace_class_init (GstGLDeinterlaceClass * klass)
GST_BASE_TRANSFORM_CLASS (klass)->start = gst_gl_deinterlace_start;
GST_BASE_TRANSFORM_CLASS (klass)->stop = gst_gl_deinterlace_reset;
GST_GL_FILTER_CLASS (klass)->transform_internal_caps =
gst_gl_deinterlace_transform_internal_caps;
GST_GL_FILTER_CLASS (klass)->filter = gst_gl_deinterlace_filter;
GST_GL_FILTER_CLASS (klass)->filter_texture =
gst_gl_deinterlace_filter_texture;
......@@ -327,6 +331,26 @@ gst_gl_deinterlace_reset (GstBaseTransform * trans)
return GST_BASE_TRANSFORM_CLASS (parent_class)->stop (trans);
}
static GstCaps *
gst_gl_deinterlace_transform_internal_caps (GstGLFilter * filter,
GstPadDirection direction, GstCaps * caps, GstCaps * caps_filter)
{
gint len;
GstCaps *res;
GstStructure *s;
res = gst_caps_copy (caps);
for (len = gst_caps_get_size (res); len > 0; len--) {
s = gst_caps_get_structure (res, len - 1);
if (direction == GST_PAD_SINK) {
gst_structure_remove_field (s, "interlace-mode");
}
}
return res;
}
static void
gst_gl_deinterlace_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
......
......@@ -64,8 +64,7 @@ static GstStaticPadTemplate gst_gl_download_element_src_pad_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (
EXTRA_CAPS_TEMPLATE
GST_STATIC_CAPS (EXTRA_CAPS_TEMPLATE
"video/x-raw; video/x-raw(memory:GLMemory)"));
static GstStaticPadTemplate gst_gl_download_element_sink_pad_template =
......
......@@ -510,11 +510,6 @@ gst_gl_test_src_start (GstBaseSrc * basesrc)
{
GstGLTestSrc *src = GST_GL_TEST_SRC (basesrc);
if (!gst_gl_ensure_element_data (src, &src->display, &src->other_context))
return FALSE;
gst_gl_display_filter_gl_api (src->display, SUPPORTED_GL_APIS);
src->running_time = 0;
src->n_frames = 0;
src->negotiated = FALSE;
......@@ -735,18 +730,6 @@ gst_gl_test_src_change_state (GstElement * element, GstStateChange transition)
gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (!gst_gl_ensure_element_data (element, &src->display,
&src->other_context))
return GST_STATE_CHANGE_FAILURE;
gst_gl_display_filter_gl_api (src->display, SUPPORTED_GL_APIS);
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
if (ret == GST_STATE_CHANGE_FAILURE)
return ret;
......
......@@ -844,6 +844,7 @@ gst_ogg_mux_decorate_buffer (GstOggMux * ogg_mux, GstOggPadData * pad,
if (G_UNLIKELY (duration < 0)) {
/* well, if some day we really could handle sparse input ... */
if (pad->map.is_sparse) {
granule = 0;
limit = 1;
diff = 2;
goto resync;
......
......@@ -877,12 +877,12 @@ gst_opus_enc_get_sink_template_caps (void)
* treated as a set of individual mono channels */
s = gst_structure_copy (s2);
gst_structure_set (s, "channels", G_TYPE_INT, i, "channel-mask",
GST_TYPE_BITMASK, G_GUINT64_CONSTANT(0), NULL);
GST_TYPE_BITMASK, G_GUINT64_CONSTANT (0), NULL);
gst_caps_append_structure (caps, s);
s = gst_structure_copy (s1);
gst_structure_set (s, "channels", G_TYPE_INT, i, "channel-mask",
GST_TYPE_BITMASK, G_GUINT64_CONSTANT(0), NULL);
GST_TYPE_BITMASK, G_GUINT64_CONSTANT (0), NULL);
gst_caps_append_structure (caps, s);
}
......
......@@ -1397,20 +1397,20 @@ gst_audio_converter_new (GstAudioConverterFlags flags, GstAudioInfo * in_info,
convert->convert = converter_endian;
convert->in_place = TRUE;
switch (GST_AUDIO_INFO_BPS (in_info)) {
case 2:
switch (GST_AUDIO_INFO_WIDTH (in_info)) {
case 16:
GST_DEBUG ("initializing 16-bit endian conversion");
convert->swap_endian = converter_swap_endian_16;
break;
case 3:
case 24:
GST_DEBUG ("initializing 24-bit endian conversion");
convert->swap_endian = converter_swap_endian_24;
break;
case 4:
case 32:
GST_DEBUG ("initializing 32-bit endian conversion");
convert->swap_endian = converter_swap_endian_32;
break;
case 8:
case 64:
GST_DEBUG ("initializing 64-bit endian conversion");
convert->swap_endian = converter_swap_endian_64;
break;
......
......@@ -112,14 +112,14 @@
#define MAKE_ORC_PACK_UNPACK(fmt,fmt_t) \
static void unpack_ ##fmt (const GstAudioFormatInfo *info, \
GstAudioPackFlags flags, gpointer dest, \
const gpointer data, gint length) { \
gconstpointer data, gint length) { \
if (flags & GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE) \
audio_orc_unpack_ ##fmt_t (dest, data, length); \
else \
audio_orc_unpack_ ##fmt (dest, data, length); \
} \
static void pack_ ##fmt (const GstAudioFormatInfo *info, \
GstAudioPackFlags flags, const gpointer src, \
GstAudioPackFlags flags, gconstpointer src, \
gpointer data, gint length) { \
audio_orc_pack_ ##fmt (data, src, length); \
}
......@@ -161,21 +161,21 @@ MAKE_ORC_PACK_UNPACK (s8, s8_trunc)
#define MAKE_PACK_UNPACK(name, stride, sign, scale, READ_FUNC, WRITE_FUNC) \
static void unpack_ ##name (const GstAudioFormatInfo *info, \
GstAudioPackFlags flags, gpointer dest, \
const gpointer data, gint length) \
gconstpointer data, gint length) \
{ \
guint32 *d = dest; \
guint8 *s = data; \
const guint8 *s = data; \
for (;length; length--) { \
*d++ = (((gint32) READ_FUNC (s)) << scale) ^ (sign); \
s += stride; \
} \
} \
static void pack_ ##name (const GstAudioFormatInfo *info, \
GstAudioPackFlags flags, const gpointer src, \
GstAudioPackFlags flags, gconstpointer src, \
gpointer data, gint length) \
{ \
gint32 tmp; \
guint32 *s = src; \
const guint32 *s = src; \
guint8 *d = data; \
for (;length; length--) { \
tmp = (*s++ ^ (sign)) >> scale; \
......
......@@ -200,7 +200,7 @@ typedef enum
*/
typedef void (*GstAudioFormatUnpack) (const GstAudioFormatInfo *info,
GstAudioPackFlags flags, gpointer dest,
const gpointer data, gint length);
gconstpointer data, gint length);
/**
* GstAudioFormatPack:
* @info: a #GstAudioFormatInfo
......@@ -215,7 +215,7 @@ typedef void (*GstAudioFormatUnpack) (const GstAudioFormatInfo *info,
* and will be packed into @data.
*/
typedef void (*GstAudioFormatPack) (const GstAudioFormatInfo *info,
GstAudioPackFlags flags, const gpointer src,
GstAudioPackFlags flags, gconstpointer src,
gpointer data, gint length);
/**
......
......@@ -158,6 +158,7 @@ typedef struct _GstAudioDecoderContext
/* (output) audio format */
GstAudioInfo info;
GstCaps *caps;
gboolean output_format_changed;
/* parsing state */
......@@ -513,6 +514,7 @@ gst_audio_decoder_reset (GstAudioDecoder * dec, gboolean full)
GST_OBJECT_LOCK (dec);
gst_caps_replace (&dec->priv->ctx.input_caps, NULL);
gst_caps_replace (&dec->priv->ctx.caps, NULL);
gst_caps_replace (&dec->priv->ctx.allocation_caps, NULL);
memset (&dec->priv->ctx, 0, sizeof (dec->priv->ctx));
......@@ -625,10 +627,11 @@ gst_audio_decoder_negotiate_default (GstAudioDecoder * dec)
g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), FALSE);
g_return_val_if_fail (GST_AUDIO_INFO_IS_VALID (&dec->priv->ctx.info), FALSE);
g_return_val_if_fail (GST_IS_CAPS (dec->priv->ctx.caps), FALSE);
klass = GST_AUDIO_DECODER_GET_CLASS (dec);
caps = gst_audio_info_to_caps (&dec->priv->ctx.info);
caps = dec->priv->ctx.caps;
if (dec->priv->ctx.allocation_caps == NULL)
dec->priv->ctx.allocation_caps = gst_caps_ref (caps);
......@@ -697,7 +700,6 @@ done:
if (query)
gst_query_unref (query);
gst_caps_unref (caps);
return res;
......@@ -767,21 +769,58 @@ gst_audio_decoder_set_output_format (GstAudioDecoder * dec,
const GstAudioInfo * info)
{
gboolean res = TRUE;
guint old_rate;
GstCaps *caps = NULL;
GstCaps *templ_caps;
g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), FALSE);
g_return_val_if_fail (GST_AUDIO_INFO_IS_VALID (info), FALSE);
GST_DEBUG_OBJECT (dec, "Setting output format");
GST_AUDIO_DECODER_STREAM_LOCK (dec);
/* If the audio info can't be converted to caps,
* it was invalid */
caps = gst_audio_info_to_caps (info);
if (!caps)
if (!caps) {
GST_WARNING_OBJECT (dec, "invalid output format");
return FALSE;
}
res = gst_audio_decoder_set_output_caps (dec, caps);
gst_caps_unref (caps);
return res;
}
/**
* gst_audio_decoder_set_output_caps:
* @dec: a #GstAudioDecoder
* @caps: (transfer none): (fixed) #GstCaps
*
* Configure output caps on the srcpad of @dec. Similar to
* gst_audio_decoder_set_output_format(), but allows subclasses to specify
* output caps that can't be expressed via #GstAudioInfo e.g. caps that have
* caps features.
*
* Returns: %TRUE on success.
*
* Since: 1.16
**/
gboolean
gst_audio_decoder_set_output_caps (GstAudioDecoder * dec, GstCaps * caps)
{
gboolean res = TRUE;
guint old_rate;
GstCaps *templ_caps;
GstAudioInfo info;
g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), FALSE);
GST_DEBUG_OBJECT (dec, "Setting srcpad caps %" GST_PTR_FORMAT, caps);
GST_AUDIO_DECODER_STREAM_LOCK (dec);
if (!gst_caps_is_fixed (caps))
goto refuse_caps;
/* check if caps can be parsed */
if (!gst_audio_info_from_caps (&info, caps))
goto refuse_caps;
/* Only allow caps that are a subset of the template caps */
......@@ -804,16 +843,15 @@ gst_audio_decoder_set_output_format (GstAudioDecoder * dec,
/* copy the GstAudioInfo */
GST_OBJECT_LOCK (dec);
dec->priv->ctx.info = *info;
dec->priv->ctx.info = info;
GST_OBJECT_UNLOCK (dec);
gst_caps_replace (&dec->priv->ctx.caps, caps);
dec->priv->ctx.output_format_changed = TRUE;
done:
GST_AUDIO_DECODER_STREAM_UNLOCK (dec);
if (caps)
gst_caps_unref (caps);
return res;
/* ERRORS */
......
......@@ -322,6 +322,9 @@ gboolean gst_audio_decoder_set_output_format (GstAudioDecoder * dec
const GstAudioInfo * info);
GST_AUDIO_API
gboolean gst_audio_decoder_set_output_caps (GstAudioDecoder * dec,
GstCaps * caps);
GST_AUDIO_API
GstCaps * gst_audio_decoder_proxy_getcaps (GstAudioDecoder * decoder,
GstCaps * caps,
GstCaps * filter);
......
......@@ -192,7 +192,8 @@ gst_gl_window_dispmanx_egl_set_window_handle (GstGLWindow * window,
GST_DEBUG_OBJECT (window, "set window handle with size %dx%d",
foreign_window->width, foreign_window->height);
if (window_egl->native.element && window_egl->native.element != window_egl->foreign.element) {
if (window_egl->native.element
&& window_egl->native.element != window_egl->foreign.element) {
dispman_update = vc_dispmanx_update_start (0);
vc_dispmanx_element_remove (dispman_update, window_egl->native.element);
vc_dispmanx_update_submit_sync (dispman_update);
......
......@@ -353,7 +353,8 @@ gst_egl_image_from_texture (GstGLContext * context, GstGLMemory * gl_mem,
* target.
*/
static int
_drm_rgba_fourcc_from_info (GstVideoInfo * info, int plane)
_drm_rgba_fourcc_from_info (GstVideoInfo * info, int plane,
GstGLFormat * out_format)
{
GstVideoFormat format = GST_VIDEO_INFO_FORMAT (info);
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
......@@ -372,10 +373,12 @@ _drm_rgba_fourcc_from_info (GstVideoInfo * info, int plane)
switch (format) {
case GST_VIDEO_FORMAT_RGB16:
case GST_VIDEO_FORMAT_BGR16:
*out_format = GST_GL_RGB565;
return DRM_FORMAT_RGB565;
case GST_VIDEO_FORMAT_RGB:
case GST_VIDEO_FORMAT_BGR:
*out_format = GST_GL_RGB;
return rgb_fourcc;
case GST_VIDEO_FORMAT_RGBA:
......@@ -387,19 +390,23 @@ _drm_rgba_fourcc_from_info (GstVideoInfo * info, int plane)
case GST_VIDEO_FORMAT_ABGR:
case GST_VIDEO_FORMAT_xBGR:
case GST_VIDEO_FORMAT_AYUV:
*out_format = GST_GL_RGBA;
return rgba_fourcc;
case GST_VIDEO_FORMAT_GRAY8:
*out_format = GST_GL_RED;
return DRM_FORMAT_R8;
case GST_VIDEO_FORMAT_YUY2:
case GST_VIDEO_FORMAT_UYVY:
case GST_VIDEO_FORMAT_GRAY16_LE:
case GST_VIDEO_FORMAT_GRAY16_BE:
*out_format = GST_GL_RG;
return rg_fourcc;
case GST_VIDEO_FORMAT_NV12:
case GST_VIDEO_FORMAT_NV21:
*out_format = plane == 0 ? GST_GL_RED : GST_GL_RG;
return plane == 0 ? DRM_FORMAT_R8 : rg_fourcc;
case GST_VIDEO_FORMAT_I420:
......@@ -407,6 +414,7 @@ _drm_rgba_fourcc_from_info (GstVideoInfo * info, int plane)
case GST_VIDEO_FORMAT_Y41B:
case GST_VIDEO_FORMAT_Y42B:
case GST_VIDEO_FORMAT_Y444:
*out_format = GST_GL_RED;
return DRM_FORMAT_R8;
default:
......@@ -437,16 +445,14 @@ GstEGLImage *
gst_egl_image_from_dmabuf (GstGLContext * context,
gint dmabuf, GstVideoInfo * in_info, gint plane, gsize offset)
{
GstGLFormat format;
GstGLFormat format = 0;
guintptr attribs[13];
EGLImageKHR img;
gint atti = 0;
gint fourcc;
gint i;
fourcc = _drm_rgba_fourcc_from_info (in_info, plane);
format = gst_gl_format_from_video_info (context, in_info, plane);
fourcc = _drm_rgba_fourcc_from_info (in_info, plane, &format);
GST_DEBUG ("fourcc %.4s (%d) plane %d (%dx%d)",
(char *) &fourcc, fourcc, plane,
GST_VIDEO_INFO_COMP_WIDTH (in_info, plane),
......
......@@ -33,11 +33,16 @@ G_GNUC_INTERNAL GType gst_gl_context_egl_get_type (void);
#define GST_TYPE_GL_CONTEXT_EGL (gst_gl_context_egl_get_type())
#define GST_GL_CONTEXT_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_CONTEXT_EGL, GstGLContextEGL))
#define GST_GL_CONTEXT_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_CONTEXT_EGL, GstGLContextEGLClass))
#define GST_GL_CONTEXT_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_GL_CONTEXT_EGL, GstGLContextEGLClass))
#define GST_IS_GL_CONTEXT_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_CONTEXT_EGL))
#define GST_IS_GL_CONTEXT_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_CONTEXT_EGL))
#define GST_GL_CONTEXT_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_CONTEXT_EGL, GstGLContextEGLClass))
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstGLContextEGL, gst_object_unref)
#endif
/**
* GstGLContextEGL:
*
......
......@@ -26,7 +26,6 @@
GST_DEBUG_CATEGORY_EXTERN (gst_gl_gbm_debug);
#define GST_CAT_DEFAULT gst_gl_gbm_debug
const gchar *
gst_gl_gbm_get_name_for_drm_connector (drmModeConnector * connector)
{
......@@ -54,7 +53,7 @@ gst_gl_gbm_get_name_for_drm_connector (drmModeConnector * connector)
case DRM_MODE_CONNECTOR_9PinDIN:
return "9-Pin DIN";
case DRM_MODE_CONNECTOR_DisplayPort:
return "DisplayPort";
return "DP";
case DRM_MODE_CONNECTOR_HDMIA:
return "HDMI-A";
case DRM_MODE_CONNECTOR_HDMIB:
......@@ -67,6 +66,8 @@ gst_gl_gbm_get_name_for_drm_connector (drmModeConnector * connector)
return "Virtual";
case DRM_MODE_CONNECTOR_DSI:
return "DSI";
case DRM_MODE_CONNECTOR_DPI:
return "DPI";
default:
return "<unknown>";
}
......
......@@ -49,7 +49,8 @@ static guint32 gst_gl_gbm_find_crtc_id_for_encoder (GstGLDisplayGBM *
static guint32 gst_gl_gbm_find_crtc_id_for_connector (GstGLDisplayGBM *
display_gbm);
static gboolean gst_gl_display_gbm_setup_drm (GstGLDisplayGBM * display_gbm);
static gboolean gst_gl_display_gbm_setup_drm (GstGLDisplayGBM * display_gbm,
const gchar * drm_connector_name);
static void gst_gl_display_gbm_shutdown_drm (GstGLDisplayGBM * display_gbm);
static gboolean gst_gl_display_gbm_setup_gbm (GstGLDisplayGBM * display_gbm);
......@@ -82,6 +83,9 @@ gst_gl_display_gbm_finalize (GObject * object)
gst_gl_display_gbm_shutdown_gbm (display_gbm);
gst_gl_display_gbm_shutdown_drm (display_gbm);
if (display_gbm->drm_fd >= 0)
close (display_gbm->drm_fd);
G_OBJECT_CLASS (gst_gl_display_gbm_parent_class)->finalize (object);
}
......@@ -137,7 +141,8 @@ gst_gl_gbm_find_crtc_id_for_connector (GstGLDisplayGBM * display_gbm)
static gboolean
gst_gl_display_gbm_setup_drm (GstGLDisplayGBM * display_gbm)
gst_gl_display_gbm_setup_drm (GstGLDisplayGBM * display_gbm, const gchar *
drm_connector_name)
{
int i;
......@@ -157,32 +162,65 @@ gst_gl_display_gbm_setup_drm (GstGLDisplayGBM * display_gbm)
* finally sent to, and typically connects to some form of display, like an
* HDMI TV, an LVDS panel etc. */
{
drmModeConnector *connector = NULL;
drmModeConnector *connected_connector = NULL;
GST_DEBUG ("Checking %d DRM connector(s)",
display_gbm->drm_mode_resources->count_connectors);
for (i = 0; i < display_gbm->drm_mode_resources->count_connectors; ++i) {
connector = drmModeGetConnector (display_gbm->drm_fd,
drmModeConnector *candidate_connector =
drmModeGetConnector (display_gbm->drm_fd,
display_gbm->drm_mode_resources->connectors[i]);
gchar *candidate_name;
candidate_name = g_strdup_printf ("%s-%i",
gst_gl_gbm_get_name_for_drm_connector (candidate_connector),
candidate_connector->connector_type_id);
GST_DEBUG ("Found DRM connector #%d \"%s\" with ID %" G_GUINT32_FORMAT, i,
gst_gl_gbm_get_name_for_drm_connector (connector),
connector->connector_id);
candidate_name, candidate_connector->connector_id);
/* If we already picked a connector, and connected_connector is therefore
* non-NULL, then are just printing information about the other connectors
* for logging purposes by now, so don't actually do anything with this
* connector. Just loop instead. */
if (connected_connector != NULL) {
drmModeFreeConnector (candidate_connector);
g_free (candidate_name);
continue;
}
if (connector->connection == DRM_MODE_CONNECTED) {
GST_DEBUG ("DRM connector #%d is connected", i);
break;
if (drm_connector_name != NULL) {
if (g_ascii_strcasecmp (drm_connector_name, candidate_name) != 0) {
drmModeFreeConnector (candidate_connector);
g_free (candidate_name);
continue;
}
}
drmModeFreeConnector (connector);
connector = NULL;
if (candidate_connector->connection == DRM_MODE_CONNECTED) {
if (drm_connector_name != NULL)
GST_DEBUG ("Picking DRM connector #%d because it is connected and "
"has a matching name \"%s\"", i, candidate_name);
else
GST_DEBUG ("Picking DRM connector #%d because it is connected", i);
connected_connector = candidate_connector;
g_free (candidate_name);
break;
} else {
if (drm_connector_name != NULL)
GST_WARNING ("DRM connector #%d has a matching name \"%s\" but is "
"not connected; not picking it", i, candidate_name);
drmModeFreeConnector (candidate_connector);
g_free (candidate_name);
}
}
if (connector == NULL) {
if (connected_connector == NULL) {
GST_ERROR ("No connected DRM connector found");
goto cleanup;
}
display_gbm->drm_mode_connector = connector;
display_gbm->drm_mode_connector = connected_connector;
}
/* Check out what modes are supported by the chosen connector,
......@@ -191,6 +229,7 @@ gst_gl_display_gbm_setup_drm (GstGLDisplayGBM * display_gbm)
{
int selected_mode_index = -1;
int selected_mode_area = -1;
gboolean preferred_mode_found = FALSE;
GST_DEBUG ("Checking %d DRM mode(s) from selected connector",
display_gbm->drm_mode_connector->count_modes);
......@@ -212,14 +251,15 @@ gst_gl_display_gbm_setup_drm (GstGLDisplayGBM * display_gbm)
current_mode->vscan, current_mode->vrefresh,
(current_mode->type & DRM_MODE_TYPE_PREFERRED) ? TRUE : FALSE);
if ((current_mode->type & DRM_MODE_TYPE_PREFERRED) ||
(current_mode_area > selected_mode_area)) {
if (!preferred_mode_found
&& ((current_mode->type & DRM_MODE_TYPE_PREFERRED)
|| (current_mode_area > selected_mode_area))) {
display_gbm->drm_mode_info = current_mode;
selected_mode_area = current_mode_area;
selected_mode_index = i;
if (current_mode->type & DRM_MODE_TYPE_PREFERRED)
break;
preferred_mode_found = TRUE;
}
}
......@@ -228,7 +268,8 @@ gst_gl_display_gbm_setup_drm (GstGLDisplayGBM * display_gbm)
goto cleanup;
}
GST_DEBUG ("Selected DRM mode #%d", selected_mode_index);
GST_DEBUG ("Selected DRM mode #%d (is preferred: %d)", selected_mode_index,
preferred_mode_found);
}
/* Find an encoder that is attached to the chosen connector. Also find the
......@@ -242,34 +283,36 @@ gst_gl_display_gbm_setup_drm (GstGLDisplayGBM * display_gbm)
* used by the DRM to refer to the CRTC universally. (We need the CRTC
* information for page flipping and DRM scanout framebuffer configuration.) */
{
drmModeEncoder *encoder = NULL;
drmModeEncoder *selected_encoder = NULL;
GST_DEBUG ("Checking %d DRM encoder(s)",
display_gbm->drm_mode_resources->count_encoders);
for (i = 0; i < display_gbm->drm_mode_resources->count_encoders; ++i) {
encoder = drmModeGetEncoder (display_gbm->drm_fd,
drmModeEncoder *candidate_encoder =
drmModeGetEncoder (display_gbm->drm_fd,
display_gbm->drm_mode_resources->encoders[i]);
GST_DEBUG ("Found DRM encoder #%d \"%s\"", i,
gst_gl_gbm_get_name_for_drm_encoder (encoder));
gst_gl_gbm_get_name_for_drm_encoder (candidate_encoder));
if (encoder->encoder_id == display_gbm->drm_mode_connector->encoder_id) {
if ((selected_encoder == NULL) &&
(candidate_encoder->encoder_id ==
display_gbm->drm_mode_connector->encoder_id)) {
selected_encoder = candidate_encoder;
GST_DEBUG ("DRM encoder #%d corresponds to selected DRM connector "
"-> selected", i);
break;
}
drmModeFreeEncoder (encoder);
encoder = NULL;
} else
drmModeFreeEncoder (candidate_encoder);
}
if (encoder == NULL) {
if (selected_encoder == NULL) {
GST_DEBUG ("No encoder found; searching for CRTC ID in the connector");
display_gbm->crtc_id =
gst_gl_gbm_find_crtc_id_for_connector (display_gbm);
} else {
GST_DEBUG ("Using CRTC ID from selected encoder");
display_gbm->crtc_id = encoder->crtc_id;
drmModeFreeEncoder (encoder);
display_gbm->crtc_id = selected_encoder->crtc_id;
drmModeFreeEncoder (selected_encoder);
}
if (display_gbm->crtc_id == INVALID_CRTC) {
......@@ -372,10 +415,12 @@ gst_gl_display_gbm_new (void)
int drm_fd = -1;
GstGLDisplayGBM *display;
const gchar *drm_node_name;
const gchar *drm_connector_name;
_init_debug ();
drm_node_name = g_getenv ("GST_GL_GBM_DRM_DEVICE");
drm_connector_name = g_getenv ("GST_GL_GBM_DRM_CONNECTOR");
if (drm_node_name != NULL) {
GST_DEBUG ("attempting to open device %s (specified by the "
......@@ -399,7 +444,12 @@ gst_gl_display_gbm_new (void)
display = g_object_new (GST_TYPE_GL_DISPLAY_GBM, NULL);
display->drm_fd = drm_fd;
if (!gst_gl_display_gbm_setup_drm (display)) {
if (drm_connector_name != NULL) {
GST_DEBUG ("GST_GL_GBM_DRM_CONNECTOR variable set to value \"%s\"; "
"will use this name to match connector(s) against", drm_connector_name);
}
if (!gst_gl_display_gbm_setup_drm (display, drm_connector_name)) {
GST_WARNING ("Failed to initialize DRM");
}
......
......@@ -50,8 +50,6 @@ static void gst_gl_window_gbm_egl_close (GstGLWindow * window);
static void gst_gl_window_gbm_egl_draw (GstGLWindow * window);
static gboolean gst_gl_window_gbm_init_surface (GstGLWindowGBMEGL * window_egl);
static void gst_gl_window_gbm_egl_cleanup (GstGLWindowGBMEGL * window_egl);
static void
......@@ -112,7 +110,31 @@ gst_gl_window_gbm_egl_close (GstGLWindow * window)
{
GstGLWindowGBMEGL *window_egl = GST_GL_WINDOW_GBM_EGL (window);
gst_gl_window_gbm_egl_cleanup (window_egl);
if (window_egl->saved_crtc) {
GstGLDisplayGBM *display = (GstGLDisplayGBM *) window->display;
drmModeCrtc *crtc = window_egl->saved_crtc;
gint err;
err = drmModeSetCrtc (display->drm_fd, crtc->crtc_id, crtc->buffer_id,
crtc->x, crtc->y, &(display->drm_mode_connector->connector_id), 1,
&crtc->mode);
if (err)
GST_ERROR_OBJECT (window, "Failed to restore previous CRTC mode: %s",
g_strerror (errno));
drmModeFreeCrtc (crtc);
window_egl->saved_crtc = NULL;
}
if (window_egl->gbm_surf != NULL) {
if (window_egl->current_bo != NULL) {
gbm_surface_release_buffer (window_egl->gbm_surf, window_egl->current_bo);
window_egl->current_bo = NULL;
}
gbm_surface_destroy (window_egl->gbm_surf);
window_egl->gbm_surf = NULL;
}
GST_GL_WINDOW_CLASS (gst_gl_window_gbm_egl_parent_class)->close (window);
}
......@@ -155,6 +177,7 @@ draw_cb (gpointer data)
/* No display connected */
if (!display->drm_mode_info) {
GST_ERROR ("No display connected");
gst_object_unref (context);
return;
};
......@@ -198,6 +221,11 @@ draw_cb (gpointer data)
gbm_surface_lock_front_buffer (window_egl->gbm_surf);
framebuf = gst_gl_gbm_drm_fb_get_from_bo (window_egl->current_bo);
/* Save the CRTC state */
if (!window_egl->saved_crtc)
window_egl->saved_crtc =
drmModeGetCrtc (display->drm_fd, display->crtc_id);
/* Configure CRTC to show this first BO. */
ret = drmModeSetCrtc (display->drm_fd, display->crtc_id, framebuf->fb_id,
0, 0, &(display->drm_mode_connector->connector_id), 1,
......@@ -205,6 +233,7 @@ draw_cb (gpointer data)
if (ret != 0) {
GST_ERROR ("Could not set DRM CRTC: %s (%d)", g_strerror (errno), errno);
gst_object_unref (context);
/* XXX: it is not possible to communicate the error to the pipeline */
return;
}
......@@ -305,6 +334,7 @@ gst_gl_window_gbm_init_surface (GstGLWindowGBMEGL * window_egl)
GstGLContextEGL *context_egl = GST_GL_CONTEXT_EGL (context);
EGLint gbm_format;
int hdisplay, vdisplay;
gboolean ret = TRUE;
if (drm_mode_info) {
vdisplay = drm_mode_info->vdisplay;
......@@ -320,7 +350,8 @@ gst_gl_window_gbm_init_surface (GstGLWindowGBMEGL * window_egl)
EGL_NATIVE_VISUAL_ID, &gbm_format)) {
GST_ERROR ("eglGetConfigAttrib failed: %s",
gst_egl_get_error_string (eglGetError ()));
return FALSE;
ret = FALSE;
goto cleanup;
}
/* Create a GBM surface that shall contain the BOs we are
......@@ -333,22 +364,10 @@ gst_gl_window_gbm_init_surface (GstGLWindowGBMEGL * window_egl)
GST_DEBUG ("Successfully created GBM surface");
return TRUE;
}
static void
gst_gl_window_gbm_egl_cleanup (GstGLWindowGBMEGL * window_egl)
{
if (window_egl->gbm_surf != NULL) {
if (window_egl->current_bo != NULL) {
gbm_surface_release_buffer (window_egl->gbm_surf, window_egl->current_bo);
window_egl->current_bo = NULL;
}
cleanup:
gbm_surface_destroy (window_egl->gbm_surf);
window_egl->gbm_surf = NULL;
}
gst_object_unref (context);
return ret;
}
......
......@@ -24,6 +24,7 @@
#include <gbm.h>
#include <gst/gl/gl.h>
#include <gst/gl/egl/gstegl.h>
#include <gst/gl/gbm/gstgldisplay_gbm.h>
G_BEGIN_DECLS
......@@ -37,8 +38,6 @@ G_BEGIN_DECLS
typedef struct _GstGLWindowGBMEGL GstGLWindowGBMEGL;
typedef struct _GstGLWindowGBMEGLClass GstGLWindowGBMEGLClass;
typedef struct _GstGLDisplayGBM GstGLDisplayGBM;
struct _GstGLWindowGBMEGL {
/*< private >*/
GstGLWindow parent;
......@@ -47,6 +46,8 @@ struct _GstGLWindowGBMEGL {
struct gbm_bo *current_bo, *prev_bo;
int waiting_for_flip;
drmModeCrtc *saved_crtc;
GstGLDisplayGBM *display;
gpointer _reserved[GST_PADDING];
......
......@@ -25,8 +25,6 @@
G_BEGIN_DECLS
typedef struct _GstGLAsyncDebug GstGLAsyncDebug;
typedef gchar * (*GstGLAsyncDebugLogGetMessage) (gpointer user_data);
/**
......@@ -94,7 +92,7 @@ void gst_gl_async_debug_thaw (GstGLAsyncDebug
*
* Stores a debug message in @ad for later output
*/
#if G_HAVE_ISO_VARARGS
#ifdef G_HAVE_ISO_VARARGS
#define GST_GL_ASYNC_CAT_LEVEL_LOG(ad,cat,level,object,format,...) \
gst_gl_async_debug_store_log_msg (ad, cat, level, __FILE__, GST_FUNCTION, \
__LINE__, object, format, __VA_ARGS__)
......@@ -149,7 +147,7 @@ void gst_gl_async_debug_store_log_msg_valist (GstGLAsyncDebug * ad,
#define gst_gl_async_debug_output_log_msg(ad) G_STMT_START{ }G_STMT_END
#define gst_gl_async_debug_store_log_msg_valist(ad,cat,level,file,function,line,object,format,args) G_STMT_START{ }G_STMT_END
#if G_HAVE_ISO_VARARGS
#ifdef G_HAVE_ISO_VARARGS
#define gst_gl_insert_debug_marker(...) G_STMT_START{ }G_STMT_END
#define gst_gl_async_debug_store_log_msg(...) G_STMT_START{ }G_STMT_END
......
......@@ -197,13 +197,13 @@ gst_gl_format_from_video_info (GstGLContext * context, GstVideoInfo * vinfo,
switch (n_plane_components) {
case 4:
return GST_GL_RGBA;
return GST_GL_RGBA8;
case 3:
return GST_GL_RGB;
return GST_GL_RGB8;
case 2:
return texture_rg ? GST_GL_RG : GST_GL_LUMINANCE_ALPHA;
return texture_rg ? GST_GL_RG8 : GST_GL_LUMINANCE_ALPHA;
case 1:
return texture_rg ? GST_GL_RED : GST_GL_LUMINANCE;
return texture_rg ? GST_GL_R8 : GST_GL_LUMINANCE;
default:
break;
}
......
......@@ -93,11 +93,11 @@ G_BEGIN_DECLS
ret (GSTGLAPI *name) args;
#define GST_GL_EXT_END()
typedef struct _GstGLFuncs
struct _GstGLFuncs
{
#include <gst/gl/glprototypes/all_functions.h>
gpointer padding[GST_PADDING_LARGE*6];
} GstGLFuncs;
};
#undef GST_GL_EXT_BEGIN
#undef GST_GL_EXT_FUNCTION
......
......@@ -96,7 +96,7 @@ guint64 gst_gl_query_result (GstGLQuery * query);
gst_gl_async_debug_thaw (&(query)->debug); \
} G_STMT_END
#if G_HAVE_ISO_VARARGS
#ifdef G_HAVE_ISO_VARARGS
#define gst_gl_query_start_log(query,cat,level,object,format,...) \
G_STMT_START { \
......
......@@ -831,7 +831,7 @@ gst_gl_context_clear_shader (GstGLContext * context)
g_return_if_fail (shader->priv->program_handle != 0); \
location = _get_uniform_location (shader, name);
#if G_HAVE_ISO_VARARGS
#ifdef G_HAVE_ISO_VARARGS
#define set_uniform_v(gl_suffix, c_type, debug_stride, debug_str, ...) \
void \
......
......@@ -110,6 +110,9 @@ typedef enum
*
* Since: 1.8
*/
/* FIXME: For GST_GLSL_PROFILE_ANY ~0 -> 0xffffffff see
* https://bugzilla.gnome.org/show_bug.cgi?id=732633
*/
typedef enum
{
/* XXX: maybe make GstGLAPI instead */
......@@ -119,7 +122,7 @@ typedef enum
GST_GLSL_PROFILE_CORE = (1 << 1),
GST_GLSL_PROFILE_COMPATIBILITY = (1 << 2),
GST_GLSL_PROFILE_ANY = -1,
GST_GLSL_PROFILE_ANY = (gint) (0xffffffff),
} GstGLSLProfile;
GST_GL_API
......
......@@ -488,6 +488,7 @@ struct DmabufUpload
GstGLUpload *upload;
GstEGLImage *eglimage[GST_VIDEO_MAX_PLANES];
GstGLFormat formats[GST_VIDEO_MAX_PLANES];
GstBuffer *outbuf;
GstGLVideoAllocationParams *params;
guint n_mem;
......@@ -719,6 +720,7 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
return FALSE;
_set_cached_eglimage (mems[i], dmabuf->eglimage[i], cache_id);
dmabuf->formats[i] = dmabuf->eglimage[i]->format;
}
return TRUE;
......@@ -743,8 +745,8 @@ _dma_buf_upload_perform_gl_thread (GstGLContext * context,
/* FIXME: buffer pool */
dmabuf->outbuf = gst_buffer_new ();
gst_gl_memory_setup_buffer (allocator, dmabuf->outbuf, dmabuf->params, NULL,
(gpointer *) dmabuf->eglimage, dmabuf->n_mem);
gst_gl_memory_setup_buffer (allocator, dmabuf->outbuf, dmabuf->params,
dmabuf->formats, (gpointer *) dmabuf->eglimage, dmabuf->n_mem);
gst_object_unref (allocator);
}
......
......@@ -281,11 +281,8 @@ gl_include_header = '''
# convoluted way of getting at the subproject taking into account the wrap-mode
# so we don't download a subproject unless allowed
# FIXME: dependency() needs a valid name to attempt to find otherwise meson
# short-circuits and will always fail and never look into the fallback
# subproject. https://github.com/mesonbuild/meson/issues/3754
gl_header_dep = dependency('gl-headers-not-findable', method : 'pkg-config',
fallback : ['gl-headers', 'gl_headers_dummy_dep'], required : false)
gl_header_dep = dependency('', fallback : ['gl-headers', 'gl_headers_dummy_dep'],
required : false)
if gl_header_dep.type_name() == 'internal'
# this will only contain the includes of headers that are not found
compat_includes = subproject('gl-headers').get_variable('compatibility_includes')
......@@ -324,7 +321,12 @@ if need_api_opengl != 'no' or need_platform_glx != 'no'
endif
endif
glx_dep = gl_dep
if host_system == 'darwin'
glx_dep = cc.find_library('GL', required : false)
else
glx_dep = gl_dep
endif
if need_api_opengl == 'no'
gl_dep = unneeded_dep
endif
......@@ -575,7 +577,7 @@ if need_win_x11 != 'no'
gl_winsys_deps += [x11_dep, xcb_dep]
enabled_gl_winsys += 'x11'
if need_platform_glx != 'no' and glx_dep.found()
if need_platform_glx != 'no' and glx_dep.found() and cc.has_function ('glXMakeCurrent', dependencies : glx_dep)
glconf.set('GST_GL_HAVE_PLATFORM_GLX', 1)
gl_sources += [
'x11/gstglcontext_glx.c',
......@@ -627,10 +629,10 @@ endif
if need_platform_wgl != 'no' and need_win_win32 != 'no'
gdi_dep = cc.find_library('gdi32', required : false)
# FIXME: Revert back to has_header once it gains prefix support
wglext_h = cc.has_header_symbol('GL/wglext.h', 'WGL_WGLEXT_VERSION',
prefix : '''#include <windows.h>
#include <GL/gl.h>''',
include_directories : compat_includes)
wglext_h = cc.has_header('GL/wglext.h',
prefix : '''#include <windows.h>
#include <GL/gl.h>''',
include_directories : compat_includes)
if wglext_h and gdi_dep.found() and gl_dep.found()
gl_includes += [compat_includes]
......
......@@ -1306,6 +1306,8 @@ gst_rtp_base_payload_prepare_push (GstRTPBasePayload * payload,
if (is_list) {
gst_buffer_list_foreach (GST_BUFFER_LIST_CAST (obj), set_headers, &data);
gst_buffer_list_foreach (GST_BUFFER_LIST_CAST (obj), filter_meta, NULL);
/* sequence number has increased more if this was a buffer list */
payload->seqnum = data.seqnum - 1;
} else {
GstBuffer *buf = GST_BUFFER_CAST (obj);
set_headers (&buf, 0, &data);
......
......@@ -1088,6 +1088,8 @@ add_auth_header (GstRTSPConnection * conn, GstRTSPMessage * message)
g_free (auth_string);
auth_string = auth_string2;
}
/* Do not keep any old Authorization headers */
gst_rtsp_message_remove_header (message, GST_RTSP_HDR_AUTHORIZATION, -1);
gst_rtsp_message_take_header (message, GST_RTSP_HDR_AUTHORIZATION,
auth_string);
break;
......
......@@ -70,8 +70,14 @@ endif
core_conf.set('HAVE_ISO_CODES', have_iso_codes)
# could drop optional zlib dep and use g_zlib_decompressor_new()
zlib_dep = dependency('zlib', required: false, fallback: ['zlib', 'zlib_dep'])
core_conf.set('HAVE_ZLIB', zlib_dep.found())
zlib_dep = dependency('zlib', required : false)
if not zlib_dep.found()
zlib_dep = cc.find_library('z', required : false)
if not zlib_dep.found() or not cc.has_header('zlib.h')
zlib_dep = subproject('zlib').get_variable('zlib_dep')
endif
endif
core_conf.set('HAVE_ZLIB', true)
tag_deps = [gst_base_dep, libm, zlib_dep]
gsttag = library('gsttag-@0@'.format(api_version),
......
This diff is collapsed.
This diff is collapsed.
......@@ -32,7 +32,7 @@ typedef struct _GstVideoAncillary GstVideoAncillary;
* GstVideoAncillary:
* @DID: The Data Identifier
* @SDID_block_number: The Secondary Data Identifier (if type 2) or the Data
* Block Number (if type 2)
* Block Number (if type 1)
* @data_count: The amount of data (in bytes) in @data (max 255 bytes)
* @data: (array length=data_count): The user data content of the Ancillary packet.
* Does not contain the ADF, DID, SDID nor CS.
......@@ -109,7 +109,7 @@ typedef enum {
* @GST_VIDEO_CAPTION_TYPE_CEA608_IN_CEA708_RAW: CEA-608 as cc_data byte triplets.
* The first byte of each triplet shall specify the field as in CEA-708
* (i.e: 0xFC for the first field or 0xFD for the second field.). The 2nd
* and 3rd byte of each triplet at the cc1 and cc2 bytes. Use this if
* and 3rd byte of each triplet are the cc1 and cc2 bytes. Use this if
* there is *only* CEA-608 caption. If there is also CEA-708 caption,
* use @GST_VIDEO_CAPTION_TYPE_CEA708_RAW.
* @GST_VIDEO_CAPTION_TYPE_CEA708_RAW: CEA-708 as cc_data byte triplets. They
......@@ -223,6 +223,39 @@ void gst_video_vbi_parser_free (GstVideoVBIParser *parser);
GST_VIDEO_API
void gst_video_vbi_parser_add_line (GstVideoVBIParser *parser, const guint8 *data);
/**
* GstVideoVBIEncoder:
*
* An encoder for writing ancillary data to the
* Vertical Blanking Interval lines of component signals.
*
* Since: 1.16
*/
typedef struct _GstVideoVBIEncoder GstVideoVBIEncoder;
GST_VIDEO_API
GType gst_video_vbi_encoder_get_type (void);
GST_VIDEO_API
GstVideoVBIEncoder *gst_video_vbi_encoder_new (GstVideoFormat format, guint32 pixel_width);
GST_VIDEO_API
GstVideoVBIEncoder *gst_video_vbi_encoder_copy (const GstVideoVBIEncoder *encoder);
GST_VIDEO_API
void gst_video_vbi_encoder_free (GstVideoVBIEncoder *encoder);
GST_VIDEO_API
gboolean gst_video_vbi_encoder_add_ancillary (GstVideoVBIEncoder *encoder,
gboolean composite,
guint8 DID,
guint8 SDID_block_number,
const guint8 *data,
guint data_count);
GST_VIDEO_API
void gst_video_vbi_encoder_write_line (GstVideoVBIEncoder *encoder, guint8 *data);
G_END_DECLS
......
......@@ -5851,6 +5851,7 @@ get_scale_format (GstVideoFormat format, gint plane)
case GST_VIDEO_FORMAT_v210:
case GST_VIDEO_FORMAT_v216:
case GST_VIDEO_FORMAT_Y210:
case GST_VIDEO_FORMAT_Y410:
case GST_VIDEO_FORMAT_UYVP:
case GST_VIDEO_FORMAT_RGB8P:
case GST_VIDEO_FORMAT_IYU1:
......
......@@ -846,6 +846,64 @@ pack_Y210 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
}
}
#define PACK_Y410 GST_VIDEO_FORMAT_AYUV64, unpack_Y410, 1, pack_Y410
static void
unpack_Y410 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
gpointer dest, const gpointer data[GST_VIDEO_MAX_PLANES],
const gint stride[GST_VIDEO_MAX_PLANES], gint x, gint y, gint width)
{
int i;
const guint8 *restrict s = GET_LINE (y);
guint16 *restrict d = dest;
guint32 AVYU;
guint16 A, Y, U, V;
for (i = 0; i < width; i++) {
AVYU = GST_READ_UINT32_LE (s + 4 * i);
U = ((AVYU >> 0) & 0x3ff) << 6;
Y = ((AVYU >> 10) & 0x3ff) << 6;
V = ((AVYU >> 20) & 0x3ff) << 6;
A = ((AVYU >> 30) & 0x03) << 14;
if (!(flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)) {
U |= (U >> 10);
Y |= (Y >> 10);
V |= (V >> 10);
A |= (A >> 10);
}
d[4 * i + 0] = A;
d[4 * i + 1] = Y;
d[4 * i + 2] = U;
d[4 * i + 3] = V;
}
}
static void
pack_Y410 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
const gpointer src, gint sstride, gpointer data[GST_VIDEO_MAX_PLANES],
const gint stride[GST_VIDEO_MAX_PLANES], GstVideoChromaSite chroma_site,
gint y, gint width)
{
int i;
guint32 *restrict d = GET_LINE (y);
const guint16 *restrict s = src;
guint32 AVYU;
guint16 A, Y, U, V;
for (i = 0; i < width; i++) {
A = s[4 * i] & 0xc000;
Y = s[4 * i + 1] & 0xffc0;
U = s[4 * i + 2] & 0xffc0;
V = s[4 * i + 3] & 0xffc0;
AVYU = (U >> 6) | (Y << 4) | (V << 14) | (A << 16);
GST_WRITE_UINT32_LE (d + i, AVYU);
}
}
#define PACK_Y41B GST_VIDEO_FORMAT_AYUV, unpack_Y41B, 1, pack_Y41B
static void
unpack_Y41B (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
......@@ -5168,6 +5226,7 @@ typedef struct
#define DPTH10_10_10 10, 3, { 0, 0, 0, 0 }, { 10, 10, 10, 0 }
#define DPTH10_10_10_10 10, 4, { 0, 0, 0, 0 }, { 10, 10, 10, 10 }
#define DPTH10_10_10_HI 16, 3, { 6, 6, 6, 0 }, { 10, 10, 10, 0 }
#define DPTH10_10_10_2 10, 4, { 0, 0, 0, 0 }, { 10, 10, 10, 2}
#define DPTH12_12_12 12, 3, { 0, 0, 0, 0 }, { 12, 12, 12, 0 }
#define DPTH12_12_12_12 12, 4, { 0, 0, 0, 0 }, { 12, 12, 12, 12 }
#define DPTH16 16, 1, { 0, 0, 0, 0 }, { 16, 0, 0, 0 }
......@@ -5328,8 +5387,6 @@ static const VideoFormat formats[] = {
DPTH10_10_10, PSTR0, PLANE0, OFFS0, SUB422, PACK_v210),
MAKE_YUV_FORMAT (v216, "raw video", GST_MAKE_FOURCC ('v', '2', '1', '6'),
DPTH16_16_16, PSTR488, PLANE0, OFFS204, SUB422, PACK_v216),
MAKE_YUV_FORMAT (Y210, "raw video", GST_MAKE_FOURCC ('Y', '2', '1', '0'),
DPTH10_10_10, PSTR488, PLANE0, OFFS0, SUB422, PACK_Y210),
MAKE_YUV_FORMAT (NV12, "raw video", GST_MAKE_FOURCC ('N', 'V', '1', '2'),
DPTH888, PSTR122, PLANE011, OFFS001, SUB420, PACK_NV12),
MAKE_YUV_FORMAT (NV21, "raw video", GST_MAKE_FOURCC ('N', 'V', '2', '1'),
......@@ -5476,6 +5533,10 @@ static const VideoFormat formats[] = {
MAKE_YUV_C_LE_FORMAT (NV12_10LE40, "raw video",
GST_MAKE_FOURCC ('R', 'K', '2', '0'), DPTH10_10_10, PSTR0, PLANE011,
OFFS0, SUB420, PACK_NV12_10LE40),
MAKE_YUV_FORMAT (Y210, "raw video", GST_MAKE_FOURCC ('Y', '2', '1', '0'),
DPTH10_10_10, PSTR488, PLANE0, OFFS0, SUB422, PACK_Y210),
MAKE_YUV_FORMAT (Y410, "raw video", GST_MAKE_FOURCC ('Y', '4', '1', '0'),
DPTH10_10_10_2, PSTR0, PLANE0, OFFS0, SUB4444, PACK_Y410),
};
static GstVideoFormat
......@@ -5718,6 +5779,9 @@ gst_video_format_from_fourcc (guint32 fourcc)
return GST_VIDEO_FORMAT_NV16_10LE32;
case GST_MAKE_FOURCC ('R', 'K', '2', '0'):
return GST_VIDEO_FORMAT_NV12_10LE40;
case GST_MAKE_FOURCC ('Y', '4', '1', '0'):
return GST_VIDEO_FORMAT_Y410;
default:
return GST_VIDEO_FORMAT_UNKNOWN;
}
......
......@@ -114,6 +114,8 @@ G_BEGIN_DECLS
* @GST_VIDEO_FORMAT_Y444_12BE: planar 4:4:4 YUV, 12 bits per channel (Since: 1.12)
* @GST_VIDEO_FORMAT_Y444_12LE: planar 4:4:4 YUV, 12 bits per channel (Since: 1.12)
* @GST_VIDEO_FORMAT_NV12_10LE40: Fully packed variant of NV12_10LE32 (Since: 1.16)
* @GST_VIDEO_FORMAT_Y210: packed 4:2:2 YUV, 10 bits per channel (Since: 1.16)
* @GST_VIDEO_FORMAT_Y410: packed 4:4:4 YUV, 10 bits per channel(A-V-Y-U...) (Since: 1.16)
*
* Enum value describing the most common video formats.
*/
......@@ -141,7 +143,6 @@ typedef enum {
GST_VIDEO_FORMAT_Y444,
GST_VIDEO_FORMAT_v210,
GST_VIDEO_FORMAT_v216,
GST_VIDEO_FORMAT_Y210,
GST_VIDEO_FORMAT_NV12,
GST_VIDEO_FORMAT_NV21,
GST_VIDEO_FORMAT_GRAY8,
......@@ -201,6 +202,8 @@ typedef enum {
GST_VIDEO_FORMAT_NV12_10LE32,
GST_VIDEO_FORMAT_NV16_10LE32,
GST_VIDEO_FORMAT_NV12_10LE40,
GST_VIDEO_FORMAT_Y210,
GST_VIDEO_FORMAT_Y410,
} GstVideoFormat;
#define GST_VIDEO_MAX_PLANES 4
......@@ -545,7 +548,7 @@ gconstpointer gst_video_format_get_palette (GstVideoFormat format, gsi
#define GST_VIDEO_FORMATS_ALL "{ I420, YV12, YUY2, UYVY, AYUV, RGBx, " \
"BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, " \
"Y444, v210, v216, Y210, NV12, NV21, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, " \
"Y444, v210, v216, Y210, Y410, NV12, NV21, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, " \
"BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, " \
"AYUV64, r210, I420_10BE, I420_10LE, I422_10BE, I422_10LE, Y444_10BE, " \
"Y444_10LE, GBR, GBR_10BE, GBR_10LE, NV16, NV24, NV12_64Z32, A420_10BE, " \
......
......@@ -762,6 +762,7 @@ fill_planes (GstVideoInfo * info)
case GST_VIDEO_FORMAT_xBGR:
case GST_VIDEO_FORMAT_ABGR:
case GST_VIDEO_FORMAT_r210:
case GST_VIDEO_FORMAT_Y410:
info->stride[0] = width * 4;
info->offset[0] = 0;
info->size = info->stride[0] * height;
......
......@@ -841,12 +841,17 @@ static void
gst_video_overlay_rectangle_premultiply_0 (GstVideoFrame * frame)
{
int i, j;
for (j = 0; j < GST_VIDEO_FRAME_HEIGHT (frame); ++j) {
int width = GST_VIDEO_FRAME_WIDTH (frame);
int height = GST_VIDEO_FRAME_HEIGHT (frame);
int stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
guint8 *data = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
for (j = 0; j < height; ++j) {
guint8 *line;