[gegl/video-rejuvenation: 75/83] ff-save: use GeglAudio for audio fragments
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/video-rejuvenation: 75/83] ff-save: use GeglAudio for audio fragments
- Date: Thu, 19 Nov 2015 21:48:39 +0000 (UTC)
commit f2c9211d3530457fbc06023023020c7d60d2e0ef
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Nov 18 18:29:45 2015 +0100
ff-save: use GeglAudio for audio fragments
operations/external/ff-save.c | 29 +++++++++--------------------
1 files changed, 9 insertions(+), 20 deletions(-)
---
diff --git a/operations/external/ff-save.c b/operations/external/ff-save.c
index 232c28e..dffd015 100644
--- a/operations/external/ff-save.c
+++ b/operations/external/ff-save.c
@@ -60,17 +60,6 @@ property_audio (audio, _("audio"), 0)
#include <libavutil/opt.h>
#include <libswscale/swscale.h>
-#define MAX_AUDIO_CHANNELS 6
-#define MAX_AUDIO_SAMPLES 2048
-
-typedef struct AudioFrame {
- float data[MAX_AUDIO_CHANNELS][MAX_AUDIO_SAMPLES];
- int channels;
- int sample_rate;
- int len;
- long pos;
-} AudioFrame;
-
typedef struct
{
gdouble frame;
@@ -135,14 +124,14 @@ static void get_sample_data (Priv *p, long sample_no, float *left, float *right)
return;
for (; l; l = l->next)
{
- AudioFrame *af = l->data;
- if (sample_no > af->pos + af->len)
+ GeglAudio *af = l->data;
+ if (sample_no > af->pos + af->samples)
{
to_remove ++;
}
if (af->pos <= sample_no &&
- sample_no < af->pos + af->len)
+ sample_no < af->pos + af->samples)
{
int i = sample_no - af->pos;
*left = af->data[0][i];
@@ -156,8 +145,8 @@ static void get_sample_data (Priv *p, long sample_no, float *left, float *right)
again:
for (l = p->audio_track; l; l = l->next)
{
- AudioFrame *af = l->data;
- if (sample_no > af->pos + af->len)
+ GeglAudio *af = l->data;
+ if (sample_no > af->pos + af->samples)
{
p->audio_track = g_list_remove (p->audio_track, af);
g_free (af);
@@ -338,16 +327,16 @@ write_audio_frame (GeglProperties *o, AVFormatContext * oc, AVStream * st)
/* first we add incoming frames audio samples */
{
int i;
- AudioFrame *af = g_malloc0 (sizeof (AudioFrame));
+ GeglAudio *af = g_malloc0 (sizeof (GeglAudio));
af->channels = 2; //o->audio->channels;
- af->len = o->audio->samples;
- for (i = 0; i < af->len; i++)
+ af->samples = o->audio->samples;
+ for (i = 0; i < af->samples; 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;
+ p->audio_pos += af->samples;
p->audio_track = g_list_append (p->audio_track, af);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]