mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-02 18:23:56 +00:00
tests: add support for GStreamer 1.0.
This commit is contained in:
parent
51151e7aa1
commit
13ca9f382c
5 changed files with 39 additions and 11 deletions
|
@ -49,6 +49,15 @@ gst_compat_structure_get_fourcc(const GstStructure *structure,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* GstTypeFind */
|
||||||
|
#undef GstTypeFindPeekFunction
|
||||||
|
#define GstTypeFindPeekFunction GstCompatTypeFindPeekFunction
|
||||||
|
#undef GstTypeFindSuggestFunction
|
||||||
|
#define GstTypeFindSuggestFunction GstCompatTypeFindSuggestFunction
|
||||||
|
|
||||||
|
typedef const guint8 *(*GstCompatTypeFindPeekFunction)(gpointer, gint64, guint);
|
||||||
|
typedef void (*GstCompatTypeFindSuggestFunction)(gpointer, guint, GstCaps *);
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
/* --- GStreamer = 0.10 --- */
|
/* --- GStreamer = 0.10 --- */
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
|
@ -41,7 +41,7 @@ static const CodecMap g_codec_map[] = {
|
||||||
{ "wmv3", GST_VAAPI_CODEC_VC1,
|
{ "wmv3", GST_VAAPI_CODEC_VC1,
|
||||||
"video/x-wmv, wmvversion=3" },
|
"video/x-wmv, wmvversion=3" },
|
||||||
{ "vc1", GST_VAAPI_CODEC_VC1,
|
{ "vc1", GST_VAAPI_CODEC_VC1,
|
||||||
"video/x-wmv, wmvversion=3, format=(fourcc)WVC1" },
|
"video/x-wmv, wmvversion=3, format=(string)WVC1" },
|
||||||
{ NULL, }
|
{ NULL, }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -151,15 +151,14 @@ decoder_put_buffers(GstVaapiDecoder *decoder)
|
||||||
codec = get_codec_defs(decoder);
|
codec = get_codec_defs(decoder);
|
||||||
g_return_val_if_fail(codec != NULL, FALSE);
|
g_return_val_if_fail(codec != NULL, FALSE);
|
||||||
|
|
||||||
buffer = gst_buffer_new();
|
codec->get_video_info(&info);
|
||||||
|
buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY,
|
||||||
|
(guchar *)info.data, info.data_size, 0, info.data_size, NULL, NULL);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
GST_ERROR("failed to create encoded data buffer");
|
GST_ERROR("failed to create encoded data buffer");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
codec->get_video_info(&info);
|
|
||||||
gst_buffer_set_data(buffer, (guchar *)info.data, info.data_size);
|
|
||||||
|
|
||||||
success = gst_vaapi_decoder_put_buffer(decoder, buffer);
|
success = gst_vaapi_decoder_put_buffer(decoder, buffer);
|
||||||
gst_buffer_unref(buffer);
|
gst_buffer_unref(buffer);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|
|
@ -251,13 +251,12 @@ decoder_thread(gpointer data)
|
||||||
if (G_UNLIKELY(ofs == app->file_size))
|
if (G_UNLIKELY(ofs == app->file_size))
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
else {
|
else {
|
||||||
buffer = gst_buffer_new();
|
const gsize size = MIN(4096, app->file_size - ofs);
|
||||||
|
buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY,
|
||||||
|
app->file_data, app->file_size, ofs, size, NULL, NULL);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
SEND_ERROR("failed to allocate new buffer");
|
SEND_ERROR("failed to allocate new buffer");
|
||||||
|
ofs += size;
|
||||||
GST_BUFFER_DATA(buffer) = app->file_data + ofs;
|
|
||||||
GST_BUFFER_SIZE(buffer) = MIN(4096, app->file_size - ofs);
|
|
||||||
ofs += GST_BUFFER_SIZE(buffer);
|
|
||||||
}
|
}
|
||||||
if (!gst_vaapi_decoder_put_buffer(app->decoder, buffer))
|
if (!gst_vaapi_decoder_put_buffer(app->decoder, buffer))
|
||||||
SEND_ERROR("failed to push buffer to decoder");
|
SEND_ERROR("failed to push buffer to decoder");
|
||||||
|
|
|
@ -53,15 +53,22 @@ static GOptionEntry g_options[] = {
|
||||||
static void
|
static void
|
||||||
upload_subpicture(GstBuffer *buffer, const VideoSubpictureInfo *subinfo)
|
upload_subpicture(GstBuffer *buffer, const VideoSubpictureInfo *subinfo)
|
||||||
{
|
{
|
||||||
guint32 * const dst = (guint32 *)GST_BUFFER_DATA(buffer);
|
|
||||||
const guint32 * const src = subinfo->data;
|
const guint32 * const src = subinfo->data;
|
||||||
guint i, len = subinfo->data_size / 4;
|
guint i, len = subinfo->data_size / 4;
|
||||||
|
GstMapInfo map_info;
|
||||||
|
guint32 *dst;
|
||||||
|
|
||||||
|
if (!gst_buffer_map(buffer, &map_info, GST_MAP_WRITE))
|
||||||
|
return;
|
||||||
|
dst = (guint32 *)map_info.data;
|
||||||
|
|
||||||
/* Convert from RGBA source to ARGB */
|
/* Convert from RGBA source to ARGB */
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
const guint32 rgba = src[i];
|
const guint32 rgba = src[i];
|
||||||
dst[i] = (rgba >> 8) | (rgba << 24);
|
dst[i] = (rgba >> 8) | (rgba << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gst_buffer_unmap(buffer, &map_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -120,9 +127,23 @@ main(int argc, char *argv[])
|
||||||
subrect.height = subinfo.height;
|
subrect.height = subinfo.height;
|
||||||
subrect.width = subinfo.width;
|
subrect.width = subinfo.width;
|
||||||
|
|
||||||
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
|
{
|
||||||
|
GstVideoMeta * const vmeta =
|
||||||
|
gst_buffer_add_video_meta(buffer, GST_VIDEO_FRAME_FLAG_NONE,
|
||||||
|
GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB,
|
||||||
|
subinfo.width, subinfo.height);
|
||||||
|
if (!vmeta)
|
||||||
|
g_error("could not create video meta");
|
||||||
|
|
||||||
|
overlay = gst_video_overlay_rectangle_new_raw(buffer,
|
||||||
|
subrect.x, subrect.y, subrect.width, subrect.height, flags);
|
||||||
|
}
|
||||||
|
#else
|
||||||
overlay = gst_video_overlay_rectangle_new_argb(buffer,
|
overlay = gst_video_overlay_rectangle_new_argb(buffer,
|
||||||
subinfo.width, subinfo.height, subinfo.width * 4,
|
subinfo.width, subinfo.height, subinfo.width * 4,
|
||||||
subrect.x, subrect.y, subrect.width, subrect.height, flags);
|
subrect.x, subrect.y, subrect.width, subrect.height, flags);
|
||||||
|
#endif
|
||||||
if (!overlay)
|
if (!overlay)
|
||||||
g_error("could not create video overlay");
|
g_error("could not create video overlay");
|
||||||
gst_buffer_unref(buffer);
|
gst_buffer_unref(buffer);
|
||||||
|
|
Loading…
Reference in a new issue