Bug fix for Qt AVI encoding of idx1 chunk sizes.

This commit is contained in:
mjbudd77 2021-08-29 16:06:50 -04:00
parent 04aa7afb1f
commit a47fd82334
2 changed files with 11 additions and 3 deletions

View File

@ -436,6 +436,7 @@ gwavi_t::write_index(FILE *out, int count, unsigned int *offsets)
{
long marker, t;
unsigned int offset = 4;
unsigned int r;
if (offsets == 0)
return -1;
@ -465,7 +466,14 @@ gwavi_t::write_index(FILE *out, int count, unsigned int *offsets)
if (write_int(out, offsets[t]) == -1)
goto write_int_failed;
offset = offset + offsets[t] + 8;
r = offsets[t] % WORD_SIZE;
if ( r > 0 )
{
r = WORD_SIZE - r;
}
offset = offset + offsets[t] + 8 + r;
}
if ((t = ftell(out)) == -1) {

View File

@ -331,7 +331,7 @@ gwavi_t::add_frame( unsigned char *buffer, size_t len)
}
}
offsets[offsets_ptr++] = (unsigned int)(len + maxi_pad);
offsets[offsets_ptr++] = (unsigned int)(len);
if (write_chars_bin(out, "00dc", 4) == -1) {
(void)fprintf(stderr, "gwavi_add_frame: write_chars_bin() "
@ -406,7 +406,7 @@ gwavi_t::add_audio( unsigned char *buffer, size_t len)
}
offsets[offsets_ptr++] =
(unsigned int)((len + maxi_pad) | 0x80000000);
(unsigned int)((len) | 0x80000000);
if (write_chars_bin(out,"01wb",4) == -1) {
(void)fprintf(stderr, "gwavi_add_audio: write_chars_bin() "