diff --git a/src/gstducatih264dec.c b/src/gstducatih264dec.c
index dff7fc2e8e34cc0dac9b661069b350c68597c704..5ae75e5073c68323def0d2d59aff84137205e1d7 100644 (file)
--- a/src/gstducatih264dec.c
+++ b/src/gstducatih264dec.c
#define PADX 32
#define PADY 24
+/* This structure is not public, this should be replaced by
+ sizeof(sErrConcealLayerStr) when it is made so. */
+#define SIZE_OF_CONCEALMENT_DATA 65536
+
GST_BOILERPLATE (GstDucatiH264Dec, gst_ducati_h264dec, GstDucatiVidDec,
GST_TYPE_DUCATIVIDDEC);
params->presetLevelIdc = IH264VDEC_LEVEL41;
params->errConcealmentMode = IH264VDEC_APPLY_CONCEALMENT;
params->temporalDirModePred = TRUE;
+
+ if (self->codec_debug_info) {
+ /* We must allocate a byte per MB, plus the size of some struture which
+ is not public. Place this in the first metadata buffer slot, and ask
+ for MBINFO metadata for it. */
+ GstDucatiH264Dec *h264dec = GST_DUCATIH264DEC (self);
+ unsigned mbw = (self->width + 15) / 16;
+ unsigned mbh = (self->height + 15) / 16;
+ unsigned nmb = mbw * mbh;
+
+ h264dec->bo_mberror =
+ omap_bo_new (self->device, nmb + SIZE_OF_CONCEALMENT_DATA,
+ OMAP_BO_WC);
+ self->outBufs->descs[2].memType = XDM_MEMTYPE_BO;
+ self->outBufs->descs[2].buf =
+ (XDAS_Int8 *) omap_bo_handle (h264dec->bo_mberror);
+ self->outBufs->descs[2].bufSize.bytes = nmb + SIZE_OF_CONCEALMENT_DATA;
+ self->params->metadataType[0] = IVIDEO_METADATAPLANE_MBINFO;
+ }
}
return ret;
gst_ducati_h264dec_handle_error (GstDucatiVidDec * self, gint ret,
gint extended_error, gint status_extended_error)
{
+ GstDucatiH264Dec *h264dec = GST_DUCATIH264DEC (self);
+ const unsigned char *mberror, *mbcon;
+ unsigned mbw, mbh, nmb;
+ uint16_t mbwr, mbhr;
+ size_t n, nerr = 0;
+
+ if (h264dec->bo_mberror) {
+ mberror = omap_bo_map (h264dec->bo_mberror);
+ mbw = (self->width + 15) / 16;
+ mbh = (self->height + 15) / 16;
+ nmb = mbw * mbh;
+ mbcon = mberror + nmb;
+ mbwr = ((const uint16_t *) mbcon)[21]; /* not a public struct */
+ mbhr = ((const uint16_t *) mbcon)[22]; /* not a public struct */
+ if (nmb != mbwr * mbhr) {
+ GST_WARNING_OBJECT (self, "Failed to find MB size - "
+ "corruption might have happened");
+ } else {
+ for (n = 0; n < nmb; ++n) {
+ if (mberror[n])
+ ++nerr;
+ }
+ GST_INFO_OBJECT (self, "Frame has %zu MB errors over %zu (%u x %u) MBs",
+ nerr, nmb, mbwr, mbhr);
+ }
+ }
+
if (extended_error & 0x00000001) {
/* No valid slice. This seems to be bad enough that it's better to flush and
* skip to the next keyframe.
gst_static_pad_template_get (&sink_factory));
}
+static void
+gst_ducati_h264dec_finalize (GObject * obj)
+{
+ GstDucatiH264Dec *self = GST_DUCATIH264DEC (obj);
+ if (self->bo_mberror)
+ omap_bo_del (self->bo_mberror);
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
+}
+
static void
gst_ducati_h264dec_class_init (GstDucatiH264DecClass * klass)
{
GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
bclass->codec_name = "ivahd_h264dec";
bclass->update_buffer_size =
GST_DEBUG_FUNCPTR (gst_ducati_h264dec_update_buffer_size);
GST_DEBUG_FUNCPTR (gst_ducati_h264dec_can_drop_frame);
bclass->query = GST_DEBUG_FUNCPTR (gst_ducati_h264dec_query);
bclass->set_sink_caps = GST_DEBUG_FUNCPTR (gst_ducati_h264dec_set_sink_caps);
+ gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_ducati_h264dec_finalize);
}
static void