summaryrefslogtreecommitdiff
path: root/plugins/ffmpeg
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-11-10 20:31:42 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-11-10 20:31:42 +0100
commitb7f2e02e7395fb0a696f3d70c7cb388195cbd6fd (patch)
treea2af6535c6076781e7597d0af0976adbeaae22fb /plugins/ffmpeg
parent86d49636d7babca36f63580454d5e08ab6e25b0e (diff)
ffmpeg: added 8 and 24 bit planar format support
Diffstat (limited to 'plugins/ffmpeg')
-rw-r--r--plugins/ffmpeg/ffmpeg.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index 6b8e393f..00c53e86 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -338,11 +338,19 @@ ffmpeg_read (DB_fileinfo_t *_info, char *bytes, int size) {
out_size = 0;
for (int c = 0; c < info->ctx->channels; c++) {
for (int i = 0; i < info->frame->nb_samples; i++) {
- if (_info->fmt.bps == 16) {
+ if (_info->fmt.bps == 8) {
+ info->buffer[i*info->ctx->channels+c] = ((int8_t *)info->frame->extended_data[c])[i];
+ out_size++;
+ }
+ else if (_info->fmt.bps == 16) {
int16_t outsample = ((int16_t *)info->frame->extended_data[c])[i];
((int16_t*)info->buffer)[i*info->ctx->channels+c] = outsample;
out_size += 2;
}
+ else if (_info->fmt.bps == 24) {
+ memcpy (&info->buffer[(i*info->ctx->channels+c)*3], &((int8_t*)info->frame->extended_data[c])[i*3], 3);
+ out_size += 3;
+ }
else if (_info->fmt.bps == 32) {
int32_t sample = ((int32_t *)info->frame->extended_data[c])[i];
((int32_t*)info->buffer)[i*info->ctx->channels+c] = sample;