[gegl/video-rejuvenation] audio: make audiofragment be multichannel
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/video-rejuvenation] audio: make audiofragment be multichannel
- Date: Wed, 18 Nov 2015 23:51:30 +0000 (UTC)
commit 7d4c0de65e706ae5afb4d1994f05e1643de99b5a
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Nov 18 18:14:19 2015 +0100
audio: make audiofragment be multichannel
gegl/property-types/gegl-audio.c | 2 ++
gegl/property-types/gegl-audio.h | 14 +++++++++-----
operations/external/ff-load.c | 10 ++++------
operations/external/ff-save.c | 10 +++++-----
4 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/gegl/property-types/gegl-audio.c b/gegl/property-types/gegl-audio.c
index 9223c41..e005009 100644
--- a/gegl/property-types/gegl-audio.c
+++ b/gegl/property-types/gegl-audio.c
@@ -168,6 +168,8 @@ gegl_param_audio_finalize (GParamSpec *self)
param_audio->default_audio = NULL;
}
+ g_warning ("...\n");
+
parent_class->finalize (self);
}
diff --git a/gegl/property-types/gegl-audio.h b/gegl/property-types/gegl-audio.h
index 06ad66b..41b3b58 100644
--- a/gegl/property-types/gegl-audio.h
+++ b/gegl/property-types/gegl-audio.h
@@ -33,13 +33,17 @@ G_BEGIN_DECLS
typedef struct _GeglAudioClass GeglAudioClass;
typedef struct _GeglAudioPrivate GeglAudioPrivate;
+#define GEGL_MAX_AUDIO_CHANNELS 6
+#define GEGL_MAX_AUDIO_SAMPLES 4800
+
struct _GeglAudio
{
- GObject parent_instance;
- float left[4000];
- float right[4000];
- int samples;
- int samplerate;
+ GObject parent_instance;
+ int sample_rate;
+ int samples;
+ int channels;
+ int channel_layout;/* unused - assumed channels = 1 is mono 2 stereo */
+ float data[GEGL_MAX_AUDIO_CHANNELS][GEGL_MAX_AUDIO_SAMPLES];
GeglAudioPrivate *priv;
};
diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c
index c1a7864..7b3b0aa 100644
--- a/operations/external/ff-load.c
+++ b/operations/external/ff-load.c
@@ -83,8 +83,6 @@ typedef struct
glong prevframe; /* previously decoded frame number */
gdouble prevpts; /* timestamp in seconds of last decoded frame */
-
-
} Priv;
#define MAX_AUDIO_CHANNELS 6
@@ -638,17 +636,17 @@ process (GeglOperation *operation,
if (p->audio_stream && p->audio_stream->codec) // XXX: remove second clause
{
- o->audio->samplerate = p->audio_stream->codec->sample_rate;
+ o->audio->sample_rate = p->audio_stream->codec->sample_rate;
o->audio->samples = samples_per_frame (o->frame,
- o->frame_rate, o->audio->samplerate,
+ o->frame_rate, o->audio->sample_rate,
&sample_start);
decode_audio (operation, p->prevpts, p->prevpts + 5.0);
{
int i;
for (i = 0; i < o->audio->samples; i++)
{
- get_sample_data (p, sample_start + i, &o->audio->left[i],
- &o->audio->right[i]);
+ get_sample_data (p, sample_start + i, &o->audio->data[0][i],
+ &o->audio->data[1][i]);
}
}
}
diff --git a/operations/external/ff-save.c b/operations/external/ff-save.c
index 9771b57..232c28e 100644
--- a/operations/external/ff-save.c
+++ b/operations/external/ff-save.c
@@ -265,11 +265,11 @@ open_audio (GeglProperties *o, AVFormatContext * oc, AVStream * st)
{
if (o->audio)
{
- if (o->audio->samplerate == 0)
+ if (o->audio->sample_rate == 0)
{
- o->audio->samplerate = 48000; // XXX: should skip adding audiostream instead
+ o->audio->sample_rate = 48000; // XXX: should skip adding audiostream instead
}
- p->audio_sample_rate = o->audio->samplerate;
+ p->audio_sample_rate = o->audio->sample_rate;
}
}
c->sample_rate = p->audio_sample_rate;
@@ -343,8 +343,8 @@ write_audio_frame (GeglProperties *o, AVFormatContext * oc, AVStream * st)
af->len = o->audio->samples;
for (i = 0; i < af->len; i++)
{
- af->data[0][i] = o->audio->left[i];
- af->data[1][i] = o->audio->right[i];
+ af->data[0][i] = o->audio->data[0][i];
+ af->data[1][i] = o->audio->data[1][i];
}
af->pos = p->audio_pos;
p->audio_pos += af->len;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]