textoverlay: Release memory storage and resize image when caps change
This commit is contained in:
parent
2683c87863
commit
d5e7c7bffe
@ -137,6 +137,10 @@ gst_opencv_text_overlay_finalize (GObject * obj)
|
|||||||
cvReleaseImage (&filter->cvImage);
|
cvReleaseImage (&filter->cvImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filter->cvStorage) {
|
||||||
|
cvReleaseMemStorage (&filter->cvStorage);
|
||||||
|
}
|
||||||
|
|
||||||
g_free (filter->textbuf);
|
g_free (filter->textbuf);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gst_opencv_text_overlay_parent_class)->finalize (obj);
|
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, "width", &width);
|
||||||
gst_structure_get_int (structure, "height", &height);
|
gst_structure_get_int (structure, "height", &height);
|
||||||
|
|
||||||
if (!filter->cvImage) {
|
if (filter->cvImage) {
|
||||||
filter->cvImage =
|
cvReleaseImage (&filter->cvImage);
|
||||||
cvCreateImage (cvSize (width, height), IPL_DEPTH_8U, 3);
|
}
|
||||||
|
filter->cvImage = cvCreateImage (cvSize (width, height), IPL_DEPTH_8U, 3);
|
||||||
|
|
||||||
|
if (!filter->cvStorage) {
|
||||||
filter->cvStorage = cvCreateMemStorage (0);
|
filter->cvStorage = cvCreateMemStorage (0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user