Skip to content

Commit

Permalink
[demuxers/Matroska] Preliminarily mark index entries as keyframes bas…
Browse files Browse the repository at this point in the history
…ed on Simple Block headers

This should help to deal with some broken files where we cannot locate the
Cues element and the video codec is not H.264, HEVC, MPEG-4 or MPEG-2
where we ignore both flags and Cues and rely only on frame headers.
  • Loading branch information
eumagga0x2a committed May 7, 2022
1 parent d56c90d commit 0283b22
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvIndexer.cpp
Expand Up @@ -120,8 +120,6 @@ uint8_t mkvHeader::indexLastCluster(ADM_ebml_file *parser)
*/
uint8_t mkvHeader::indexBlock(ADM_ebml_file *parser,uint32_t len,uint32_t clusterTimeCodeMs)
{
int entryFlags=0;

uint64_t tail=parser->tell()+len;
// Read Track id
uint32_t tid=parser->readEBMCode();
Expand All @@ -141,6 +139,8 @@ uint8_t mkvHeader::indexBlock(ADM_ebml_file *parser,uint32_t len,uint32_t cluste

//int lacing=((flags>>1)&3);

uint32_t entryFlags = (flags & 0x80)? AVI_KEY_FRAME : 0;

addIndexEntry(track,parser,blockBegin,tail-blockBegin,entryFlags,clusterTimeCodeMs+timecode);
parser->seek(tail);
return 1;
Expand Down Expand Up @@ -188,7 +188,7 @@ uint8_t mkvHeader::addIndexEntry(uint32_t track,ADM_ebml_file *parser,uint64_t w

ix.pos=where;
ix.size=size;
ix.flags=0;
ix.flags=flags;
ix.Dts=timecodeMS*_timeBase;
ix.Pts=timecodeMS*_timeBase;
//printf("Track=%d, timecode=%d timeBase=%d, Pts=%d\n",track,(int)timecodeMS,(int)_timeBase,ix.Pts);
Expand Down

0 comments on commit 0283b22

Please sign in to comment.