[FFmpeg-cvslog] mxfdec: Let pkt->pts = mxf->current_edit_unit if intra-only

Tomas Härdin git at videolan.org
Sun Mar 18 20:24:34 CET 2012


ffmpeg | branch: master | Tomas Härdin <tomas.hardin at codemill.se> | Wed Mar  7 10:03:16 2012 +0100| [eb74e9ea10f64704ee45e5da7baf6c100a2a88f7] | committer: Michael Niedermayer

mxfdec: Let pkt->pts = mxf->current_edit_unit if intra-only

We can't do this in general since we could be reading a file with B-frames while
lacking an index.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb74e9ea10f64704ee45e5da7baf6c100a2a88f7
---

 libavformat/mxfdec.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 3d99ea7..07ac9fb 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2002,11 +2002,17 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
             IS_KLV_KEY(klv.key, mxf_avid_essence_element_key)) {
             int index = mxf_get_stream_index(s, &klv);
             int64_t next_ofs, next_klv;
+            AVStream *st;
+            MXFTrack *track;
 
             if (index < 0) {
                 av_log(s, AV_LOG_ERROR, "error getting stream index %d\n", AV_RB32(klv.key+12));
                 goto skip;
             }
+
+            st = s->streams[index];
+            track = st->priv_data;
+
             if (s->streams[index]->discard == AVDISCARD_ALL)
                 goto skip;
 
@@ -2043,6 +2049,10 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
                 if (mxf->nb_index_tables >= 1 && mxf->current_edit_unit < t->nb_ptses) {
                     pkt->dts = mxf->current_edit_unit + t->first_dts;
                     pkt->pts = t->ptses[mxf->current_edit_unit];
+                } else if (track->intra_only) {
+                    /* intra-only -> PTS = EditUnit.
+                     * let utils.c figure out DTS since it can be < PTS if low_delay = 0 (Sony IMX30) */
+                    pkt->pts = mxf->current_edit_unit;
                 }
             }
 



More information about the ffmpeg-cvslog mailing list