summaryrefslogtreecommitdiff
path: root/gtk2_ardour/video_image_frame.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-04-17 20:26:09 +0200
committerRobin Gareus <robin@gareus.org>2013-04-17 20:26:09 +0200
commit8f2a2877b52894349f2f5f9315c5bf7498de4b02 (patch)
tree61cc534ab558d5d246fb191a65a07bd9e6e73a5e /gtk2_ardour/video_image_frame.cc
parent9727a2311100d87bba1ceac62e5a9e42e9420cd8 (diff)
ArdourCanvas::Image allow to set custom data instead of class pre-allocated memory.
Diffstat (limited to 'gtk2_ardour/video_image_frame.cc')
-rw-r--r--gtk2_ardour/video_image_frame.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/gtk2_ardour/video_image_frame.cc b/gtk2_ardour/video_image_frame.cc
index b10b546857..c892bacfa6 100644
--- a/gtk2_ardour/video_image_frame.cc
+++ b/gtk2_ardour/video_image_frame.cc
@@ -35,6 +35,13 @@
using namespace std;
using namespace ARDOUR;
+static void freedata_cb (uint8_t *d, void *arg) {
+ /* later this can be used with libharvid
+ * the buffer/videocacheline instead of freeing it
+ */
+ free (d);
+}
+
VideoImageFrame::VideoImageFrame (PublicEditor& ed, ArdourCanvas::Group& parent, int w, int h, std::string vsurl, std::string vfn)
: editor (ed)
, _parent(&parent)
@@ -117,7 +124,7 @@ VideoImageFrame::draw_line ()
const int rowstride = img->stride;
const int clip_height = img->height;
uint8_t *pixels, *p;
- pixels = img->data.get();
+ pixels = img->data;
int y;
for (y = 0;y < clip_height; y++) {
@@ -133,7 +140,7 @@ VideoImageFrame::fill_frame (const uint8_t r, const uint8_t g, const uint8_t b)
const int clip_height = img->height;
const int clip_width = img->width;
uint8_t *pixels, *p;
- pixels = img->data.get();
+ pixels = img->data;
int x,y;
for (y = 0; y < clip_height; ++y) {
@@ -152,7 +159,7 @@ VideoImageFrame::draw_x ()
const int clip_width = img->width;
const int clip_height = img->height;
uint8_t *pixels, *p;
- pixels = img->data.get();
+ pixels = img->data;
for (x = 0;x < clip_width; x++) {
y = clip_height * x / clip_width;
@@ -173,7 +180,7 @@ VideoImageFrame::cut_rightend ()
const int clip_height = img->height;
const int clip_width = img->width;
uint8_t *pixels, *p;
- pixels = img->data.get();
+ pixels = img->data;
if (rightend > clip_width) { return; }
int x,y;
@@ -233,10 +240,9 @@ VideoImageFrame::http_download_done (char *data){
cut_rightend();
image->put_image(img);
} else {
- img = image->get_image();
- /* TODO - have curl write directly to the shared memory region */
- memcpy((void*) img->data.get(), data, img->stride * img->height);
- free(data);
+ img = image->get_image(false);
+ img->data = (uint8_t*) data;
+ img->destroy_callback = &freedata_cb;
draw_line();
cut_rightend();
image->put_image(img);