mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
avformat/matroskaenc: Make sure UIDs of delayed chapters are != 0
This has previously only been checked if the chapters were initially available, but not if they were only written in the trailer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
6397b4d6a2
commit
0aed3002ad
@ -1437,6 +1437,12 @@ static int mkv_write_chapters(AVFormatContext *s)
|
|||||||
if (!s->nb_chapters || mkv->wrote_chapters)
|
if (!s->nb_chapters || mkv->wrote_chapters)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
for (i = 0; i < s->nb_chapters; i++)
|
||||||
|
if (!s->chapters[i]->id) {
|
||||||
|
mkv->chapter_id_offset = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
mkv_add_seekhead_entry(mkv, MATROSKA_ID_CHAPTERS, avio_tell(pb));
|
mkv_add_seekhead_entry(mkv, MATROSKA_ID_CHAPTERS, avio_tell(pb));
|
||||||
|
|
||||||
ret = start_ebml_master_crc32(&dyn_cp, mkv);
|
ret = start_ebml_master_crc32(&dyn_cp, mkv);
|
||||||
@ -1863,12 +1869,6 @@ static int mkv_write_header(AVFormatContext *s)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; i < s->nb_chapters; i++)
|
|
||||||
if (!s->chapters[i]->id) {
|
|
||||||
mkv->chapter_id_offset = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = mkv_write_chapters(s);
|
ret = mkv_write_chapters(s);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -1879,6 +1879,7 @@ static int mkv_write_header(AVFormatContext *s)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Must come after mkv_write_chapters() because of chapter_id_offset */
|
||||||
ret = mkv_write_tags(s);
|
ret = mkv_write_tags(s);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user