mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 23:18:52 +00:00
video-converter: don't reuse the input line when adding borders
When we need to add borders, we need a writable input line, so don't reuse the source memory directly. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=745207
This commit is contained in:
parent
ace35b78ee
commit
e0a192d3dd
2 changed files with 44 additions and 1 deletions
|
@ -1754,7 +1754,8 @@ setup_allocators (GstVideoConverter * convert)
|
||||||
setup_border_alloc (convert, user_data);
|
setup_border_alloc (convert, user_data);
|
||||||
notify = (GDestroyNotify) converter_alloc_free;
|
notify = (GDestroyNotify) converter_alloc_free;
|
||||||
alloc_line = get_border_temp_line;
|
alloc_line = get_border_temp_line;
|
||||||
alloc_writable = FALSE;
|
/* when we add a border, we need to write */
|
||||||
|
alloc_writable = convert->borderline != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now walk backwards, we try to write into the dest lines directly
|
/* now walk backwards, we try to write into the dest lines directly
|
||||||
|
|
|
@ -2251,6 +2251,47 @@ GST_END_TEST;
|
||||||
#undef WIDTH
|
#undef WIDTH
|
||||||
#undef HEIGHT
|
#undef HEIGHT
|
||||||
|
|
||||||
|
GST_START_TEST (test_video_convert)
|
||||||
|
{
|
||||||
|
GstVideoInfo ininfo, outinfo;
|
||||||
|
GstVideoFrame inframe, outframe;
|
||||||
|
GstBuffer *inbuffer, *outbuffer;
|
||||||
|
GstVideoConverter *convert;
|
||||||
|
|
||||||
|
gst_video_info_set_format (&ininfo, GST_VIDEO_FORMAT_ARGB, 320, 240);
|
||||||
|
inbuffer = gst_buffer_new_and_alloc (ininfo.size);
|
||||||
|
gst_buffer_memset (inbuffer, 0, 0, -1);
|
||||||
|
gst_video_frame_map (&inframe, &ininfo, inbuffer, GST_MAP_READ);
|
||||||
|
|
||||||
|
gst_video_info_set_format (&outinfo, GST_VIDEO_FORMAT_BGRx, 400, 300);
|
||||||
|
outbuffer = gst_buffer_new_and_alloc (outinfo.size);
|
||||||
|
gst_video_frame_map (&outframe, &outinfo, outbuffer, GST_MAP_WRITE);
|
||||||
|
|
||||||
|
convert = gst_video_converter_new (&ininfo, &outinfo,
|
||||||
|
gst_structure_new ("options",
|
||||||
|
GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD,
|
||||||
|
GST_TYPE_VIDEO_RESAMPLER_METHOD, 3,
|
||||||
|
GST_VIDEO_CONVERTER_OPT_SRC_X, G_TYPE_INT, 10,
|
||||||
|
GST_VIDEO_CONVERTER_OPT_SRC_Y, G_TYPE_INT, 0,
|
||||||
|
GST_VIDEO_CONVERTER_OPT_SRC_WIDTH, G_TYPE_INT, 300,
|
||||||
|
GST_VIDEO_CONVERTER_OPT_SRC_HEIGHT, G_TYPE_INT, 220,
|
||||||
|
GST_VIDEO_CONVERTER_OPT_DEST_X, G_TYPE_INT, 80,
|
||||||
|
GST_VIDEO_CONVERTER_OPT_DEST_Y, G_TYPE_INT, 60,
|
||||||
|
GST_VIDEO_CONVERTER_OPT_DEST_WIDTH, G_TYPE_INT, 300,
|
||||||
|
GST_VIDEO_CONVERTER_OPT_DEST_HEIGHT, G_TYPE_INT, 220, NULL));
|
||||||
|
|
||||||
|
gst_video_converter_frame (convert, &inframe, &outframe);
|
||||||
|
gst_video_converter_free (convert);
|
||||||
|
|
||||||
|
gst_video_frame_unmap (&outframe);
|
||||||
|
gst_buffer_unref (outbuffer);
|
||||||
|
gst_video_frame_unmap (&inframe);
|
||||||
|
gst_buffer_unref (inbuffer);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
GST_START_TEST (test_video_transfer)
|
GST_START_TEST (test_video_transfer)
|
||||||
{
|
{
|
||||||
gint i, j;
|
gint i, j;
|
||||||
|
@ -2527,6 +2568,7 @@ video_suite (void)
|
||||||
tcase_add_test (tc_chain, test_video_scaler);
|
tcase_add_test (tc_chain, test_video_scaler);
|
||||||
tcase_add_test (tc_chain, test_video_color_convert);
|
tcase_add_test (tc_chain, test_video_color_convert);
|
||||||
tcase_add_test (tc_chain, test_video_size_convert);
|
tcase_add_test (tc_chain, test_video_size_convert);
|
||||||
|
tcase_add_test (tc_chain, test_video_convert);
|
||||||
tcase_add_test (tc_chain, test_video_transfer);
|
tcase_add_test (tc_chain, test_video_transfer);
|
||||||
tcase_add_test (tc_chain, test_overlay_blend);
|
tcase_add_test (tc_chain, test_overlay_blend);
|
||||||
tcase_add_test (tc_chain, test_video_center_rect);
|
tcase_add_test (tc_chain, test_video_center_rect);
|
||||||
|
|
Loading…
Reference in a new issue