On Tue, 14 Jul 2015, Tomas Härdin wrote:

On Sat, 2015-07-11 at 18:54 +0200, Marton Balint wrote:
This should fix seeking for open GOP files as well.

Signed-off-by: Marton Balint <c...@passwd.hu>
---
@@ -1411,8 +1417,7 @@ static int mxf_compute_ptses_fake_index(MXFContext *mxf, 
MXFIndexTable *index_ta
                 break;
             }

-            index_table->fake_index[x].timestamp = x;

Why is this removed?

It is only moved to the index calculation loop below, it looked cleaner to
fill all fields of the fake index in one place.


-            index_table->fake_index[x].flags = !(s->flag_entries[j] & 0x30) ? 
AVINDEX_KEYFRAME : 0;
+            flags[x] = !(s->flag_entries[j] & 0x30) ? AVINDEX_KEYFRAME : 0;

             if (index < 0 || index >= index_table->nb_ptses) {
                 av_log(mxf->fc, AV_LOG_ERROR,
@@ -1421,11 +1426,20 @@ static int mxf_compute_ptses_fake_index(MXFContext 
*mxf, MXFIndexTable *index_ta
                 continue;
             }

+            index_table->offsets[x] = offset;
             index_table->ptses[index] = x;
             max_temporal_offset = FFMAX(max_temporal_offset, offset);
         }
     }

+    /* calculate the fake index table in display order */
+    for (x = 0; x < index_table->nb_ptses; x++) {
+        index_table->fake_index[x].timestamp = x;
+        if (index_table->ptses[x] != AV_NOPTS_VALUE)
+            index_table->fake_index[index_table->ptses[x]].flags = flags[x];

ptses are checked to be in range, right?


Sure :). ptses are only set to x in the first loop, and x is between 0 and nb_ptses.

Anyway, the patch is probably OK. I recall doing something similar at
work in another mxf library. Do we have test files with B-frames? If not
then this may be a good time to add them.

tests/data/lavf/lavf.mxf already has B-frames, but probably a more thorough seek test for the file would not hurt... I plan to work on this later.

Thanks,
Marton
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to