ff-save: support 16bit audio sample formats

parent 0927bf9e
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment