I don't know anything about codecs, so I shamelessly copied the
code from quicktime/rawaudio.c and it worked!
Reproduced by loading a video from a camera that was previously not
being correctly loaded, as well as an Audacity-made 440 Hz tone
exported to FLAC and then converted to AVI[pcm_u8] with ffmpeg.
However, it is only correctly displayed when zoomed in enough in
the timeline. If I zoom out enough, it renders the old, wrong way.
Also, I don't know if I'm breaking anything else.
Thanks go to hermanr for his help and finding out the difference.
---
quicktime/sowt.c | 6 ++++--
quicktime/twos.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/quicktime/sowt.c b/quicktime/sowt.c
index 43d2f2f..d1a5697 100644
--- a/quicktime/sowt.c
+++ b/quicktime/sowt.c
@@ -134,7 +134,8 @@ static int decode(quicktime_t *file,
{
for(i = 0, j = channel; i < samples; i++)
{
- output_i[i] =
((int16_t)codec->work_buffer[j]) << 8;
+ output_i[i] = ((int16_t)((unsigned
char)codec->work_buffer[j]) << 8);
+ output_i[i] -= 0x8000;
j += step;
}
}
@@ -143,7 +144,8 @@ static int decode(quicktime_t *file,
{
for(i = 0, j = channel; i < samples; i++)
{
- output_f[i] =
((float)codec->work_buffer[j]) / 0x7f;
+ output_f[i] = (float)((unsigned
char)codec->work_buffer[j]) - 0x80;
+ output_f[i] /= 0x7f;
j += step;
}
}
diff --git a/quicktime/twos.c b/quicktime/twos.c
index db034f3..5848848 100644
--- a/quicktime/twos.c
+++ b/quicktime/twos.c
@@ -134,7 +134,8 @@ static int decode(quicktime_t *file,
{
for(i = 0, j = channel; i < samples; i++)
{
- output_i[i] =
((int16_t)codec->work_buffer[j]) << 8;
+ output_i[i] = ((int16_t)((unsigned
char)codec->work_buffer[j]) << 8);
+ output_i[i] -= 0x8000;
j += step;
}
}
@@ -143,7 +144,8 @@ static int decode(quicktime_t *file,
{
for(i = 0, j = channel; i < samples; i++)
{
- output_f[i] =
((float)codec->work_buffer[j]) / 0x7f;
+ output_f[i] = (float)((unsigned
char)codec->work_buffer[j]) - 0x80;
+ output_f[i] /= 0x7f;
j += step;
}
}
--
1.7.5.4
--
Octavio.
Twitter: @alvarezp2000 -- Identi.ca: @alvarezp
_______________________________________________
Cinelerra mailing list
[email protected]
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra