[vlc-devel] [PATCH 9/9] omxil: Pass pts as timestamp on the ducati decoder

Martin Storsjö martin at martin.st
Wed Apr 4 14:18:00 CEST 2012


This decoder reorders timestamps according to the frame reordering,
and thus should be given pts instead of dts. Other decoders don't
do this reordering and should be given dts.

Still to be investigated how android/stagefright handles this,
since it always seems pass pts, not dts, to decoders.
---
 modules/codec/omxil/omxil.c |    8 +++++++-
 modules/codec/omxil/omxil.h |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 34509e1..29d92ed 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -910,6 +910,7 @@ loaded:
     p_sys->out.p_fmt = &p_dec->fmt_out;
     p_sys->ports = 2;
     p_sys->p_ports = &p_sys->in;
+    p_sys->b_use_pts = 0;
 
     msg_Dbg(p_dec, "fmt in:%4.4s, out: %4.4s", (char *)&p_dec->fmt_in.i_codec,
             (char *)&p_dec->fmt_out.i_codec);
@@ -1051,6 +1052,8 @@ loaded:
     if(p_sys->b_error) goto error;
 
     p_dec->b_need_packetized = true;
+    if (!strcmp(p_sys->psz_component, "OMX.TI.DUCATI1.VIDEO.DECODER"))
+        p_sys->b_use_pts = 1;
     return VLC_SUCCESS;
 
  error:
@@ -1270,7 +1273,10 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
         p_header->nFilledLen = p_block->i_buffer;
         p_header->nOffset = 0;
         p_header->nFlags = OMX_BUFFERFLAG_ENDOFFRAME;
-        p_header->nTimeStamp = p_block->i_dts;
+        if (p_sys->b_use_pts)
+            p_header->nTimeStamp = p_block->i_pts;
+        else
+            p_header->nTimeStamp = p_block->i_dts;
 
         /* In direct mode we pass the input pointer as is.
          * Otherwise we memcopy the data */
diff --git a/modules/codec/omxil/omxil.h b/modules/codec/omxil/omxil.h
index 4fa1d60..649ba65 100644
--- a/modules/codec/omxil/omxil.h
+++ b/modules/codec/omxil/omxil.h
@@ -103,6 +103,7 @@ struct decoder_sys_t
     date_t end_date;
 
     int i_nal_size_length; /* Length of the NAL size field for H264 */
+    int b_use_pts;
 
     OMX_BUFFERHEADERTYPE sentinel_buffer;
 };
-- 
1.7.2.5




More information about the vlc-devel mailing list