[gegl/video-rejuvenation] ff-save: support 16bit audio sample formats
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/video-rejuvenation] ff-save: support 16bit audio sample formats
- Date: Wed, 18 Nov 2015 23:51:10 +0000 (UTC)
commit a55c4305641adf5ab4d3a3bda2339acdee182c59
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Nov 18 17:47:59 2015 +0100
ff-save: support 16bit audio sample formats
operations/external/ff-save.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/operations/external/ff-save.c b/operations/external/ff-save.c
index 1bd6c4a..4238999 100644
--- a/operations/external/ff-save.c
+++ b/operations/external/ff-save.c
@@ -382,6 +382,15 @@ write_audio_frame (GeglProperties *o, AVFormatContext * oc, AVStream * st)
((float*)frame->data[1])[i] = right;
}
break;
+ case AV_SAMPLE_FMT_S16:
+ for (i = 0; i < c->frame_size; i++)
+ {
+ float left = 0, right = 0;
+ get_sample_data (p, i + p->audio_read_pos, &left, &right);
+ ((int16_t*)frame->data[0])[c->channels*i+0] = left * (1<<15);
+ ((int16_t*)frame->data[0])[c->channels*i+1] = right * (1<<15);
+ }
+ break;
case AV_SAMPLE_FMT_S32:
for (i = 0; i < c->frame_size; i++)
{
@@ -400,6 +409,15 @@ write_audio_frame (GeglProperties *o, AVFormatContext * oc, AVStream * st)
((int32_t*)frame->data[1])[i] = right * (1<<31);
}
break;
+ case AV_SAMPLE_FMT_S16P:
+ for (i = 0; i < c->frame_size; i++)
+ {
+ float left = 0, right = 0;
+ get_sample_data (p, i + p->audio_read_pos, &left, &right);
+ ((int16_t*)frame->data[0])[i] = left * (1<<15);
+ ((int16_t*)frame->data[1])[i] = right * (1<<15);
+ }
+ break;
default:
fprintf (stderr, "eeeek unhandled audio format\n");
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]