diff options
author | Rob Clark <rob@ti.com> | 2010-11-25 11:19:24 -0600 |
---|---|---|
committer | Rob Clark <rob@ti.com> | 2010-11-25 12:13:19 -0600 |
commit | 3f70d7c48d98337904a61b0d14d70682407d105d (patch) | |
tree | c82b45c08e9fbb82c7e7f3d939b1d46f96ae0f95 | |
parent | ce6fa3d9459189fe8bb86f4b82cad328d5393474 (diff) |
viddec: add support for cropping
-rw-r--r-- | src/gstducatividdec.c | 21 | ||||
-rw-r--r-- | src/gstducatividdec.h | 3 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/gstducatividdec.c b/src/gstducatividdec.c index cac3c27..36e9b8e 100644 --- a/src/gstducatividdec.c +++ b/src/gstducatividdec.c @@ -163,6 +163,8 @@ codec_create (GstDucatiVidDec * self) } #endif + self->first_buffer = TRUE; + /* allocate input buffer and initialize inBufs: */ self->inBufs->numBufs = 1; self->input = gst_ducati_alloc_1d (self->width * self->height); @@ -505,13 +507,18 @@ gst_ducati_viddec_chain (GstPad * pad, GstBuffer * buf) } for (i = 0; self->outArgs->outputID[i]; i++) { -#if 0 - /* calculate offset to region of interest */ - XDM_Rect *r = &(outArgs->displayBufs.bufDesc[0].activeFrameRegion); - int yoff = (r->topLeft.y * 4096) + r->topLeft.x; - int uvoff = (r->topLeft.y * 4096 / 2) + r->topLeft.x; - // XXX do something.. -#endif + if (G_UNLIKELY (self->first_buffer)) { + /* send region of interest to sink on first buffer: */ + XDM_Rect *r = + &(self->outArgs->displayBufs.bufDesc[0].activeFrameRegion); + + gst_pad_push_event (self->srcpad, + gst_event_new_crop (r->topLeft.y, r->topLeft.x, + r->bottomRight.x - r->topLeft.x, + r->bottomRight.y - r->topLeft.y)); + + self->first_buffer = FALSE; + } outbuf = codec_get_outbuf (self, self->outArgs->outputID[i]); gst_pad_push (self->srcpad, outbuf); diff --git a/src/gstducatividdec.h b/src/gstducatividdec.h index dfb505a..44440d3 100644 --- a/src/gstducatividdec.h +++ b/src/gstducatividdec.h @@ -65,6 +65,9 @@ struct _GstDucatiVidDec /* input buffer, allocated when codec is created: */ guint8 *input; + /* on first output buffer, we need to send crop info to sink: */ + gboolean first_buffer; + Engine_Handle engine; VIDDEC3_Handle codec; VIDDEC3_Params *params; |