Set GstBuffer flags for interlaced frames
authorHarinarayan Bhatta <harinarayan@ti.com>
Thu, 3 Apr 2014 10:09:52 +0000 (15:39 +0530)
committerHarinarayan Bhatta <harinarayan@ti.com>
Thu, 3 Apr 2014 10:09:52 +0000 (15:39 +0530)
Set the Top-Field-Fist, Repeat-First-Field flags for interlaced
content on gstreamer output buffers.

Signed-off-by: Harinarayan Bhatta <harinarayan@ti.com>
src/gstducatividdec.c

index 6b51ca84d9a5119adf99158cbd3c8bcc354f3d09..81f75f0c3e38f39e8802eab8563c354465855d77 100644 (file)
@@ -449,12 +449,27 @@ codec_process (GstDucatiVidDec * self, gboolean send, gboolean flush,
   for (i = 0; i < IVIDEO2_MAX_IO_BUFFERS && self->outArgs->outputID[i]; i++) {
     gboolean interlaced;
 
-    /* Getting an extra reference for the decoder */
-    outbuf = codec_get_outbuf (self, self->outArgs->outputID[i]);
     interlaced =
-        self->outArgs->decodedBufs.contentType ==
+        self->outArgs->displayBufs.bufDesc[0].contentType ==
         IVIDEO_PROGRESSIVE ? FALSE : TRUE;
 
+    if (interlaced) {
+      GstBuffer *buf = GST_BUFFER (self->outArgs->outputID[i]);
+      if (!buf || !gst_buffer_is_metadata_writable (buf)) {
+        GST_ERROR_OBJECT (self, "Cannot change buffer flags!!");
+      } else {
+        GST_BUFFER_FLAG_UNSET (buf, GST_VIDEO_BUFFER_TFF);
+        GST_BUFFER_FLAG_UNSET (buf, GST_VIDEO_BUFFER_RFF);
+        if (self->outArgs->displayBufs.bufDesc[0].topFieldFirstFlag)
+          GST_BUFFER_FLAG_SET (buf, GST_VIDEO_BUFFER_TFF);
+        if (self->outArgs->displayBufs.bufDesc[0].repeatFirstFieldFlag)
+          GST_BUFFER_FLAG_SET (buf, GST_VIDEO_BUFFER_RFF);
+      }
+    }
+
+    /* Getting an extra reference for the decoder */
+    outbuf = codec_get_outbuf (self, self->outArgs->outputID[i]);
+
     /* if send is FALSE, don't try to renegotiate as we could be flushing during
      * a PAUSED->READY state change
      */