mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
textoverlay: Release memory storage and resize image when caps change
This commit is contained in:
parent
2683c87863
commit
d5e7c7bffe
1 changed files with 10 additions and 3 deletions
|
@ -137,6 +137,10 @@ gst_opencv_text_overlay_finalize (GObject * obj)
|
|||
cvReleaseImage (&filter->cvImage);
|
||||
}
|
||||
|
||||
if (filter->cvStorage) {
|
||||
cvReleaseMemStorage (&filter->cvStorage);
|
||||
}
|
||||
|
||||
g_free (filter->textbuf);
|
||||
|
||||
G_OBJECT_CLASS (gst_opencv_text_overlay_parent_class)->finalize (obj);
|
||||
|
@ -351,9 +355,12 @@ gst_opencv_text_overlay_handle_sink_event (GstPad * pad, GstObject * parent,
|
|||
gst_structure_get_int (structure, "width", &width);
|
||||
gst_structure_get_int (structure, "height", &height);
|
||||
|
||||
if (!filter->cvImage) {
|
||||
filter->cvImage =
|
||||
cvCreateImage (cvSize (width, height), IPL_DEPTH_8U, 3);
|
||||
if (filter->cvImage) {
|
||||
cvReleaseImage (&filter->cvImage);
|
||||
}
|
||||
filter->cvImage = cvCreateImage (cvSize (width, height), IPL_DEPTH_8U, 3);
|
||||
|
||||
if (!filter->cvStorage) {
|
||||
filter->cvStorage = cvCreateMemStorage (0);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue