mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 23:58:17 +00:00
quarktv: Fix setting the planes property of quarktv
Setting it to a value<16 would cause crashes before because current_plane was set to the old number of planes-1. Also fix calculations for non-2^n planes values.
This commit is contained in:
parent
c116c301af
commit
426ff3bd93
1 changed files with 12 additions and 9 deletions
|
@ -171,7 +171,7 @@ gst_quarktv_transform (GstBaseTransform * trans, GstBuffer * in,
|
|||
/* pick a random buffer */
|
||||
rand =
|
||||
filter->planetable[(filter->current_plane +
|
||||
(fastrand () >> 24)) & (filter->planes - 1)];
|
||||
(fastrand () >> 24)) % filter->planes];
|
||||
|
||||
/* Copy the pixel from the random buffer to dest */
|
||||
dest[area] = (rand ? ((guint32 *) GST_BUFFER_DATA (rand))[area] : 0);
|
||||
|
@ -250,17 +250,20 @@ gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
new_planetable =
|
||||
(GstBuffer **) g_malloc0 (new_n_planes * sizeof (GstBuffer *));
|
||||
|
||||
for (i = 0; (i < new_n_planes) && (i < filter->planes); i++) {
|
||||
new_planetable[i] = filter->planetable[i];
|
||||
if (filter->planetable) {
|
||||
for (i = 0; (i < new_n_planes) && (i < filter->planes); i++) {
|
||||
new_planetable[i] = filter->planetable[i];
|
||||
}
|
||||
for (; i < filter->planes; i++) {
|
||||
if (filter->planetable[i])
|
||||
gst_buffer_unref (filter->planetable[i]);
|
||||
}
|
||||
g_free (filter->planetable);
|
||||
}
|
||||
for (; i < filter->planes; i++) {
|
||||
if (filter->planetable[i])
|
||||
gst_buffer_unref (filter->planetable[i]);
|
||||
}
|
||||
g_free (filter->planetable);
|
||||
|
||||
filter->planetable = new_planetable;
|
||||
filter->current_plane = filter->planes - 1;
|
||||
filter->planes = new_n_planes;
|
||||
filter->current_plane = filter->planes - 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue