basetextoverlay: make memory copy when video buffer's memory is ready only

1. since gst_buffer_make_writable just lookup the refcount to determine if
   a buffer is writable, and it will use _gst_buffer_copy() which don't
   perform a deep memory copy even if the flag of a memory is set to
   GST_MEMORY_FLAG_READONLY. So, we detect the memory flag and use
   gst_buffer_copy_region with GST_BUFFER_COPY_DEEP parameter to perform
   deep memory copy. if the allocator of a memory don't support mem_copy
   interface, the it will return NULL, if this case, we can use
   gst_buffer_make_writable() to get a shared memory buffer or the orignal
   buffer if the buffer's refcount is 1.

Signed-off-by: Mingke Wang <mingke.wang@freescale.com>
1 file changed