mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
Add initial support for GStreamer 1.0.
This integrates support for GStreamer API >= 1.0 only in the libgstvaapi core decoding library. The changes are kept rather minimal here so that the library retains as little dependency as possible on core GStreamer functionality. Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
6136ebe5e2
commit
51151e7aa1
16 changed files with 179 additions and 36 deletions
12
configure.ac
12
configure.ac
|
@ -18,10 +18,13 @@ m4_define([gst_vaapi_lt_age], [0])
|
|||
m4_define([glib_version], [2.28])
|
||||
|
||||
# gstreamer version number
|
||||
m4_define([gst_api_version], [0.10])
|
||||
m4_define([gst_api_version], [1.0])
|
||||
m4_define([gst0_version], [0.10.36])
|
||||
m4_define([gst0_plugins_base_version], [0.10.31])
|
||||
m4_define([gst0_plugins_bad_version], [0.10.22])
|
||||
m4_define([gst1_version], [1.0.0])
|
||||
m4_define([gst1_plugins_base_version], [1.0.0])
|
||||
m4_define([gst1_plugins_bad_version], [1.0.0])
|
||||
|
||||
# Wayland minimum version number
|
||||
m4_define([wayland_api_version], [1.0.0])
|
||||
|
@ -135,6 +138,11 @@ case $GST_API_VERSION in
|
|||
GST_PLUGINS_BASE_VERSION_REQUIRED=gst0_plugins_base_version
|
||||
GST_PLUGINS_BAD_VERSION_REQUIRED=gst0_plugins_bad_version
|
||||
;;
|
||||
1.0)
|
||||
GST_VERSION_REQUIRED=gst1_version
|
||||
GST_PLUGINS_BASE_VERSION_REQUIRED=gst1_plugins_base_version
|
||||
GST_PLUGINS_BAD_VERSION_REQUIRED=gst1_plugins_bad_version
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([unsupported GStreamer API version $GST_API_VERSION])
|
||||
;;
|
||||
|
@ -172,8 +180,10 @@ fi
|
|||
dnl GStreamer -base plugins
|
||||
PKG_CHECK_MODULES([GST_PLUGINS_BASE],
|
||||
[gstreamer-plugins-base-$GST_API_VERSION >= $GST_PLUGINS_BASE_VERSION_REQUIRED])
|
||||
if test "$GST_API_VERSION" = "0.10"; then
|
||||
PKG_CHECK_MODULES([GST_INTERFACES],
|
||||
[gstreamer-interfaces-$GST_API_VERSION >= $GST_PLUGINS_BASE_VERSION_REQUIRED])
|
||||
fi
|
||||
|
||||
dnl ... GstVideoOverlayComposition (gstreamer-video)
|
||||
PKG_CHECK_MODULES([GST_VIDEO],
|
||||
|
|
|
@ -24,6 +24,37 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* --- GStreamer >= 1.0 --- */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#if GST_CHECK_VERSION(1,0,0)
|
||||
#include <gst/video/gstvideometa.h>
|
||||
|
||||
/* GstStructure */
|
||||
#undef gst_structure_get_fourcc
|
||||
#define gst_structure_get_fourcc(structure, fieldname, value) \
|
||||
gst_compat_structure_get_fourcc(structure, fieldname, value)
|
||||
|
||||
static inline gboolean
|
||||
gst_compat_structure_get_fourcc(const GstStructure *structure,
|
||||
const gchar *fieldname, guint32 *value)
|
||||
{
|
||||
const gchar *s = gst_structure_get_string(structure, fieldname);
|
||||
|
||||
if (!s || strlen(s) != 4)
|
||||
return FALSE;
|
||||
|
||||
*value = GST_MAKE_FOURCC(s[0], s[1], s[2], s[3]);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* --- GStreamer = 0.10 --- */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#else
|
||||
|
||||
/* GstVideoOverlayComposition */
|
||||
#include <gst/video/video-overlay-composition.h>
|
||||
|
||||
|
@ -71,4 +102,6 @@ gst_compat_element_class_set_static_metadata(GstElementClass *klass,
|
|||
typedef guint8 *(*GstCompatTypeFindPeekFunction)(gpointer, gint64, guint);
|
||||
typedef void (*GstCompatTypeFindSuggestFunction)(gpointer, guint, const GstCaps *);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GST_COMPAT_H */
|
||||
|
|
|
@ -252,8 +252,30 @@ overlay_rectangle_changed_pixels(GstVaapiOverlayRectangle *overlay,
|
|||
buffer = gst_video_overlay_rectangle_get_pixels_unscaled_raw(rect, flags);
|
||||
if (!buffer)
|
||||
return FALSE;
|
||||
#if GST_CHECK_VERSION(1,0,0)
|
||||
{
|
||||
const guint n_blocks = gst_buffer_n_memory(buffer);
|
||||
gsize ofs;
|
||||
guint i;
|
||||
|
||||
if (buffer == overlay->rect_buffer)
|
||||
return TRUE;
|
||||
|
||||
if (n_blocks != gst_buffer_n_memory(overlay->rect_buffer))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < n_blocks; i++) {
|
||||
GstMemory * const mem1 = gst_buffer_peek_memory(buffer, i);
|
||||
GstMemory * const mem2 =
|
||||
gst_buffer_peek_memory(overlay->rect_buffer, i);
|
||||
if (!gst_memory_is_span(mem1, mem2, &ofs))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (GST_BUFFER_DATA(overlay->rect_buffer) != GST_BUFFER_DATA(buffer))
|
||||
return FALSE;
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ push_buffer(GstVaapiDecoder *decoder, GstBuffer *buffer)
|
|||
}
|
||||
|
||||
GST_DEBUG("queue encoded data buffer %p (%d bytes)",
|
||||
buffer, GST_BUFFER_SIZE(buffer));
|
||||
buffer, gst_buffer_get_size(buffer));
|
||||
|
||||
g_queue_push_tail(priv->buffers, buffer);
|
||||
return TRUE;
|
||||
|
@ -128,7 +128,7 @@ pop_buffer(GstVaapiDecoder *decoder)
|
|||
return NULL;
|
||||
|
||||
GST_DEBUG("dequeue buffer %p for decoding (%d bytes)",
|
||||
buffer, GST_BUFFER_SIZE(buffer));
|
||||
buffer, gst_buffer_get_size(buffer));
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ gst_vaapi_decoder_put_buffer(GstVaapiDecoder *decoder, GstBuffer *buf)
|
|||
g_return_val_if_fail(GST_VAAPI_IS_DECODER(decoder), FALSE);
|
||||
|
||||
if (buf) {
|
||||
if (!GST_BUFFER_DATA(buf) || GST_BUFFER_SIZE(buf) <= 0)
|
||||
if (gst_buffer_get_size(buf) == 0)
|
||||
return TRUE;
|
||||
buf = gst_buffer_ref(buf);
|
||||
}
|
||||
|
@ -950,6 +950,7 @@ gst_vaapi_decoder_decode_codec_data(GstVaapiDecoder *decoder)
|
|||
GstVaapiDecoderClass * const klass = GST_VAAPI_DECODER_GET_CLASS(decoder);
|
||||
GstBuffer * const codec_data = GST_VAAPI_DECODER_CODEC_DATA(decoder);
|
||||
GstVaapiDecoderStatus status;
|
||||
GstMapInfo map_info;
|
||||
const guchar *buf;
|
||||
guint buf_size;
|
||||
|
||||
|
@ -960,11 +961,16 @@ gst_vaapi_decoder_decode_codec_data(GstVaapiDecoder *decoder)
|
|||
if (!klass->decode_codec_data)
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
|
||||
buf = GST_BUFFER_DATA(codec_data);
|
||||
buf_size = GST_BUFFER_SIZE(codec_data);
|
||||
if (!buf || buf_size == 0)
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
if (!gst_buffer_map(codec_data, &map_info, GST_MAP_READ)) {
|
||||
GST_ERROR("failed to map buffer");
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
status = klass->decode_codec_data(decoder, buf, buf_size);
|
||||
buf = map_info.data;
|
||||
buf_size = map_info.size;
|
||||
if (G_LIKELY(buf && buf_size > 0))
|
||||
status = klass->decode_codec_data(decoder, buf, buf_size);
|
||||
else
|
||||
status = GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -2700,6 +2700,7 @@ decode_slice(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnit *unit)
|
|||
GstVaapiSlice *slice;
|
||||
GstBuffer * const buffer =
|
||||
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
|
||||
GstMapInfo map_info;
|
||||
|
||||
GST_DEBUG("slice (%u bytes)", pi->nalu.size);
|
||||
|
||||
|
@ -2708,9 +2709,13 @@ decode_slice(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnit *unit)
|
|||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!gst_buffer_map(buffer, &map_info, GST_MAP_READ)) {
|
||||
GST_ERROR("failed to map buffer");
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
slice = GST_VAAPI_SLICE_NEW(H264, decoder,
|
||||
(GST_BUFFER_DATA(buffer) + unit->offset + pi->nalu.offset),
|
||||
pi->nalu.size);
|
||||
(map_info.data + unit->offset + pi->nalu.offset), pi->nalu.size);
|
||||
if (!slice) {
|
||||
GST_ERROR("failed to allocate slice");
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
||||
|
@ -2918,7 +2923,7 @@ gst_vaapi_decoder_h264_parse(GstVaapiDecoder *base_decoder,
|
|||
}
|
||||
ps->input_offset2 = 0;
|
||||
|
||||
buf = (guchar *)gst_adapter_peek(adapter, buf_size);
|
||||
buf = (guchar *)gst_adapter_map(adapter, buf_size);
|
||||
if (!buf)
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
|
||||
|
||||
|
|
|
@ -680,17 +680,18 @@ gst_vaapi_decoder_jpeg_decode(GstVaapiDecoder *base_decoder,
|
|||
GstVaapiDecoderStatus status;
|
||||
GstBuffer * const buffer =
|
||||
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
|
||||
const guchar *buf;
|
||||
guint buf_size;
|
||||
GstMapInfo map_info;
|
||||
|
||||
status = ensure_decoder(decoder);
|
||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||
return status;
|
||||
|
||||
buf = GST_BUFFER_DATA(buffer) + unit->offset;
|
||||
buf_size = unit->size;
|
||||
if (!gst_buffer_map(buffer, &map_info, GST_MAP_READ)) {
|
||||
GST_ERROR("failed to map buffer");
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
status = decode_buffer(decoder, buf, buf_size);
|
||||
status = decode_buffer(decoder, map_info.data + unit->offset, unit->size);
|
||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||
return status;
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
|
|
|
@ -1196,6 +1196,7 @@ decode_slice(GstVaapiDecoderMpeg2 *decoder, GstVaapiDecoderUnit *unit)
|
|||
GstMpegVideoSliceHdr * const slice_hdr = unit->parsed_info;
|
||||
GstBuffer * const buffer =
|
||||
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
|
||||
GstMapInfo map_info;
|
||||
|
||||
GST_DEBUG("slice %d (%u bytes)", slice_hdr->slice_vertical_position,
|
||||
unit->size);
|
||||
|
@ -1203,8 +1204,13 @@ decode_slice(GstVaapiDecoderMpeg2 *decoder, GstVaapiDecoderUnit *unit)
|
|||
if (!is_valid_state(decoder, GST_MPEG_VIDEO_STATE_VALID_PIC_HEADERS))
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
|
||||
if (!gst_buffer_map(buffer, &map_info, GST_MAP_READ)) {
|
||||
GST_ERROR("failed to map buffer");
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
slice = GST_VAAPI_SLICE_NEW(MPEG2, decoder,
|
||||
(GST_BUFFER_DATA(buffer) + unit->offset), unit->size);
|
||||
(map_info.data + unit->offset), unit->size);
|
||||
if (!slice) {
|
||||
GST_ERROR("failed to allocate slice");
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
||||
|
@ -1393,7 +1399,7 @@ gst_vaapi_decoder_mpeg2_parse(GstVaapiDecoder *base_decoder,
|
|||
if (buf_size < 4)
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
|
||||
|
||||
buf = gst_adapter_peek(adapter, buf_size);
|
||||
buf = gst_adapter_map(adapter, buf_size);
|
||||
if (!buf)
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
|
||||
|
||||
|
@ -1476,12 +1482,18 @@ gst_vaapi_decoder_mpeg2_decode(GstVaapiDecoder *base_decoder,
|
|||
GstMpegVideoPacket packet;
|
||||
GstBuffer * const buffer =
|
||||
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
|
||||
GstMapInfo map_info;
|
||||
|
||||
status = ensure_decoder(decoder);
|
||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||
return status;
|
||||
|
||||
packet.data = GST_BUFFER_DATA(buffer) + unit->offset;
|
||||
if (!gst_buffer_map(buffer, &map_info, GST_MAP_READ)) {
|
||||
GST_ERROR("failed to map buffer");
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
packet.data = map_info.data + unit->offset;
|
||||
packet.size = unit->size;
|
||||
packet.type = packet.data[3];
|
||||
packet.offset = 4;
|
||||
|
|
|
@ -1004,7 +1004,7 @@ gst_vaapi_decoder_mpeg4_parse(GstVaapiDecoder *base_decoder,
|
|||
return status;
|
||||
|
||||
size = gst_adapter_available(adapter);
|
||||
buf = gst_adapter_peek(adapter, size);
|
||||
buf = gst_adapter_map(adapter, size);
|
||||
if (!buf)
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
|
||||
|
||||
|
@ -1085,17 +1085,18 @@ gst_vaapi_decoder_mpeg4_decode(GstVaapiDecoder *base_decoder,
|
|||
GstVaapiDecoderStatus status;
|
||||
GstBuffer * const buffer =
|
||||
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
|
||||
const guchar *buf;
|
||||
guint buf_size;
|
||||
GstMapInfo map_info;
|
||||
|
||||
status = ensure_decoder(decoder);
|
||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||
return status;
|
||||
|
||||
buf = GST_BUFFER_DATA(buffer) + unit->offset;
|
||||
buf_size = unit->size;
|
||||
if (!gst_buffer_map(buffer, &map_info, GST_MAP_READ)) {
|
||||
GST_ERROR("failed to map buffer");
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
status = decode_buffer(decoder, buf, buf_size);
|
||||
status = decode_buffer(decoder, map_info.data + unit->offset, unit->size);
|
||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||
return status;
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
|
|
|
@ -315,9 +315,12 @@ gst_vaapi_picture_output(GstVaapiPicture *picture)
|
|||
if (GST_VAAPI_PICTURE_IS_SKIPPED(picture))
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_SET(out_frame,
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY);
|
||||
#if !GST_CHECK_VERSION(1,0,0)
|
||||
/* XXX: replaced with GST_VIDEO_BUFFER_FLAG_TFF */
|
||||
if (GST_VAAPI_PICTURE_IS_TFF(picture))
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_SET(out_frame,
|
||||
GST_VIDEO_CODEC_FRAME_FLAG_TFF);
|
||||
#endif
|
||||
|
||||
gst_vaapi_decoder_push_frame(GET_DECODER(picture), out_frame);
|
||||
|
||||
|
|
|
@ -1255,13 +1255,18 @@ gst_vaapi_decoder_vc1_decode(GstVaapiDecoder *base_decoder,
|
|||
GstVaapiDecoderStatus status;
|
||||
GstBuffer * const buffer =
|
||||
GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer;
|
||||
GstMapInfo map_info;
|
||||
|
||||
status = ensure_decoder(decoder);
|
||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||
return status;
|
||||
|
||||
status = decode_buffer(decoder,
|
||||
(GST_BUFFER_DATA(buffer) + unit->offset), unit->size);
|
||||
if (!gst_buffer_map(buffer, &map_info, GST_MAP_READ)) {
|
||||
GST_ERROR("failed to map buffer");
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
status = decode_buffer(decoder, map_info.data + unit->offset, unit->size);
|
||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||
return status;
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
|
|
|
@ -332,7 +332,7 @@ get_profile_caps(GArray *configs)
|
|||
config = &g_array_index(configs, GstVaapiConfig, i);
|
||||
caps = gst_vaapi_profile_get_caps(config->profile);
|
||||
if (caps)
|
||||
gst_caps_merge(out_caps, caps);
|
||||
out_caps = gst_caps_merge(out_caps, caps);
|
||||
}
|
||||
return out_caps;
|
||||
}
|
||||
|
|
|
@ -913,6 +913,24 @@ gst_vaapi_image_get_data_size(GstVaapiImage *image)
|
|||
return image->priv->image.data_size;
|
||||
}
|
||||
|
||||
#if GST_CHECK_VERSION(1,0,0)
|
||||
#include <gst/video/gstvideometa.h>
|
||||
|
||||
static gboolean
|
||||
init_image_from_video_meta(GstVaapiImageRaw *raw_image, GstVideoMeta *vmeta)
|
||||
{
|
||||
GST_FIXME("map from GstVideoMeta + add fini_image_from_buffer()");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
init_image_from_buffer(GstVaapiImageRaw *raw_image, GstBuffer *buffer)
|
||||
{
|
||||
GstVideoMeta * const vmeta = gst_buffer_get_video_meta(buffer);
|
||||
|
||||
return vmeta ? init_image_from_video_meta(raw_image, vmeta) : FALSE;
|
||||
}
|
||||
#else
|
||||
static gboolean
|
||||
init_image_from_buffer(GstVaapiImageRaw *raw_image, GstBuffer *buffer)
|
||||
{
|
||||
|
@ -989,6 +1007,7 @@ init_image_from_buffer(GstVaapiImageRaw *raw_image, GstBuffer *buffer)
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Copy N lines of an image */
|
||||
static inline void
|
||||
|
|
|
@ -50,10 +50,10 @@ struct _GstVaapiImageFormatMap {
|
|||
GST_VAAPI_IMAGE_##FORMAT, \
|
||||
CAPS_STR
|
||||
#define DEF_YUV(FORMAT, FOURCC, ENDIAN, BPP) \
|
||||
{ DEF(YCBCR, FORMAT, GST_VIDEO_CAPS_YUV(#FORMAT)), \
|
||||
{ DEF(YCBCR, FORMAT, GST_VIDEO_CAPS_MAKE(#FORMAT)), \
|
||||
{ VA_FOURCC FOURCC, VA_##ENDIAN##_FIRST, BPP, }, }
|
||||
#define DEF_RGB(FORMAT, FOURCC, ENDIAN, BPP, DEPTH, R,G,B,A) \
|
||||
{ DEF(RGB, FORMAT, GST_VIDEO_CAPS_##FORMAT), \
|
||||
{ DEF(RGB, FORMAT, GST_VIDEO_CAPS_MAKE(#FORMAT)), \
|
||||
{ VA_FOURCC FOURCC, VA_##ENDIAN##_FIRST, BPP, DEPTH, R,G,B,A }, }
|
||||
|
||||
/* Image formats, listed in HW order preference */
|
||||
|
|
|
@ -91,7 +91,7 @@ static const GstVaapiProfileMap gst_vaapi_profiles[] = {
|
|||
"video/x-wmv, wmvversion=3", "main"
|
||||
},
|
||||
{ GST_VAAPI_PROFILE_VC1_ADVANCED, VAProfileVC1Advanced,
|
||||
"video/x-wmv, wmvversion=3, format=(fourcc)WVC1", "advanced"
|
||||
"video/x-wmv, wmvversion=3, format=(string)WVC1", "advanced"
|
||||
},
|
||||
#if VA_CHECK_VERSION(0,32,0)
|
||||
{ GST_VAAPI_PROFILE_JPEG_BASELINE, VAProfileJPEGBaseline,
|
||||
|
@ -168,7 +168,10 @@ static GstVaapiProfile
|
|||
gst_vaapi_profile_from_codec_data_h264(GstBuffer *buffer)
|
||||
{
|
||||
/* MPEG-4 Part 15: Advanced Video Coding (AVC) file format */
|
||||
guchar * const buf = GST_BUFFER_DATA(buffer);
|
||||
guchar buf[2];
|
||||
|
||||
if (gst_buffer_extract(buffer, 0, buf, sizeof(buf)) != sizeof(buf))
|
||||
return 0;
|
||||
|
||||
if (buf[0] != 1) /* configurationVersion = 1 */
|
||||
return 0;
|
||||
|
@ -317,7 +320,7 @@ gst_vaapi_profile_get_caps(GstVaapiProfile profile)
|
|||
"profile", G_TYPE_STRING, m->profile_str,
|
||||
NULL
|
||||
);
|
||||
gst_caps_merge(out_caps, caps);
|
||||
out_caps = gst_caps_merge(out_caps, caps);
|
||||
}
|
||||
return out_caps;
|
||||
}
|
||||
|
|
|
@ -304,6 +304,10 @@ gst_vaapi_subpicture_new_from_overlay_rectangle(
|
|||
gfloat global_alpha;
|
||||
guint width, height, stride;
|
||||
guint hw_flags, flags;
|
||||
#if GST_CHECK_VERSION(1,0,0)
|
||||
GstVideoMeta *vmeta;
|
||||
GstMapInfo map_info;
|
||||
#endif
|
||||
|
||||
g_return_val_if_fail(GST_IS_VIDEO_OVERLAY_RECTANGLE(rect), NULL);
|
||||
|
||||
|
@ -319,11 +323,28 @@ gst_vaapi_subpicture_new_from_overlay_rectangle(
|
|||
flags = hw_flags & from_GstVideoOverlayFormatFlags(
|
||||
gst_video_overlay_rectangle_get_flags(rect));
|
||||
|
||||
#if GST_CHECK_VERSION(1,0,0)
|
||||
buffer = gst_video_overlay_rectangle_get_pixels_unscaled_argb(rect,
|
||||
to_GstVideoOverlayFormatFlags(flags));
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
|
||||
vmeta = gst_buffer_get_video_meta(buffer);
|
||||
if (!vmeta)
|
||||
return NULL;
|
||||
width = vmeta->width;
|
||||
height = vmeta->height;
|
||||
|
||||
if (!gst_video_meta_map(vmeta, 0, &map_info, (gpointer *)&data,
|
||||
(gint *)&stride, GST_MAP_READ))
|
||||
return NULL;
|
||||
#else
|
||||
buffer = (gst_video_overlay_rectangle_get_pixels_unscaled_argb)(rect,
|
||||
&width, &height, &stride, to_GstVideoOverlayFormatFlags(flags));
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
data = GST_BUFFER_DATA(buffer);
|
||||
#endif
|
||||
|
||||
image = gst_vaapi_image_new(display, format, width, height);
|
||||
if (!image)
|
||||
|
@ -343,6 +364,9 @@ gst_vaapi_subpicture_new_from_overlay_rectangle(
|
|||
|
||||
subpicture = gst_vaapi_subpicture_new(image, flags);
|
||||
g_object_unref(image);
|
||||
#if GST_CHECK_VERSION(1,0,0)
|
||||
gst_video_meta_unmap(vmeta, 0, &map_info);
|
||||
#endif
|
||||
if (!subpicture)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <gst/vaapi/gstvaapidisplay.h>
|
||||
#include <gst/vaapi/gstvaapiimage.h>
|
||||
#include <gst/vaapi/gstvaapisubpicture.h>
|
||||
#include <gst/video/gstsurfacebuffer.h>
|
||||
#include <gst/video/video-overlay-composition.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -37,7 +36,7 @@ G_BEGIN_DECLS
|
|||
*
|
||||
* Generic caps type for VA surfaces.
|
||||
*/
|
||||
#define GST_VAAPI_SURFACE_CAPS_NAME GST_VIDEO_CAPS_SURFACE
|
||||
#define GST_VAAPI_SURFACE_CAPS_NAME "video/x-surface"
|
||||
|
||||
/**
|
||||
* GST_VAAPI_SURFACE_CAPS:
|
||||
|
|
Loading…
Reference in a new issue